From 9918a0fa2cc10734d8a0a6f49748f5d511823034 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 11 Oct 2014 04:07:08 -0700 Subject: [PATCH] Build and configure required libraries on Android. --- .gitignore | 3 + android-configure.sh | 7 ++ android-libffi.sh | 9 +++ android-make.sh | 4 + android-ncurses.sh | 8 ++ android-readline.sh | 10 +++ android.sh | 21 +++++ configure | 180 +++++++++++++++++++++++++++++++++++++++++++ configure.ac | 6 +- libffi | 2 +- readline | 2 +- 11 files changed, 248 insertions(+), 4 deletions(-) create mode 100755 android-configure.sh create mode 100755 android-libffi.sh create mode 100755 android-make.sh create mode 100755 android-ncurses.sh create mode 100755 android-readline.sh create mode 100755 android.sh diff --git a/.gitignore b/.gitignore index bb5c540..c5806c1 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,9 @@ Bridge.hpp package aclocal.m4 stamp-h1 +ncurses-5.9 +ncurses-5.9.tar.gz +ncurses.* readline-6.2 readline-6.2.tar.gz readline.* diff --git a/android-configure.sh b/android-configure.sh new file mode 100755 index 0000000..c91f69b --- /dev/null +++ b/android-configure.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +source ./android.sh +rm -rf build.and-armeabi +mkdir -p build.and-armeabi +cd build.and-armeabi +cfg ../configure CPPFLAGS="-I../ncurses.and/include -I../readline.and -I../android -I../libffi.and/include" LDFLAGS="-L../ncurses.and/lib -L../readline.and -L../android/armeabi -L../libffi.and ${ldf[*]}" diff --git a/android-libffi.sh b/android-libffi.sh new file mode 100755 index 0000000..ba08763 --- /dev/null +++ b/android-libffi.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +. ./android.sh +arch=armeabi +rm -rf libffi.and +mkdir -p libffi.and +cd libffi.and +cfg ../libffi/configure --enable-static --disable-shared +make diff --git a/android-make.sh b/android-make.sh new file mode 100755 index 0000000..176b47c --- /dev/null +++ b/android-make.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +cd build.and-armeabi +make "$@" diff --git a/android-ncurses.sh b/android-ncurses.sh new file mode 100755 index 0000000..a10aef7 --- /dev/null +++ b/android-ncurses.sh @@ -0,0 +1,8 @@ +#!/bin/bash +. ./android.sh +rm -rf ncurses.and +mkdir ncurses.and +cd ncurses.and +cfg ../ncurses-5.9/configure --enable-static --disable-shared +sed -i -e '/^#define HAVE_LOCALE_H 1$/ d;' include/ncurses_cfg.h +make -j4 diff --git a/android-readline.sh b/android-readline.sh new file mode 100755 index 0000000..04e6168 --- /dev/null +++ b/android-readline.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +. ./android.sh +arch=armeabi +rm -rf readline.and +mkdir -p readline.and +cd readline.and +cfg ../readline/configure bash_cv_wcwidth_broken=no +make +ln -sf . readline diff --git a/android.sh b/android.sh new file mode 100755 index 0000000..8cac853 --- /dev/null +++ b/android.sh @@ -0,0 +1,21 @@ +#!/bin/bash +ndk=~/bin/android-ndk +abi=armeabi +ver=4.9 +bin=${ndk}/toolchains/arm-linux-androideabi-${ver}/prebuilt/darwin-x86_64/bin +#export PATH=${bin}:$PATH +flg=() +flg+=(--sysroot=${ndk}/platforms/android-9/arch-arm) +flg+=(-I${ndk}/sources/cxx-stl/gnu-libstdc++/${ver}/include) +flg+=(-I${ndk}/sources/cxx-stl/gnu-libstdc++/${ver}/libs/${abi}/include) +ldf=() +ldf+=(-L${ndk}/sources/cxx-stl/gnu-libstdc++/${ver}/libs/${abi}) +ldf+=(-lgnustl_static) +tgt=arm-linux-androideabi +cc=${bin}/${tgt}-gcc +cxx=${bin}/${tgt}-g++ +function cfg() { + cfg=$1 + shift + CC="${cc} ${flg[*]}" CXX="${cxx} ${flg[*]}" OBJCXX="${cxx} ${flg[*]}" "${cfg}" --host="${tgt}" LDFLAGS="${ldf[*]}" "$@" +} diff --git a/configure b/configure index d18c187..b0f2ec2 100755 --- a/configure +++ b/configure @@ -18426,6 +18426,64 @@ if test "${enable_javascript+set}" = set; then : cy_save=$LIBS LIBS= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing JSEvaluateScript" >&5 +$as_echo_n "checking for library containing JSEvaluateScript... " >&6; } +if ${ac_cv_search_JSEvaluateScript+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char JSEvaluateScript (); +int +main () +{ +return JSEvaluateScript (); + ; + return 0; +} +_ACEOF +for ac_lib in '' JavaScriptCore; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_JSEvaluateScript=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_JSEvaluateScript+:} false; then : + break +fi +done +if ${ac_cv_search_JSEvaluateScript+:} false; then : + +else + ac_cv_search_JSEvaluateScript=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_JSEvaluateScript" >&5 +$as_echo "$ac_cv_search_JSEvaluateScript" >&6; } +ac_res=$ac_cv_search_JSEvaluateScript +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + CY_EXECUTE=1 + + +else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for framework JavaScriptCore" >&5 $as_echo_n "checking for framework JavaScriptCore... " >&6; } @@ -18618,6 +18676,8 @@ fi; if test "x$CY_EXECUTE" = x1; then break; fi done fi +fi + LTJAVASCRIPTCORE=$LIBS LIBS=$cy_save @@ -18633,6 +18693,64 @@ fi cy_save=$LIBS LIBS= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing JSEvaluateScript" >&5 +$as_echo_n "checking for library containing JSEvaluateScript... " >&6; } +if ${ac_cv_search_JSEvaluateScript+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char JSEvaluateScript (); +int +main () +{ +return JSEvaluateScript (); + ; + return 0; +} +_ACEOF +for ac_lib in '' JavaScriptCore; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_JSEvaluateScript=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_JSEvaluateScript+:} false; then : + break +fi +done +if ${ac_cv_search_JSEvaluateScript+:} false; then : + +else + ac_cv_search_JSEvaluateScript=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_JSEvaluateScript" >&5 +$as_echo "$ac_cv_search_JSEvaluateScript" >&6; } +ac_res=$ac_cv_search_JSEvaluateScript +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + CY_EXECUTE=1 + + +else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for framework JavaScriptCore" >&5 $as_echo_n "checking for framework JavaScriptCore... " >&6; } @@ -18825,6 +18943,8 @@ fi; if test "x$CY_EXECUTE" = x1; then break; fi done fi +fi + LTJAVASCRIPTCORE=$LIBS LIBS=$cy_save @@ -18840,6 +18960,64 @@ else cy_save=$LIBS LIBS= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing JSEvaluateScript" >&5 +$as_echo_n "checking for library containing JSEvaluateScript... " >&6; } +if ${ac_cv_search_JSEvaluateScript+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char JSEvaluateScript (); +int +main () +{ +return JSEvaluateScript (); + ; + return 0; +} +_ACEOF +for ac_lib in '' JavaScriptCore; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_search_JSEvaluateScript=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_JSEvaluateScript+:} false; then : + break +fi +done +if ${ac_cv_search_JSEvaluateScript+:} false; then : + +else + ac_cv_search_JSEvaluateScript=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_JSEvaluateScript" >&5 +$as_echo "$ac_cv_search_JSEvaluateScript" >&6; } +ac_res=$ac_cv_search_JSEvaluateScript +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + CY_EXECUTE=1 + + +else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for framework JavaScriptCore" >&5 $as_echo_n "checking for framework JavaScriptCore... " >&6; } @@ -19032,6 +19210,8 @@ fi; if test "x$CY_EXECUTE" = x1; then break; fi done fi +fi + LTJAVASCRIPTCORE=$LIBS LIBS=$cy_save diff --git a/configure.ac b/configure.ac index 4081901..382ddf0 100644 --- a/configure.ac +++ b/configure.ac @@ -160,7 +160,9 @@ dnl }}} dnl --enable-javascript {{{ AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [ - CY_LT_LIB([LTJAVASCRIPTCORE], [AC_CHECK_FRAMEWORK([JavaScriptCore], [ + CY_LT_LIB([LTJAVASCRIPTCORE], [AC_SEARCH_LIBS([JSEvaluateScript], [JavaScriptCore], [ + AC_SUBST([CY_EXECUTE], [1]) + ], [AC_CHECK_FRAMEWORK([JavaScriptCore], [ #include ], [ JSEvaluateScript(0, 0, 0, 0, 0, 0); @@ -174,7 +176,7 @@ AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [ AC_LIB_APPENDTOVAR([LIBS], [`$PKG_CONFIG --libs $cy_webkit_pkg`]) ], [:]); if test "x$CY_EXECUTE" = x1; then break; fi done - ])]) + ])])]) ]) AC_DEFUN([CY_CHECK_JAVASCRIPT], [ diff --git a/libffi b/libffi index 6024223..91ad74f 160000 --- a/libffi +++ b/libffi @@ -1 +1 @@ -Subproject commit 602422310a33b7769731b3517a8d8484a71dfef2 +Subproject commit 91ad74f13b186aa23c00d5fea7658e9abb243543 diff --git a/readline b/readline index 9922d2d..a73b98f 160000 --- a/readline +++ b/readline @@ -1 +1 @@ -Subproject commit 9922d2d7608ea86ff9e42aca0d3342a92748873f +Subproject commit a73b98f779b388a5d0624e02e8bb187246e3e396 -- 2.45.2