]> git.saurik.com Git - cycript.git/blame - apple-lib.sh
MIME type is now required when calling appcast.sh.
[cycript.git] / apple-lib.sh
CommitLineData
ae1b611e
JF
1#!/usr/bin/env bash
2
7341eedb
JF
3# Cycript - The Truly Universal Scripting Language
4# Copyright (C) 2009-2016 Jay Freeman (saurik)
ae1b611e
JF
5
6# GNU Affero General Public License, Version 3 {{{
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20# }}}
21
22set -e
23
ae1b611e
JF
24extra=("$@")
25
26archs=()
27function arch() {
3e50deaf
JF
28 local lib=$1
29 shift
30
ae1b611e
JF
31 local arch=$1
32 local host=$2
33 local sdk=$3
34 local os=$4
35 local min=$5
36 shift 5
37
3e50deaf 38 rm -rvf "${lib}.${arch}"
ae1b611e
JF
39 if ! isysroot=$(xcodebuild -sdk "${sdk}" -version Path); then
40 return
41 fi
42
43 archs+=("${arch}")
3e50deaf 44 mkdir "${lib}.${arch}"
ae1b611e 45
3e50deaf 46 flags=()
ae1b611e
JF
47 flags+=(-isysroot "${isysroot}")
48 flags+=(-m${os}-version-min="${min}")
49 flags+=(-O3 -g3)
50
51 if [[ ${arch} == armv* && ${arch} != armv6 ]]; then
52 flags+=(-mthumb)
53 fi
54
3e50deaf
JF
55 cd "${lib}.${arch}"
56 CC="clang -arch ${arch}" CXX="clang++ -arch ${arch}" LDFLAGS="${flags[*]}" CPPFLAGS="${flags[*]} $*" ../"${lib}"/configure --host="${host}" --enable-static --disable-shared \
57 ac_cv_func_strcoll_works=yes bash_cv_func_sigsetjmp=present bash_cv_func_ctype_nonascii=no bash_cv_must_reinstall_sighandlers=no bash_cv_func_strcoll_broken=yes bash_cv_wcwidth_broken=no
ae1b611e
JF
58 make -j5
59 cd ..
60}
61
3e50deaf
JF
62function arch64() {
63 local lib=$1
64 shift
65
66 arch "${lib}" arm64 aarch64-apple-darwin11 iphoneos iphoneos 2.0 "$@"
67}
68
69function archs() {
70 local lib=$1
71 shift
72
73 arch "${lib}" armv6 arm-apple-darwin10 iphoneos iphoneos 2.0 "$@" -mllvm -arm-reserve-r9
74 arch "${lib}" armv7 arm-apple-darwin10 iphoneos iphoneos 2.0 "$@"
75 arch "${lib}" armv7s arm-apple-darwin10 iphoneos iphoneos 2.0 "$@"
76
77 arch64 "${lib}" "$@"
78
79 arch "${lib}" i386 i386-apple-darwin10 iphonesimulator ios-simulator 4.0 "$@"
80 arch "${lib}" x86_64 x86_64-apple-darwin11 iphonesimulator ios-simulator 4.0 "$@"
81}
82
83archs libffi -DPAGE_MAX_SIZE=16384 -DPAGE_MAX_SHIFT=14 -fno-stack-protector
84archs libuv
85arch64 readline -include sys/ioctl.h
ae1b611e 86
3e50deaf
JF
87for arch in arm64; do
88 ln -sf . "readline.${arch}/readline"
89done