1#!/bin/bash
2
3# Before using this you probably need to install
4#   sudo pbuilder yada devscripts lintian cdebootstrap
5# and maybe dpkg-sig.  Also:
6# set up for sudo
7# set up pbuilder's /etc/pbuilderrc (maybe no attention needed these days)
8#   sudo pbuilder create --distribution squeeze
9# and/or update with
10#   sudo pbuilder update
11# Expect a lot of warnings re LOGNAME - see Debian bug Bug#275118
12
13# TODO: DEBEMAIL
14
15VER=`./VERSION`
16
17TARBALL=evolvotron-${VER}.tar.gz
18
19if [ ! -s ${TARBALL} ] ; then
20    echo "Could't find ${TARBALL}" ;
21    exit ;
22fi
23
24export DISTRIBUTION=`lsb_release -s -c`
25
26echo "*** Will package ${TARBALL} for distribution \"${DISTRIBUTION}\""
27echo -n "*** Starting in 5 seconds..."
28for t in 5 4 3 2 1 ; do sleep 1 ; echo -n "." ; done
29
30PROJECT=`echo $TARBALL | sed 's/-.*//'`
31TARBALLORIG="${PROJECT}_${VER}.orig.tar.gz"
32REV="1${DISTRIBUTION}1"
33
34WORKDIR=pkg_${VER}-${REV}
35rm -r -f ${WORKDIR}
36mkdir ${WORKDIR}
37cd ${WORKDIR}
38
39cp ../${TARBALL} ${TARBALLORIG}
40tar xvfz ${TARBALLORIG}
41mv ${PROJECT} ${PROJECT}-${VER}
42cd ${PROJECT}-${VER}
43sed -i "s/${VER}/${VER}-${REV}/g" VERSION
44
45mkdir debian
46dch --create --package evolvotron --distribution stable --newversion ${VER}-${REV} "Created by mkdeb script"
47
48cat << EOF > debian/packages
49Source: evolvotron
50Section: graphics
51Priority: extra
52Maintainer: Tim Day <timday@bottlenose.demon.co.uk>
53Standards-Version: 3.6.1
54Upstream-Source: <URL:http://sourceforge.net/projects/evolvotron/index.htm>
55Home-Page: <URL:http://www.bottlenose.demon.co.uk/share/evolvotron>
56Description: Interactive evolutionary texture generator
57Copyright: GPL
58 Copyright 2009 Tim Day
59Build-Depends: qt4-qmake,qt4-dev-tools,libqt4-dev,libqt4-xml,libboost-dev,libboost-program-options-dev,yada
60Build: sh
61 export QTDIR=/usr/share/qt4
62 # Note: yada install deals with DEB_BUILD_OPTIONS 'nostrip'
63 if [ "${DEB_BUILD_OPTIONS#*noopt}" != "$DEB_BUILD_OPTIONS" ]; then
64   ./configure "CONFIG -= release" "CONFIG += debug"
65 else
66   ./configure # No noticeable advantage in overriding qt optimisation options
67 fi
68 make
69Clean: sh
70 make distclean || make clean || true
71
72Package: evolvotron
73Architecture: any
74Depends: []
75Suggests: gimp
76Description: Interactive evolutionary texture generator
77 A "generative art" application to evolve images/textures/patterns through an 
78 iterative process of random mutation and user-selection driven evolution.
79 If you like lava lamps, and never got bored with the Mandelbrot Set,
80 this could be the software for you.
81Install: sh
82 yada install -bin evolvotron/evolvotron
83 yada install -bin evolvotron_mutate/evolvotron_mutate
84 yada install -bin evolvotron_render/evolvotron_render
85 yada install -bin evolvotron/evolvotron
86 yada install -doc evolvotron.html
87 yada install -doc BUGS TODO NEWS USAGE
88 yada install -man man/man1/evolvotron.1
89 yada install -man man/man1/evolvotron_mutate.1
90 yada install -man man/man1/evolvotron_render.1
91Menu: ?package(evolvotron): needs="X11" section="Applications/Graphics" title="Evolvotron" hints="Bitmap" command="/usr/bin/evolvotron" longtitle="Evolutionary art program"
92EOF
93
94yada rebuild
95
96cd ..
97dpkg-source -b ${PROJECT}-${VER} ${TARBALLORIG}
98
99# Alternative but inferior approach is apparently to do
100#   dpkg-buildpackage -rfakeroot
101
102mkdir result
103echo "Building package"
104sudo pbuilder build --allow-untrusted --buildresult ./result ${PROJECT}_${VER}-${REV}.dsc
105
106sudo chown ${USER}:${USER} result/*
107
108RESULT=`(cd .. ; find ${WORKDIR} -name '*.deb')`
109echo "Results: ${RESULT}"
110echo "Don't forget to lintian ${RESULT}"
111echo 'Also dpkg-sig --sign builder -k $DPKGSIG_KEYID any .deb files'
112
113