Makefile: compile shared library only
[lbook_fbreader.git] / build_packages.sh
blob3eb33b712e43deb8b861ac98ad2994574fc184f5
1 #!/bin/sh
3 version=`cat fbreader/VERSION`
4 tmpdir=fbreader-$version
6 if [ "$1" == "-non-GPL" ]; then
7 distdir=distributions-nonGPL
8 pkgdir=packages-nonGPL
9 prepare_nonGPL=true
10 shift;
11 else
12 distdir=distributions
13 pkgdir=packages
14 prepare_nonGPL=false
17 if [ $# != 1 ]; then
18 echo "usage:"
19 echo " $0 [-non-GPL] <architecture>"
20 echo "or"
21 echo " $0 [-non-GPL] all"
22 echo ""
23 echo "available architectures are:"
24 for pkgtype in $distdir/*; do
25 for archtype in $pkgtype/*; do
26 echo " `basename $archtype`-`basename $pkgtype`";
27 done;
28 done;
29 exit 1;
32 create_tmpdir() {
33 mkdir $tmpdir
34 cp -r Makefile build_packages.sh zlibrary fbreader makefiles README.build $distdir $tmpdir
35 rm -rf `find $tmpdir -name ".svn"`
36 make -C $tmpdir distclean 1> /dev/null 2>&1
38 if [ "$prepare_nonGPL" == "true" ]; then
39 pushd $tmpdir > /dev/null;
40 echo -en "Removing Finnish localization... ";
41 rm -rf fbreader/data/resources/fi.xml zlibrary/core/data/resources/fi.xml fbreader/data/help/MiniHelp.*.fi.fb2;
42 echo OK;
43 echo -en "Removing Swedish localization... ";
44 rm -rf fbreader/data/resources/sv.xml zlibrary/core/data/resources/sv.xml fbreader/data/help/MiniHelp.*.sv.fb2;
45 echo OK;
46 echo -en "Removing Czech hyphenation patterns... ";
47 zip -dq zlibrary/text/data/hyphenationPatterns.zip cs.pattern;
48 echo OK;
49 echo -en "Removing Indonesian hyphenation patterns... ";
50 zip -dq zlibrary/text/data/hyphenationPatterns.zip id.pattern;
51 echo OK;
52 echo -en "Removing Qt-based interface... ";
53 rm -rf zlibrary/ui/src/qt zlibrary/ui/src/qt4
54 echo OK;
55 popd > /dev/null;
56 fi;
59 remove_tmpdir() {
60 rm -rf $tmpdir
63 build_package() {
64 make_package="make -f makefiles/packaging.mk -C $tmpdir DIST_DIR=$distdir"
66 case "$2" in
67 debian)
68 case "$1" in
69 maemo)
70 /scratchbox/login sb-conf se SDK_ARM
71 /scratchbox/login -d src/projects/fbreader $make_package ARCHITECTURE=$1 $2
73 maemo2)
74 /scratchbox/login sb-conf se SDK_ARMEL
75 /scratchbox/login -d src/projects/fbreader $make_package ARCHITECTURE=$1 $2
77 maemo4)
78 /scratchbox/login sb-conf se CHINOOK_ARMEL
79 /scratchbox/login -d src/projects/fbreader $make_package ARCHITECTURE=$1 $2
82 $make_package ARCHITECTURE=$1 $2
84 esac;
85 mkdirhier $pkgdir/$1
86 mv -f $tmpdir/*.deb $tmpdir/*.dsc $tmpdir/*.changes $tmpdir/*.tar.gz $pkgdir/$1
88 ipk|debipk)
89 $make_package ARCHITECTURE=$1 $2
90 mkdirhier $pkgdir/$1
91 mv -f $tmpdir/*.ipk $pkgdir/$1
93 motopkg)
94 $make_package ARCHITECTURE=$1 $2
95 mkdirhier $pkgdir/$1
96 mv -f $tmpdir/*.pkg $pkgdir/$1
98 tarball)
99 $make_package ARCHITECTURE=$1 $2
100 mkdirhier $pkgdir/$1
101 mv -f $tmpdir/*.tgz $pkgdir/$1
103 nsi)
104 $make_package ARCHITECTURE=$1 $2
105 mkdirhier $pkgdir/$1
106 mv -f $tmpdir/*.exe $pkgdir/$1
109 echo no rule is defined for package type ''$2'';
111 esac;
114 if [ $1 == all ]; then
115 create_tmpdir
116 for pkgtype in $distdir/*; do
117 for archtype in $pkgtype/*; do
118 build_package `basename $archtype` `basename $pkgtype`;
119 done;
120 done;
121 remove_tmpdir
122 else
123 archtype=`echo $1 | cut -d "-" -f 1`;
124 pkgtype=`echo $1 | cut -d "-" -f 2`;
125 extra=`echo $1 | cut -d "-" -f 3`;
127 if [ "$pkgtype" != "" -a "$extra" == "" -a -d $distdir/$pkgtype/$archtype ]; then
128 create_tmpdir
129 build_package $archtype $pkgtype
130 remove_tmpdir
131 else
132 echo "unknown architecture: $1"