diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 0444e40fbf9e..80339f290377 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -132,6 +132,7 @@ MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@ MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@ XPCOM_USE_LEA = @XPCOM_USE_LEA@ JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@ +JS_STATIC_BUILD = @JS_STATIC_BUILD@ MOZ_ENABLE_POSTSCRIPT = @MOZ_ENABLE_POSTSCRIPT@ MOZ_INSTALLER = @MOZ_INSTALLER@ MOZ_UPDATER = @MOZ_UPDATER@ diff --git a/configure.in b/configure.in index f5a77b3c8a12..ac6f2fc40210 100644 --- a/configure.in +++ b/configure.in @@ -4379,6 +4379,7 @@ NECKO_COOKIES=1 NECKO_DISK_CACHE=1 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource" NECKO_SMALL_BUFFERS= +JS_STATIC_BUILD= XPC_IDISPATCH_SUPPORT= @@ -4471,6 +4472,7 @@ basic) NECKO_SMALL_BUFFERS=1 NS_DISABLE_LOGGING=1 NS_PRINTING= + JS_STATIC_BUILD=1 ;; minimal) @@ -4518,6 +4520,7 @@ minimal) NECKO_SMALL_BUFFERS=1 NS_DISABLE_LOGGING=1 NS_PRINTING= + JS_STATIC_BUILD=1 ;; *) @@ -7184,6 +7187,25 @@ else XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS" fi +dnl ======================================================== +dnl = Force JS to be a static lib +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(js-static-build, +[ --enable-js-static-build Force js to be a static lib], + JS_STATIC_BUILD=1, + JS_STATIC_BUILD= ) + +AC_SUBST(JS_STATIC_BUILD) + +if test -n "$JS_STATIC_BUILD"; then + AC_DEFINE(EXPORT_JS_API) + +if test -z "$BUILD_STATIC_LIBS"; then + AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static]) +fi + +fi + dnl ======================================================== dnl = dnl = Standalone module options diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 99f6492e129f..ce3bc1e03e00 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -52,18 +52,15 @@ ifndef JS_MOZ_INSTALL NSDISTMODE = copy endif -ifdef JS_NATIVE_EDITLINE -DIRS += editline -endif - -# editline needs to get built before the shell -DIRS += shell - -MODULE = js -LIBRARY_NAME = mozjs -STATIC_LIBRARY_NAME = js_static -GRE_MODULE = 1 +MODULE = js +LIBRARY_NAME = mozjs +GRE_MODULE = 1 +PROGRAM = js$(BIN_SUFFIX) +# The shell uses some 'HIDDEN' symbols to produce statistics, so we +# link directly against the .o files, not against the JS shared +# library. +PROGOBJS = js.$(OBJ_SUFFIX) $(OBJS) LIBS = $(NSPR_LIBS) ifdef GNU_CXX @@ -103,12 +100,10 @@ endif # other modules which are always built shared. Failure to do so results in # the js code getting copied into xpinstall and jsd as well as mozilla-bin, # and then the static data cells used for locking no longer work. -# -# In fact, we now build both a static and a shared library, as the -# JS shell would like to link to the static library. +ifndef JS_STATIC_BUILD FORCE_SHARED_LIB = 1 -FORCE_STATIC_LIB = 1 +endif ifeq (86,$(findstring 86,$(OS_TEST))) ifeq (64,$(findstring 64,$(OS_TEST))) @@ -620,22 +615,20 @@ install:: $(INSTALLED_HEADERS) install:: $(SCRIPTS) $(PROGRAM) $(INSTALL) $(IFLAGS2) $^ $(bindir) -install:: $(LIBRARY) -ifneq (,$(LIBRARY)) - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir) -endif -ifneq (,$(IMPORT_LIBRARY)) - $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir) -endif - # The Mozilla top-level makefiles use install-runtime-libs directly to # place an additional copy of the libraries in the 'dist/bin' # directory. install:: install-runtime-libs install-runtime-libs:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) +ifneq (,$(LIBRARY)) + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir) +endif ifneq (,$(SHARED_LIBRARY)) $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(libdir) endif +ifneq (,$(IMPORT_LIBRARY)) + $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir) +endif # Extra dependancies and rules for auto-generated headers host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index 606393e4da9b..43a6c700d2f2 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -106,6 +106,7 @@ MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@ BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@ ENABLE_TESTS = @ENABLE_TESTS@ JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@ +JS_STATIC_BUILD = @JS_STATIC_BUILD@ TAR=@TAR@ @@ -268,9 +269,6 @@ NSPR_LIBS = @NSPR_LIBS@ USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@ -JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@ -EDITLINE_LIBS = @EDITLINE_LIBS@ - # MKSHLIB_FORCE_ALL is used to force the linker to include all object # files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker # to normal behavior. Makefile's that create shared libraries out of diff --git a/js/src/configure.in b/js/src/configure.in index 6eb44d4a1c4c..1ad90e8a3dcf 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -3808,6 +3808,7 @@ MOZ_ARG_HEADER(Application) BUILD_STATIC_LIBS= ENABLE_TESTS=1 MOZ_DBGRINFO_MODULES= +JS_STATIC_BUILD= dnl ======================================================== dnl = @@ -4745,33 +4746,23 @@ MOZ_ARG_ENABLE_BOOL(static, BUILD_STATIC_LIBS=) dnl ======================================================== -dnl = Link js shell to system readline +dnl = Force JS to be a static lib dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(readline, -[ --enable-readline Link js shell to system readline library], - JS_WANT_READLINE=1, - JS_WANT_READLINE= ) +MOZ_ARG_ENABLE_BOOL(js-static-build, +[ --enable-js-static-build Force js to be a static lib], + JS_STATIC_BUILD=1, + JS_STATIC_BUILD= ) -JS_NATIVE_EDITLINE= -EDITLINE_LIBS= +AC_SUBST(JS_STATIC_BUILD) + +if test -n "$JS_STATIC_BUILD"; then + AC_DEFINE(EXPORT_JS_API) + +if test -z "$BUILD_STATIC_LIBS"; then + AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static]) +fi -dnl Conveniently, Win32 sets SKIP_LIBRARY_CHECKS... -if test -z "$SKIP_LIBRARY_CHECKS"; then - if test -n "$JS_WANT_READLINE"; then - AC_CHECK_LIB(readline, readline, - EDITLINE_LIBS="-lreadline", - AC_MSG_ERROR([No system readline library found.])) - else - dnl By default, we use editline - JS_NATIVE_EDITLINE=1 - EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)' - fi - - dnl Either way, we want to build with line editing support. - AC_DEFINE(EDITLINE) fi -AC_SUBST(JS_NATIVE_EDITLINE) -AC_SUBST(EDITLINE_LIBS) dnl ======================================================== dnl = @@ -5156,18 +5147,11 @@ mv confdefs.h.save confdefs.h MAKEFILES=" Makefile - shell/Makefile config/Makefile config/autoconf.mk config/mkdepend/Makefile " -if test -n "$JS_NATIVE_EDITLINE"; then - MAKEFILES="$MAKEFILES -editline/Makefile -" -fi - dnl dnl Run a perl script to quickly create the makefiles. dnl If it succeeds, it outputs a shell command to set CONFIG_FILES diff --git a/js/src/editline/Makefile.in b/js/src/editline/Makefile.in deleted file mode 100644 index acf5a6ddb839..000000000000 --- a/js/src/editline/Makefile.in +++ /dev/null @@ -1,55 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Spidermonkey build system. -# -# The Initial Developer of the Original Code is -# The Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2008 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Ted Mielczarek -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = .. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -LIBRARY_NAME = editline -FORCE_STATIC_LIB = 1 - -CSRCS = editline.c sysunix.c - -DEFINES += -DANSI_ARROWS -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT -DSYS_UNIX \ - -DHAVE_STDLIB -DUNIQUE_HISTORY - -include $(topsrcdir)/config/rules.mk diff --git a/js/src/shell/js.cpp b/js/src/js.cpp similarity index 100% rename from js/src/shell/js.cpp rename to js/src/js.cpp diff --git a/js/src/shell/Makefile.in b/js/src/shell/Makefile.in deleted file mode 100644 index bf59bb69b64c..000000000000 --- a/js/src/shell/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -*- Mode: makefile -*- -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Spidermonkey build system. -# -# The Initial Developer of the Original Code is -# The Mozilla Foundation. -# Portions created by the Initial Developer are Copyright (C) 2008 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Ted Mielczarek -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = .. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -PROGRAM = js$(BIN_SUFFIX) -CPPSRCS = js.cpp - -DEFINES += -DEXPORT_JS_API - -LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) - -LOCAL_INCLUDES += -I$(topsrcdir) -I.. - -include $(topsrcdir)/config/rules.mk - -# People expect the js shell to wind up in the top-level JS dir. -libs:: - $(INSTALL) $(IFLAGS2) $(PROGRAM) $(DEPTH)