Bug 1262241 - Move the definition of the js library to a subdirectory. r=mshal

Also move some related files and rules used for `make install`.

Also move the js directory up in the top-level directory, so that the
linking order for the js library stays the same (fdlibm and ffi going
after the js engine objects)

This has the side effect of moving js/src/target very early in the
compilation tier.

--HG--
rename : js/src/js-config.in => js/src/build/js-config.in
rename : js/src/js.pc.in => js/src/build/js.pc.in
rename : js/src/symverscript.in => js/src/build/symverscript.in
extra : rebase_source : 7f188ee11469c7d352d4d9c90c8ba72c97224652
This commit is contained in:
Mike Hommey 2017-04-04 11:43:14 +09:00
parent 4bd092e460
commit 35efd64a58
9 changed files with 178 additions and 152 deletions

View File

@ -18,36 +18,8 @@ DASH_R = -r
USE_HOST_CXX = 1
# Ensure symbol versions of shared library on Linux do not conflict
# with those in libxul.
ifeq (Linux,$(OS_TARGET))
OS_LDFLAGS += -Wl,-version-script,symverscript
symverscript: symverscript.in
$(call py_action,preprocessor, \
-DVERSION='$(subst -,_,$(LIBRARY_NAME))' $< -o $@)
EXTRA_DEPS += symverscript
endif
include $(topsrcdir)/config/rules.mk
# check_vanilla_allocations.py is tailored to Linux, so only run it there.
# That should be enough to catch any problems.
check-vanilla-allocations:
$(PYTHON) $(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:
$(PYTHON) $(topsrcdir)/config/check_vanilla_allocations.py --aggressive $(REAL_LIBRARY)
ifeq ($(OS_ARCH),Linux)
ifeq (,$(filter -flto,$(CFLAGS) $(CXXFLAGS) $(LDFLAGS)))
check:: check-vanilla-allocations
endif
endif
# Help ensure that the number of OOM errors in SpiderMonkey doesn't increase.
# If the number of OOM errors changes, update the number below. We intend this
# number to go down over time, by fixing OOMs.
@ -162,62 +134,8 @@ endif # GNU_CC
endif
endif
SCRIPTS = $(JS_CONFIG_NAME)
$(LIBRARY_NAME).pc: js.pc
cp $^ $@
install:: $(LIBRARY_NAME).pc
$(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
install:: js-config.h
$(SYSINSTALL) $^ $(DESTDIR)$(includedir)
######################################################
# 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)/
# $(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,--no-remove --no-symlinks $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include)
#
# END SpiderMonkey header installation
#############################################
install:: $(SCRIPTS)
$(SYSINSTALL) $^ $(DESTDIR)$(bindir)
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)
endif
ifneq (,$(IMPORT_LIBRARY))
$(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir)
endif
$(MAKE) -C build install
$(MAKE) -C shell install
ifdef HAVE_DTRACE

View File

@ -36,7 +36,7 @@ fn main() {
.expect("Should spawn autospider OK");
assert!(result.success(), "autospider should exit OK");
println!("cargo:rustc-link-search=native={}/js/src", out_dir);
println!("cargo:rustc-link-search=native={}/js/src/build", out_dir);
if target.contains("windows") {
println!("cargo:rustc-link-lib=winmm");

92
js/src/build/Makefile.in Normal file
View File

@ -0,0 +1,92 @@
# -*- 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/.
# Ensure symbol versions of shared library on Linux do not conflict
# with those in libxul.
ifeq (Linux,$(OS_TARGET))
OS_LDFLAGS += -Wl,-version-script,symverscript
symverscript: symverscript.in
$(call py_action,preprocessor, \
-DVERSION='$(subst -,_,$(LIBRARY_NAME))' $< -o $@)
EXTRA_DEPS += symverscript
endif
include $(topsrcdir)/config/rules.mk
# check_vanilla_allocations.py is tailored to Linux, so only run it there.
# That should be enough to catch any problems.
check-vanilla-allocations:
$(PYTHON) $(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:
$(PYTHON) $(topsrcdir)/config/check_vanilla_allocations.py --aggressive $(REAL_LIBRARY)
ifeq ($(OS_ARCH),Linux)
ifeq (,$(filter -flto,$(CFLAGS) $(CXXFLAGS) $(LDFLAGS)))
check:: check-vanilla-allocations
endif
endif
SCRIPTS = $(JS_CONFIG_NAME)
$(LIBRARY_NAME).pc: js.pc
cp $^ $@
install:: $(LIBRARY_NAME).pc
$(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
install:: ../js-config.h
$(SYSINSTALL) $^ $(DESTDIR)$(includedir)
######################################################
# 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)/
# $(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,--no-remove --no-symlinks $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include)
#
# END SpiderMonkey header installation
#############################################
install:: $(SCRIPTS)
$(SYSINSTALL) $^ $(DESTDIR)$(bindir)
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)
endif
ifneq (,$(IMPORT_LIBRARY))
$(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir)
endif

77
js/src/build/moz.build Normal file
View File

@ -0,0 +1,77 @@
# -*- 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',
]
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']
else:
Library('js')
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'js_static'
if CONFIG['ENABLE_INTL_API']:
if not CONFIG['MOZ_ICU_DATA_ARCHIVE']:
USE_LIBS += [
'icu',
]
else:
# Linking 'icu' will pull in the stubdata library,
# which the shell doesn't want, so link the other bits.
USE_LIBS += [
'icui18n',
'icuuc',
]
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',
]
OS_LIBS += CONFIG['REALTIME_LIBS']
NO_EXPAND_LIBS = True
DIST_INSTALL = True

View File

@ -52,16 +52,12 @@ TEST_DIRS += ['jsapi-tests', 'tests', 'gdb']
CONFIGURE_SUBST_FILES += [
'devtools/rootAnalysis/Makefile',
'js-config',
'js.pc',
]
CONFIGURE_DEFINE_FILES += [
'js-confdefs.h',
]
if not CONFIG['JS_STANDALONE']:
LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
CONFIGURE_SUBST_FILES += [
'../../config/autoconf-js.mk',
'../../config/emptyvars-js.mk',
@ -632,41 +628,12 @@ ReservedWordsGenerated.inputs += [
'frontend/ReservedWords.h'
]
# 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']
else:
Library('js')
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'js_static'
if CONFIG['ENABLE_INTL_API']:
if not CONFIG['MOZ_ICU_DATA_ARCHIVE']:
USE_LIBS += [
'icu',
]
else:
# Linking 'icu' will pull in the stubdata library,
# which the shell doesn't want, so link the other bits.
USE_LIBS += [
'icui18n',
'icuuc',
]
USE_LIBS += [
'nspr',
'zlib',
DIRS += [
'build',
]
FINAL_LIBRARY = 'js'
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ENABLE_BINARYDATA'] = True
@ -712,38 +679,9 @@ if CONFIG['_MSC_VER']:
CXXFLAGS += ['-wd4577']
CXXFLAGS += ['-wd4312']
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',
]
OS_LIBS += CONFIG['REALTIME_LIBS']
CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
NO_EXPAND_LIBS = True
DIST_INSTALL = True
# Prepare self-hosted JS code for embedding
GENERATED_FILES += [('selfhosted.out.h', 'selfhosted.js')]
selfhosted = GENERATED_FILES[('selfhosted.out.h', 'selfhosted.js')]

View File

@ -95,6 +95,9 @@ if not CONFIG['JS_STANDALONE']:
'probes',
]
if CONFIG['COMPILE_ENVIRONMENT']:
DIRS += ['js/src']
DIRS += [
'config/external/fdlibm',
'config/external/nspr',
@ -111,7 +114,6 @@ if CONFIG['USE_ICU']:
DIRS += ['config/external/icu']
if CONFIG['COMPILE_ENVIRONMENT']:
if not CONFIG['JS_STANDALONE']:
DIRS += [
'config/external',
@ -121,7 +123,6 @@ if CONFIG['COMPILE_ENVIRONMENT']:
if CONFIG['BUILD_CTYPES']:
DIRS += ['config/external/ffi']
DIRS += ['js/src']
else:
TEST_DIRS += ['js/src/tests']