]> git.lyx.org Git - lyx.git/blob - development/tools/lyx-build
Update distribution build script for git.
[lyx.git] / development / tools / lyx-build
1 #!/bin/bash
2 # This script builds a maintainance LyX distribution according to 
3 # the procedure outlined at:
4 #   http://wiki.lyx.org/Devel/ReleaseProcedure
5 # It also includes several other tests, to make sure the packages
6 # works as it should.
7
8 # A few variables need to be set, here at the top. 
9 #
10 # Where we will do our work
11 BASE="/cvs/lyx/lyx-release";
12 # Where our git repository lives
13 SRCDIR="/cvs/lyx/lyx-20";
14 # editor 
15 if [ -z "$EDITOR" ]; then EDITOR=vi; fi
16 # Options to make, when we compile
17 MAKEOPTS="-j4";
18
19 # Determine LyX version
20 cd $SRCDIR/
21 VERSION=$(head configure.ac | grep AC_INIT | perl -e 'while (<>) {m/(\d\.\d+\.\d+)/; print $1;}');
22
23 echo "This is version $VERSION.";
24 echo -n "Ready to build source packages...";
25 read
26
27 echo "Exporting clean tree...";
28 rm -Rf $BASE/lyx-export/
29 git checkout-index -a -f --prefix=$BASE/lyx-export/
30 cd $BASE/lyx-export/
31 ./autogen.sh
32 rm -Rf $BASE/lyx-build/
33 mkdir $BASE/lyx-build/
34 cd $BASE/lyx-build/
35
36 echo "Building distribution...";
37 $BASE/lyx-export/configure --enable-build-type=rel
38 if ! make lyxdist; then
39   echo "Couldn't make distribution!";
40   exit 1;
41 fi
42
43 echo "Packages created:";
44 cp -v lyx-$VERSION.tar.{gz,xz} $BASE;
45
46 echo -n "Ready to build signatures...";
47 read
48
49 gpg -b lyx-$VERSION.tar.gz
50 gpg -b lyx-$VERSION.tar.xz
51
52 echo "Signatures created:"
53 cp -v lyx-$VERSION.tar.*.sig $BASE;
54
55 echo -n "Ready to test compilation...";
56 read
57
58 rm -Rf $BASE/lyx-test/
59 mkdir $BASE/lyx-test/
60 cd $BASE/lyx-test/
61 tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null
62 if ! cd lyx-$VERSION; then
63   echo "Unable to enter build directory!";
64   exit 1;
65 fi
66
67 ./configure --enable-build-type=rel
68
69 if make $MAKEOPTS; then
70   echo "Compilation complete.";
71   echo -n "Ready to run LyX...";
72   read
73   src/lyx -userdir /tmp/lyx-test
74 else
75   echo "Compilation errors!!";
76   exit 1;
77 fi
78
79 LASTNUM=$(echo $VERSION | sed -e 's/.*\.//');
80 LAST=$(($LASTNUM - 1));
81 FIRST=$(echo $VERSION | sed -e 's/[0-9]*$//');
82 ORIGINAL=${FIRST}0;
83 LAST=$FIRST$LAST;
84
85 if [ ! -d "$BASE/lyx-patch/" ]; then
86         mkdir "$BASE/lyx-patch/" || exit 1;
87 fi
88
89 if [ ! -d lyx-$LAST ]; then 
90   echo "Can't find directory for last version $LAST.";
91   echo "Will try to download from LyX site....";
92   read;
93   wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz;
94   tar -zxvf lyx-$LAST.tar.gz;
95   if [ ! -f lyx-$LAST.tar.gz ]; then
96     echo "Still unable to find directory for last version $LAST.";
97     exit 1;
98   fi
99 fi
100
101 echo -n "Ready to make patch against $LAST...";
102 read
103
104 cd $BASE/lyx-patch/;
105 tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null;
106
107 diff -urN -x .svn -x version.cpp lyx-$LAST lyx-$VERSION > patch
108
109 echo -n "Please check the patch...";
110 read
111 $EDITOR patch;
112
113 NUMFIX="th";
114 if [ "$LASTNUM" = "1" ]; then
115   NUMFIX="st";
116 elif [ "$LASTNUM" = "2" ]; then
117   NUMFIX="nd";
118 fi
119 NUM="$LASTNUM$NUMFIX";
120 cat $BASE/lyx-export/development/tools/patch-preamble | \
121 sed -e "s/VERSION/$VERSION/; s/ORIGINAL/$ORIGINAL/; s/LAST/$LAST/; s/NUM/$NUM/;" >patch-preamble;
122 echo -n "Please verify the patch preamble...";
123 read
124 $EDITOR patch-preamble;
125
126 PATCH="patch-$VERSION";
127 cat patch-preamble patch >$PATCH;
128 gzip -c $PATCH > $PATCH.gz
129 if [ -f $PATCH.gz.sig ]; then
130   rm $PATCH.gz.sig;
131 fi
132 gpg -b $PATCH.gz
133 xz -zc $PATCH > $PATCH.xz
134 rm $PATCH.xz.sig;
135 gpg -b $PATCH.xz
136
137 echo -n "Patch and signatures created...";
138 cp -v $PATCH.gz $PATCH.gz.sig $PATCH.xz $PATCH.xz.sig $BASE;
139
140