michael@0: #!/bin/sh michael@0: michael@0: # Find out ASAP if some command breaks here, because we're copying a lot of michael@0: # files we don't actually maintain ourselves, and requirements could easily be michael@0: # broken. michael@0: set -e michael@0: michael@0: # need these environment vars: michael@0: echo "Environment:" michael@0: echo " MAKE = $MAKE" michael@0: echo " MKDIR = $MKDIR" michael@0: echo " TAR = $TAR" michael@0: echo " DIST = $DIST" michael@0: echo " SRCDIR = $SRCDIR" michael@0: echo " MOZJS_MAJOR_VERSION = $MOZJS_MAJOR_VERSION" michael@0: echo " MOZJS_MINOR_VERSION = $MOZJS_MINOR_VERSION" michael@0: echo " MOZJS_PATCH_VERSION = $MOZJS_PATCH_VERSION" michael@0: echo " MOZJS_ALPHA = $MOZJS_ALPHA" michael@0: michael@0: cmd=${1:-build} michael@0: pkg="mozjs-${MOZJS_MAJOR_VERSION}.${MOZJS_MINOR_VERSION}.${MOZJS_PATCH_VERSION:-${MOZJS_ALPHA:-0}}.tar.bz2" michael@0: pkgpath=${pkg%.tar*} michael@0: tgtpath=${DIST}/${pkgpath} michael@0: taropts="-jcf" michael@0: michael@0: case $cmd in michael@0: "clean") michael@0: echo "Cleaning ${pkg} and ${tgtpath} ..." michael@0: rm -rf ${pkg} ${tgtpath} michael@0: ;; michael@0: "build") michael@0: echo "Packaging source tarball ${pkg}..." michael@0: if [ -d ${tgtpath} ]; then michael@0: echo "WARNING - dist tree ${tgtpath} already exists!" michael@0: fi michael@0: ${MKDIR} -p ${tgtpath}/js/src michael@0: michael@0: # copy the embedded icu michael@0: ${MKDIR} -p ${tgtpath}/intl michael@0: cp -t ${tgtpath}/intl -dRp ${SRCDIR}/../../intl/icu michael@0: michael@0: # copy main moz.build and Makefile.in michael@0: cp -t ${tgtpath} -dRp ${SRCDIR}/../../Makefile.in ${SRCDIR}/../../moz.build michael@0: michael@0: # copy a nspr file used by the build system michael@0: ${MKDIR} -p ${tgtpath}/nsprpub/config michael@0: cp -t ${tgtpath}/nsprpub/config -dRp \ michael@0: ${SRCDIR}/../../nsprpub/config/make-system-wrappers.pl michael@0: michael@0: # copy build and config directory. michael@0: ${MKDIR} -p ${tgtpath}/build michael@0: cp -t ${tgtpath} -dRp ${SRCDIR}/../../build ${SRCDIR}/../../config michael@0: michael@0: # put in js itself michael@0: cp -t ${tgtpath} -dRp ${SRCDIR}/../../mfbt michael@0: cp -t ${tgtpath}/js -dRp ${SRCDIR}/../jsd ${SRCDIR}/../public michael@0: find ${SRCDIR} -mindepth 1 -maxdepth 1 -not -path ${DIST} -a -not -name ${pkg} \ michael@0: -exec cp -t ${tgtpath}/js/src -dRp {} + michael@0: michael@0: # distclean if necessary michael@0: if [ -e ${tgtpath}/js/src/Makefile ]; then michael@0: ${MAKE} -C ${tgtpath}/js/src distclean michael@0: fi michael@0: michael@0: cp -t ${tgtpath} -dRp \ michael@0: ${SRCDIR}/../../python michael@0: ${MKDIR} -p ${tgtpath}/dom/bindings michael@0: cp -t ${tgtpath}/dom/bindings -dRp \ michael@0: ${SRCDIR}/../../dom/bindings/mozwebidlcodegen michael@0: ${MKDIR} -p ${tgtpath}/media/webrtc/trunk/tools michael@0: cp -t ${tgtpath}/media/webrtc/trunk/tools -dRp \ michael@0: ${SRCDIR}/../../media/webrtc/trunk/tools/gyp michael@0: ${MKDIR} -p ${tgtpath}/testing michael@0: cp -t ${tgtpath}/testing -dRp \ michael@0: ${SRCDIR}/../../testing/mozbase michael@0: michael@0: # remove *.pyc and *.pyo files if any michael@0: find ${tgtpath} -type f -name "*.pyc" -o -name "*.pyo" |xargs rm -f michael@0: michael@0: # copy or create INSTALL michael@0: if [ -e {DIST}/INSTALL ]; then michael@0: cp -t ${tgtpath} ${DIST}/INSTALL michael@0: else michael@0: cat <${tgtpath}/INSTALL michael@0: Full build documentation for SpiderMonkey is hosted on MDN: michael@0: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Build_Documentation michael@0: michael@0: Note that the libraries produced by the build system include symbols, michael@0: causing the binaries to be extremely large. It is highly suggested that \`strip\` michael@0: be run over the binaries before deploying them. michael@0: michael@0: Building with default options may be performed as follows: michael@0: cd js/src michael@0: ./configure michael@0: make michael@0: INSTALL_EOF michael@0: fi michael@0: michael@0: # copy or create README michael@0: if [ -e ${DIST}/README ]; then michael@0: cp -t ${tgtpath} ${DIST}/README michael@0: else michael@0: cat <${tgtpath}/README michael@0: This directory contains SpiderMonkey ${MOZJS_MAJOR_VERSION}. michael@0: michael@0: This release is based on a revision of Mozilla ${MOZJS_MAJOR_VERSION}: michael@0: http://hg.mozilla.org/releases/ michael@0: The changes in the patches/ directory were applied. michael@0: michael@0: MDN hosts the latest SpiderMonkey ${MOZJS_MAJOR_VERSION} release notes: michael@0: https://developer.mozilla.org/en-US/docs/SpiderMonkey/${MOZJS_MAJOR_VERSION} michael@0: README_EOF michael@0: fi michael@0: michael@0: # copy LICENSE michael@0: if [ -e ${SRCDIR}/../../b2g/LICENSE ]; then michael@0: cp ${SRCDIR}/../../b2g/LICENSE ${tgtpath}/ michael@0: else michael@0: cp ${SRCDIR}/../../LICENSE ${tgtpath}/ michael@0: fi michael@0: michael@0: # copy patches dir, if it currently exists in DIST michael@0: if [ -d ${DIST}/patches ]; then michael@0: cp -t ${tgtpath} -dRp ${DIST}/patches michael@0: elif [ -d ${SRCDIR}/../../patches ]; then michael@0: cp -t ${tgtpath} -dRp ${SRCDIR}/../../patches michael@0: fi michael@0: michael@0: # Roll the tarball michael@0: ${TAR} $taropts ${DIST}/../${pkg} -C ${DIST} ${pkgpath} michael@0: echo "done." michael@0: ;; michael@0: *) michael@0: echo "Unrecognized command: $cmd" michael@0: ;; michael@0: esac