js/src/build/cygwin-wrapper
author Jim Blandy <jimb@mozilla.org>
Wed, 29 Oct 2008 08:29:22 -0700
changeset 21062 8c52a9486c8f25a93063f5b628575837156f266b
parent 1 build/cygwin-wrapper@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/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
#
# Stupid wrapper to avoid win32 dospath/cygdrive issues
# Try not to spawn programs from within this file. If the stuff in here looks royally 
# confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643
# and look at the older versions of this file that are easier to read, but
# do basically the same thing
#

prog=$1
shift
if test -z "$prog"; then
    exit 0
fi

# If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p
mountpoint=$CYGDRIVE_MOUNT
if test -z "$mountpoint"; then
    mountpoint=`mount -p`
    if test -z "$mountpoint"; then
       print "Cannot determine cygwin mount points. Exiting"
       exit 1
    fi
fi

# Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p`
mountpoint=${mountpoint#*/}
mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
mountpoint=${mountpoint%/}

args=""
up=""
if test "${prog}" = "-up"; then
    up=1
    prog=${1}
    shift
fi

process=1

# Convert the mountpoint in parameters to Win32 filenames
# For instance: /cygdrive/c/foo -> c:/foo
for i in "${@}"
do
    if test "${i}" = "-wrap"; then
        process=1
    else
        if test "${i}" = "-nowrap"; then
            process=
        else
            if test -n "${process}"; then
                if test -n "${up}"; then
                    pathname=${i#-I[a-zA-Z]:/}
                    if ! test "${pathname}" = "${i}"; then
                        no_i=${i#-I}
                        driveletter=${no_i%%:*}
                        i=-I${mountpoint}/${driveletter}/${pathname}
                    fi
                else
                    eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
                    if ! test "${leader}" = "${i}"; then
                        eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
                        eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
                        driveletter=${no_mountpoint%%/*}
                        i=${leader}${driveletter}:/${pathname}
                    fi
                fi
            fi

            args="${args} ${i}"
        fi
    fi
done

exec $prog $args