Rework the env - variables to produce a working cross compile script

The cross compile script kind of works right now, it's missing
something that I'm really not sure where or what it is.

currently sqlite will not build because:
	error: gethostuuid is not defined in iOS

This bug was already opened on sqlite bugtracker for about a year, the
workaround is to pass -DDSQLITE_ENABLE_LOCKING_STYLE=0 to the compilation
flags, which I did but did not work for some reason.

Which is a good error - it shows us that we are actually trying to compile
for iOS.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-12-20 12:32:55 -02:00 committed by Dirk Hohndel
parent 105d698759
commit 2316390c1f

View file

@ -1,13 +1,36 @@
#!/bin/bash #!/bin/bash
set -e set -e
PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms" # Build architecture, [armv7|armv7s|arm64|i386|x86_64]
TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin" export ARCH=i386
export IPHONEOS_DEPLOYMENT_TARGET="8.0"
pwd=`pwd` #arm-apple-darwin, arch64-apple-darwin, i386-apple-darwin*, x86_64-apple-darwin*
export CHOST=i386-apple-darwin*
#iphonesimulator or iphoneos
export SDK=iphonesimulator
export SDKVERSION=$(xcrun --sdk $SDK --show-sdk-version) # current version
export SDKROOT=$(xcrun --sdk $SDK --show-sdk-path) # current version
#make subsurface set this to a saner value
export PREFIX=/usr
# Binaries
export CC=$(xcrun --sdk $SDK --find gcc)
export CPP=$(xcrun --sdk $SDK --find gcc)" -E"
export CXX=$(xcrun --sdk $SDK --find g++)
export LD=$(xcrun --sdk $SDK --find ld)
# Flags
export CFLAGS="$CFLAGS -arch $ARCH -isysroot $SDKROOT -I$PREFIX/include -miphoneos-version-min=$SDKVERSION"
export CPPFLAGS="$CPPFLAGS -arch $ARCH -isysroot $SDKROOT -I$PREFIX/include -miphoneos-version-min=$SDKVERSION"
export CXXFLAGS="$CXXFLAGS -arch $ARCH -isysroot $SDKROOT -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -arch $ARCH -isysroot $SDKROOT -L$PREFIX/lib"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$SDKROOT/usr/lib/pkgconfig":"$PREFIX/lib/pkgconfig"
# Which versions are we building against? # Which versions are we building against?
SQLITE_VERSION=3081002 SQLITE_VERSION=3090200
LIBXML2_VERSION=2.9.3 LIBXML2_VERSION=2.9.3
LIBXSLT_VERSION=1.1.28 LIBXSLT_VERSION=1.1.28
LIBZIP_VERSION=1.0.1 LIBZIP_VERSION=1.0.1
@ -22,17 +45,6 @@ target=i386
hosttarget=i386 hosttarget=i386
platform=iPhoneSimulator platform=iPhoneSimulator
export CC="$(xcrun -sdk iphoneos -find clang)"
export CPP="$CC -E"
export CFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKVERSION"
export LDFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk"
echo "BUILDCHAIN: ${BUILDCHAIN}"
echo "ARCH: ${ARCH}"
echo "PREFIX:${PREFIX}"
if [ ! -e sqlite-autoconf-${SQLITE_VERSION}.tar.gz ] ; then if [ ! -e sqlite-autoconf-${SQLITE_VERSION}.tar.gz ] ; then
curl -O http://www.sqlite.org/2015/sqlite-autoconf-${SQLITE_VERSION}.tar.gz curl -O http://www.sqlite.org/2015/sqlite-autoconf-${SQLITE_VERSION}.tar.gz
@ -43,8 +55,11 @@ fi
if [ ! -e $PKG_CONFIG_LIBDIR/sqlite3.pc ] ; then if [ ! -e $PKG_CONFIG_LIBDIR/sqlite3.pc ] ; then
mkdir -p sqlite-build-$platform mkdir -p sqlite-build-$platform
pushd sqlite-build-$platform pushd sqlite-build-$platform
CFLAGS="${CFLAGS} -DDSQLITE_ENABLE_LOCKING_STYLE=0"
../sqlite-autoconf-${SQLITE_VERSION}/configure \ ../sqlite-autoconf-${SQLITE_VERSION}/configure \
--host=$hosttarget-apple-darwin --prefix="$PREFIX" \
--host="$CHOST" \
--enable-static \ --enable-static \
--disable-shared --disable-shared
make make