tools/build/sync-configure
author Jim Blandy <jimb@mozilla.org>
Wed, 29 Oct 2008 08:29:22 -0700
changeset 21062 8c52a9486c8f25a93063f5b628575837156f266b
parent 1264 dc43ac0fc996f24c52a2a2d1df340fde952827d8
permissions -rwxr-xr-x
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/Makefile.in: js/src only has a subset of js/src/config, and thus a subset of the makefile targets. . js/src/config/autoconf.mk.in: js/src/configure.in has its own make variables to set, not set by the top-level configure script, so it needs a custom automake.mk template. . js/src/config/make-system-wrappers.pl: 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 client.mk 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/sh -x

# 3/3/03 - Now Runs on bawb as cltbld
# 5/1/03 - Now Runs on branch as cltbld
# 2003/02/24 - Now runs on egg as cltbld
# 2005/08/24 - Modified to take a branch argument (chase)
# 2006-06-27 - Modified to use hostname -f (dbaron)

BRANCH="HEAD"
if [ "x$1" != "x" ]; then
    BRANCH=$1
fi

# Autoconf ***must*** be 2.13.
AC="/usr/bin/autoconf-2.13"
CVS="/usr/bin/cvs"
CVSROOT='cltbld@cvs.mozilla.org:/cvsroot'
CVS_RSH=ssh
PATH="/usr/bin:/bin:/usr/local/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/etc:/usr/ucb"
TDIR="/tmp/c-s.$$"
HOST=`/bin/hostname -f`

export CVSROOT CVS_RSH PATH

rm -rf ${TDIR}
mkdir ${TDIR}
cd ${TDIR}

use_tmpdir() 
{
    if [ "$BRANCH" = "HEAD" ]; then
        ${CVS} -q checkout mozilla/configure.in mozilla/configure mozilla/build/autoconf mozilla/aclocal.m4
    else
        ${CVS} -q checkout -r $BRANCH mozilla/configure.in mozilla/configure mozilla/build/autoconf mozilla/aclocal.m4
    fi
    
    CO_STATUS=$?
    if [ $CO_STATUS != 0 ]
    then
        echo "ERROR cvs checkout exited with a non-zero exit code: $CO_STATUS"
        return $CO_STATUS
    fi
    
    cd mozilla
    ${AC} -l build/autoconf
    AC_STATUS=$?
    if [ $AC_STATUS != 0 ]
    then
        echo "ERROR autoconf exited with a non-zero exit code: $AC_STATUS"
        return $AC_STATUS
    fi
    
    ${CVS} diff configure >/dev/null 2>&1
    DIFF_STATUS=$?
    if [ $DIFF_STATUS == 1 ]
    then
        ${CVS} commit -m"Automated update from host $HOST" configure
        CI_STATUS=$?
        if [ $CI_STATUS != 0 ]
        then
            echo "ERROR cvs commit exited with exit code: $CI_STATUS"
            return $CI_STATUS
        fi
    elif [ $DIFF_STATUS == 0 ]
    then
        return 0
    else 
        echo "ERROR cvs diff exited with exit code: $DIFF_STATUS"
        return $DIFF_STATUS
    fi
}

use_tmpdir
result=$?
rm -rf ${TDIR}
exit $result