aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2020-06-03 16:28:43 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2020-06-03 16:32:30 +0200
commit2ce11e47f67840addf5da7e39d24378822bed5a9 (patch)
treec2105cb8d2c220217a604b6786a134d7898e8fb7
parentb1f51586c78b6c75de117e134bef3777d3aad447 (diff)
downloadaports-2ce11e47f67840addf5da7e39d24378822bed5a9.tar.gz
aports-2ce11e47f67840addf5da7e39d24378822bed5a9.tar.bz2
aports-2ce11e47f67840addf5da7e39d24378822bed5a9.tar.xz
main/abuild: backport fixes for crosscompile
fixes #11448
-rw-r--r--main/abuild/0001-functions.sh-exclusively-use-apk-print-arch-to-detec.patch62
-rw-r--r--main/abuild/0001-functions.sh-use-apk-print-arch-for-CARCH-if-gcc-is-.patch31
-rw-r--r--main/abuild/APKBUILD8
3 files changed, 99 insertions, 2 deletions
diff --git a/main/abuild/0001-functions.sh-exclusively-use-apk-print-arch-to-detec.patch b/main/abuild/0001-functions.sh-exclusively-use-apk-print-arch-to-detec.patch
new file mode 100644
index 0000000000..ca2678fe82
--- /dev/null
+++ b/main/abuild/0001-functions.sh-exclusively-use-apk-print-arch-to-detec.patch
@@ -0,0 +1,62 @@
+From c9d3df08b3d2824e4f2b3b1e901fee08447f5b61 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Fri, 7 Feb 2020 23:06:16 +0200
+Subject: [PATCH] functions.sh: exclusively use apk --print-arch to detect
+ build arch
+
+Originally "gcc -dumpmachine" was used to detect build gcc triplet.
+However, abuild does not depend on gcc or build-base (but installs
+it if needed to build) so gcc might not be there. Additionally
+abuild-sign can be used standalone, and does not have gcc dependency.
+
+Using ${CC:-gcc} is problematic in cross-compile, as CC might be
+already set for the cross-compiler and would result giving the target
+host triplet.
+
+It was deemed simplest to use "apk --print-arch" exclusively to detect
+the builder host type, or specify CBUILD manually. If there is need
+to use abuild/abuild-sign on non-Alpine hosts withou apk, we can
+later add fallback that uses "uname -m" to detect the architecture
+and guess Alpine CBUILD from it.
+
+Fixes #9974
+Fixes: 5adf47c1 "functions.sh: use apk --print-arch for CARCH if gcc is missing"
+Fixes: 95cd15c0 "functions.sh: dont die if gcc is missing"
+---
+ functions.sh.in | 13 +++++--------
+ 1 file changed, 5 insertions(+), 8 deletions(-)
+
+diff --git a/functions.sh.in b/functions.sh.in
+index 82ac114..5fef9b0 100644
+--- a/functions.sh.in
++++ b/functions.sh.in
+@@ -117,21 +117,18 @@ readconfig() {
+ USE_COLORS=${_USE_COLORS-$USE_COLORS}
+ USE_CCACHE=${_USE_CCACHE-$USE_CCACHE}
+
+- [ -z "$CBUILD" ] && CBUILD="$(${CC:-gcc} -dumpmachine 2>/dev/null || true)"
++ [ -z "$CBUILD" ] && CBUILD="$(${APK:-apk} --print-arch 2>/dev/null)"
+ [ -z "$CHOST" ] && CHOST="$CBUILD"
+ [ -z "$CTARGET" ] && CTARGET="$CHOST"
+ [ "$(arch_to_hostspec $CBUILD)" != "unknown" ] && CBUILD="$(arch_to_hostspec $CBUILD)"
+ [ "$(arch_to_hostspec $CHOST)" != "unknown" ] && CHOST="$(arch_to_hostspec $CHOST)"
+ [ "$(arch_to_hostspec $CTARGET)" != "unknown" ] && CTARGET="$(arch_to_hostspec $CTARGET)"
+-
+- [ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)"
+-
+- # use apk --print-arch for CARCH if gcc is missing
+- if [ "$CARCH" = "unknown" ]; then
+- local apk_arch="$(${APK:-apk} --print-arch 2>/dev/null)"
+- CARCH=${apk_arch:-unknown}
++ if [ -z "$CBUILD" ]; then
++ echo "Unable to deduce build architecture. Install apk-tools, or set CBUILD."
++ exit 1
+ fi
+
++ [ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)"
+ [ -z "$CLIBC" ] && CLIBC="$(hostspec_to_libc $CHOST)"
+ [ -z "$CBUILD_ARCH" ] && CBUILD_ARCH="$(hostspec_to_arch $CBUILD)"
+ [ -z "$CTARGET_ARCH" ] && CTARGET_ARCH="$(hostspec_to_arch $CTARGET)"
+--
+2.27.0
+
diff --git a/main/abuild/0001-functions.sh-use-apk-print-arch-for-CARCH-if-gcc-is-.patch b/main/abuild/0001-functions.sh-use-apk-print-arch-for-CARCH-if-gcc-is-.patch
new file mode 100644
index 0000000000..84c667fccc
--- /dev/null
+++ b/main/abuild/0001-functions.sh-use-apk-print-arch-for-CARCH-if-gcc-is-.patch
@@ -0,0 +1,31 @@
+From 5adf47c168aff63878872383e5fd2c0e7757818d Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Fri, 31 Jan 2020 09:47:44 +0000
+Subject: [PATCH] functions.sh: use apk --print-arch for CARCH if gcc is
+ missing
+
+---
+ functions.sh.in | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/functions.sh.in b/functions.sh.in
+index 6d5181a..82ac114 100644
+--- a/functions.sh.in
++++ b/functions.sh.in
+@@ -125,6 +125,13 @@ readconfig() {
+ [ "$(arch_to_hostspec $CTARGET)" != "unknown" ] && CTARGET="$(arch_to_hostspec $CTARGET)"
+
+ [ -z "$CARCH" ] && CARCH="$(hostspec_to_arch $CHOST)"
++
++ # use apk --print-arch for CARCH if gcc is missing
++ if [ "$CARCH" = "unknown" ]; then
++ local apk_arch="$(${APK:-apk} --print-arch 2>/dev/null)"
++ CARCH=${apk_arch:-unknown}
++ fi
++
+ [ -z "$CLIBC" ] && CLIBC="$(hostspec_to_libc $CHOST)"
+ [ -z "$CBUILD_ARCH" ] && CBUILD_ARCH="$(hostspec_to_arch $CBUILD)"
+ [ -z "$CTARGET_ARCH" ] && CTARGET_ARCH="$(hostspec_to_arch $CTARGET)"
+--
+2.27.0
+
diff --git a/main/abuild/APKBUILD b/main/abuild/APKBUILD
index bce888f10d..9e388a19de 100644
--- a/main/abuild/APKBUILD
+++ b/main/abuild/APKBUILD
@@ -2,7 +2,7 @@
pkgname=abuild
pkgver=3.5.0
_ver=${pkgver%_git*}
-pkgrel=0
+pkgrel=1
pkgdesc="Script to build Alpine Packages"
url="https://git.alpinelinux.org/cgit/abuild/"
arch="all"
@@ -21,6 +21,8 @@ subpackages="apkbuild-cpan:cpan:noarch apkbuild-gem-resolver:gems:noarch
options="suid !check"
pkggroups="abuild"
source="https://dev.alpinelinux.org/archive/abuild/abuild-$_ver.tar.xz
+ 0001-functions.sh-use-apk-print-arch-for-CARCH-if-gcc-is-.patch
+ 0001-functions.sh-exclusively-use-apk-print-arch-to-detec.patch
"
builddir="$srcdir/$pkgname-$_ver"
@@ -68,4 +70,6 @@ _rootbld() {
mkdir -p "$subpkgdir"
}
-sha512sums="30577da610c0677cdd60264d43ed6704e51bd652ed1d98a7bda90d836416c5c3d7ce02e27db9b2425c18a20177e9e6591315e4ab4ae21247288c3ac0eee12d38 abuild-3.5.0.tar.xz"
+sha512sums="30577da610c0677cdd60264d43ed6704e51bd652ed1d98a7bda90d836416c5c3d7ce02e27db9b2425c18a20177e9e6591315e4ab4ae21247288c3ac0eee12d38 abuild-3.5.0.tar.xz
+d631592a6f5d65f0d3d7bbafaf8c90c5e377bc11030d5eff1b134dfbf819c2995b5681b6b2d98f26dc97cacd7ae1fa60045a516b7c3b0df4d7716f0d4f22e13f 0001-functions.sh-use-apk-print-arch-for-CARCH-if-gcc-is-.patch
+75663b67218266c74f264d1cef8b0cdb86e8339f92f9f2296fa39b6ad5638a5f9676832bd7b97a16024b5b2c002321892a250aef056bbeb808efdd5b4ff8b25b 0001-functions.sh-exclusively-use-apk-print-arch-to-detec.patch"