js/src/make-source-package.sh

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 #!/bin/sh
     3 # Find out ASAP if some command breaks here, because we're copying a lot of
     4 # files we don't actually maintain ourselves, and requirements could easily be
     5 # broken.
     6 set -e
     8 # need these environment vars:
     9 echo "Environment:"
    10 echo "    MAKE = $MAKE"
    11 echo "    MKDIR = $MKDIR"
    12 echo "    TAR = $TAR"
    13 echo "    DIST = $DIST"
    14 echo "    SRCDIR = $SRCDIR"
    15 echo "    MOZJS_MAJOR_VERSION = $MOZJS_MAJOR_VERSION"
    16 echo "    MOZJS_MINOR_VERSION = $MOZJS_MINOR_VERSION"
    17 echo "    MOZJS_PATCH_VERSION = $MOZJS_PATCH_VERSION"
    18 echo "    MOZJS_ALPHA = $MOZJS_ALPHA"
    20 cmd=${1:-build}
    21 pkg="mozjs-${MOZJS_MAJOR_VERSION}.${MOZJS_MINOR_VERSION}.${MOZJS_PATCH_VERSION:-${MOZJS_ALPHA:-0}}.tar.bz2"
    22 pkgpath=${pkg%.tar*}
    23 tgtpath=${DIST}/${pkgpath}
    24 taropts="-jcf"
    26 case $cmd in
    27 "clean")
    28 	echo "Cleaning ${pkg} and ${tgtpath} ..."
    29 	rm -rf ${pkg} ${tgtpath}
    30 	;;
    31 "build")
    32 	echo "Packaging source tarball ${pkg}..."
    33 	if [ -d ${tgtpath} ]; then
    34 		echo "WARNING - dist tree ${tgtpath} already exists!"
    35 	fi
    36 	${MKDIR} -p ${tgtpath}/js/src
    38 	# copy the embedded icu
    39 	${MKDIR} -p ${tgtpath}/intl
    40 	cp -t ${tgtpath}/intl -dRp ${SRCDIR}/../../intl/icu
    42 	# copy main moz.build and Makefile.in
    43 	cp -t ${tgtpath} -dRp ${SRCDIR}/../../Makefile.in ${SRCDIR}/../../moz.build
    45 	# copy a nspr file used by the build system
    46 	${MKDIR} -p ${tgtpath}/nsprpub/config
    47 	cp -t ${tgtpath}/nsprpub/config -dRp \
    48 		${SRCDIR}/../../nsprpub/config/make-system-wrappers.pl
    50 	# copy build and config directory.
    51 	${MKDIR} -p ${tgtpath}/build
    52 	cp -t ${tgtpath} -dRp ${SRCDIR}/../../build ${SRCDIR}/../../config
    54 	# put in js itself
    55 	cp -t ${tgtpath} -dRp ${SRCDIR}/../../mfbt
    56 	cp -t ${tgtpath}/js -dRp ${SRCDIR}/../jsd ${SRCDIR}/../public
    57 	find ${SRCDIR} -mindepth 1 -maxdepth 1 -not -path ${DIST} -a -not -name ${pkg} \
    58 		-exec cp -t ${tgtpath}/js/src -dRp {} +
    60 	# distclean if necessary
    61 	if [ -e ${tgtpath}/js/src/Makefile ]; then
    62 		${MAKE} -C ${tgtpath}/js/src distclean
    63 	fi
    65 	cp -t ${tgtpath} -dRp \
    66 		${SRCDIR}/../../python
    67 	${MKDIR} -p ${tgtpath}/dom/bindings
    68 	cp -t ${tgtpath}/dom/bindings -dRp \
    69 		${SRCDIR}/../../dom/bindings/mozwebidlcodegen
    70 	${MKDIR} -p ${tgtpath}/media/webrtc/trunk/tools
    71 	cp -t ${tgtpath}/media/webrtc/trunk/tools -dRp \
    72 		${SRCDIR}/../../media/webrtc/trunk/tools/gyp
    73 	${MKDIR} -p ${tgtpath}/testing
    74 	cp -t ${tgtpath}/testing -dRp \
    75 		${SRCDIR}/../../testing/mozbase
    77 	# remove *.pyc and *.pyo files if any
    78 	find ${tgtpath} -type f -name "*.pyc" -o -name "*.pyo" |xargs rm -f
    80 	# copy or create INSTALL
    81 	if [ -e {DIST}/INSTALL ]; then
    82 		cp -t ${tgtpath} ${DIST}/INSTALL
    83 	else
    84 		cat <<INSTALL_EOF >${tgtpath}/INSTALL
    85 Full build documentation for SpiderMonkey is hosted on MDN:
    86   https://developer.mozilla.org/en-US/docs/SpiderMonkey/Build_Documentation
    88 Note that the libraries produced by the build system include symbols,
    89 causing the binaries to be extremely large. It is highly suggested that \`strip\`
    90 be run over the binaries before deploying them.
    92 Building with default options may be performed as follows:
    93   cd js/src
    94   ./configure
    95   make
    96 INSTALL_EOF
    97 	fi
    99 	# copy or create README
   100 	if [ -e ${DIST}/README ]; then
   101 		cp -t ${tgtpath} ${DIST}/README
   102 	else
   103 		cat <<README_EOF >${tgtpath}/README
   104 This directory contains SpiderMonkey ${MOZJS_MAJOR_VERSION}.
   106 This release is based on a revision of Mozilla ${MOZJS_MAJOR_VERSION}:
   107   http://hg.mozilla.org/releases/
   108 The changes in the patches/ directory were applied.
   110 MDN hosts the latest SpiderMonkey ${MOZJS_MAJOR_VERSION} release notes:
   111   https://developer.mozilla.org/en-US/docs/SpiderMonkey/${MOZJS_MAJOR_VERSION}
   112 README_EOF
   113 	fi
   115 	# copy LICENSE
   116 	if [ -e ${SRCDIR}/../../b2g/LICENSE ]; then
   117 		cp ${SRCDIR}/../../b2g/LICENSE ${tgtpath}/
   118 	else
   119 		cp ${SRCDIR}/../../LICENSE ${tgtpath}/
   120 	fi
   122 	# copy patches dir, if it currently exists in DIST
   123 	if [ -d ${DIST}/patches ]; then
   124 		cp -t ${tgtpath} -dRp ${DIST}/patches
   125 	elif [ -d ${SRCDIR}/../../patches ]; then
   126 		cp -t ${tgtpath} -dRp ${SRCDIR}/../../patches
   127 	fi
   129 	# Roll the tarball
   130 	${TAR} $taropts ${DIST}/../${pkg} -C ${DIST} ${pkgpath}
   131 	echo "done."
   132 	;;
   133 *)
   134 	echo "Unrecognized command: $cmd"
   135 	;;
   136 esac

mercurial