Bumping manifests a=b2g-bump
[gecko.git] / js / src / make-source-package.sh
blob057e9328f37400675639eac9834b99fd289fd8c4
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}
31 "build")
32 echo "Packaging source tarball ${pkg}..."
33 if [ -d ${tgtpath} ]; then
34 echo "WARNING - dist tree ${tgtpath} already exists!"
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
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
76 ${MKDIR} -p ${tgtpath}/modules/zlib
77 cp -t ${tgtpath}/modules/zlib -dRp \
78 ${SRCDIR}/../../modules/zlib/src
80 # remove *.pyc and *.pyo files if any
81 find ${tgtpath} -type f -name "*.pyc" -o -name "*.pyo" |xargs rm -f
83 # copy or create INSTALL
84 if [ -e {DIST}/INSTALL ]; then
85 cp -t ${tgtpath} ${DIST}/INSTALL
86 else
87 cat <<INSTALL_EOF >${tgtpath}/INSTALL
88 Full build documentation for SpiderMonkey is hosted on MDN:
89 https://developer.mozilla.org/en-US/docs/SpiderMonkey/Build_Documentation
91 Note that the libraries produced by the build system include symbols,
92 causing the binaries to be extremely large. It is highly suggested that \`strip\`
93 be run over the binaries before deploying them.
95 Building with default options may be performed as follows:
96 cd js/src
97 ./configure
98 make
99 INSTALL_EOF
102 # copy or create README
103 if [ -e ${DIST}/README ]; then
104 cp -t ${tgtpath} ${DIST}/README
105 else
106 cat <<README_EOF >${tgtpath}/README
107 This directory contains SpiderMonkey ${MOZJS_MAJOR_VERSION}.
109 This release is based on a revision of Mozilla ${MOZJS_MAJOR_VERSION}:
110 http://hg.mozilla.org/releases/
111 The changes in the patches/ directory were applied.
113 MDN hosts the latest SpiderMonkey ${MOZJS_MAJOR_VERSION} release notes:
114 https://developer.mozilla.org/en-US/docs/SpiderMonkey/${MOZJS_MAJOR_VERSION}
115 README_EOF
118 # copy LICENSE
119 if [ -e ${SRCDIR}/../../b2g/LICENSE ]; then
120 cp ${SRCDIR}/../../b2g/LICENSE ${tgtpath}/
121 else
122 cp ${SRCDIR}/../../LICENSE ${tgtpath}/
125 # copy patches dir, if it currently exists in DIST
126 if [ -d ${DIST}/patches ]; then
127 cp -t ${tgtpath} -dRp ${DIST}/patches
128 elif [ -d ${SRCDIR}/../../patches ]; then
129 cp -t ${tgtpath} -dRp ${SRCDIR}/../../patches
132 # Roll the tarball
133 ${TAR} $taropts ${DIST}/../${pkg} -C ${DIST} ${pkgpath}
134 echo "done."
137 echo "Unrecognized command: $cmd"
139 esac