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
8 # This has been checked with shellcheck. It complains about a lot
9 # of missing quotes, but we know, e.g., that $VERSION will not have
10 # spaces in it. RH chose not to fix that stuff.
12 # That said, the variables $BASE and $SRCDIR will cause problems if
13 # they have spaces in them, but RH did not fix that, either, since
14 # he thinks spaces in directory names are just a bad idea.
16 # A few variables need to be set, here at the top.
18 # Where we will do our work
19 BASE="/cvs/lyx/lyx-release";
20 # Where our git repository lives
21 SRCDIR="/cvs/lyx/lyx-20";
23 if [ -z "$EDITOR" ]; then EDITOR=vi; fi
24 # Options to make, when we compile
27 # Determine LyX version
29 VERSION=$(head configure.ac | grep AC_INIT | perl -e 'while (<>) {m/AC_INIT\(LyX,([^,]+)/; print $1;}');
31 echo "This is version $VERSION.";
32 echo -n "Ready to build source packages...";
35 echo "Exporting clean tree...";
36 rm -Rf $BASE/lyx-export/
37 git checkout-index -a -f --prefix=$BASE/lyx-export/
40 rm -Rf $BASE/lyx-build/
41 mkdir $BASE/lyx-build/
44 echo "Building distribution...";
45 $BASE/lyx-export/configure --enable-build-type=rel
46 if ! make lyxdist; then
47 echo "Couldn't make distribution!";
51 echo "Packages created:";
52 cp -v lyx-$VERSION.tar.{gz,xz} $BASE;
54 echo -n "Ready to build signatures...";
57 gpg -b lyx-$VERSION.tar.gz
58 gpg -b lyx-$VERSION.tar.xz
60 echo "Signatures created:"
61 cp -v lyx-$VERSION.tar.*.sig $BASE;
63 echo -n "Ready to test compilation...";
66 rm -Rf $BASE/lyx-test/
69 tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null
70 if ! cd lyx-$VERSION; then
71 echo "Unable to enter build directory!";
75 ./configure --enable-build-type=rel
77 if make $MAKEOPTS; then
78 echo "Compilation complete.";
79 echo -n "Ready to run LyX...";
81 src/lyx -userdir /tmp/lyx-test
83 echo "Compilation errors!!";
87 LASTNUM=$(echo $VERSION | sed -e 's/.*\.//');
88 LAST=$((LASTNUM - 1));
89 FIRST=$(echo $VERSION | sed -e 's/[0-9]*$//');
93 if [ ! -d "$BASE/lyx-patch/" ]; then
94 mkdir "$BASE/lyx-patch/" || exit 1;
97 if [ ! -d "$BASE/lyx-patch/lyx-$LAST" ]; then
98 echo "Can't find directory for last version $LAST.";
99 echo "See if you can fix this in $BASE/lyx-patch/.";
100 echo "Try that, if you like, and then we'll continue.";
101 echo "We'll try to download from the LyX site if that does not work.";
104 if [ ! -d "$BASE/lyx-patch/lyx-$LAST" ]; then
105 echo "Will try to download from LyX site....";
106 pushd $BASE/lyx-patch/;
107 wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz;
108 tar -zxvf lyx-$LAST.tar.gz;
109 if [ ! -f lyx-$LAST.tar.gz ]; then
110 echo "Still unable to find directory for last version $LAST.";
117 echo -n "Ready to make patch against $LAST...";
121 tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null;
123 diff -urN -x .svn -x version.cpp lyx-$LAST lyx-$VERSION > patch
125 echo -n "Please check the patch...";
130 if [ "$LASTNUM" = "1" ]; then
132 elif [ "$LASTNUM" = "2" ]; then
135 NUM="$LASTNUM$NUMFIX";
136 cat $BASE/lyx-export/development/tools/patch-preamble | \
137 sed -e "s/VERSION/$VERSION/; s/ORIGINAL/$ORIGINAL/; s/LAST/$LAST/; s/NUM/$NUM/;" >patch-preamble;
138 echo -n "Please verify the patch preamble...";
140 $EDITOR patch-preamble;
142 PATCH="patch-$VERSION";
143 cat patch-preamble $BASE/lyx-export/ANNOUNCE patch >$PATCH;
144 gzip -c $PATCH > $PATCH.gz
145 if [ -f $PATCH.gz.sig ]; then
149 xz -zc $PATCH > $PATCH.xz
150 if [ -f $PATCH.xz.sig ]; then
155 echo -n "Patch and signatures created...";
156 cp -v $PATCH.gz $PATCH.gz.sig $PATCH.xz $PATCH.xz.sig $BASE;