Add support to cross-compile for Mac from linux

This commit is contained in:
brandon15811 2013-08-21 12:50:31 -05:00
parent e0390d0f54
commit 5175e1f297

View File

@ -23,6 +23,7 @@ type wget >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"wge
export CC="gcc" export CC="gcc"
COMPILE_FOR_ANDROID=no COMPILE_FOR_ANDROID=no
RANLIB=ranlib
if [ "$1" == "rpi" ]; then if [ "$1" == "rpi" ]; then
[ -z "$march" ] && march=armv6zk; [ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s; [ -z "$mtune" ] && mtune=arm1176jzf-s;
@ -61,8 +62,18 @@ elif [ "$1" == "crosscompile" ]; then
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX" CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
[ -z "$CFLAGS" ] && CFLAGS="-uclibc"; [ -z "$CFLAGS" ] && CFLAGS="-uclibc";
echo "[INFO] Cross-compiling for Raspberry Pi ARMv6zk hard float" echo "[INFO] Cross-compiling for Raspberry Pi ARMv6zk hard float"
elif [ "$2" == "mac" ]; then
[ -z "$march" ] && march=prescott;
[ -z "$mtune" ] && mtune=generic;
[ -z "$CFLAGS" ] && CFLAGS="-fomit-frame-pointer";
TOOLCHAIN_PREFIX="i686-apple-darwin10"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
#zlib doesn't use the correct ranlib
RANLIB=$TOOLCHAIN_PREFIX-ranlib
echo "[INFO] Cross-compiling for Intel MacOS"
else else
echo "Please supply a proper platform [android android-armv6 android-armv7 rpi] to cross-compile" echo "Please supply a proper platform [android android-armv6 android-armv7 rpi mac] to cross-compile"
exit 1 exit 1
fi fi
else else
@ -135,7 +146,7 @@ wget http://zlib.net/zlib-$ZLIB_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/instal
mv zlib-$ZLIB_VERSION zlib mv zlib-$ZLIB_VERSION zlib
echo -n " checking..." echo -n " checking..."
cd zlib cd zlib
./configure --prefix="$DIR/install_data/php/ext/zlib" \ RANLIB=$RANLIB ./configure --prefix="$DIR/install_data/php/ext/zlib" \
--static >> "$DIR/install.log" 2>&1 --static >> "$DIR/install.log" 2>&1
echo -n " compiling..." echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1 make -j $THREADS >> "$DIR/install.log" 2>&1