]> git.saurik.com Git - cycript.git/commitdiff
Wedge way to link against Python 2.7 to configure.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 31 Dec 2015 04:47:24 +0000 (20:47 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 31 Dec 2015 04:47:24 +0000 (20:47 -0800)
Makefile.am
Makefile.in
Python/Execute.cpp [new file with mode: 0644]
apple-configure.sh
configure
configure.ac

index 162175e2a2c595fdd8676b0d8f3d12a2ac33a6db..82536ebb0427fd3af384703ca7ade8e560bd5584 100644 (file)
@@ -105,6 +105,12 @@ libcycript_la_SOURCES += Ruby/Execute.cpp
 libcycript_la_LIBADD += $(LTRUBY)
 endif
 
+if CY_PYTHON
+filters += Python
+libcycript_la_SOURCES += Python/Execute.cpp
+libcycript_la_LIBADD += $(LTPYTHON)
+endif
+
 if CY_OBJECTIVEC
 filters += ObjectiveC
 libcycript_la_SOURCES += ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
index 1d0529a27e8274414a050c3aac963941cc33a3d1..e66ec1dfe91bf441cb34759b9917cbb0bddfd1f7 100644 (file)
@@ -123,9 +123,9 @@ host_triplet = @host@
 @CY_JAVA_TRUE@am__append_10 = Java
 @CY_JAVA_TRUE@am__append_11 = Java/Execute.cpp
 @CY_JAVA_TRUE@am__append_12 = $(LTJAVA)
-@CY_RUBY_TRUE@am__append_13 = Ruby
-@CY_RUBY_TRUE@am__append_14 = Ruby/Execute.cpp
-@CY_RUBY_TRUE@am__append_15 = $(LTRUBY)
+@CY_RUBY_TRUE@am__append_13 = Ruby Python
+@CY_RUBY_TRUE@am__append_14 = Ruby/Execute.cpp Python/Execute.cpp
+@CY_RUBY_TRUE@am__append_15 = $(LTRUBY) $(LTPYTHON)
 @CY_OBJECTIVEC_TRUE@am__append_16 = ObjectiveC
 @CY_OBJECTIVEC_TRUE@am__append_17 = ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm
 @CY_OBJECTIVEC_TRUE@am__append_18 = $(LTOBJECTIVEC)
@@ -183,7 +183,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 @CY_EXECUTE_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
 @CY_JAVA_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
-@CY_RUBY_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1)
+@CY_RUBY_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) \
+@CY_RUBY_TRUE@ $(am__DEPENDENCIES_1)
 @CY_OBJECTIVEC_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1)
 libcycript_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
@@ -195,14 +196,14 @@ am__libcycript_la_SOURCES_DIST = ConvertUTF.c Decode.cpp Driver.cpp \
        Replace.cpp Syntax.cpp Parser.cpp Scanner.cpp Complete.cpp \
        sig/ffi_type.cpp sig/parse.cpp sig/copy.cpp Execute.cpp \
        JavaScriptCore.cpp Java/Execute.cpp Ruby/Execute.cpp \
-       ObjectiveC/Output.cpp ObjectiveC/Replace.cpp \
-       ObjectiveC/Library.mm Handler.cpp
+       Python/Execute.cpp ObjectiveC/Output.cpp \
+       ObjectiveC/Replace.cpp ObjectiveC/Library.mm Handler.cpp
 @CY_CONSOLE_TRUE@am__objects_1 = Complete.lo
 am__dirstamp = $(am__leading_dot)dirstamp
 @CY_EXECUTE_TRUE@am__objects_2 = sig/ffi_type.lo sig/parse.lo \
 @CY_EXECUTE_TRUE@      sig/copy.lo Execute.lo JavaScriptCore.lo
 @CY_JAVA_TRUE@am__objects_3 = Java/Execute.lo
-@CY_RUBY_TRUE@am__objects_4 = Ruby/Execute.lo
+@CY_RUBY_TRUE@am__objects_4 = Ruby/Execute.lo Python/Execute.lo
 @CY_OBJECTIVEC_TRUE@am__objects_5 = ObjectiveC/Output.lo \
 @CY_OBJECTIVEC_TRUE@   ObjectiveC/Replace.lo \
 @CY_OBJECTIVEC_TRUE@   ObjectiveC/Library.lo
@@ -424,6 +425,7 @@ CY_EXECUTE = @CY_EXECUTE@
 CY_JAVA = @CY_JAVA@
 CY_LIBCLANG = @CY_LIBCLANG@
 CY_OBJECTIVEC = @CY_OBJECTIVEC@
+CY_PYTHON = @CY_PYTHON@
 CY_RUBY = @CY_RUBY@
 CY_SYSTEM = @CY_SYSTEM@
 DEFS = @DEFS@
@@ -473,6 +475,7 @@ LTLIBSQLITE3 = @LTLIBSQLITE3@
 LTLIBTERMCAP = @LTLIBTERMCAP@
 LTLIBUV = @LTLIBUV@
 LTOBJECTIVEC = @LTOBJECTIVEC@
+LTPYTHON = @LTPYTHON@
 LTRUBY = @LTRUBY@
 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 MAINT = @MAINT@
@@ -711,6 +714,14 @@ Ruby/$(DEPDIR)/$(am__dirstamp):
        @$(MKDIR_P) Ruby/$(DEPDIR)
        @: > Ruby/$(DEPDIR)/$(am__dirstamp)
 Ruby/Execute.lo: Ruby/$(am__dirstamp) Ruby/$(DEPDIR)/$(am__dirstamp)
+Python/$(am__dirstamp):
+       @$(MKDIR_P) Python
+       @: > Python/$(am__dirstamp)
+Python/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) Python/$(DEPDIR)
+       @: > Python/$(DEPDIR)/$(am__dirstamp)
+Python/Execute.lo: Python/$(am__dirstamp) \
+       Python/$(DEPDIR)/$(am__dirstamp)
 ObjectiveC/$(am__dirstamp):
        @$(MKDIR_P) ObjectiveC
        @: > ObjectiveC/$(am__dirstamp)
@@ -786,6 +797,8 @@ mostlyclean-compile:
        -rm -f Java/*.lo
        -rm -f ObjectiveC/*.$(OBJEXT)
        -rm -f ObjectiveC/*.lo
+       -rm -f Python/*.$(OBJEXT)
+       -rm -f Python/*.lo
        -rm -f Ruby/*.$(OBJEXT)
        -rm -f Ruby/*.lo
        -rm -f sig/*.$(OBJEXT)
@@ -816,6 +829,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Library.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Output.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Replace.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@Python/$(DEPDIR)/Execute.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@Ruby/$(DEPDIR)/Execute.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sig/$(DEPDIR)/copy.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sig/$(DEPDIR)/ffi_type.Plo@am__quote@
@@ -900,6 +914,7 @@ clean-libtool:
        -rm -rf .libs _libs
        -rm -rf Java/.libs Java/_libs
        -rm -rf ObjectiveC/.libs ObjectiveC/_libs
+       -rm -rf Python/.libs Python/_libs
        -rm -rf Ruby/.libs Ruby/_libs
        -rm -rf sig/.libs sig/_libs
 
@@ -1262,6 +1277,8 @@ distclean-generic:
        -rm -f Java/$(am__dirstamp)
        -rm -f ObjectiveC/$(DEPDIR)/$(am__dirstamp)
        -rm -f ObjectiveC/$(am__dirstamp)
+       -rm -f Python/$(DEPDIR)/$(am__dirstamp)
+       -rm -f Python/$(am__dirstamp)
        -rm -f Ruby/$(DEPDIR)/$(am__dirstamp)
        -rm -f Ruby/$(am__dirstamp)
        -rm -f sig/$(DEPDIR)/$(am__dirstamp)
@@ -1277,7 +1294,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
 
 distclean: distclean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-       -rm -rf ./$(DEPDIR) Java/$(DEPDIR) ObjectiveC/$(DEPDIR) Ruby/$(DEPDIR) sig/$(DEPDIR)
+       -rm -rf ./$(DEPDIR) Java/$(DEPDIR) ObjectiveC/$(DEPDIR) Python/$(DEPDIR) Ruby/$(DEPDIR) sig/$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-hdr distclean-libtool distclean-tags
@@ -1325,7 +1342,7 @@ installcheck-am:
 maintainer-clean: maintainer-clean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf $(top_srcdir)/autom4te.cache
-       -rm -rf ./$(DEPDIR) Java/$(DEPDIR) ObjectiveC/$(DEPDIR) Ruby/$(DEPDIR) sig/$(DEPDIR)
+       -rm -rf ./$(DEPDIR) Java/$(DEPDIR) ObjectiveC/$(DEPDIR) Python/$(DEPDIR) Ruby/$(DEPDIR) sig/$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
diff --git a/Python/Execute.cpp b/Python/Execute.cpp
new file mode 100644 (file)
index 0000000..f5ca077
--- /dev/null
@@ -0,0 +1,22 @@
+/* Cycript - Optimizing JavaScript Compiler/Runtime
+ * Copyright (C) 2009-2015  Jay Freeman (saurik)
+*/
+
+/* GNU Affero General Public License, Version 3 {{{ */
+/*
+ * 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.
+
+ * 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 Affero General Public License for more details.
+
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#include <Python.h>
index 50b4461885e0730da9d129f86a5e067853d32128..153dc84a24181b9182b667e6e02db23ef2b515ed 100755 (executable)
@@ -87,7 +87,8 @@ function configure() {
 
 for arch in i386 x86_64; do
     configure "osx-${arch}" "${mac}" "${arch}" "-mmacosx-version-min=10.6" \
-        false "-I../readline.osx" "-L../readline.osx" ""
+        false "-I../readline.osx" "-L../readline.osx" "" \
+        --with-python=/usr/bin/python-config
 done
 
 for arch in i386 x86_64; do
index 4487182295b3d1f5ee770660610267037f4e678c..e7dd8f7e729ca33453806de94d7d0c22d1628a8c 100755 (executable)
--- a/configure
+++ b/configure
@@ -643,11 +643,11 @@ LTFLAGS
 LTLIBGCC
 LTLIBTERMCAP
 LTLIBREADLINE
-CY_PRELINK_FALSE
-CY_PRELINK_TRUE
 CY_LIBCLANG
 CY_OBJECTIVEC_FALSE
 CY_OBJECTIVEC_TRUE
+CY_PYTHON_FALSE
+CY_PYTHON_TRUE
 CY_RUBY_FALSE
 CY_RUBY_TRUE
 CY_JAVA_FALSE
@@ -655,6 +655,10 @@ CY_JAVA_TRUE
 LTOBJECTIVEC
 GNUSTEP_CONFIG
 CY_OBJECTIVEC
+CY_PRELINK_FALSE
+CY_PRELINK_TRUE
+LTPYTHON
+CY_PYTHON
 LTRUBY
 CY_RUBY
 LIBRUBY21_LIBS
@@ -851,6 +855,7 @@ enable_libtool_lock
 enable_javascript
 enable_console
 enable_attach
+with_python
 with_libclang
 '
       ac_precious_vars='build_alias
@@ -1534,6 +1539,7 @@ Optional Packages:
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
                           compiler's sysroot if not specified).
+  --with-python           support python (pass the path to python-config)
   --with-libclang         build bridge definitions using this libclang
 
 Some influential environment variables:
 
 
 
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then :
+  withval=$with_python;
+else
+  with_python=no
+fi
+
+
+    if test "x$with_python" != "xno"; then :
+
+        CY_PYTHON=1
+
+
+    cy_save=$LIBS
+    LIBS=
+
+
+  for element in `$with_python --includes`; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+
+  for element in `$with_python --ldflags`; do
+    haveit=
+    for x in $LIBS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      LIBS="${LIBS}${LIBS:+ }$element"
+    fi
+  done
+
+
+    LTPYTHON=$LIBS
+    LIBS=$cy_save
+
+
+
+else
+
+        CY_PYTHON=0
+
+
+fi
+
+     if test "x$with_python" != "xno"; then
+  CY_PRELINK_TRUE=
+  CY_PRELINK_FALSE='#'
+else
+  CY_PRELINK_TRUE='#'
+  CY_PRELINK_FALSE=
+fi
+
+
     ac_ext=mm
 ac_cpp='$OBJCXXCPP $CPPFLAGS'
 ac_compile='$OBJCXX -c $OBJCXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -23908,6 +23999,14 @@ else
   CY_RUBY_FALSE=
 fi
 
+ if test "x$CY_PYTHON" = x1; then
+  CY_PYTHON_TRUE=
+  CY_PYTHON_FALSE='#'
+else
+  CY_PYTHON_TRUE='#'
+  CY_PYTHON_FALSE=
+fi
+
  if test "x$CY_OBJECTIVEC" = x1; then
   CY_OBJECTIVEC_TRUE=
   CY_OBJECTIVEC_FALSE='#'
@@ -24319,6 +24418,10 @@ if test -z "${CY_EXECUTE_TRUE}" && test -z "${CY_EXECUTE_FALSE}"; then
   as_fn_error $? "conditional \"CY_EXECUTE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${CY_PRELINK_TRUE}" && test -z "${CY_PRELINK_FALSE}"; then
+  as_fn_error $? "conditional \"CY_PRELINK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${CY_JAVA_TRUE}" && test -z "${CY_JAVA_FALSE}"; then
   as_fn_error $? "conditional \"CY_JAVA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -24327,6 +24430,10 @@ if test -z "${CY_RUBY_TRUE}" && test -z "${CY_RUBY_FALSE}"; then
   as_fn_error $? "conditional \"CY_RUBY\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${CY_PYTHON_TRUE}" && test -z "${CY_PYTHON_FALSE}"; then
+  as_fn_error $? "conditional \"CY_PYTHON\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${CY_OBJECTIVEC_TRUE}" && test -z "${CY_OBJECTIVEC_FALSE}"; then
   as_fn_error $? "conditional \"CY_OBJECTIVEC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
index ffc6239238b714f1675c0097125fd70ec0a0feb8..429ac27ca2336b5b09c9c028bb397d5aafd5220b 100644 (file)
@@ -247,6 +247,20 @@ AS_CASE([$CY_EXECUTE], [1], [
         AC_SUBST([CY_RUBY], [0])
     ])])])])
 
+    AC_ARG_WITH([python], AS_HELP_STRING([--with-python], [support python (pass the path to python-config)]), [], [with_python=no])
+
+    AS_IF([test "x$with_python" != "xno"], [
+        AC_SUBST([CY_PYTHON], [1])
+        CY_LT_LIB([LTPYTHON], [
+            AC_LIB_APPENDTOVAR([CPPFLAGS], [`$with_python --includes`])
+            AC_LIB_APPENDTOVAR([LIBS], [`$with_python --ldflags`])
+        ])
+    ], [
+        AC_SUBST([CY_PYTHON], [0])
+    ])
+
+    AM_CONDITIONAL([CY_PRELINK], [test "x$with_python" != "xno"])
+
     AC_LANG_PUSH([Objective C++])
 
     AC_MSG_CHECKING([if we really have Objective C++])
@@ -281,6 +295,7 @@ AS_CASE([$CY_EXECUTE], [1], [
 
 AM_CONDITIONAL([CY_JAVA], [test "x$CY_JAVA" = x1])
 AM_CONDITIONAL([CY_RUBY], [test "x$CY_RUBY" = x1])
+AM_CONDITIONAL([CY_PYTHON], [test "x$CY_PYTHON" = x1])
 AM_CONDITIONAL([CY_OBJECTIVEC], [test "x$CY_OBJECTIVEC" = x1])
 
 AC_ARG_WITH([libclang], AS_HELP_STRING([--with-libclang], [build bridge definitions using this libclang]), [], [with_libclang=no])