diff options
Diffstat (limited to 'js/src/build')
-rw-r--r-- | js/src/build/Makefile.in | 87 | ||||
-rw-r--r-- | js/src/build/js-config.in | 116 | ||||
-rw-r--r-- | js/src/build/js.pc.in | 14 | ||||
-rw-r--r-- | js/src/build/moz.build | 98 | ||||
-rw-r--r-- | js/src/build/symverscript.in | 4 |
5 files changed, 319 insertions, 0 deletions
diff --git a/js/src/build/Makefile.in b/js/src/build/Makefile.in new file mode 100644 index 0000000000..8548eb2584 --- /dev/null +++ b/js/src/build/Makefile.in @@ -0,0 +1,87 @@ +# -*- Mode: makefile -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +include $(topsrcdir)/config/rules.mk + +ifdef NM +# check_vanilla_allocations.py is tailored to Linux, so only run it there. +# That should be enough to catch any problems. +check-vanilla-allocations: + $(PYTHON3) $(topsrcdir)/config/check_vanilla_allocations.py $(REAL_LIBRARY) + +# The "aggressive" variant will likely fail on some compiler/platform +# combinations, but is worth running by hand every once in a while. +check-vanilla-allocations-aggressive: + $(PYTHON3) $(topsrcdir)/config/check_vanilla_allocations.py --aggressive $(REAL_LIBRARY) + +check:: check-vanilla-allocations +endif + +$(LIBRARY_NAME).pc: js.pc + cp $^ $@ + +# Install versioned file, for parallel installability in Linux distributions +install:: $(LIBRARY_NAME).pc + cp $^ $(JS_LIBRARY_NAME).pc + $(SYSINSTALL) $(JS_LIBRARY_NAME).pc $(DESTDIR)$(libdir)/pkgconfig + +install:: ../js-config.h + $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(JS_LIBRARY_NAME) + +###################################################### +# BEGIN SpiderMonkey header installation +# +# Mozilla/Gecko/Firefox mostly doesn't concern itself with defining a sensible +# install target, because it's shipping primarily packaged builds. And even if +# it did, those builds wouldn't really have reason to include header files. So +# we have to install public headers ourselves, rather than using something from +# config/rules.mk or similar. +# +# The overall directory structure of the installed headers looks like so: +# +# $(includedir)/ +# $(JS_LIBRARY_NAME)/ +# jsapi.h, jspubtd.h, etc. (all of EXPORTS) +# js/ +# js/public/* headers (all are public) +# ds/ +# js/src/ds/* public headers +# gc/ +# js/src/gc/* public headers +# mozilla/ +# mfbt headers +# + +install:: + $(call py_action,process_install_manifest,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install_dist_include.track --no-symlinks $(DESTDIR)$(includedir)/$(JS_LIBRARY_NAME) $(DEPTH)/_build_manifests/install/dist_include) + +# +# END SpiderMonkey header installation +############################################# + +# Install versioned script, for parallel installability in Linux distributions +install:: js-config + cp $^ js$(MOZJS_MAJOR_VERSION)-config + $(SYSINSTALL) js$(MOZJS_MAJOR_VERSION)-config $(DESTDIR)$(bindir) + +# Use install_name_tool to set the install_name properly for standalone +# installed libraries on macOS +install:: $(REAL_LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) +ifneq (,$(REAL_LIBRARY)) + $(SYSINSTALL) $(REAL_LIBRARY) $(DESTDIR)$(libdir) + mv -f $(DESTDIR)$(libdir)/$(REAL_LIBRARY) $(subst $(STATIC_LIBRARY_NAME),$(LIBRARY_NAME),$(DESTDIR)$(libdir)/$(REAL_LIBRARY)) +endif +ifneq (,$(SHARED_LIBRARY)) + $(SYSINSTALL) $(SHARED_LIBRARY) $(DESTDIR)$(libdir) +ifeq ($(OS_ARCH),Darwin) + install_name_tool -id $(abspath $(libdir)/$(SHARED_LIBRARY)) $(DESTDIR)$(libdir)/$(SHARED_LIBRARY) +endif +endif +ifneq (,$(IMPORT_LIBRARY)) +ifneq ($(IMPORT_LIBRARY),$(SHARED_LIBRARY)) + $(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir) +endif +endif diff --git a/js/src/build/js-config.in b/js/src/build/js-config.in new file mode 100644 index 0000000000..7694944bc3 --- /dev/null +++ b/js/src/build/js-config.in @@ -0,0 +1,116 @@ +#!/bin/sh +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +prefix='@prefix@' +mozilla_version='@MOZILLA_VERSION@' +JS_LIBRARY_NAME='@JS_LIBRARY_NAME@' +NSPR_CFLAGS='@NSPR_CFLAGS@' +JS_CONFIG_LIBS='@JS_CONFIG_LIBS@' +MOZ_JS_LIBS='@JS_CONFIG_MOZ_JS_LIBS@' + +FILENAME=`basename "$0"` + +usage() +{ + cat <<EOF +Usage: $FILENAME [OPTIONS] +Options: + [--prefix[=DIR]] + [--exec-prefix[=DIR]] + [--includedir[=DIR]] + [--libdir[=DIR]] + [--version] + [--libs] + [--cflags] + [--lib-filenames] +EOF + exit $1 +} + +if test $# -eq 0; then + usage 1 1>&2 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + ;; + --prefix) + echo_prefix=yes + ;; + --exec-prefix=*) + exec_prefix=$optarg + ;; + --exec-prefix) + echo_exec_prefix=yes + ;; + --includedir=*) + includedir=$optarg + ;; + --includedir) + echo_includedir=yes + ;; + --libdir=*) + libdir=$optarg + ;; + --libdir) + echo_libdir=yes + ;; + --version) + echo "$mozilla_version" + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=yes + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +# Set variables that may be dependent upon other variables +if test -z "$exec_prefix"; then + exec_prefix=@exec_prefix@ +fi +if test -z "$includedir"; then + includedir=@includedir@ +fi +if test -z "$libdir"; then + libdir=@libdir@ +fi + +if test "$echo_prefix" = "yes"; then + echo $prefix +fi + +if test "$echo_exec_prefix" = "yes"; then + echo $exec_prefix +fi + +if test "$echo_includedir" = "yes"; then + echo $includedir +fi + +if test "$echo_libdir" = "yes"; then + echo $libdir +fi + +if test "$echo_cflags" = "yes"; then + echo "-std=gnu++11 -include $includedir/$JS_LIBRARY_NAME/js/RequiredDefines.h -isystem $includedir/$JS_LIBRARY_NAME $NSPR_CFLAGS" +fi + +if test "$echo_libs" = "yes"; then + echo "$MOZ_JS_LIBS $JS_CONFIG_LIBS" +fi diff --git a/js/src/build/js.pc.in b/js/src/build/js.pc.in new file mode 100644 index 0000000000..d40deb174f --- /dev/null +++ b/js/src/build/js.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: SpiderMonkey @MOZILLA_VERSION@ +Description: The Mozilla library for JavaScript +Version: @MOZILLA_VERSION@ +@PKGCONF_REQUIRES_PRIVATE@ +Libs: -L${libdir} -l@JS_LIBRARY_NAME@ +# Use -isystem for includes rather than -I, to mark them as "system headers" +# that don't generate warning diagnostics. For justification, see +# https://bugzilla.mozilla.org/show_bug.cgi?id=1539036 +Cflags: -include ${includedir}/@JS_LIBRARY_NAME@/js/RequiredDefines.h -isystem ${includedir}/@JS_LIBRARY_NAME@ diff --git a/js/src/build/moz.build b/js/src/build/moz.build new file mode 100644 index 0000000000..3f5dce5f73 --- /dev/null +++ b/js/src/build/moz.build @@ -0,0 +1,98 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +CONFIGURE_SUBST_FILES += [ + "js-config", + "js.pc", +] + +LIBRARY_DEFINES["EXPORT_JS_API"] = True + +if not CONFIG["JS_STANDALONE"]: + LIBRARY_DEFINES["MOZ_HAS_MOZGLUE"] = True + +# JavaScript must be built shared, even for static builds, as it is used by +# 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. + +if CONFIG["JS_SHARED_LIBRARY"]: + GeckoSharedLibrary("js", linkage=None) + SHARED_LIBRARY_NAME = CONFIG["JS_LIBRARY_NAME"] + + # Ensure symbol versions of shared library on Linux do not conflict + # with those in libxul. + if CONFIG["OS_TARGET"] == "Linux": + GeneratedFile( + "symverscript", + script="/build/gen_symverscript.py", + inputs=["symverscript.in"], + flags=[CONFIG["JS_LIBRARY_NAME"].replace("-", "_")], + ) + SYMBOLS_FILE = "!symverscript" +else: + Library("js") + +FORCE_STATIC_LIB = True +STATIC_LIBRARY_NAME = "js_static" + +if CONFIG["JS_HAS_INTL_API"]: + USE_LIBS += [ + "icu", + ] + +USE_LIBS += [ + "nspr", + "zlib", +] + +if CONFIG["OS_ARCH"] not in ("WINNT", "HP-UX"): + OS_LIBS += [ + "m", + ] + +if CONFIG["OS_ARCH"] == "FreeBSD": + OS_LIBS += [ + "-pthread", + ] + +if CONFIG["OS_ARCH"] == "Linux": + OS_LIBS += [ + "dl", + ] + +if CONFIG["OS_ARCH"] == "SunOS": + OS_LIBS += [ + "posix4", + "dl", + "nsl", + "socket", + ] + +if CONFIG["MOZ_NEEDS_LIBATOMIC"]: + OS_LIBS += ["atomic"] + +OS_LIBS += CONFIG["REALTIME_LIBS"] + +NO_EXPAND_LIBS = True + +DIST_INSTALL = True + +# Run SpiderMonkey style checker after linking the static library. This avoids +# running the script for no-op builds. +GeneratedFile( + "spidermonkey_checks", + script="/config/run_spidermonkey_checks.py", + inputs=[ + "!%sjs_static.%s" % (CONFIG["LIB_PREFIX"], CONFIG["LIB_SUFFIX"]), + "/config/check_spidermonkey_style.py", + "/config/check_macroassembler_style.py", + "/config/check_js_opcode.py", + ], +) diff --git a/js/src/build/symverscript.in b/js/src/build/symverscript.in new file mode 100644 index 0000000000..ef70826ad4 --- /dev/null +++ b/js/src/build/symverscript.in @@ -0,0 +1,4 @@ +#filter substitution +@VERSION@ { + global: *; +}; |