* lra-constraints.c (process_address_1): Swap base_term and index_term
[official-gcc.git] / libffi / build-ios.sh
blob3dea242255ee90d0fafbdf200977457755b0c56e
1 #!/bin/sh
3 PLATFORM_IOS=/Developer/Platforms/iPhoneOS.platform/
4 PLATFORM_IOS_SIM=/Developer/Platforms/iPhoneSimulator.platform/
5 SDK_IOS_VERSION="4.2"
6 MIN_IOS_VERSION="3.0"
7 OUTPUT_DIR="universal-ios"
9 build_target () {
10 local platform=$1
11 local sdk=$2
12 local arch=$3
13 local triple=$4
14 local builddir=$5
16 mkdir -p "${builddir}"
17 pushd "${builddir}"
18 export CC="${platform}"/Developer/usr/bin/gcc-4.2
19 export CFLAGS="-arch ${arch} -isysroot ${sdk} -miphoneos-version-min=${MIN_IOS_VERSION}"
20 ../configure --host=${triple} && make
21 popd
24 # Build all targets
25 build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv6 arm-apple-darwin10 armv6-ios
26 build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv7 arm-apple-darwin10 armv7-ios
27 build_target "${PLATFORM_IOS_SIM}" "${PLATFORM_IOS_SIM}/Developer/SDKs/iPhoneSimulator${SDK_IOS_VERSION}.sdk/" i386 i386-apple-darwin10 i386-ios-sim
29 # Create universal output directories
30 mkdir -p "${OUTPUT_DIR}"
31 mkdir -p "${OUTPUT_DIR}/include"
32 mkdir -p "${OUTPUT_DIR}/include/armv6"
33 mkdir -p "${OUTPUT_DIR}/include/armv7"
34 mkdir -p "${OUTPUT_DIR}/include/i386"
36 # Create the universal binary
37 lipo -create armv6-ios/.libs/libffi.a armv7-ios/.libs/libffi.a i386-ios-sim/.libs/libffi.a -output "${OUTPUT_DIR}/libffi.a"
39 # Copy in the headers
40 copy_headers () {
41 local src=$1
42 local dest=$2
44 # Fix non-relative header reference
45 sed 's/<ffitarget.h>/"ffitarget.h"/' < "${src}/include/ffi.h" > "${dest}/ffi.h"
46 cp "${src}/include/ffitarget.h" "${dest}"
49 copy_headers armv6-ios "${OUTPUT_DIR}/include/armv6"
50 copy_headers armv7-ios "${OUTPUT_DIR}/include/armv7"
51 copy_headers i386-ios-sim "${OUTPUT_DIR}/include/i386"
53 # Create top-level header
55 cat << EOF
56 #ifdef __arm__
57 #include <arm/arch.h>
58 #ifdef _ARM_ARCH_6
59 #include "include/armv6/ffi.h"
60 #elif _ARM_ARCH_7
61 #include "include/armv7/ffi.h"
62 #endif
63 #elif defined(__i386__)
64 #include "include/i386/ffi.h"
65 #endif
66 EOF
67 ) > "${OUTPUT_DIR}/ffi.h"