lyx_mirror/development/tools/lyx-build

223 lines
6.0 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# This script builds a maintainance LyX distribution according to
# the procedure outlined at:
# http://wiki.lyx.org/Devel/ReleaseProcedure
# It also includes several other tests, to make sure the packages
# works as it should.
2018-09-08 18:24:49 +00:00
#DEBUG=echo;
2020-06-07 16:36:53 +00:00
#########################################################
# A few variables need to be set, here at the top.
2020-06-07 16:36:53 +00:00
# The script should not need any other customization.
#
# Where we will do our work
BASE="/cvs/lyx/lyx-release";
# Where our git repository lives
2018-08-27 18:06:46 +00:00
SRCDIR="/cvs/lyx/lyx-stable";
# editor
if [ -z "$EDITOR" ]; then EDITOR=vi; fi
2020-06-07 16:36:53 +00:00
#########################################################
# Option variables
# Options to make, when we compile
2020-03-03 19:25:53 +00:00
MAKEOPTS="-j8";
2018-09-08 18:24:49 +00:00
# Compile?
COMPILE="YES";
# Make patch file?
PATCH="YES";
function usage() {
echo "lyx-build [-C] [-m MAKEARGS[ [-P]";
echo " -C: Do not test compilation";
echo " -m MAKEARGS: Arguments for make";
echo " -P: Do not build patch files";
}
2020-06-07 16:37:54 +00:00
while getopts ":Cm:Ph" opt; do
2018-08-30 19:08:47 +00:00
case $opt in
C ) COMPILE="";; # don't test compilation
2018-08-30 19:08:47 +00:00
m ) MAKEOPTS="$OPTARG";;
P ) PATCH="";; # don't build patch files
h ) usage; exit 0;;
\? ) echo "Unknown option $opt"; usage; exit 1;;
2018-08-30 19:08:47 +00:00
esac
done
shift $(($OPTIND - 1));
# Determine LyX version
cd $SRCDIR/
2012-11-04 02:10:40 +00:00
VERSION=$(head configure.ac | grep AC_INIT | perl -e 'while (<>) {m/AC_INIT\(LyX,([^,]+)/; print $1;}');
2020-03-03 19:25:53 +00:00
2020-06-07 16:36:53 +00:00
# Development release?
2020-03-03 19:25:53 +00:00
DEVEL_RELEASE="";
2020-06-07 16:36:53 +00:00
# If the version in configure.ac is e.g. "2.3.4dev", then we are building
# a development release.
2020-06-07 16:39:04 +00:00
PKG_VERSION=${VERSION%dev};
if [ "$VERSION" != "$PKG_VERSION" ]; then
2020-06-07 16:36:53 +00:00
CURHASH=$(git rev-parse HEAD);
# Eight chars should be enough
CURHASH=${CURHASH:0:8};
# New version is e.g. 2.3.4-12649348
2020-06-07 16:39:04 +00:00
PKG_VERSION="$VERSION-$CURHASH";
2020-03-03 19:25:53 +00:00
PATCH="";
fi
2018-08-30 19:08:47 +00:00
2020-06-07 16:39:04 +00:00
echo "This is version $PKG_VERSION.";
echo -n "Ready to build source packages...";
read
echo "Exporting clean tree...";
2018-09-08 18:24:49 +00:00
$DEBUG rm -Rf $BASE/lyx-export/
$DEBUG git checkout-index -a -f --prefix=$BASE/lyx-export/
$DEBUG cd $BASE/lyx-export/
$DEBUG ./autogen.sh
$DEBUG rm -Rf $BASE/lyx-build/
$DEBUG mkdir $BASE/lyx-build/
$DEBUG cd $BASE/lyx-build/
echo "Building distribution...";
2018-09-08 18:24:49 +00:00
$DEBUG $BASE/lyx-export/configure --enable-build-type=rel --enable-qt5
if ! $DEBUG make lyxdist; then
echo "Couldn't make distribution!";
exit 1;
fi
echo "Packages created:";
2020-03-03 19:25:53 +00:00
2020-06-07 16:36:53 +00:00
# This will happen with development releases
2020-06-07 16:39:04 +00:00
if [ ! -f "lyx-$PKG_VERSION.tar.gz" ]; then
$DEBUG mv "lyx-$VERSION.tar.gz" "lyx-$PKG_VERSION.tar.gz" || exit 1;
$DEBUG mv "lyx-$VERSION.tar.xz" "lyx-$PKG_VERSION.tar.xz" || exit 1;
2020-03-03 19:25:53 +00:00
fi
2020-06-07 16:39:04 +00:00
$DEBUG ln lyx-$PKG_VERSION.tar.{gz,xz} $BASE/ || exit 1;
echo -n "Ready to build signatures...";
read
2018-09-08 18:24:49 +00:00
$DEBUG gpg -b lyx-$VERSION.tar.gz
$DEBUG gpg -b lyx-$VERSION.tar.xz
echo "Signatures created:"
2020-06-07 16:36:53 +00:00
$DEBUG ln lyx-$VERSION.tar.*.sig $BASE;
2018-09-08 18:24:49 +00:00
if [ -n "$COMPILE" ]; then
2020-03-03 19:25:53 +00:00
echo -n "Ready to test compilation...";
read
$DEBUG rm -Rf $BASE/lyx-test/
$DEBUG mkdir $BASE/lyx-test/
$DEBUG cd $BASE/lyx-test/
$DEBUG tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz
2020-06-07 16:39:04 +00:00
if ! $DEBUG cd lyx-$PKG_VERSION; then
2020-03-03 19:25:53 +00:00
echo "Unable to enter build directory!";
exit 1;
fi
$DEBUG ./configure --enable-build-type=rel --enable-qt5
if $DEBUG make $MAKEOPTS; then
echo "Compilation complete.";
echo -n "Ready to run LyX...";
read;
$DEBUG src/lyx -userdir /tmp/lyx-test;
else
echo "Compilation errors!!";
exit 1;
fi
fi
2020-03-03 19:25:53 +00:00
if [ -z "$PATCH" ]; then
echo "Skipping patch files.";
exit 0;
fi
2020-06-07 16:39:04 +00:00
LASTNUM=$(echo $PKG_VERSION | sed -e 's/.*\.//');
2018-08-30 19:08:47 +00:00
LAST=$((LASTNUM - 1));
2020-06-07 16:39:04 +00:00
FIRST=$(echo $PKG_VERSION | sed -e 's/[0-9]*$//');
ORIGINAL=${FIRST}0;
LAST=$FIRST$LAST;
if [ ! -d "$BASE/lyx-patch/" ]; then
2018-09-08 18:24:49 +00:00
$DEBUG mkdir "$BASE/lyx-patch/" || exit 1;
fi
2012-11-04 02:10:40 +00:00
if [ ! -d $BASE/lyx-patch/lyx-$LAST ]; then
2018-09-08 18:24:49 +00:00
echo "Can't find directory for last version $LAST.";
echo "See if you can fix this in $BASE/lyx-patch/.";
echo "Try that, if you like, and then we'll continue.";
echo "We'll try to download from the LyX site if that does not work.";
read;
if [ -z "$DEBUG" ]; then
if [ ! -d $BASE/lyx-patch/lyx-$LAST ]; then
echo "Will try to download from LyX site....";
pushd $BASE/lyx-patch/;
wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz;
wget ftp://ftp.lyx.org/pub/lyx/stable/${FIRST}x/lyx-$LAST.tar.gz.sig
gpg -q --verify lyx-$LAST.tar.gz.sig
if ! [ $? == 0 ]; then
echo "Signature wrong!"
exit 1;
fi
rm lyx-$LAST.tar.gz.sig
tar -zxvf lyx-$LAST.tar.gz;
if [ ! -f lyx-$LAST.tar.gz ]; then
echo "Still unable to find directory for last version $LAST.";
exit 1;
fi
$DEBUG popd;
fi
fi
fi
echo -n "Ready to make patch against $LAST...";
read
2018-09-08 18:24:49 +00:00
$DEBUG cd $BASE/lyx-patch/;
if [ -z "$DEBUG" ]; then
tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz >/dev/null;
2020-06-07 16:39:04 +00:00
diff -urN -x .svn -x version.cpp lyx-$LAST lyx-$PKG_VERSION > patch;
2018-09-08 18:24:49 +00:00
echo -n "Please check the patch...";
2020-03-03 19:25:53 +00:00
read;
2018-09-08 18:24:49 +00:00
$EDITOR patch;
else
$DEBUG tar -zxvf $BASE/lyx-build/lyx-$VERSION.tar.gz;
2020-06-07 16:39:04 +00:00
$DEBUG diff -urN -x .svn -x version.cpp lyx-$LAST lyx-$PKG_VERSION;
2018-09-08 18:24:49 +00:00
fi
NUMFIX="th";
if [ "$LASTNUM" = "1" ]; then
NUMFIX="st";
elif [ "$LASTNUM" = "2" ]; then
NUMFIX="nd";
fi
NUM="$LASTNUM$NUMFIX";
2018-09-08 18:24:49 +00:00
if [ -z "$DEBUG" ]; then
cat $BASE/lyx-export/development/tools/patch-preamble | \
2020-06-07 16:39:04 +00:00
sed -e "s/VERSION/$PKG_VERSION/; s/ORIGINAL/$ORIGINAL/; s/LAST/$LAST/; s/NUM/$NUM/;" >patch-preamble;
2018-09-08 18:24:49 +00:00
echo -n "Please verify the patch preamble...";
read
$EDITOR patch-preamble;
PATCH="patch-$VERSION";
cat patch-preamble $BASE/lyx-export/ANNOUNCE patch >$PATCH;
gzip -c $PATCH > $PATCH.gz
if [ -f $PATCH.gz.sig ]; then
rm $PATCH.gz.sig;
fi
gpg -b $PATCH.gz
xz -zc $PATCH > $PATCH.xz
if [ -f $PATCH.xz.sig ]; then
rm $PATCH.xz.sig;
fi
$DEBUG gpg -b $PATCH.xz
2018-09-08 18:24:49 +00:00
echo -n "Patch and signatures created...";
2020-06-07 16:36:53 +00:00
ln $PATCH.gz $PATCH.gz.sig $PATCH.xz $PATCH.xz.sig $BASE;
2012-11-04 02:10:40 +00:00
fi