diff options
author | Cem Keylan <cem@ckyln.com> | 2020-12-27 20:26:32 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2020-12-27 20:26:32 +0300 |
commit | 38f6aa7f5401d8322daa0b978df10d5fda2a613e (patch) | |
tree | 6fb948ff52a57a6e2220025a51ef705dd9d98e0c /core | |
parent | d9f26f27eb38c4727ff8446e36fbb0ed7efb0532 (diff) | |
download | repository-38f6aa7f5401d8322daa0b978df10d5fda2a613e.tar.gz |
experimental: add initial cross-compilation support
Diffstat (limited to 'core')
-rwxr-xr-x | core/binutils/build | 15 | ||||
-rwxr-xr-x | core/busybox/build | 6 | ||||
-rwxr-xr-x | core/byacc/build | 3 | ||||
-rwxr-xr-x | core/bzip2/build | 8 | ||||
-rwxr-xr-x | core/carbs-init/build | 4 | ||||
-rwxr-xr-x | core/curl/build | 3 | ||||
-rwxr-xr-x | core/flex/build | 4 | ||||
-rwxr-xr-x | core/gzip/build | 2 | ||||
-rwxr-xr-x | core/libelf/build | 3 | ||||
-rwxr-xr-x | core/m4/build | 3 | ||||
-rwxr-xr-x | core/musl/build | 4 | ||||
-rwxr-xr-x | core/zlib/build | 3 |
12 files changed, 28 insertions, 30 deletions
diff --git a/core/binutils/build b/core/binutils/build index 67a1af16..61c53318 100755 --- a/core/binutils/build +++ b/core/binutils/build @@ -1,12 +1,8 @@ #!/bin/sh -e # Architecture specific build options -case ${3:-$(uname -m)} in - i*86) archopts="--build=i686-pc-linux-musl \ - --host=i686-pc-linux-musl \ - --enable-64-bit-bfd" ;; - x86_64) archopts="--build=x86_64-pc-linux-musl \ - --host=x86_64-pc-linux-musl" +case "$3" in + i?86) archopts="--enable-64-bit-bfd" esac cat > makeinfo <<EOF @@ -19,9 +15,7 @@ export PATH=$PATH:$PWD # Word splitting is intentional here. # shellcheck disable=2086 -./configure \ - --prefix=/usr \ - $archopts \ +cpt-configure \ --enable-targets=x86_64-pep \ --disable-multilib \ --disable-werror \ @@ -30,7 +24,8 @@ export PATH=$PATH:$PWD --disable-readline \ --disable-gprof \ --with-mmap \ - --with-system-zlib + --with-system-zlib \ + "$archopts" make make DESTDIR="$1" install diff --git a/core/busybox/build b/core/busybox/build index df00282d..2a3f38c1 100755 --- a/core/busybox/build +++ b/core/busybox/build @@ -10,9 +10,11 @@ for patch in *.patch; do patch -p1 < "$patch" done +[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc + # Build and install regular busybox. # This excludes utilities which require 'suid' to function. -make CC="${CC:-gcc}" +make CC="${CC:=gcc}" make CONFIG_PREFIX="$1/usr" install # Rename the binary temporarily. @@ -21,7 +23,7 @@ mv "$1/usr/bin/busybox" "$1/usr/bin/busybox-nosuid" # Build and install suid busybox. # This _only_ includes utlities which require 'suid' to function. cp -f .config-suid .config -make CC="${CC:-gcc}" +make CC="$CC" make CONFIG_PREFIX="$1/usr" install # Aptly name the busybox binaries. diff --git a/core/byacc/build b/core/byacc/build index cc21d9ed..f3cc6001 100755 --- a/core/byacc/build +++ b/core/byacc/build @@ -2,8 +2,7 @@ export LDFLAGS="$LDFLAGS -static" -./configure \ - --prefix=/usr \ +cpt-configure \ --program-transform='s/^/b/' make diff --git a/core/bzip2/build b/core/bzip2/build index ac1055b2..209cce27 100755 --- a/core/bzip2/build +++ b/core/bzip2/build @@ -1,10 +1,12 @@ #!/bin/sh -e +[ "$CPT_CROSS_TARGET" ] && CC=$CPT_CROSS_TARGET-cc + make CC="${CC:-cc} $CFLAGS -fPIC $LDFLAGS" -f Makefile-libbz2_so -make CC="${CC:-cc} $CFLAGS -fPIC $LDFLAGS" bzip2recover libbz2.a +make CC="${CC:-cc} $CFLAGS -fPIC $LDFLAGS -static" bzip2 bzip2recover libbz2.a -for bin in bzip2-shared bzdiff bzgrep bzip2recover bzmore; do - install -Dm755 "$bin" "$1/usr/bin/${bin%%-shared}" +for bin in bzip2 bzdiff bzgrep bzip2recover bzmore; do + install -Dm755 "$bin" "$1/usr/bin/$bin" done install -Dm755 libbz2.so.1.0.8 "$1/usr/lib/libbz2.so.1.0.8" diff --git a/core/carbs-init/build b/core/carbs-init/build index c46dc3e2..4fa04cb5 100755 --- a/core/carbs-init/build +++ b/core/carbs-init/build @@ -2,4 +2,6 @@ patch -p1 < respawn-fix.patch -make DESTDIR="$1" install +[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc + +make CC="${CC:-cc}" DESTDIR="$1" install diff --git a/core/curl/build b/core/curl/build index f27b1522..f5630ab3 100755 --- a/core/curl/build +++ b/core/curl/build @@ -1,7 +1,6 @@ #!/bin/sh -e -./configure \ - --prefix=/usr \ +cpt-configure \ --enable-ipv6 \ --enable-unix-sockets \ --enable-hidden-symbols \ diff --git a/core/flex/build b/core/flex/build index c0aa1260..e0305c7c 100755 --- a/core/flex/build +++ b/core/flex/build @@ -1,8 +1,6 @@ #!/bin/sh -e -./configure \ - --prefix=/usr \ - --disable-static \ +cpt-configure \ --enable-shared \ ac_cv_func_malloc_0_nonnull=yes \ ac_cv_func_realloc_0_nonnull=yes diff --git a/core/gzip/build b/core/gzip/build index 8d190a07..aecc904a 100755 --- a/core/gzip/build +++ b/core/gzip/build @@ -1,5 +1,7 @@ #!/bin/sh -e +[ "$CPT_CROSS_TRIPLET" ] && + CC="$CPT_CROSS_TRIPLET-cc -L$CPT_ROOT/usr/lib -isystem -isystem $CPT_ROOT/usr/include" make CC="${CC:-cc} -static" install -Dm755 pigz "$1/usr/bin/pigz" diff --git a/core/libelf/build b/core/libelf/build index 7bade69a..003b171e 100755 --- a/core/libelf/build +++ b/core/libelf/build @@ -9,8 +9,7 @@ sed -i 's/as_fn_error.*libargp/: "/g' configure # Don't compile two unrelated C files which require argp. sed -i 's/color.*printversion../#/g' lib/Makefile.in -./configure \ - --prefix=/usr \ +cpt-configure \ --disable-symbol-versioning \ --disable-debuginfod \ --disable-nls diff --git a/core/m4/build b/core/m4/build index bbd53ee2..adbcf2ea 100755 --- a/core/m4/build +++ b/core/m4/build @@ -2,8 +2,7 @@ export LDFLAGS="$LDFLAGS -static" -./configure \ - --prefix=/usr +cpt-configure make make DESTDIR="$1" install diff --git a/core/musl/build b/core/musl/build index 44b80ec1..d5971790 100755 --- a/core/musl/build +++ b/core/musl/build @@ -18,9 +18,7 @@ kinstall_t() { patch -p0 < CVE-2020-28928.patch -./configure \ - --prefix=/usr \ - --syslibdir=/usr/lib +cpt-configure make make DESTDIR="$1" install diff --git a/core/zlib/build b/core/zlib/build index 01090e82..c14fa524 100755 --- a/core/zlib/build +++ b/core/zlib/build @@ -1,5 +1,8 @@ #!/bin/sh -e +[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc +export CC + ./configure \ --prefix=/usr \ --libdir=/usr/lib \ |