Skip to content

Commit

Permalink
Bug 969164 - Traverse js/src moz.builds from top-level configure. r=gps
Browse files Browse the repository at this point in the history
Before, we would run configure in both top-level and js/src, and both
configures would traverse their own set of moz.builds, without actual
knowledge about the other. With this change, both configures still run,
but only top-level traverses moz.build files, and uses js/src's
config.status when traversing its moz.build files. This allows a better
sharing of information between both build systems and the removal of many
hacks.

This also moves running libffi and icu configure to top-level.

Standalone js builds still have their own configure doing moz.build traversal,
as before.

--HG--
rename : config/autoconf.mk.in => config/autoconf-js.mk.in
rename : config/emptyvars.mk.in => config/emptyvars-js.mk.in
  • Loading branch information
glandium committed Feb 11, 2014
1 parent 3ce0ef9 commit 69e7008
Show file tree
Hide file tree
Showing 17 changed files with 354 additions and 317 deletions.
2 changes: 1 addition & 1 deletion CLOBBER
Expand Up @@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.

Bug 964200 - Touching webidl files in this bug doesn't work without a clobber. Tried landing already and had to back out.
Bug 969164 changes the directory layout under js/src during gecko builds, and that causes a build failure on incremental builds because of the js shell trying to replace a directory with the same name.
61 changes: 23 additions & 38 deletions Makefile.in
Expand Up @@ -23,22 +23,14 @@ endif

include $(topsrcdir)/config/config.mk

ifndef LIBXUL_SDK
ifdef COMPILE_ENVIRONMENT
ifndef BUILDING_JS
BUILD_JS = 1
endif
endif
endif

GARBAGE_DIRS += dist _javagen _profile staticlib
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
config/autoconf.mk \
mozilla-config.h \
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
.mozconfig.mk

ifdef BUILDING_JS
ifdef JS_STANDALONE
configure_dir = $(topsrcdir)/js/src
else
configure_dir = $(topsrcdir)
Expand All @@ -48,8 +40,8 @@ ifndef MOZ_PROFILE_USE
# We need to explicitly put backend.RecursiveMakeBackend here
# otherwise the rule in rules.mk doesn't run early enough.
libs binaries export tools:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
ifdef BUILD_JS
libs binaries export tools:: js-config-status
ifndef JS_STANDALONE
libs binaries export tools:: $(topsrcdir)/js/src/configure js/src/config.status
endif
endif

Expand All @@ -64,17 +56,21 @@ CLOBBER: $(topsrcdir)/CLOBBER
@exit 1
endif

$(configure_dir)/configure: $(configure_dir)/configure.in
@echo 'STOP! configure.in has changed, and your configure is out of date.'
$(topsrcdir)/configure: $(topsrcdir)/configure.in
$(topsrcdir)/js/src/configure: $(topsrcdir)/js/src/configure.in
$(topsrcdir)/configure $(topsrcdir)/js/src/configure:
@echo 'STOP! $^ has changed, and your configure is out of date.'
@echo 'Please rerun autoconf and re-configure your build directory.'
@echo 'To ignore this message, touch "configure" in the source directory,'
@echo 'To ignore this message, touch "$@",'
@echo 'but your build might not succeed.'
@exit 1

config.status: $(configure_dir)/configure
@echo 'STOP! configure has changed and needs to be run in this build directory.'
@echo 'Please rerun configure.'
@echo 'To ignore this message, touch "config.status" in the build directory,'
js/src/config.status: $(topsrcdir)/js/src/configure
config.status js/src/config.status:
@echo 'STOP! $^ has changed and needs to be run again.'
@echo 'Please rerun it.'
@echo 'To ignore this message, touch "$(CURDIR)/$@",'
@echo 'but your build might not succeed.'
@exit 1

Expand All @@ -96,12 +92,6 @@ include backend.RecursiveMakeBackend.pp

default:: backend.RecursiveMakeBackend

ifdef BUILD_JS
.PHONY: js-config-status
js-config-status:
$(call SUBMAKE,backend.RecursiveMakeBackend,js/src,1)
endif

install_manifests := bin idl include public private sdk
install_manifest_depends = \
CLOBBER \
Expand All @@ -110,33 +100,33 @@ install_manifest_depends = \
backend.RecursiveMakeBackend \
$(NULL)

ifdef BUILD_JS
install_manifest_depends += js-config-status
ifndef JS_STANDALONE
install_manifest_depends += \
$(topsrcdir)/js/src/configure \
js/src/config.status \
$(NULL)
endif

.PHONY: install-manifests
install-manifests: $(addprefix install-dist-,$(install_manifests))

# process_install_manifest needs to be invoked with --no-remove when building
# js as standalone because automated builds are building nspr separately and
# that would remove the resulting files. It is also necessary when building
# js as part of gecko because that would remove the files exported from gecko.
# that would remove the resulting files.
# Eventually, a standalone js build would just be able to build nspr itself,
# removing the need for the former. But that won't likely happen before
# finishing to merge gecko and js build systems, removing the need for the
# latter.
# removing the need for the former.
ifdef BUILDING_JS
NO_REMOVE=1
endif

.PHONY: $(addprefix install-dist-,$(install_manifests))
$(addprefix install-dist-,$(install_manifests)): install-dist-%: $(install_manifest_depends)
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$* $(if $(BUILD_JS),js/src/_build_manifests/install/dist_$*))
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )$(DIST)/$* _build_manifests/install/dist_$*)

.PHONY: install-tests
install-manifests: install-tests
install-tests: $(install_manifest_depends)
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests $(if $(BUILD_JS),js/src/_build_manifests/install/tests))
$(call py_action,process_install_manifest,$(if $(NO_REMOVE),--no-remove )_tests _build_manifests/install/tests)


# _tests should be purged during cleaning. However, we don't want it purged
Expand Down Expand Up @@ -294,10 +284,7 @@ source-package install:
.PHONY: config/export
config/export:

else

ifdef BUILD_JS
js/src/Makefile: subsrcdir := js/src
endif

ifdef MOZ_PSEUDO_DERECURSE
# Interdependencies for parallel export.
Expand All @@ -308,5 +295,3 @@ ifdef ENABLE_CLANG_PLUGIN
js/src/export config/export: build/clang-plugin/export
endif
endif
endif
endif
20 changes: 17 additions & 3 deletions build/autoconf/config.status.m4
Expand Up @@ -55,7 +55,7 @@ ifelse($#, 2, _MOZ_AC_DEFINE_UNQUOTED($1, $2), $#, 3, _MOZ_AC_DEFINE_UNQUOTED($1
])

dnl Replace AC_OUTPUT to create and call a python config.status
define([_MOZ_AC_OUTPUT],
define([MOZ_CREATE_CONFIG_STATUS],
[dnl Top source directory in Windows format (as opposed to msys format).
WIN_TOP_SRC=
encoding=utf-8
Expand Down Expand Up @@ -99,7 +99,8 @@ dnl form suitable for make.
topsrcdir = '''${WIN_TOP_SRC:-$srcdir}'''
if not os.path.isabs(topsrcdir):
rel = os.path.join(os.path.dirname(<<<__file__>>>), topsrcdir)
topsrcdir = os.path.normpath(os.path.abspath(rel))
topsrcdir = os.path.abspath(rel)
topsrcdir = os.path.normpath(topsrcdir)
topobjdir = os.path.abspath(os.path.dirname(<<<__file__>>>))
Expand Down Expand Up @@ -149,14 +150,26 @@ cat >> $CONFIG_STATUS <<EOF
]
__all__ = ['topobjdir', 'topsrcdir', 'defines', 'non_global_defines', 'substs']
EOF
# We don't want js/src/config.status to do anything in gecko builds.
if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
cat >> $CONFIG_STATUS <<EOF
dnl Do the actual work
if __name__ == '__main__':
args = dict([(name, globals()[name]) for name in __all__])
from mozbuild.config_status import config_status
config_status(**args)
EOF
fi
changequote([, ])
])

define([MOZ_RUN_CONFIG_STATUS],
[
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
dnl Execute config.status, unless --no-create was passed to configure.
Expand All @@ -172,7 +185,8 @@ errprint([$1
m4exit(1)
])

define([AC_OUTPUT], [ifelse($#_$1, 1_, [_MOZ_AC_OUTPUT()],
define([AC_OUTPUT], [ifelse($#_$1, 1_, [MOZ_CREATE_CONFIG_STATUS()
MOZ_RUN_CONFIG_STATUS()],
[m4_fatal([Use CONFIGURE_SUBST_FILES in moz.build files to create substituted files.])]
)])

Expand Down
116 changes: 60 additions & 56 deletions build/autoconf/ffi.m4
Expand Up @@ -23,66 +23,70 @@ AC_SUBST(MOZ_NATIVE_FFI)
])

AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [
if test "$BUILD_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
ac_configure_args="$ac_configure_args --enable-debug"
fi
if test "$DSO_PIC_CFLAGS"; then
ac_configure_args="$ac_configure_args --with-pic"
fi
for var in AS CC CXX CPP LD AR RANLIB STRIP; do
ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
done
if test "$CROSS_COMPILE"; then
export CPPFLAGS CFLAGS LDFLAGS
fi
ac_configure_args="$ac_configure_args --build=$build --host=$target"
if test "$_MSC_VER"; then
# Use a wrapper script for cl and ml that looks more like gcc.
# autotools can't quite handle an MSVC build environment yet.
LDFLAGS=
CFLAGS=
ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
case "${target_cpu}" in
x86_64)
# Need target since MSYS tools into mozilla-build may be 32bit
ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\""
;;
*)
ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh"
;;
esac
fi
if test "$SOLARIS_SUNPRO_CC"; then
# Always use gcc for libffi on Solaris
if test ! "$HAVE_64BIT_OS"; then
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS="
else
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS="
if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then
if test "$BUILD_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
ac_configure_args="$ac_configure_args --enable-debug"
fi
fi
if test "$AIX_IBM_XLC"; then
# Always use gcc for libffi on IBM AIX5/AIX6
if test ! "$HAVE_64BIT_OS"; then
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32"
else
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64"
if test "$DSO_PIC_CFLAGS"; then
ac_configure_args="$ac_configure_args --with-pic"
fi
for var in AS CC CXX CPP LD AR RANLIB STRIP; do
ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
done
if test "$CROSS_COMPILE"; then
export CPPFLAGS CFLAGS LDFLAGS
fi
ac_configure_args="$ac_configure_args --build=$build --host=$target"
if test "$_MSC_VER"; then
# Use a wrapper script for cl and ml that looks more like gcc.
# autotools can't quite handle an MSVC build environment yet.
LDFLAGS=
CFLAGS=
ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
case "${target_cpu}" in
x86_64)
# Need target since MSYS tools into mozilla-build may be 32bit
ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh -m64\""
;;
*)
ac_configure_args="$ac_configure_args CC=$_topsrcdir/js/src/ctypes/libffi/msvcc.sh"
;;
esac
fi
if test "$SOLARIS_SUNPRO_CC"; then
# Always use gcc for libffi on Solaris
if test ! "$HAVE_64BIT_OS"; then
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS="
else
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS="
fi
fi
if test "$AIX_IBM_XLC"; then
# Always use gcc for libffi on IBM AIX5/AIX6
if test ! "$HAVE_64BIT_OS"; then
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32"
else
ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64"
fi
fi
# Use a separate cache file for libffi, since it does things differently
# from our configure.
mkdir -p $_objdir/js/src/ctypes/libffi
old_cache_file=$cache_file
cache_file=$_objdir/js/src/ctypes/libffi/config.cache
old_config_files=$CONFIG_FILES
unset CONFIG_FILES
AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi)
cache_file=$old_cache_file
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
CONFIG_FILES=$old_config_files
fi
# Use a separate cache file for libffi, since it does things differently
# from our configure.
mkdir -p $_objdir/js/src/ctypes/libffi
old_cache_file=$cache_file
cache_file=$_objdir/js/src/ctypes/libffi/config.cache
old_config_files=$CONFIG_FILES
unset CONFIG_FILES
AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi)
cache_file=$old_cache_file
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
CONFIG_FILES=$old_config_files
fi
])

0 comments on commit 69e7008

Please sign in to comment.