wok-next view js185/stuff/patches/allow-to-build-against-system-libffi.patch @ rev 20762
Add leanify
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Jun 05 17:27:09 2018 +0300 (2018-06-05) |
parents | |
children |
line source
1 From: Mike Hommey <mh@glandium.org>
2 Date: Tue, 9 Mar 2010 09:44:37 +0100
3 Subject: Allow to build against system libffi
5 https://bugzilla.mozilla.org/show_bug.cgi?id=551138
6 ---
7 js/src/Makefile.in | 16 ++++++++++++++--
8 js/src/config/autoconf.mk.in | 4 ++++
9 js/src/configure.in | 14 +++++++++++++-
10 js/src/shell/Makefile.in | 3 +++
11 4 files changed, 34 insertions(+), 3 deletions(-)
13 --- a/js/src/Makefile.in
14 +++ b/js/src/Makefile.in
15 @@ -453,11 +453,20 @@ CPPSRCS += \
16 Library.cpp \
17 $(NULL)
19 -LOCAL_INCLUDES = \
20 - -Ictypes/libffi/include \
21 +ifdef MOZ_NATIVE_FFI
22 +LOCAL_INCLUDES = $(MOZ_FFI_CFLAGS)
23 +else
24 +LOCAL_INCLUDES = -Ictypes/libffi/include
25 +endif
26 +
27 +LOCAL_INCLUDES += \
28 -I. \
29 $(NULL)
31 +
32 +ifdef MOZ_NATIVE_FFI
33 +EXTRA_DSO_LDOPTS += $(MOZ_FFI_LIBS)
34 +else
35 ifeq ($(OS_ARCH),OS2)
36 SHARED_LIBRARY_LIBS += \
37 ctypes/libffi/.libs/ffi.a \
38 @@ -467,6 +476,7 @@ SHARED_LIBRARY_LIBS += \
39 ctypes/libffi/.libs/libffi.$(LIB_SUFFIX) \
40 $(NULL)
41 endif
42 +endif
44 endif # JS_HAS_CTYPES
46 @@ -546,6 +556,7 @@ endif
47 include $(topsrcdir)/config/rules.mk
49 ifdef JS_HAS_CTYPES
50 +ifndef MOZ_NATIVE_FFI
51 # Build libffi proper as part of the 'exports' target, so things get built
52 # in the right order.
53 export::
54 @@ -554,6 +565,7 @@ export::
55 distclean clean::
56 $(call SUBMAKE,$@,ctypes/libffi)
57 endif
58 +endif
60 ifdef MOZ_SYNC_BUILD_FILES
61 # Because the SpiderMonkey can be distributed and built independently
62 --- a/js/src/config/autoconf.mk.in
63 +++ b/js/src/config/autoconf.mk.in
64 @@ -250,6 +250,10 @@ NSPR_CONFIG = @NSPR_CONFIG@
65 NSPR_CFLAGS = @NSPR_CFLAGS@
66 NSPR_LIBS = @NSPR_LIBS@
68 +MOZ_NATIVE_FFI = @MOZ_NATIVE_FFI@
69 +MOZ_FFI_LIBS = @MOZ_FFI_LIBS@
70 +MOZ_FFI_CFLAGS = @MOZ_FFI_CFLAGS@
71 +
72 USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@
74 JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@
75 --- a/js/src/configure.in
76 +++ b/js/src/configure.in
77 @@ -4591,6 +4591,18 @@ if test -n "$MOZ_NATIVE_NSPR"; then
78 CFLAGS=$_SAVE_CFLAGS
79 fi
81 +dnl system libffi Support
82 +dnl ========================================================
83 +MOZ_ARG_ENABLE_BOOL(system-ffi,
84 +[ --enable-system-ffi Use system libffi (located with pkgconfig)],
85 + MOZ_NATIVE_FFI=1 )
86 +
87 +if test -n "$MOZ_NATIVE_FFI"; then
88 + PKG_CHECK_MODULES(MOZ_FFI, libffi)
89 +fi
90 +
91 +AC_SUBST(MOZ_NATIVE_FFI)
92 +
93 dnl ========================================================
94 dnl =
95 dnl = Application
96 @@ -6074,7 +6086,7 @@ AC_MSG_RESULT(invoking make to create js
97 $GMAKE js-config
99 # Build jsctypes if it's enabled.
100 -if test "$JS_HAS_CTYPES"; then
101 +if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
102 # Run the libffi 'configure' script.
103 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
104 if test "$MOZ_DEBUG"; then
105 --- a/js/src/shell/Makefile.in
106 +++ b/js/src/shell/Makefile.in
107 @@ -53,6 +53,9 @@ CPPSRCS = \
108 DEFINES += -DEXPORT_JS_API
110 LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
111 +ifdef MOZ_NATIVE_FFI
112 +EXTRA_LIBS += $(MOZ_FFI_LIBS)
113 +endif
115 LOCAL_INCLUDES += -I$(topsrcdir) -I..