From 4eb744c007302197f11d57730c1ad79e1e2ef2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Sun, 15 Nov 2020 20:33:05 -0300 Subject: [PATCH 1/2] common/{env,helper}: create Go build-helper. Split the environment file from go build style into a build helper that's pulled in automatically by the go build style. --- common/build-helper/go.sh | 41 +++++++++++++++++++++++++++ common/environment/build-style/go.sh | 42 +--------------------------- 2 files changed, 42 insertions(+), 41 deletions(-) create mode 100644 common/build-helper/go.sh diff --git a/common/build-helper/go.sh b/common/build-helper/go.sh new file mode 100644 index 00000000000..3f83013d4f7 --- /dev/null +++ b/common/build-helper/go.sh @@ -0,0 +1,41 @@ +if [ -z "$hostmakedepends" -o "${hostmakedepends##*gcc-go-tools*}" ]; then + # gc compiler + if [ -z "$archs" ]; then + archs="aarch64* armv[567]* i686* x86_64* ppc64le*" + fi + hostmakedepends+=" go" + nopie=yes +else + # gccgo compiler + if [ "$CROSS_BUILD" ]; then + # target compiler to use; otherwise it'll just call gccgo + export GCCGO="${XBPS_CROSS_TRIPLET}-gccgo" + fi +fi +nostrip=yes + +case "$XBPS_TARGET_MACHINE" in + aarch64*) export GOARCH=arm64;; + armv5*) export GOARCH=arm; export GOARM=5;; + armv6*) export GOARCH=arm; export GOARM=6;; + armv7*) export GOARCH=arm; export GOARM=7;; + i686*) export GOARCH=386;; + x86_64*) export GOARCH=amd64;; + ppc64le*) export GOARCH=ppc64le;; + ppc64*) export GOARCH=ppc64;; + ppc*) export GOARCH=ppc;; + mipsel*) export GOARCH=mipsle;; + mips*) export GOARCH=mips;; +esac + +export GOPATH="${wrksrc}/_build-${pkgname}-xbps" +GOSRCPATH="${GOPATH}/src/${go_import_path}" +export CGO_CFLAGS="$CFLAGS" +export CGO_CPPFLAGS="$CPPFLAGS" +export CGO_CXXFLAGS="$CXXFLAGS" +export CGO_LDFLAGS="$LDFLAGS" +export CGO_ENABLED=1 +case "$XBPS_TARGET_MACHINE" in + *-musl) export GOCACHE="${XBPS_HOSTDIR}/gocache-muslc" ;; + *) export GOCACHE="${XBPS_HOSTDIR}/gocache-glibc" ;; +esac diff --git a/common/environment/build-style/go.sh b/common/environment/build-style/go.sh index 3f83013d4f7..a765f7bab89 100644 --- a/common/environment/build-style/go.sh +++ b/common/environment/build-style/go.sh @@ -1,41 +1 @@ -if [ -z "$hostmakedepends" -o "${hostmakedepends##*gcc-go-tools*}" ]; then - # gc compiler - if [ -z "$archs" ]; then - archs="aarch64* armv[567]* i686* x86_64* ppc64le*" - fi - hostmakedepends+=" go" - nopie=yes -else - # gccgo compiler - if [ "$CROSS_BUILD" ]; then - # target compiler to use; otherwise it'll just call gccgo - export GCCGO="${XBPS_CROSS_TRIPLET}-gccgo" - fi -fi -nostrip=yes - -case "$XBPS_TARGET_MACHINE" in - aarch64*) export GOARCH=arm64;; - armv5*) export GOARCH=arm; export GOARM=5;; - armv6*) export GOARCH=arm; export GOARM=6;; - armv7*) export GOARCH=arm; export GOARM=7;; - i686*) export GOARCH=386;; - x86_64*) export GOARCH=amd64;; - ppc64le*) export GOARCH=ppc64le;; - ppc64*) export GOARCH=ppc64;; - ppc*) export GOARCH=ppc;; - mipsel*) export GOARCH=mipsle;; - mips*) export GOARCH=mips;; -esac - -export GOPATH="${wrksrc}/_build-${pkgname}-xbps" -GOSRCPATH="${GOPATH}/src/${go_import_path}" -export CGO_CFLAGS="$CFLAGS" -export CGO_CPPFLAGS="$CPPFLAGS" -export CGO_CXXFLAGS="$CXXFLAGS" -export CGO_LDFLAGS="$LDFLAGS" -export CGO_ENABLED=1 -case "$XBPS_TARGET_MACHINE" in - *-musl) export GOCACHE="${XBPS_HOSTDIR}/gocache-muslc" ;; - *) export GOCACHE="${XBPS_HOSTDIR}/gocache-glibc" ;; -esac +build_helper+=" go" From 6f6ae65530dd7381d55cbdc7cf8a0f9a4eaf62f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Sun, 15 Nov 2020 20:34:44 -0300 Subject: [PATCH 2/2] aerc: use go build helper. --- srcpkgs/aerc/template | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/srcpkgs/aerc/template b/srcpkgs/aerc/template index 08c81ef0d4e..e0938103dc6 100644 --- a/srcpkgs/aerc/template +++ b/srcpkgs/aerc/template @@ -2,7 +2,9 @@ pkgname=aerc version=0.5.2 revision=1 -build_style=go +build_helper=go +build_style=gnu-makefile +make_build_args="GOFLAGS=-tags=notmuch PREFIX=/usr" hostmakedepends="scdoc git" makedepends="libnotmuch-devel" short_desc="Terminal email client" @@ -12,18 +14,6 @@ homepage="https://aerc-mail.org" distfiles="https://git.sr.ht/~sircmpwn/aerc/archive/${version}.tar.gz" checksum=87b922440e53b99f260d2332996537decb452c838c774e9340b633296f9f68ee -do_configure() { - : -} - -do_build() { - make ${makejobs} PREFIX=/usr GOFLAGS=-tags=notmuch -} - -do_install() { - make STRIP=true PREFIX=/usr DESTDIR=${DESTDIR} install -} - post_install() { vlicense LICENSE }