]> git.lyx.org Git - lyx.git/blob - development/tools/lyx-build
Add support for mixed-encoded biblatex files
[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 # 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.
11
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.
15
16 # A few variables need to be set, here at the top. 
17 #
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";
22 # editor 
23 if [ -z "$EDITOR" ]; then EDITOR=vi; fi
24 # Options to make, when we compile
25 MAKEOPTS="-j4";
26
27 # Determine LyX version
28 cd $SRCDIR/
29 VERSION=$(head configure.ac | grep AC_INIT | perl -e 'while (<>) {m/AC_INIT\(LyX,([^,]+)/; print $1;}');
30
31 echo "This is version $VERSION.";
32 echo -n "Ready to build source packages...";
33 read
34
35 echo "Exporting clean tree...";
36 rm -Rf $BASE/lyx-export/
37 git checkout-index -a -f --prefix=$BASE/lyx-export/
38 cd $BASE/lyx-export/
39 ./autogen.sh
40 rm -Rf $BASE/lyx-build/
41 mkdir $BASE/lyx-build/
42 cd $BASE/lyx-build/
43
44 echo "Building distribution...";
45 $BASE/lyx-export/configure --enable-build-type=rel --enable-qt5
46 if ! make lyxdist; then
47   echo "Couldn't make distribution!";
48   exit 1;
49 fi
50
51 echo "Packages created:";
52 cp -v lyx-$VERSION.tar.{gz,xz} $BASE;
53
54 echo -n "Ready to build signatures...";
55 read
56
57 gpg -b lyx-$VERSION.tar.gz
58 gpg -b lyx-$VERSION.tar.xz
59
60 echo "Signatures created:"
61 cp -v lyx-$VERSION.tar.*.sig $BASE;
62
63 echo -n "Ready to test compilation...";
64 read
65
66 rm -Rf $BASE/lyx-test/
67 mkdir $BASE/lyx-test/
68 cd $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!";
72   exit 1;
73 fi
74
75 ./configure --enable-build-type=rel --enable-qt5
76
77 if make $MAKEOPTS; then
78   echo "Compilation complete.";
79   echo -n "Ready to run LyX...";
80   read
81   src/lyx -userdir /tmp/lyx-test
82 else
83   echo "Compilation errors!!";
84   exit 1;
85 fi
86
87 LASTNUM=$(echo $VERSION | sed -e 's/.*\.//');
88 LAST=$((LASTNUM - 1));
89 FIRST=$(echo $VERSION | sed -e 's/[0-9]*$//');
90 ORIGINAL=${FIRST}0;
91 LAST=$FIRST$LAST;
92
93 if [ ! -d "$BASE/lyx-patch/" ]; then
94         mkdir "$BASE/lyx-patch/" || exit 1;
95 fi
96
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.";
102   read;
103
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     wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz.sig
109     gpg -q --verify lyx-$LAST.tar.gz.sig
110     if ! [ $? == 0 ]; then
111       echo "Signature wrong!"
112       exit 1;
113     fi
114     rm lyx-$LAST.tar.gz.sig
115     tar -zxvf lyx-$LAST.tar.gz;
116     if [ ! -f lyx-$LAST.tar.gz ]; then
117       echo "Still unable to find directory for last version $LAST.";
118       exit 1;
119     fi
120     popd;
121   fi
122 fi
123
124 echo -n "Ready to make patch against $LAST...";
125 read
126
127 cd $BASE/lyx-patch/;
128 tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null;
129
130 diff -urN -x .svn -x version.cpp lyx-$LAST lyx-$VERSION > patch
131
132 echo -n "Please check the patch...";
133 read
134 $EDITOR patch;
135
136 NUMFIX="th";
137 if [ "$LASTNUM" = "1" ]; then
138   NUMFIX="st";
139 elif [ "$LASTNUM" = "2" ]; then
140   NUMFIX="nd";
141 fi
142 NUM="$LASTNUM$NUMFIX";
143 cat $BASE/lyx-export/development/tools/patch-preamble | \
144 sed -e "s/VERSION/$VERSION/; s/ORIGINAL/$ORIGINAL/; s/LAST/$LAST/; s/NUM/$NUM/;" >patch-preamble;
145 echo -n "Please verify the patch preamble...";
146 read
147 $EDITOR patch-preamble;
148
149 PATCH="patch-$VERSION";
150 cat patch-preamble $BASE/lyx-export/ANNOUNCE patch >$PATCH;
151 gzip -c $PATCH > $PATCH.gz
152 if [ -f $PATCH.gz.sig ]; then
153   rm $PATCH.gz.sig;
154 fi
155 gpg -b $PATCH.gz
156 xz -zc $PATCH > $PATCH.xz
157 if [ -f $PATCH.xz.sig ]; then
158         rm $PATCH.xz.sig;
159 fi
160 gpg -b $PATCH.xz
161
162 echo -n "Patch and signatures created...";
163 cp -v $PATCH.gz $PATCH.gz.sig $PATCH.xz $PATCH.xz.sig $BASE;
164
165