1#!/bin/bash
2#
3# Note: Build support for 32 bit and 64 bit.
4#
5# Difference in Control file: Line 13
6#       32bit:= Architecture: i386
7#       64bit:= Architecture: amd64
8#
9# To build the amd64 (64 bit version), set variable below to amd64
10#
11
12# Specify system Architecture  ("i386" or "amd64")
13ARCHITECTURE="amd64"
14
15# Specify the build version of mmex
16MMEX_VERSION="1.2.7"
17MMEX_RELEASE_DATE="2016-01-24"
18EMAIL="moneymanagerex@moneymanagerex.org"
19HOMEPAGE="http://www.moneymanagerex.org"
20BUILD_DIR="$HOME/build"
21RELEASE_DIR="release"
22
23PACKAGE_NAME="mmex-$MMEX_VERSION-$ARCHITECTURE"
24
25BUILD_DIR="$HOME/build"
26cd ../../..
27MMEX_DIR=`pwd`
28
29mkdir $RELEASE_DIR
30
31./bootstrap
32if [ $? -gt 0 ]; then
33    echo "ERROR!"
34    exit 1
35fi
36
37cd $RELEASE_DIR
38../configure --prefix=$BUILD_DIR/$PACKAGE_NAME/usr
39
40if [ $? -gt 0 ]; then
41    echo "ERROR!"
42    exit 1
43fi
44make && make install
45if [ $? -gt 0 ]; then
46    echo "ERROR!"
47    exit 1
48fi
49
50cd -
51
52#Strip the binary before calculating the installed size
53strip $BUILD_DIR/$PACKAGE_NAME/usr/bin/mmex
54
55#Make sure any needed files are in place and formatted correctly
56#Changelog
57mv $BUILD_DIR/$PACKAGE_NAME/usr/share/doc/mmex/version.txt $BUILD_DIR/$PACKAGE_NAME/usr/share/doc/mmex/changelog
58gzip -9 -f $BUILD_DIR/$PACKAGE_NAME/usr/share/doc/mmex/changelog
59
60#Copyright
61cp $BUILD_DIR/$PACKAGE_NAME/usr/share/doc/mmex/contrib.txt $BUILD_DIR/$PACKAGE_NAME/usr/share/doc/mmex/copyright
62
63#Manpage
64cp $MMEX_DIR/setup/linux/debian/mmex.1 $BUILD_DIR/$PACKAGE_NAME/usr/share/man/man1/mmex.1
65sed -i "s/MMEX_RELEASE_DATE/$MMEX_RELEASE_DATE/g" $BUILD_DIR/$PACKAGE_NAME/usr/share/man/man1/mmex.1
66sed -i "s/MMEX_VERSION/$MMEX_VERSION/g" $BUILD_DIR/$PACKAGE_NAME/usr/share/man/man1/mmex.1
67gzip -9 -f $BUILD_DIR/$PACKAGE_NAME/usr/share/man/man1/mmex.1
68chmod 0644 $BUILD_DIR/$PACKAGE_NAME/usr/share/man/man1/mmex.1.gz
69
70#Calculate installed size
71INSTALLED_SIZE=$(du -sb $BUILD_DIR/ | cut -f1)
72INSTALLED_SIZE=`expr $INSTALLED_SIZE / 1024`
73
74mkdir -p $BUILD_DIR/$PACKAGE_NAME/DEBIAN
75
76echo "Package: mmex
77Version: $MMEX_VERSION
78Section: misc
79Priority: extra
80Architecture: $ARCHITECTURE
81Homepage: $HOMEPAGE
82Depends: libc6 (>= 2.3.5-1), libwxgtk3.0-0 (>= 3.0.0)
83Installed-Size: $INSTALLED_SIZE
84Maintainer: MoneyManagerEx <$EMAIL>
85Description: Simple to use financial management software
86 Money Manager Ex (MMEX) is a free, open-source,
87 cross-platform, easy-to-use personal finance software.
88 It primarily helps organize one's finances and keeps
89 track of where, when and how the money goes.
90 MMEX includes all the basic features that 90% of users
91 would want to see in a personal finance application.
92 The design goals are to concentrate on simplicity
93 and user friendliness - something one can use everyday." > $BUILD_DIR/$PACKAGE_NAME/DEBIAN/control
94
95cd $BUILD_DIR
96fakeroot dpkg-deb -b $PACKAGE_NAME
97
98lintian $PACKAGE_NAME.deb
99# check errors against other lintian deb
100
101# install the package (Have you backed up your databases?)
102
103#sudo dpkg -i mmex.deb
104#mmex&
105
106