js/src/make-source-package.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/make-source-package.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,136 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# Find out ASAP if some command breaks here, because we're copying a lot of
     1.7 +# files we don't actually maintain ourselves, and requirements could easily be
     1.8 +# broken.
     1.9 +set -e
    1.10 +
    1.11 +# need these environment vars:
    1.12 +echo "Environment:"
    1.13 +echo "    MAKE = $MAKE"
    1.14 +echo "    MKDIR = $MKDIR"
    1.15 +echo "    TAR = $TAR"
    1.16 +echo "    DIST = $DIST"
    1.17 +echo "    SRCDIR = $SRCDIR"
    1.18 +echo "    MOZJS_MAJOR_VERSION = $MOZJS_MAJOR_VERSION"
    1.19 +echo "    MOZJS_MINOR_VERSION = $MOZJS_MINOR_VERSION"
    1.20 +echo "    MOZJS_PATCH_VERSION = $MOZJS_PATCH_VERSION"
    1.21 +echo "    MOZJS_ALPHA = $MOZJS_ALPHA"
    1.22 +
    1.23 +cmd=${1:-build}
    1.24 +pkg="mozjs-${MOZJS_MAJOR_VERSION}.${MOZJS_MINOR_VERSION}.${MOZJS_PATCH_VERSION:-${MOZJS_ALPHA:-0}}.tar.bz2"
    1.25 +pkgpath=${pkg%.tar*}
    1.26 +tgtpath=${DIST}/${pkgpath}
    1.27 +taropts="-jcf"
    1.28 +
    1.29 +case $cmd in
    1.30 +"clean")
    1.31 +	echo "Cleaning ${pkg} and ${tgtpath} ..."
    1.32 +	rm -rf ${pkg} ${tgtpath}
    1.33 +	;;
    1.34 +"build")
    1.35 +	echo "Packaging source tarball ${pkg}..."
    1.36 +	if [ -d ${tgtpath} ]; then
    1.37 +		echo "WARNING - dist tree ${tgtpath} already exists!"
    1.38 +	fi
    1.39 +	${MKDIR} -p ${tgtpath}/js/src
    1.40 +
    1.41 +	# copy the embedded icu
    1.42 +	${MKDIR} -p ${tgtpath}/intl
    1.43 +	cp -t ${tgtpath}/intl -dRp ${SRCDIR}/../../intl/icu
    1.44 +
    1.45 +	# copy main moz.build and Makefile.in
    1.46 +	cp -t ${tgtpath} -dRp ${SRCDIR}/../../Makefile.in ${SRCDIR}/../../moz.build
    1.47 +
    1.48 +	# copy a nspr file used by the build system
    1.49 +	${MKDIR} -p ${tgtpath}/nsprpub/config
    1.50 +	cp -t ${tgtpath}/nsprpub/config -dRp \
    1.51 +		${SRCDIR}/../../nsprpub/config/make-system-wrappers.pl
    1.52 +
    1.53 +	# copy build and config directory.
    1.54 +	${MKDIR} -p ${tgtpath}/build
    1.55 +	cp -t ${tgtpath} -dRp ${SRCDIR}/../../build ${SRCDIR}/../../config
    1.56 +
    1.57 +	# put in js itself
    1.58 +	cp -t ${tgtpath} -dRp ${SRCDIR}/../../mfbt
    1.59 +	cp -t ${tgtpath}/js -dRp ${SRCDIR}/../jsd ${SRCDIR}/../public
    1.60 +	find ${SRCDIR} -mindepth 1 -maxdepth 1 -not -path ${DIST} -a -not -name ${pkg} \
    1.61 +		-exec cp -t ${tgtpath}/js/src -dRp {} +
    1.62 +
    1.63 +	# distclean if necessary
    1.64 +	if [ -e ${tgtpath}/js/src/Makefile ]; then
    1.65 +		${MAKE} -C ${tgtpath}/js/src distclean
    1.66 +	fi
    1.67 +
    1.68 +	cp -t ${tgtpath} -dRp \
    1.69 +		${SRCDIR}/../../python
    1.70 +	${MKDIR} -p ${tgtpath}/dom/bindings
    1.71 +	cp -t ${tgtpath}/dom/bindings -dRp \
    1.72 +		${SRCDIR}/../../dom/bindings/mozwebidlcodegen
    1.73 +	${MKDIR} -p ${tgtpath}/media/webrtc/trunk/tools
    1.74 +	cp -t ${tgtpath}/media/webrtc/trunk/tools -dRp \
    1.75 +		${SRCDIR}/../../media/webrtc/trunk/tools/gyp
    1.76 +	${MKDIR} -p ${tgtpath}/testing
    1.77 +	cp -t ${tgtpath}/testing -dRp \
    1.78 +		${SRCDIR}/../../testing/mozbase
    1.79 +
    1.80 +	# remove *.pyc and *.pyo files if any
    1.81 +	find ${tgtpath} -type f -name "*.pyc" -o -name "*.pyo" |xargs rm -f
    1.82 +
    1.83 +	# copy or create INSTALL
    1.84 +	if [ -e {DIST}/INSTALL ]; then
    1.85 +		cp -t ${tgtpath} ${DIST}/INSTALL
    1.86 +	else
    1.87 +		cat <<INSTALL_EOF >${tgtpath}/INSTALL
    1.88 +Full build documentation for SpiderMonkey is hosted on MDN:
    1.89 +  https://developer.mozilla.org/en-US/docs/SpiderMonkey/Build_Documentation
    1.90 +
    1.91 +Note that the libraries produced by the build system include symbols,
    1.92 +causing the binaries to be extremely large. It is highly suggested that \`strip\`
    1.93 +be run over the binaries before deploying them.
    1.94 +
    1.95 +Building with default options may be performed as follows:
    1.96 +  cd js/src
    1.97 +  ./configure
    1.98 +  make
    1.99 +INSTALL_EOF
   1.100 +	fi
   1.101 +
   1.102 +	# copy or create README
   1.103 +	if [ -e ${DIST}/README ]; then
   1.104 +		cp -t ${tgtpath} ${DIST}/README
   1.105 +	else
   1.106 +		cat <<README_EOF >${tgtpath}/README
   1.107 +This directory contains SpiderMonkey ${MOZJS_MAJOR_VERSION}.
   1.108 +
   1.109 +This release is based on a revision of Mozilla ${MOZJS_MAJOR_VERSION}:
   1.110 +  http://hg.mozilla.org/releases/
   1.111 +The changes in the patches/ directory were applied.
   1.112 +
   1.113 +MDN hosts the latest SpiderMonkey ${MOZJS_MAJOR_VERSION} release notes:
   1.114 +  https://developer.mozilla.org/en-US/docs/SpiderMonkey/${MOZJS_MAJOR_VERSION}
   1.115 +README_EOF
   1.116 +	fi
   1.117 +
   1.118 +	# copy LICENSE
   1.119 +	if [ -e ${SRCDIR}/../../b2g/LICENSE ]; then
   1.120 +		cp ${SRCDIR}/../../b2g/LICENSE ${tgtpath}/
   1.121 +	else
   1.122 +		cp ${SRCDIR}/../../LICENSE ${tgtpath}/
   1.123 +	fi
   1.124 +
   1.125 +	# copy patches dir, if it currently exists in DIST
   1.126 +	if [ -d ${DIST}/patches ]; then
   1.127 +		cp -t ${tgtpath} -dRp ${DIST}/patches
   1.128 +	elif [ -d ${SRCDIR}/../../patches ]; then
   1.129 +		cp -t ${tgtpath} -dRp ${SRCDIR}/../../patches
   1.130 +	fi
   1.131 +
   1.132 +	# Roll the tarball
   1.133 +	${TAR} $taropts ${DIST}/../${pkg} -C ${DIST} ${pkgpath}
   1.134 +	echo "done."
   1.135 +	;;
   1.136 +*)
   1.137 +	echo "Unrecognized command: $cmd"
   1.138 +	;;
   1.139 +esac

mercurial