3 # args 3 and 4 are optional
4 if [ -z "$1" -o -z "$2" ] ; then
6 echo "Usage: ./make-deb.sh tarball deb_targets [build_dir results_dir]"
8 echo "Creates <build_dir>/binarybuild, expands the tarball into it,"
9 echo "and builds debian packages. After the build, all deb"
10 echo "files are copied into <results_dir>/results/"
11 echo "Therefore <build_dir> and <results_dir> can be the same"
12 echo "if needed, without harm."
14 echo "If build_dir or results_dir are empty, the current directory,"
15 echo "plus the corresponding binarybuild and results directories,"
18 echo "tarball is the full pathname of the tarball to extract."
19 echo "It is allowed to be relative to the current directory."
21 echo "deb_targets is a full command line of what you want to build."
22 echo "For example: fakeroot -- debian/rules binary"
29 BUILDPATH
="$3/binarybuild"
31 BUILDPATH
="binarybuild"
41 # Note that all commands below are done from the current directory.
42 # Where the directory must change, it is done within brackets so that
43 # we return to the current directory immediately afterward.
45 # This is so that all paths and directories given on the command line
46 # may be relative, and everything still works.
56 tar -C "$BUILDPATH" -xjvf "$TARBALL"
58 # build binary packages
59 if ! (cd "$BUILDPATH"/* && eval $DEBTARGETS) ; then
60 echo "DEB build failed"
64 # move results to destination directory
65 mv $
(find "$BUILDPATH" -type f
-name "*.deb" -print) "$DESTPATH"