more appimage stuff related to installation
[citadel.git] / appimage / build_appimage.sh
1 #!/bin/bash
2
3 export CITADEL_BUILD_DIR=/tmp/citadel-build-$$
4 export WEBCIT_BUILD_DIR=/tmp/webcit-build-$$
5 rm -fr $CITADEL_BUILD_DIR $WEBCIT_BUILD_DIR
6
7 # libcitadel has to be built in a "real" library directory
8 pushd ../libcitadel || exit 1
9 ./bootstrap || exit 1
10 ./configure || exit 1
11 make || exit 1
12 make install || exit 1
13 popd
14
15 # Build the Citadel server
16 pushd ../citadel || exit 1
17 ./bootstrap || exit 1
18 ./configure --prefix=$CITADEL_BUILD_DIR || exit 1
19 make || exit 1
20 make install || exit 1
21 popd
22
23 # Build WebCit
24 pushd ../webcit || exit 1
25 ./bootstrap || exit 1
26 ./configure --prefix=$WEBCIT_BUILD_DIR || exit 1
27 make || exit 1
28 make install || exit 1
29 popd
30
31 # Clear out any old versions in the AppDir
32 rm -frv citadel.AppDir/usr
33 mkdir -p citadel.AppDir/usr/bin
34 mkdir -p citadel.AppDir/usr/lib
35
36 # Copy over all the libraries we used
37 for bin in $CITADEL_BUILD_DIR/citserver $WEBCIT_BUILD_DIR/webcit
38 do
39         for x in `ldd $bin | awk ' { print $3 } ' | grep -v -e '^$' | grep -v 'libc.so' | grep -v 'libpthread.so' | grep -v 'libresolv.so'`
40         do
41                 cp -v -L $x citadel.AppDir/usr/lib/
42         done
43 done
44 ldconfig -v citadel.AppDir/usr/lib
45
46 # Install the Citadel Server application tree
47 mkdir -p citadel.AppDir/usr/local/citadel
48 rsync -va $CITADEL_BUILD_DIR/ ./citadel.AppDir/usr/local/citadel/
49
50 # Install the WebCit application tree
51 mkdir -p citadel.AppDir/usr/local/webcit
52 rsync -va $WEBCIT_BUILD_DIR/ ./citadel.AppDir/usr/local/webcit/
53
54 # Remove the build directories
55 rm -fr $CITADEL_BUILD_DIR $WEBCIT_BUILD_DIR
56
57 cc ctdlvisor.c -o citadel.AppDir/usr/bin/ctdlvisor || exit 1
58
59 cpu=`uname -p`
60 if [ $cpu == x86_64 ] ; then
61         ARCH=x86_64 appimagetool citadel.AppDir/
62         md5sum Citadel-x86_64.AppImage | awk ' { print $1 } ' >Citadel-x86_64.AppImage.md5
63 else
64         ARCH=ARM appimagetool citadel.AppDir/
65         md5sum Citadel-armhf.AppImage | awk ' { print $1 } ' >Citadel-armhf.AppImage.md5
66 fi
67
68