2
0

Linux cross-compiling.

This commit is contained in:
Maarten Billemont 2019-09-25 22:51:12 -04:00
parent 64536f95c0
commit 61611e108c

View File

@ -169,7 +169,7 @@ _target_prepare() {
# --enable-pic --disable-pie to ensure the resulting library can be linked again.
target_configure() { _target_configure "$@"; }
_target_configure() {
local prefix=$1 platform=$2 arch=$3; shift 3
local prefix=$1 platform=$2 arch=$3 host=$arch-$platform; shift 3
case "$platform" in
'windows')
@ -188,7 +188,7 @@ _target_configure() {
;;
esac
./configure ${host:+--host="$host"} --enable-pic --disable-pie --prefix="$prefix/$arch" "$@"
./configure --build="$(./build-aux/config.guess)" ${host:+--host="$host"} --enable-pic --disable-pie --prefix="$prefix/$arch" "$@"
}
# target_build <prefix> <platform> <arch>
@ -305,11 +305,12 @@ _build() {
'ios') archs=( 'i386' 'x86_64' 'armv7' 'armv7s' 'arm64' ) ;;
'android') archs=( 'arm' 'arm64' 'x86' 'x86_64' ) ;;
'windows') archs=( 'Win32' 'x64' ) ;;
*) archs=( 'i386' 'x86_64' ) ;;
*) archs=( 'x86' 'x86_64' ) ;;
esac
fi
local prefix="$PWD/build-$platform~"
echo " # $name ($platform: ${archs[*]}) into $prefix ..."
initialize "$prefix" "$platform"
# "clean" argument wipes the lib clean and exits. If .success exists in prefix output, skip build.
@ -373,8 +374,19 @@ _build() {
# x86 CFLAGS="-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
# x86_64 CFLAGS="-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
;;
*)
case "$arch" in
x86)
export CFLAGS="-m32"
;;
x86_64)
export CFLAGS="-m64"
;;
esac
;;
esac
echo " # $name ($platform: $arch) ..."
target "$prefix" "$platform" "$arch"
); done