From 08a06639d08501ab39c389f189bc9ee50151c9cd Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Thu, 26 Sep 2019 10:50:22 -0400 Subject: [PATCH] Cross compile build fixes. --- lib/bin/build_lib | 19 +++++++++++-------- platform-independent/c/core/Dockerfile | 5 +++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/bin/build_lib b/lib/bin/build_lib index d75baec0..f3e50866 100755 --- a/lib/bin/build_lib +++ b/lib/bin/build_lib @@ -169,7 +169,10 @@ _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 host=$arch-$platform; shift 3 + local prefix=$1 platform=$2 arch=$3; shift 3 + + local host=$arch build= + [[ -x build-aux/config.guess ]] && build=$(build-aux/config.guess) case "$platform" in 'windows') @@ -180,15 +183,15 @@ _target_configure() { set -- --with-sysroot="$SDKROOT/sysroot" "$@" ;; - 'ios') - [[ $arch = *arm* ]] && host=arm || host=$arch + 'macos'|'ios') + [[ $arch = *arm* ]] && host=arm host+=-apple set -- --disable-shared "$@" ;; esac - ./configure --build="$(./build-aux/config.guess)" ${host:+--host="$host"} --enable-pic --disable-pie --prefix="$prefix/$arch" "$@" + ./configure ${build:+--build="$build"} ${host:+--host="$host"} --enable-pic --disable-pie --prefix="$prefix/$arch" "$@" } # target_build @@ -305,7 +308,7 @@ _build() { 'ios') archs=( 'i386' 'x86_64' 'armv7' 'armv7s' 'arm64' ) ;; 'android') archs=( 'arm' 'arm64' 'x86' 'x86_64' ) ;; 'windows') archs=( 'Win32' 'x64' ) ;; - *) archs=( 'x86' 'x86_64' ) ;; + *) archs=( 'i686' 'x86_64' ) ;; esac fi @@ -376,11 +379,11 @@ _build() { ;; *) case "$arch" in - x86) - export CFLAGS="-m32" + i686) + export CFLAGS="-m32 $CFLAGS" CXXFLAGS="-m32 $CXXFLAGS" LDFLAGS="-m32 $LDFLAGS" ;; x86_64) - export CFLAGS="-m64" + export CFLAGS="-m64 $CFLAGS" CXXFLAGS="-m64 $CXXFLAGS" LDFLAGS="-m64 $LDFLAGS" ;; esac ;; diff --git a/platform-independent/c/core/Dockerfile b/platform-independent/c/core/Dockerfile index 31ec5f6e..c5d8ed6b 100644 --- a/platform-independent/c/core/Dockerfile +++ b/platform-independent/c/core/Dockerfile @@ -3,6 +3,7 @@ FROM debian:stable-slim # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 RUN mkdir -p /usr/share/man/man1 -RUN apt-get update && apt-get install -y default-jdk-headless git-core bash libtool automake autoconf make g++ +RUN apt-get update && apt-get install -y default-jdk-headless git-core bash libtool automake autoconf make g++-multilib RUN git clone --depth=3 $(: --shallow-submodules) --recurse-submodules --branch rewrite https://gitlab.com/MasterPassword/MasterPassword.git /mpw -RUN cd /mpw && git log -1 && ./gradlew -i clean build +RUN cd /mpw && ./gradlew -i clean +#RUN cd /mpw && git pull && git log -1 && ./gradlew -i check