iOS build: more build.sh hacking

This now can create all the support libraries in armv7, but that isn't
sufficient for QtCreator which wants fat libraries with both armv7 and arm64 in
them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-03-06 15:10:54 -08:00
parent 8a6728eb08
commit 7ae4eed734

View file

@ -1,8 +1,18 @@
#!/bin/bash #!/bin/bash
set -x set -x
set -e
TOP=$(pwd) TOP=$(pwd)
if [ "$1" = "device" ] ; then
DEVICE=1
INSTALL_ROOT=$TOP/install-root-device
shift
else
DEVICE=0
INSTALL_ROOT=$TOP/install-root-simulator
fi
SUBSURFACE_SOURCE=${TOP}/../../../subsurface SUBSURFACE_SOURCE=${TOP}/../../../subsurface
IOS_QT=${TOP}/Qt IOS_QT=${TOP}/Qt
@ -21,17 +31,27 @@ echo "#define GIT_VERSION_STRING \"$GITVERSION\"" > subsurface-ios/ssrf-version.
echo "#define CANONICAL_VERSION_STRING \"$CANONICALVERSION\"" >> subsurface-ios/ssrf-version.h echo "#define CANONICAL_VERSION_STRING \"$CANONICALVERSION\"" >> subsurface-ios/ssrf-version.h
echo "#define MOBILE_VERSION_STRING \"$MOBILEVERSION\"" >> subsurface-ios/ssrf-version.h echo "#define MOBILE_VERSION_STRING \"$MOBILEVERSION\"" >> subsurface-ios/ssrf-version.h
mkdir -p $TOP/install-root/lib $TOP/install-root/bin $TOP/install-root/include mkdir -p $INSTALL_ROOT/lib $INSTALL_ROOT/bin $INSTALL_ROOT/include
PKG_CONFIG_LIBDIR=$TOP/install-root/lib/pkgconfig PKG_CONFIG_LIBDIR=$INSTALL_ROOT/lib/pkgconfig
export PKG_CONFIG_PATH=$PKG_CONFIG_LIBDIR export PKG_CONFIG_PATH=$PKG_CONFIG_LIBDIR
declare -x PREFIX=$INSTALL_ROOT
declare TOOLCHAIN_FILE="iPhoneSimulatorCMakeToolchain" # set up toolchain, architecture and SDK
declare -x PREFIX=$TOP/install-root
declare -x SDK_NAME="iphonesimulator"
# Build architecture, [armv7|armv7s|arm64|i386|x86_64] # Build architecture, [armv7|armv7s|arm64|i386|x86_64]
declare -x ARCH_NAME="x86_64" if [ "$DEVICE" = "0" ] ; then
declare -x SDK_NAME="iphonesimulator"
declare -x TOOLCHAIN_FILE="${TOP}/iPhoneSimulatorCMakeToolchain"
declare -x ARCH_NAME="x86_64"
declare -x IOS_PLATFORM=SIMULATOR64
else
declare -x SDK_NAME="iphoneos"
declare -x TOOLCHAIN_FILE="${TOP}/iPhoneDeviceCMakeToolchain"
declare -x ARCH_NAME="armv7"
declare -x IOS_PLATFORM=OS
fi
declare -x ARCH=$ARCH_NAME declare -x ARCH=$ARCH_NAME
declare -x SDK=$SDK_NAME
declare -x SDK_DIR=`xcrun --sdk $SDK_NAME --show-sdk-path` declare -x SDK_DIR=`xcrun --sdk $SDK_NAME --show-sdk-path`
declare -x PLATFORM_DIR=`xcrun --sdk $SDK_NAME --show-sdk-platform-path` declare -x PLATFORM_DIR=`xcrun --sdk $SDK_NAME --show-sdk-platform-path`
@ -43,9 +63,6 @@ declare -x CXXFLAGS="$CFLAGS"
declare -x LDFLAGS="$CFLAGS -lpthread -lc++ -L$SDK_DIR/usr/lib" declare -x LDFLAGS="$CFLAGS -lpthread -lc++ -L$SDK_DIR/usr/lib"
export BUILDCHAIN=${ARCH_NAME}-apple-darwin export BUILDCHAIN=${ARCH_NAME}-apple-darwin
#iphonesimulator or iphoneos // SIMULATOR or OS
export SDK=iphonesimulator
export IOS_PLATFORM=SIMULATOR64
# openssl build stuff. # openssl build stuff.
export DEVELOPER=$(xcode-select --print-path)\ export DEVELOPER=$(xcode-select --print-path)\
@ -111,7 +128,11 @@ fi
if [ ! -e $PKG_CONFIG_LIBDIR/libxml-2.0.pc ] ; then if [ ! -e $PKG_CONFIG_LIBDIR/libxml-2.0.pc ] ; then
mkdir -p libxml2-build-$ARCH mkdir -p libxml2-build-$ARCH
pushd libxml2-build-$ARCH pushd libxml2-build-$ARCH
../libxml2-${LIBXML2_VERSION}/configure --host=${BUILDCHAIN} --prefix=${PREFIX} --without-python --without-iconv --enable-static --disable-shared if [ "$ARCH_NAME" == "x86_64" ]; then
../libxml2-${LIBXML2_VERSION}/configure --host=${BUILDCHAIN} --prefix=${PREFIX} --without-python --without-iconv --enable-static --disable-shared
else
../libxml2-${LIBXML2_VERSION}/configure --host=arm-apple-darwin --prefix=${PREFIX} --without-python --without-iconv --enable-static --disable-shared
fi
perl -pi -e 's/runtest\$\(EXEEXT\)//' Makefile perl -pi -e 's/runtest\$\(EXEEXT\)//' Makefile
perl -pi -e 's/testrecurse\$\(EXEEXT\)//' Makefile perl -pi -e 's/testrecurse\$\(EXEEXT\)//' Makefile
make make
@ -160,14 +181,14 @@ configure_openssl() {
export CROSS_TOP="${PLATFORM}/Developer" export CROSS_TOP="${PLATFORM}/Developer"
export CROSS_SDK="${OS}${SDK_VERSION}.sdk" export CROSS_SDK="${OS}${SDK_VERSION}.sdk"
# if [ "$ARCH" == "i386" ]; then if [ "$ARCH_NAME" == "x86_64" ]; then
./Configure darwin64-${ARCH}-cc --openssldir="${PREFIX}" --prefix="${PREFIX}" ./Configure darwin64-${ARCH}-cc --openssldir="${PREFIX}" --prefix="${PREFIX}"
sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -mios-simulator-version-min=${DEPLOYMENT_VERSION} !" "Makefile" sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -mios-simulator-version-min=${DEPLOYMENT_VERSION} !" "Makefile"
# else else
# ./Configure iphoneos-cross -no-asm --openssldir="${PREFIX}" ./Configure iphoneos-cross -no-asm --openssldir="${PREFIX}"
# sed -ie "s!^CFLAG=!CFLAG=-mios-simulator-version-min=${DEPLOYMENT_VERSION} !" "Makefile" sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch $ARCH -miphoneos-version-min=${DEPLOYMENT_VERSION} !" "Makefile"
# perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
# fi fi
} }
build_openssl() build_openssl()
@ -185,11 +206,11 @@ build_openssl()
#fix header for Swift #fix header for Swift
sed -ie "s/BIGNUM \*I,/BIGNUM \*i,/g" crypto/rsa/rsa.h sed -ie "s/BIGNUM \*I,/BIGNUM \*i,/g" crypto/rsa/rsa.h
if [ "$TYPE" == "ios" ]; then if [ "$TYPE" == "ios" ]; then
# if [ "$ARCH" == "i386" ]; then if [ "$ARCH" == "x86_64" ]; then
configure_openssl "iPhoneSimulator" $ARCH ${IPHONESIMULATOR_PLATFORM} ${IPHONEOS_SDK_VERSION} ${IPHONEOS_DEPLOYMENT_VERSION} configure_openssl "iPhoneSimulator" $ARCH ${IPHONESIMULATOR_PLATFORM} ${IPHONEOS_SDK_VERSION} ${IPHONEOS_DEPLOYMENT_VERSION}
# else else
# configure_openssl "iPhoneOS" $ARCH ${IPHONEOS_PLATFORM} ${IPHONEOS_SDK_VERSION} ${IPHONEOS_DEPLOYMENT_VERSION} configure_openssl "iPhoneOS" $ARCH ${IPHONEOS_PLATFORM} ${IPHONEOS_SDK_VERSION} ${IPHONEOS_DEPLOYMENT_VERSION}
# fi fi
fi fi
make make
make install_sw make install_sw
@ -236,7 +257,7 @@ if [ ! -e $PKG_CONFIG_LIBDIR/libgit2.pc ] ; then
cmake ../libgit2-${LIBGIT2_VERSION} \ cmake ../libgit2-${LIBGIT2_VERSION} \
-G "Unix Makefiles" \ -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS="OFF" \ -DBUILD_SHARED_LIBS="OFF" \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_DEV" \ -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \
-DSHA1_TYPE=builtin \ -DSHA1_TYPE=builtin \
-DBUILD_CLAR=OFF \ -DBUILD_CLAR=OFF \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \ -DCMAKE_INSTALL_PREFIX=${PREFIX} \