1#!/bin/sh 2# Release the QuickJS source code 3 4set -e 5 6version=`cat VERSION` 7 8if [ "$1" = "-h" ] ; then 9 echo "release.sh [release_list]" 10 echo "" 11 echo "release_list: extras binary win_binary quickjs" 12 13 exit 1 14fi 15 16release_list="extras binary win_binary quickjs" 17 18if [ "$1" != "" ] ; then 19 release_list="$1" 20fi 21 22#################################################" 23# extras 24 25if echo $release_list | grep -w -q extras ; then 26 27d="quickjs-${version}" 28name="quickjs-extras-${version}" 29outdir="/tmp/${d}" 30 31rm -rf $outdir 32mkdir -p $outdir $outdir/unicode $outdir/tests 33 34cp unicode/* $outdir/unicode 35cp -a tests/bench-v8 $outdir/tests 36 37( cd /tmp && tar Jcvf /tmp/${name}.tar.xz ${d} ) 38 39fi 40 41#################################################" 42# Windows binary release 43 44if echo $release_list | grep -w -q win_binary ; then 45 46# win64 47 48dlldir=/usr/x86_64-w64-mingw32/sys-root/mingw/bin 49cross_prefix="x86_64-w64-mingw32-" 50d="quickjs-win-x86_64-${version}" 51outdir="/tmp/${d}" 52 53rm -rf $outdir 54mkdir -p $outdir 55 56make CONFIG_WIN32=y qjs.exe 57cp qjs.exe $outdir 58${cross_prefix}strip $outdir/qjs.exe 59cp $dlldir/libwinpthread-1.dll $outdir 60 61( cd /tmp/$d && rm -f ../${d}.zip && zip -r ../${d}.zip . ) 62 63make CONFIG_WIN32=y clean 64 65# win32 66 67dlldir=/usr/i686-w64-mingw32/sys-root/mingw/bin 68cross_prefix="i686-w64-mingw32-" 69d="quickjs-win-i686-${version}" 70outdir="/tmp/${d}" 71 72rm -rf $outdir 73mkdir -p $outdir 74 75make clean 76make CONFIG_WIN32=y clean 77 78make CONFIG_WIN32=y CONFIG_M32=y qjs.exe 79cp qjs.exe $outdir 80${cross_prefix}strip $outdir/qjs.exe 81cp $dlldir/libwinpthread-1.dll $outdir 82 83( cd /tmp/$d && rm -f ../${d}.zip && zip -r ../${d}.zip . ) 84 85fi 86 87#################################################" 88# Linux binary release 89 90if echo $release_list | grep -w -q binary ; then 91 92make clean 93make CONFIG_WIN32=y clean 94make -j4 qjs run-test262 95make -j4 CONFIG_M32=y qjs32 run-test262-32 96strip qjs run-test262 qjs32 run-test262-32 97 98d="quickjs-linux-x86_64-${version}" 99outdir="/tmp/${d}" 100 101rm -rf $outdir 102mkdir -p $outdir 103 104cp qjs run-test262 $outdir 105 106( cd /tmp/$d && rm -f ../${d}.zip && zip -r ../${d}.zip . ) 107 108d="quickjs-linux-i686-${version}" 109outdir="/tmp/${d}" 110 111rm -rf $outdir 112mkdir -p $outdir 113 114cp qjs32 $outdir/qjs 115cp run-test262-32 $outdir/run-test262 116 117( cd /tmp/$d && rm -f ../${d}.zip && zip -r ../${d}.zip . ) 118 119fi 120 121#################################################" 122# quickjs 123 124if echo $release_list | grep -w -q quickjs ; then 125 126make build_doc 127 128d="quickjs-${version}" 129outdir="/tmp/${d}" 130 131rm -rf $outdir 132mkdir -p $outdir $outdir/doc $outdir/tests $outdir/examples 133 134cp Makefile VERSION TODO Changelog readme.txt release.sh unicode_download.sh \ 135 qjs.c qjsc.c qjscalc.js repl.js \ 136 quickjs.c quickjs.h quickjs-atom.h \ 137 quickjs-libc.c quickjs-libc.h quickjs-opcode.h \ 138 cutils.c cutils.h list.h \ 139 libregexp.c libregexp.h libregexp-opcode.h \ 140 libunicode.c libunicode.h libunicode-table.h \ 141 libbf.c libbf.h \ 142 unicode_gen.c unicode_gen_def.h \ 143 run-test262.c test262o.conf test262.conf \ 144 test262o_errors.txt test262_errors.txt \ 145 $outdir 146 147cp tests/*.js tests/*.patch tests/bjson.c $outdir/tests 148 149cp examples/*.js examples/*.c $outdir/examples 150 151cp doc/quickjs.texi doc/quickjs.pdf doc/quickjs.html \ 152 doc/jsbignum.texi doc/jsbignum.html doc/jsbignum.pdf \ 153 $outdir/doc 154 155( cd /tmp && tar Jcvf /tmp/${d}.tar.xz ${d} ) 156 157fi 158