Add Apache License version 2.0.
[pbc.git] / release
blob3c56f6b7b2afbe8f113ffb239ce7d287cb2dac7c
1 #!/bin/bash
2 # perform sanity checks, make packages
3 VER=`grep AC_INIT configure.ac | sed 's/.*\[\([0-9]*\.[0-9]*\.[0-9]*\)\].*/\1/'`
4 echo Preparing new release: pbc-$VER
5 GREPVER=${VER//\./\\.}
6 if [[ $1 == "test" ]]; then
7 echo test run
8 TESTRUN=1
9 fi
10 if [[ ! -z $(git diff) ]]; then
11 echo Uncommitted changes detected. Commit them first.
12 exit 1
14 git log > ChangeLog
15 cat ChangeLog | head -20 | grep pbc-$GREPVER > /dev/null || {
16 echo git log does not mention release
17 if [[ $TESTRUN ]]; then
18 echo test run: continuing anyway...
19 else
20 exit 1
23 TMPDIR=`mktemp -d` || {
24 echo Error creating temp directory
25 exit 1
27 PBCDIR=$TMPDIR/pbc-$VER
28 echo Running setup...
29 git archive --format=tar --prefix=pbc-$VER/ HEAD | tar xvC $TMPDIR
30 HERE=`pwd`
31 make -f simple.make pbc/parser.tab.c pbc/lex.yy.c
32 cp pbc/parser.tab.[ch] pbc/lex.yy.[ch] $PBCDIR/pbc
33 cp ChangeLog $PBCDIR
34 cd $PBCDIR
35 grep $GREPVER NEWS > /dev/null || {
36 echo NEWS does not mention release
37 if [[ $TESTRUN ]]; then
38 echo test run: continuing anyway...
39 else
40 cd $HERE
41 rm -rf $TMPDIR
42 exit 1
45 grep $GREPVER doc/preface.txt > /dev/null || {
46 echo Error: cannot find $GREPVER in doc/preface.txt.
47 if [[ $TESTRUN ]]; then
48 echo test run: continuing anyway...
49 else
50 cd $HERE
51 rm -rf $TMPDIR
52 exit 1
55 ./setup || {
56 echo ./setup error
57 rm -rf $TMPDIR
58 exit 1
60 cd $TMPDIR
61 echo Creating tarball...
62 rm -rf $PBCDIR/autom4te.cache
63 if [[ $TESTRUN ]]; then
64 echo test run: not building tarball...
65 else
66 tar cvfz $HERE/pbc-$VER.tar.gz pbc-$VER
68 cd $PBCDIR
69 ./configure || {
70 echo ./configure error
71 rm -rf $TMPDIR
72 exit 1
74 echo Testing make...
75 make || {
76 echo make error
77 rm -rf $TMPDIR
78 exit 1
80 make clean
81 echo Cross compiling with simple.make...
82 PLATFORM=win32 colormake -f simple.make || {
83 echo mingw cross compile error
84 rm -rf $TMPDIR
85 exit 1
87 if [[ $TESTRUN ]]; then
88 echo test run: not building zip...
89 else
90 mkdir pbc-$VER
91 mv out/* param/* pbc-$VER
92 cp benchmark/REPORT.BAT pbc-$VER
93 zip -r $HERE/pbc-$VER-win32-bin.zip pbc-$VER
95 rm -rf $TMPDIR
96 echo 'Now run ./publish!'