Skip to content

Instantly share code, notes, and snippets.

@lydonchandra
Forked from swisspol/build.sh
Created January 25, 2014 04:31
Show Gist options
  • Save lydonchandra/8611908 to your computer and use it in GitHub Desktop.
Save lydonchandra/8611908 to your computer and use it in GitHub Desktop.
#!/bin/sh -ex
DEVELOPER=`xcode-select --print-path`
PLATFORM="iPhoneOS"
ARCH="armv7"
IPHONE_SDK="7.0"
IPHONE_MIN_VERSION="5.0"
VERSION="1.3.0"
NASM_VERSION="2.10.09"
AUTOCONF_VERSION="2.69"
AUTOMAKE_VERSION="1.13"
LIBTOOL_VERSION="2.4.2"
GNU_PATH="`pwd`/gnu"
# Make gnu directory and preprend to $PATH
rm -rf "${GNU_PATH}"
mkdir -p "${GNU_PATH}/bin"
export PATH="${GNU_PATH}/bin:$PATH"
# Download autoconf if necessary
if [ ! -f "autoconf-${AUTOCONF_VERSION}.tar.gz" ]
then
curl -O "http://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz"
fi
# Extract autoconf
rm -rf "autoconf-${AUTOCONF_VERSION}"
tar -xzf "autoconf-${AUTOCONF_VERSION}.tar.gz"
# Build autoconf
pushd "autoconf-${AUTOCONF_VERSION}"
./configure "--prefix=${GNU_PATH}"
make -j4
make install
popd
# Download automake if necessary
if [ ! -f "automake-${AUTOCONF_VERSION}.tar.gz" ]
then
curl -O "http://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz"
fi
# Extract automake
rm -rf "automake-${AUTOMAKE_VERSION}"
tar -xvf "automake-${AUTOMAKE_VERSION}.tar.gz"
# Build automake
pushd "automake-${AUTOMAKE_VERSION}"
./configure "--prefix=${GNU_PATH}"
make -j4
make install
popd
# Download automake if necessary
if [ ! -f "libtool-${LIBTOOL_VERSION}.tar.gz" ]
then
curl -O "http://ftp.gnu.org/gnu/libtool/libtool-${LIBTOOL_VERSION}.tar.gz"
fi
# Extract libtool
rm -rf "libtool-${LIBTOOL_VERSION}"
tar -xvf "libtool-${LIBTOOL_VERSION}.tar.gz"
# Build libtool
pushd "libtool-${LIBTOOL_VERSION}"
./configure "--prefix=${GNU_PATH}"
make -j4
make install
popd
# Download gas preprocessor if necessary and append to $PATH
if [ ! -f "gas-preprocessor-master.zip" ]
then
curl -o "gas-preprocessor-master.zip" "https://codeload.github.com/yuvi/gas-preprocessor/zip/master"
fi
rm -rf "gas-preprocessor-master"
unzip "gas-preprocessor-master.zip"
pushd "gas-preprocessor-master"
chmod a+x "gas-preprocessor.pl"
export PATH="$PATH:`pwd`"
popd
# Download source if necessary
if [ ! -f "libjpeg-turbo-${VERSION}.tar.gz" ]
then
curl -O "http://softlayer-dal.dl.sourceforge.net/project/libjpeg-turbo/${VERSION}/libjpeg-turbo-${VERSION}.tar.gz"
fi
# Extract source
rm -rf "libjpeg-turbo-${VERSION}"
tar -xvf "libjpeg-turbo-${VERSION}.tar.gz"
# Build
pushd "libjpeg-turbo-${VERSION}"
autoreconf -fiv # See http://sourceforge.net/mailarchive/message.php?msg_id=30462917
export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${IPHONE_SDK}.sdk"
export CC=`xcrun -find gcc`
export LD=`xcrun -find ld`
export IOS_CFLAGS="-arch ${ARCH}"
export CFLAGS="-O3 ${IOS_CFLAGS} -isysroot ${SDKROOT}"
export LDFLAGS="${IOS_CFLAGS} -isysroot ${SDKROOT}"
export CPPFLAGS="${CFLAGS}"
export CFLAGS="${CFLAGS} -miphoneos-version-min=${IPHONE_MIN_VERSION}"
export LDFLAGS="${LDFLAGS} -miphoneos-version-min=${IPHONE_MIN_VERSION}"
./configure --with-jpeg8 --host arm-apple-darwin --enable-static --disable-shared
make -j4
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment