diff options
Diffstat (limited to 'recipes-containers/umoci/umoci_git.bb')
-rw-r--r-- | recipes-containers/umoci/umoci_git.bb | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/recipes-containers/umoci/umoci_git.bb b/recipes-containers/umoci/umoci_git.bb index 5273a70e..7cd147b2 100644 --- a/recipes-containers/umoci/umoci_git.bb +++ b/recipes-containers/umoci/umoci_git.bb @@ -21,30 +21,60 @@ inherit go # go package. EXTRA_OEMAKE="BUILDTAGS=''" + +do_compile_class-native () { + export GOARCH="${BUILD_GOARCH}" + + # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries + export CGO_ENABLED="1" + export CFLAGS="${BUILD_CFLAGS}" + export LDFLAGS="${BUILD_LDFLAGS}" + export CGO_CFLAGS="${BUILD_CFLAGS}" + + # as of go 1.15.5, there are some flags the CGO doesn't like. Rather than + # clearing them all, we sed away the ones we don't want. + # export CGO_LDFLAGS="$(echo ${BUILD_LDFLAGS} | sed 's/-Wl,-O1//g' | sed 's/-Wl,--dynamic-linker.*?( \|$\)//g')" + export CC="${BUILD_CC}" + export LD="${BUILD_LD}" + + export GOPATH="${WORKDIR}/git/" + export GO111MODULE=off + + cd ${S} + + # why static ? patchelf will be run on dynamic binaries and it breaks + # the executable (coredump) + # https://forum.snapcraft.io/t/patchelf-broke-my-binary/4928 + # https://github.com/NixOS/patchelf/issues/146 + oe_runmake umoci.static + + # so the common install can find our binary + cp umoci.static umoci +} + do_compile() { - export GOARCH="${TARGET_GOARCH}" - export GOPATH="${WORKDIR}/git/" + export GOARCH="${TARGET_GOARCH}" + export GOPATH="${WORKDIR}/git/" - # Pass the needed cflags/ldflags so that cgo - # can find the needed headers files and libraries - export CGO_ENABLED="1" - export CFLAGS="" - export LDFLAGS="" - export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" + # Pass the needed cflags/ldflags so that cgo + # can find the needed headers files and libraries + export CGO_ENABLED="1" + export CFLAGS="" + export LDFLAGS="" + export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" + export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" - export GO111MODULE=off + export GO111MODULE=off - cd ${S} + cd ${S} - oe_runmake umoci + oe_runmake umoci } do_install() { - install -d ${D}/${sbindir} - install ${S}/umoci ${D}/${sbindir} + install -d ${D}/${sbindir} + install ${S}/umoci ${D}/${sbindir} } INSANE_SKIP_${PN} += "ldflags already-stripped" - BBCLASSEXTEND = "native" |