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