X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/42311506d531ad98d674cbaa4768453cf8950451..f472e52e4b5ee9147023ba4f22da8c18bed9a00a:/apple-configure.sh
diff --git a/apple-configure.sh b/apple-configure.sh
index c4bfd02..da3efc1 100755
--- a/apple-configure.sh
+++ b/apple-configure.sh
@@ -1,33 +1,28 @@
#!/usr/bin/env bash
-# Cycript - Optimizing JavaScript Compiler/Runtime
-# Copyright (C) 2009-2013 Jay Freeman (saurik)
+# Cycript - The Truly Universal Scripting Language
+# Copyright (C) 2009-2016 Jay Freeman (saurik)
-# GNU General Public License, Version 3 {{{
+# GNU Affero General Public License, Version 3 {{{
#
-# Cycript is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation, either version 3 of the License,
-# or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
#
-# Cycript is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# GNU Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with Cycript. If not, see .
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
# }}}
set -e
cd "${0%%/*}"
-if [[ ! -e readline.osx/libreadline.a ]]; then
- ./apple-readline.sh; fi
-if [[ ! -e libffi.a ]]; then
- ./libffi.sh; fi
-
if ! which aclocal; then
touch aclocal.m4; fi
if ! which autoconf; then
@@ -38,6 +33,7 @@ if ! which autoheader; then
touch config.h.in; fi
flags=("$@")
+ccf=(-g0 -O3)
function path() {
xcodebuild -sdk "$1" -version Path
@@ -45,52 +41,65 @@ function path() {
xcs=$(xcode-select --print-path)
mac=$(path macosx)
+xct="${xcs}/Toolchains/XcodeDefault.xctoolchain/usr/lib"
+
+system=0
function configure() {
local dir=$1
local sdk=$2
- local flg=$3
- shift 3
+ local arc=$3
+ local min=$4
+ local ffi=$5
+ local cpf=$6
+ local ldf=$7
+ local obc=$8
+ shift 8
+
+ set -- "$@" --enable-static --with-pic
cc=$(xcrun --sdk "${sdk}" -f clang)
cxx=$(xcrun --sdk "${sdk}" -f clang++)
+
+ flg="-arch ${arc} ${min}"
flg+=" -isysroot $(path "${sdk}")"
rm -rf build."${dir}"
mkdir build."${dir}"
cd build."${dir}"
- CC="${cc} ${flg}" CXX="${cxx} ${flg}" OBJCXX="${cxx} ${flg}" \
- ../configure --enable-maintainer-mode "${flags[@]}" --prefix="/usr" "$@"
+ if "${ffi}"; then
+ cpf+=" -I../libffi.${arch}/include"
+ ldf+=" -L../libffi.${arch}/.libs"
+ fi
- cd ..
-}
+ cpf+=" -I../libuv/include"
+ ldf+=" -L../libuv.${arch}/.libs"
-function build() {
- local dir=$1
- local sdk=$2
- local flg=$3
- shift 3
+ ../configure --enable-maintainer-mode "${flags[@]}" --prefix="/usr" "$@" \
+ --with-libclang="-rpath ${xct} ${xct}/libclang.dylib" \
+ CC="${cc} ${flg}" CXX="${cxx} ${flg}" OBJCXX="${cxx} ${flg}" \
+ CFLAGS="${ccf[*]}" CXXFLAGS="${ccf[*]}" OBJCXXFLAGS="${ccf[*]} ${obc}" \
+ CPPFLAGS="${cpf}" LDFLAGS="${ldf}" CY_SYSTEM="$((1<