]> git.lyx.org Git - lyx.git/blob - development/tools/lyx-build
Remove InsetMathXYArrow
[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/AC_INIT\(LyX,([^,]+)/; 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 $BASE/lyx-patch/lyx-$LAST ]; then 
90   echo "Can't find directory for last version $LAST.";
91   echo "See if you can fix this in $BASE/lyx-patch/.";
92   echo "Try that, if you like, and then we'll continue.";
93   echo "We'll try to download from the LyX site if that does not work.";
94   read;
95
96   if [ ! -d $BASE/lyx-patch/lyx-$LAST ]; then 
97     echo "Will try to download from LyX site....";
98     pushd $BASE/lyx-patch/;
99     wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz;
100     tar -zxvf lyx-$LAST.tar.gz;
101     if [ ! -f lyx-$LAST.tar.gz ]; then
102       echo "Still unable to find directory for last version $LAST.";
103       exit 1;
104     fi
105     popd;
106   fi
107 fi
108
109 echo -n "Ready to make patch against $LAST...";
110 read
111
112 cd $BASE/lyx-patch/;
113 tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null;
114
115 diff -urN -x .svn -x version.cpp lyx-$LAST lyx-$VERSION > patch
116
117 echo -n "Please check the patch...";
118 read
119 $EDITOR patch;
120
121 NUMFIX="th";
122 if [ "$LASTNUM" = "1" ]; then
123   NUMFIX="st";
124 elif [ "$LASTNUM" = "2" ]; then
125   NUMFIX="nd";
126 fi
127 NUM="$LASTNUM$NUMFIX";
128 cat $BASE/lyx-export/development/tools/patch-preamble | \
129 sed -e "s/VERSION/$VERSION/; s/ORIGINAL/$ORIGINAL/; s/LAST/$LAST/; s/NUM/$NUM/;" >patch-preamble;
130 echo -n "Please verify the patch preamble...";
131 read
132 $EDITOR patch-preamble;
133
134 PATCH="patch-$VERSION";
135 cat patch-preamble $BASE/lyx-export/ANNOUNCE patch >$PATCH;
136 gzip -c $PATCH > $PATCH.gz
137 if [ -f $PATCH.gz.sig ]; then
138   rm $PATCH.gz.sig;
139 fi
140 gpg -b $PATCH.gz
141 xz -zc $PATCH > $PATCH.xz
142 if [ -f $PATCH.xz.sig ]; then
143         rm $PATCH.xz.sig;
144 fi
145 gpg -b $PATCH.xz
146
147 echo -n "Patch and signatures created...";
148 cp -v $PATCH.gz $PATCH.gz.sig $PATCH.xz $PATCH.xz.sig $BASE;
149
150