Created
January 17, 2014 13:08
-
-
Save yageek/8473072 to your computer and use it in GitHub Desktop.
GMP 5.1.3 build for armv7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Yay shell scripting! This script builds a static version of | |
# GMP ${GMP_VERSION} for iOS 7.0 that contains code for | |
# armv6, armv7, arm7vs, arm64. | |
set -x | |
# Setup paths to stuff we need | |
GMP_VERSION="5.1.3" | |
DEVELOPER="/Applications/Xcode.app/Contents/Developer" | |
SDK_VERSION="7.0" | |
MIN_VERSION="4.3" | |
IPHONEOS_PLATFORM="${DEVELOPER}/Platforms/iPhoneOS.platform" | |
IPHONEOS_SDK="${IPHONEOS_PLATFORM}/Developer/SDKs/iPhoneOS${SDK_VERSION}.sdk" | |
IPHONEOS_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" | |
IPHONESIMULATOR_PLATFORM="${DEVELOPER}/Platforms/iPhoneSimulator.platform" | |
IPHONESIMULATOR_SDK="${IPHONESIMULATOR_PLATFORM}/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk" | |
IPHONESIMULATOR_GCC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" | |
# Make sure things actually exist | |
if [ ! -d "$IPHONEOS_PLATFORM" ]; then | |
echo "Cannot find $IPHONEOS_PLATFORM" | |
exit 1 | |
fi | |
if [ ! -d "$IPHONEOS_SDK" ]; then | |
echo "Cannot find $IPHONEOS_SDK" | |
exit 1 | |
fi | |
if [ ! -x "$IPHONEOS_GCC" ]; then | |
echo "Cannot find $IPHONEOS_GCC" | |
exit 1 | |
fi | |
if [ ! -d "$IPHONESIMULATOR_PLATFORM" ]; then | |
echo "Cannot find $IPHONESIMULATOR_PLATFORM" | |
exit 1 | |
fi | |
if [ ! -d "$IPHONESIMULATOR_SDK" ]; then | |
echo "Cannot find $IPHONESIMULATOR_SDK" | |
exit 1 | |
fi | |
if [ ! -x "$IPHONESIMULATOR_GCC" ]; then | |
echo "Cannot find $IPHONESIMULATOR_GCC" | |
exit 1 | |
fi | |
# Clean up whatever was left from our previous build | |
rm -rf include lib | |
rm -rf /tmp/gmp-${GMP_VERSION}-* | |
rm -rf /tmp/gmp-${GMP_VERSION}-*.*-log | |
build() | |
{ | |
ARCH=$1 | |
GCC=$2 | |
SDK=$3 | |
rm -rf "gmp-${GMP_VERSION}" | |
tar xjf "gmp-${GMP_VERSION}.tar.bz2" | |
# pushd . | |
cd "gmp-${GMP_VERSION}" | |
#export IPHONEOS_DEPLOYMENT_TARGET="4.3" | |
export CC="${GCC}" | |
export CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SDK}" | |
export LDFLAGS="-arch ${ARCH} -isysroot ${SDK}" | |
./configure --prefix="/tmp/gmp-${GMP_VERSION}-${ARCH}" --disable-shared --enable-static --host="${ARCH}-apple-darwin" --disable-assembly &> "/tmp/gmp-${GMP_VERSION}-${ARCH}.log" | |
make -j `sysctl -n hw.logicalcpu_max` &> "/tmp/gmp-${GMP_VERSION}-${ARCH}.build-log" | |
make install &> "/tmp/gmp-${GMP_VERSION}-${ARCH}.install-log" | |
# popd | |
rm -rf "gmp-${GMP_VERSION}" | |
} | |
build "armv7" "${IPHONEOS_GCC}" "${IPHONEOS_SDK}" | |
mkdir include | |
cp -r /tmp/gmp-${GMP_VERSION}-armv7/include include/ | |
mkdir lib | |
lipo \ | |
"/tmp/gmp-${GMP_VERSION}-armv7/lib/libgmp.a" \ | |
"/tmp/gmp-${GMP_VERSION}-armv7s/lib/libgmp.a" \ | |
-create -output lib/libgmp.a | |
rm -rf "/tmp/gmp-${GMP_VERSION}-*" | |
rm -rf "/tmp/gmp-${GMP_VERSION}-*.*-log" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, i tried that script. and it seems to be working until i get this (in line 86):
cp: /tmp/gmp-5.1.3-armv7/include: No such file or directory
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /tmp/gmp-5.1.3-armv7/lib/libgmp.a (No such file or directory)
it seems like make did not create that directory. but for what reason? any ideas? :)