1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#!/bin/bash
echo -ne "NW: building distribution from sources"
# retrieve build infos
VERSION=`cat ${SOURCES}build/VERSION`
REVISION=1
# set used variables
BASEDIR=`pwd`
PKGNAME="nwmatcher"
RELEASE=`date +%Y%m%d%H%M%S`
# set sources
SOURCES=${1}
if [ "${SOURCES}x" == 'x' ]; then
pushd . &> /dev/null
cd ..; SOURCES=`pwd`
popd &> /dev/null
fi
# check working platform
PLATFORM=`uname -s`
# set platform specifick executables
if [ $PLATFORM == 'Darwin' ]; then
JSMIN=bin/jsmin_macos
JSVM=bin/js_macos
elif [ $PLATFORM == 'Linux' ]; then
JSMIN=bin/jsmin_linux
JSVM=bin/js_linux
elif [ $PLATFORM == 'Windows' ]; then
JSMIN=bin/jsmin.exe
JSVM=bin/js.exe
fi
pushd . &> /dev/null
cd $SOURCES
# ensure empty
> dist/$PKGNAME-src.js
> dist/$PKGNAME-min.js
cat build/HEADER >> dist/$PKGNAME-pac.js
# add selector engine to source file
cat src/nwmatcher.js >> dist/$PKGNAME-src.js
# add selector engine to minified file
cat src/nwmatcher.js | $JSMIN | tr -d "\n" >> dist/$PKGNAME-min.js
# minification of variables and privates
echo ""
echo -ne "NW: starting minification, takes time please wait, "
$JSVM build/scripts/nwpacker.js < dist/nwmatcher-src.js >> dist/nwmatcher-pac.js
echo -ne "complete..."
echo ""
# build a compressed version of the minified file
gzip -c -n9 dist/$PKGNAME-pac.js > dist/$PKGNAME-zip.js
# build a versioned file name of the minified file
#cp dist/$PKGNAME-pac.js dist/$PKGNAME-$RELEASE.js
# now copy packed file to the real nwmatcher.js
cp dist/nwmatcher-pac.js dist/nwmatcher.js
popd &> /dev/null
exit 0
|