-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-release.sh
executable file
·74 lines (56 loc) · 2.19 KB
/
build-release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# Export the source code
PACKAGE=libircclient
BINARYFILE="libircclient.dll"
FILE_VERSION="src/params.h"
# Get current version
VERSION_MAJOR=`sed -n 's/^\#define\s\+LIBIRC_VERSION_HIGH\s\+\([0-9]\+\)/\1/p' $FILE_VERSION`
VERSION_MINOR=`sed -n 's/^\#define\s\+LIBIRC_VERSION_LOW\s\+\([0-9]\+\)/\1/p' $FILE_VERSION`
CURRENTVER="$VERSION_MAJOR.$VERSION_MINOR"
BUILDDIR="build"
RELEASEDIR="release/$CURRENTVER"
PKGDIR="$PACKAGE-$CURRENTVER"
if [ -d "$BUILDDIR" ]; then
rm -rf "$BUILDDIR"
fi
if [ ! -d "$RELEASEDIR" ]; then
mkdir -p $RELEASEDIR
fi
if [ -d "$PKGDIR" ]; then
rm -rf "$PKGDIR"
fi
# Export the build directory to build the documentation
svn export . "$BUILDDIR/" || exit 1
# Build the documentation
(cd $BUILDDIR/doc && make singlehtml && make man && make latexpdf) || exit 1
# Package the documentations
cp $BUILDDIR/doc/_build/latex/Libircclient.pdf $RELEASEDIR/$PKGDIR.pdf || exit 1
(cd $BUILDDIR/doc/_build/singlehtml && zip -r ../$PKGDIR-html.zip .)
mv $BUILDDIR/doc/_build/$PKGDIR-html.zip $RELEASEDIR/ || exit 1
# Source package
svn export . "$PKGDIR/" || exit 1
mkdir $PKGDIR/man
cp $BUILDDIR/doc/_build/man/libircclient.1 $PKGDIR/man/ || exit 1
tar zcf "$RELEASEDIR/$PKGDIR.tar.gz" $PKGDIR/ || exit 1
rm -rf $PKGDIR/*
# win32
export PATH=$PATH:/usr/toolchains/windows-x86-complete/bin/
(cd $BUILDDIR && ./configure --enable-shared --host=i686-pc-mingw32 && make) || exit 1
BINDIR="$PKGDIR/bin"
mkdir -p $BINDIR
cp $BUILDDIR/src/libircclient.dll $BINDIR/ || exit 1
cp $BUILDDIR/src/libircclient.lib $BINDIR/ || exit 1
mkdir "$PKGDIR/include"
cp include/*.h "$PKGDIR/include" || exit 1
mkdir "$PKGDIR/examples"
cp examples/*.c* $PKGDIR/examples || exit 1
mkdir "$PKGDIR/doc"
cp $RELEASEDIR/$PKGDIR.pdf "$PKGDIR/doc/" || exit 1
zip -r $RELEASEDIR/$PKGDIR-win32-dll.zip $PKGDIR || exit 1
# And the SSL version
(cd $BUILDDIR && make distclean && ./configure --enable-shared --host=i686-pc-mingw32 --enable-openssl && make clean && make) || exit 1
cp $BUILDDIR/src/libircclient.dll $BINDIR/ || exit 1
cp $BUILDDIR/src/libircclient.lib $BINDIR/ || exit 1
zip -r $RELEASEDIR/$PKGDIR-win32-dll-openssl.zip $PKGDIR || exit 1
rm -rf "$BUILDDIR" "$PKGDIR"
echo "Done! Version $CURRENTVER released!"