b3a9949694fe49acdfe1a412b4878b9b88b25066
[maemo-efl] / scripts / e17 / apps / build-expedite-maemo-deb.sh
1 #!/bin/bash
2
3 PRELEASE="indt1"
4 PNAME="expedite"
5 PVER="$(pkg-config --modversion evas)_${PRELEASE}"
6 SECTION="user/accessories"
7
8 DEF_PKGS="expedite"
9
10 DESC="Expedite - Evas Benchmark suite"
11 LONG_DESC="\
12  Homepage: http://www.enlightenment.org/
13 "
14 BDEPENDS="pkg-config, efl-core"
15 DEPENDS="efl-core"
16
17 ARCH="$(arch)"
18
19 export CFLAGS="$CFLAGS -DNDEBUG=1 -fomit-frame-pointer -O2 -mfpu=vfp -mfloat-abi=softfp -mcpu=arm1136jf-s -ffast-math -funsafe-math-optimizations -fno-math-errno -fsingle-precision-constant"
20 DESTDIR="/tmp/$PNAME-$ARCH"
21
22 PKGS="$@"
23 if [ x"$PKGS" = x ]; then
24         PKGS=$DEF_PKGS
25 fi
26
27 die() {
28         echo "ERROR: $@"
29         exit 1
30 }
31
32 if [ x"$NODESTDIR" != x1 ]; then
33     rm -fr $DESTDIR
34 fi
35
36 LOG_PREFIX="$(basename $0)"
37
38 CWD=$PWD
39 for p in $PKGS; do
40     PKG_OPTS_NAME="OPTS_$p"
41     PKG_OPTS="${!PKG_OPTS_NAME}"
42     LOG="/tmp/${LOG_PREFIX}__$p.log"
43
44     echo "Build: $p"
45     echo "$(date) ---- $p" >> "$LOG"
46     cd $CWD/$p || die "missing package $p"
47
48     if [ x"$NORECONFIGURE" != x1 ]; then
49         if [ -f Makefile ] && [  x"$NOMAKE" != x1 ]; then
50             (make uninstall && make distclean) >/dev/null 2>> "$LOG"
51         fi
52         NOCONFIGURE=1 ./autogen.sh >/dev/null 2>> "$LOG" || die "failed to autogen.sh $p"
53
54         OPTS="--prefix=/usr"
55         ./configure $OPTS $PKG_OPTS >/dev/null 2>> "$LOG" || die "failed to configure $p"
56     fi
57
58     if [ x"$NOMAKE" != x1 ]; then
59         make >/dev/null 2>> "$LOG" || die "failed to make $p"
60         make install >/dev/null 2>> "$LOG" || die "failed to install $p"
61     fi
62
63     if [ x"$NODESTDIR" != x1 ]; then
64         make DESTDIR=$DESTDIR install >/dev/null 2>> "$LOG"
65     fi
66     cd $CWD
67 done
68
69 if [ x"$NODESTDIR" != x1 ]; then
70     cd $DESTDIR
71     tar czf $DESTDIR.tar.gz .
72     cd $CWD
73 fi
74
75 ##
76 ## Clean
77 ##
78 find $DESTDIR/usr/lib -name '*.a' -exec rm \{\} \;
79 find $DESTDIR/usr/lib -name '*.la' -exec rm \{\} \;
80 find $DESTDIR/usr/lib -name '*.so' -exec strip -s \{\} \;
81 rm -fr $DESTDIR/usr/include
82 rm -fr $DESTDIR/usr/bin/*-config
83 rm -fr $DESTDIR/usr/lib/pkgconfig
84 SIZE=$(du -sc $DESTDIR | grep total | sed s/total//)
85
86 MENU_DIR="$DESTDIR/usr/share/applications/hildon"
87 mkdir -p "$MENU_DIR"
88
89 cat > "$MENU_DIR/expedite-x11.desktop" <<EOF
90 [Desktop Entry]
91 Encoding=UTF-8
92 Version=1.0
93 Type=Application
94 Name=Expedite - X11
95 Exec=/usr/bin/expedite -e x11
96 EOF
97
98 cat > "$MENU_DIR/expedite-x11-16.desktop" <<EOF
99 [Desktop Entry]
100 Encoding=UTF-8
101 Version=1.0
102 Type=Application
103 Name=Expedite - X11-16
104 Exec=/usr/bin/expedite -e x11-16
105 EOF
106
107
108 ##
109 ## Package
110 ##
111 PDIR="${DESTDIR}-deb"
112 mkdir -p $PDIR
113 cd $PDIR
114 cat > control <<EOF
115 Package: $PNAME
116 Version: $PVER
117 Section: $SECTION
118 Priority: optional
119 Architecture: armel
120 Installed-Size: $SIZE
121 Maintainer: Gustavo Sverzut Barbieri <gustavo.barbieri@openbossa.org>
122 Build-Depends: $BDEPENDS
123 Depends: $DEPENDS
124 Description: $DESC
125 $LONG_DESC
126 EOF
127 echo 2.0 > debian-binary
128 tar czf control.tar.gz control
129 (cd $DESTDIR; tar czf $PDIR/data.tar.gz .)
130 rm -f ${PNAME}_${PVER}.deb
131 ar q ${PNAME}_${PVER}_armel.deb debian-binary control.tar.gz data.tar.gz
132 echo $PWD/${PNAME}_${PVER}_armel.deb