author Jim Blandy <>
Wed, 29 Oct 2008 08:29:22 -0700
changeset 21062 8c52a9486c8f25a93063f5b628575837156f266b
parent 1 9b2a99adc05e53cd4010de512f50118594756650
permissions -rw-r--r--
Bug 97954: Allow SpiderMonkey to be built on its own, or as part of Mozilla. Give SpiderMonkey its own configure script and top-level Makefile. Adjust js/src/Makefile as appropriate for life as a stand-alone makefile, instead of a 'make export; make libs'-style Mozilla tier makefile. Have the configure script accept '--with-nspr-cflags' and '--with-nspr-libs' options for using an in-tree NSPR. Also accept '--with-system-nspr', '--with-nspr-prefix', and '--with-nspr-exec-prefix' flags for using an installed NSPR. Default to --disable-jemalloc, assuming we don't have that part of the tree available; have the top-level configure script pass --enable-jemalloc as needed. Since we no longer have an export phase to copy header files into dist/include/js before we build the library, we need to be able to find nanojit.h in the nanojit directory; fix references in jsbuiltins.h and jstracer.cpp. Give SpiderMonkey it its own copies of many of the files from ./config and ./build. These are all exact copies, except as follows: . js/src/config/ js/src only has a subset of js/src/config, and thus a subset of the makefile targets. . js/src/config/ js/src/ has its own make variables to set, not set by the top-level configure script, so it needs a custom template. . js/src/config/ a copy from nsprpub/config, so that we can build without having an NSPR source tree handy. Invoke js/src/configure from ./configure, passing the values computed for NSPR_CFLAGS and NSPR_LIBS by the top-level configure script. Treat js/src as a static directory of the js tier, and create a new config/js (just a Makefile) to be the js tier's non-static directory. Let js/src/configure generate SpiderMonkey's makefiles, not ./configure. Generate a 'js-config' script, which clients can call to find the CFLAGS and LIBS values necessary to compile and link against an installed SpiderMonkey library. Don't include the js-config script in Macintosh packages. Teach how to rebuild js/src/configure. Tell Mercurial to ignore files generated by autoconf in js/src. Further work: . Right now, callers must define JS_THREADSAFE when #including jsapi.h. This is fixed in a subsequent patch. . js/src/configure is a trimmed copy of ./configure. It could be trimmed more.

#!/bin/tcsh -f
# Original Author: Alec Flett <>
# Shameless Modifier: leaf nunes <>
# Last checked in: $Date: 1999/02/09 08:09:58 $
# Last checked in by: $Author: $

test $# -gt 2 || echo "Usage: $0 package builddir prefix [options]" && exit

set package=$1
set builddir=$2
set prefix=$3
set options=$4

# add any special bin directories for the build here
set path = ( $path )

setenv LD_LIBRARY_PATH /lib:/usr/lib:/usr/local/lib:/usr/openwin/lib:/tools/contrib/lib

cd $builddir

cvs -d checkout $package

cd $package
# find the version from the RPM spec file

set ver = `grep '%define.*\<ver\>' $package.spec | awk '{print $3}'`

# combine package and version to get the package-specific destination
set packagever = $package-$ver
set dest = $prefix/$packagever

# build
echo installing in $dest
rm config.cache
rm config.status
./ $options --prefix=$dest # --with-threads=posix

# clean up last night's build
find . -name '.deps' -exec rm -rf {} \; >& /dev/null
find . -name '.libs' -exec rm -rf {} \; >& /dev/null
gmake clean

# now build
gmake install

# remove the old installation of this version
(find $dest -type l && find $dest -type f) | \
    sed s%$dest/%% | xargs -i% rm $prefix/%

# symlink in the new installation
pushd `pwd`
cd $prefix
lndir -ignorelinks $packagever

# maybe add some tests to see if the build was successful.