Sophie

Sophie

distrib > Mageia > 3 > x86_64 > by-pkgid > 2ce200b63af73372461a2a8eafb26128 > files > 2

js-1.85-5.mga3.src.rpm

From: Mike Hommey <mh@glandium.org>
Date: Tue, 9 Mar 2010 09:44:37 +0100
Subject: Allow to build against system libffi

https://bugzilla.mozilla.org/show_bug.cgi?id=551138
---
 js/src/Makefile.in           |   16 ++++++++++++++--
 js/src/config/autoconf.mk.in |    4 ++++
 js/src/configure.in          |   14 +++++++++++++-
 js/src/shell/Makefile.in     |    3 +++
 4 files changed, 34 insertions(+), 3 deletions(-)

Index: mozjs-1.8.5-1.0.0+dfsg/js/src/Makefile.in
===================================================================
--- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/Makefile.in	2011-03-31 21:08:36.000000000 +0200
+++ mozjs-1.8.5-1.0.0+dfsg/js/src/Makefile.in	2012-01-21 15:56:31.355703020 +0100
@@ -453,11 +453,20 @@
     Library.cpp \
     $(NULL)
 
-LOCAL_INCLUDES = \
-    -Ictypes/libffi/include \
+ifdef MOZ_NATIVE_FFI
+LOCAL_INCLUDES = $(MOZ_FFI_CFLAGS)
+else
+LOCAL_INCLUDES = -Ictypes/libffi/include
+endif
+
+LOCAL_INCLUDES += \
     -I. \
     $(NULL)
 
+
+ifdef MOZ_NATIVE_FFI
+EXTRA_DSO_LDOPTS += $(MOZ_FFI_LIBS)
+else
 ifeq ($(OS_ARCH),OS2)
 SHARED_LIBRARY_LIBS += \
     ctypes/libffi/.libs/ffi.a \
@@ -467,6 +476,7 @@
     ctypes/libffi/.libs/libffi.$(LIB_SUFFIX) \
     $(NULL)
 endif
+endif
 
 endif # JS_HAS_CTYPES
 
@@ -546,6 +556,7 @@
 include $(topsrcdir)/config/rules.mk
 
 ifdef JS_HAS_CTYPES
+ifndef MOZ_NATIVE_FFI
 # Build libffi proper as part of the 'exports' target, so things get built
 # in the right order.
 export::
@@ -554,6 +565,7 @@
 distclean clean::
 		$(call SUBMAKE,$@,ctypes/libffi)
 endif
+endif
 
 ifdef MOZ_SYNC_BUILD_FILES
 # Because the SpiderMonkey can be distributed and built independently
Index: mozjs-1.8.5-1.0.0+dfsg/js/src/config/autoconf.mk.in
===================================================================
--- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/config/autoconf.mk.in	2011-03-31 21:08:36.000000000 +0200
+++ mozjs-1.8.5-1.0.0+dfsg/js/src/config/autoconf.mk.in	2012-01-21 15:56:31.355703020 +0100
@@ -250,6 +250,10 @@
 NSPR_CFLAGS	= @NSPR_CFLAGS@
 NSPR_LIBS	= @NSPR_LIBS@
 
+MOZ_NATIVE_FFI	= @MOZ_NATIVE_FFI@
+MOZ_FFI_LIBS	= @MOZ_FFI_LIBS@
+MOZ_FFI_CFLAGS	= @MOZ_FFI_CFLAGS@
+
 USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
 
 JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@
Index: mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in
===================================================================
--- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/configure.in	2012-01-21 15:56:14.591702970 +0100
+++ mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in	2012-01-21 15:56:31.359703020 +0100
@@ -4591,6 +4591,18 @@
     CFLAGS=$_SAVE_CFLAGS
 fi
 
+dnl system libffi Support
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(system-ffi,
+[  --enable-system-ffi       Use system libffi (located with pkgconfig)],
+    MOZ_NATIVE_FFI=1 )
+
+if test -n "$MOZ_NATIVE_FFI"; then
+    PKG_CHECK_MODULES(MOZ_FFI, libffi)
+fi
+
+AC_SUBST(MOZ_NATIVE_FFI)
+
 dnl ========================================================
 dnl =
 dnl = Application
@@ -6074,7 +6086,7 @@
 $GMAKE js-config
 
 # Build jsctypes if it's enabled.
-if test "$JS_HAS_CTYPES"; then
+if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
   # Run the libffi 'configure' script.
   ac_configure_args="--disable-shared --enable-static --disable-raw-api"
   if test "$MOZ_DEBUG"; then
Index: mozjs-1.8.5-1.0.0+dfsg/js/src/shell/Makefile.in
===================================================================
--- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/shell/Makefile.in	2011-03-31 21:08:36.000000000 +0200
+++ mozjs-1.8.5-1.0.0+dfsg/js/src/shell/Makefile.in	2012-01-21 15:56:31.359703020 +0100
@@ -53,6 +53,9 @@
 DEFINES         += -DEXPORT_JS_API
 
 LIBS      = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
+ifdef MOZ_NATIVE_FFI
+EXTRA_LIBS += $(MOZ_FFI_LIBS)
+endif
 
 LOCAL_INCLUDES += -I$(topsrcdir) -I..