mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-19 12:50:22 +02:00

The project's internal Makefile uses BUILDFLAGS variable to pass
arguments to `go build` while Yocto/OE defines it as GOBUILDFLAGS. Add a
patch to align this and avoid using host headers in which case, a musl
build will fail similarly to:
| [...]ld: /tmp/go-link-3172010154/000015.o: in function `vfprintf':
| /usr/include/x86_64-linux-gnu/bits/stdio2.h:130: undefined reference to `__vfprintf_chk'
| [...]ld: /tmp/go-link-3172010154/000016.o: in function `fprintf':
| /usr/include/x86_64-linux-gnu/bits/stdio2.h💯 undefined reference to `__fprintf_chk'
| collect2: error: ld returned 1 exit status
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
114 lines
3.5 KiB
BlitzBasic
114 lines
3.5 KiB
BlitzBasic
HOMEPAGE = "https://podman.io/"
|
|
SUMMARY = "A daemonless container engine"
|
|
DESCRIPTION = "Podman is a daemonless container engine for developing, \
|
|
managing, and running OCI Containers on your Linux System. Containers can \
|
|
either be run as root or in rootless mode. Simply put: \
|
|
`alias docker=podman`. \
|
|
"
|
|
|
|
inherit features_check
|
|
REQUIRED_DISTRO_FEATURES ?= "seccomp ipv6"
|
|
|
|
DEPENDS = " \
|
|
go-metalinter-native \
|
|
go-md2man-native \
|
|
gpgme \
|
|
libseccomp \
|
|
${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
|
|
"
|
|
|
|
SRCREV = "cedbbfa543651a13055a1fe093a4d0a2a28ccdfd"
|
|
SRC_URI = " \
|
|
git://github.com/containers/libpod.git;branch=v4.1;protocol=https \
|
|
file://0001-Rename-BUILDFLAGS-to-GOBUILDFLAGS.patch;patchdir=src/import \
|
|
"
|
|
|
|
LICENSE = "Apache-2.0"
|
|
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=3d9b931fa23ab1cacd0087f9e2ee12c0"
|
|
|
|
GO_IMPORT = "import"
|
|
|
|
S = "${WORKDIR}/git"
|
|
|
|
PV = "4.1.0+git${SRCPV}"
|
|
|
|
PACKAGES =+ "${PN}-contrib"
|
|
|
|
PODMAN_PKG = "github.com/containers/libpod"
|
|
BUILDTAGS ?= "seccomp varlink \
|
|
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
|
|
exclude_graphdriver_btrfs exclude_graphdriver_devicemapper"
|
|
|
|
# overide LDFLAGS to allow podman to build without: "flag provided but not # defined: -Wl,-O1
|
|
export LDFLAGS=""
|
|
|
|
inherit go goarch
|
|
inherit systemd pkgconfig
|
|
|
|
do_configure[noexec] = "1"
|
|
|
|
EXTRA_OEMAKE = " \
|
|
PREFIX=${prefix} BINDIR=${bindir} LIBEXECDIR=${libexecdir} \
|
|
ETCDIR=${sysconfdir} TMPFILESDIR=${nonarch_libdir}/tmpfiles.d \
|
|
SYSTEMDDIR=${systemd_unitdir}/system USERSYSTEMDDIR=${systemd_unitdir}/user \
|
|
"
|
|
|
|
# remove 'docker' from the packageconfig if you don't want podman to
|
|
# build and install the docker wrapper. If docker is enabled in the
|
|
# packageconfig, the podman package will rconfict with docker.
|
|
PACKAGECONFIG ?= "docker"
|
|
|
|
do_compile() {
|
|
cd ${S}/src
|
|
rm -rf .gopath
|
|
mkdir -p .gopath/src/"$(dirname "${PODMAN_PKG}")"
|
|
ln -sf ../../../../import/ .gopath/src/"${PODMAN_PKG}"
|
|
|
|
ln -sf "../../../import/vendor/github.com/varlink/" ".gopath/src/github.com/varlink"
|
|
|
|
export GOARCH="${BUILD_GOARCH}"
|
|
export GOPATH="${S}/src/.gopath"
|
|
export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
|
|
|
|
cd ${S}/src/.gopath/src/"${PODMAN_PKG}"
|
|
|
|
# Pass the needed cflags/ldflags so that cgo
|
|
# can find the needed headers files and libraries
|
|
export GOARCH=${TARGET_GOARCH}
|
|
export CGO_ENABLED="1"
|
|
export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
|
|
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
|
|
|
|
oe_runmake BUILDTAGS="${BUILDTAGS}"
|
|
}
|
|
|
|
do_install() {
|
|
cd ${S}/src/.gopath/src/"${PODMAN_PKG}"
|
|
|
|
export GOARCH="${BUILD_GOARCH}"
|
|
export GOPATH="${S}/src/.gopath"
|
|
export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
|
|
|
|
oe_runmake install DESTDIR="${D}"
|
|
if ${@bb.utils.contains('PACKAGECONFIG', 'docker', 'true', 'false', d)}; then
|
|
oe_runmake install.docker DESTDIR="${D}"
|
|
fi
|
|
}
|
|
|
|
FILES:${PN} += " \
|
|
${systemd_unitdir}/system/* \
|
|
${systemd_unitdir}/user/* \
|
|
${nonarch_libdir}/tmpfiles.d/* \
|
|
${sysconfdir}/cni \
|
|
"
|
|
|
|
SYSTEMD_SERVICE:${PN} = "podman.service podman.socket"
|
|
|
|
# The other option for this is "busybox", since meta-virt ensures
|
|
# that busybox is configured with nsenter
|
|
VIRTUAL-RUNTIME_base-utils-nsenter ?= "util-linux-nsenter"
|
|
|
|
RDEPENDS:${PN} += "conmon virtual-runc iptables cni skopeo ${VIRTUAL-RUNTIME_base-utils-nsenter}"
|
|
RRECOMMENDS:${PN} += "slirp4netns kernel-module-xt-masquerade kernel-module-xt-comment"
|
|
RCONFLICTS:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'docker', 'docker', '', d)}"
|