debian: added copyrights for the spanish and french translators
[barry.git] / maintainer / make-deb.sh
blob7d74eedf844831eadb3ab0f266a4c74085c87b4f
1 #!/bin/bash
3 # args 3 and 4 are optional
4 if [ -z "$1" -o -z "$2" ] ; then
5 echo
6 echo "Usage: ./make-deb.sh tarball deb_targets [build_dir results_dir]"
7 echo
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."
13 echo
14 echo "If build_dir or results_dir are empty, the current directory,"
15 echo "plus the corresponding binarybuild and results directories,"
16 echo "are used."
17 echo
18 echo "tarball is the full pathname of the tarball to extract."
19 echo "It is allowed to be relative to the current directory."
20 echo
21 echo "deb_targets is a full command line of what you want to build."
22 echo "For example: fakeroot -- debian/rules binary"
23 echo
24 exit 1
27 TARBALL="$1"
28 DEBTARGETS="$2"
29 BUILDPATH="$3/binarybuild"
30 if [ -z "$3" ] ; then
31 BUILDPATH="binarybuild"
33 DESTPATH="$4/results"
34 if [ -z "$4" ] ; then
35 DESTPATH="results"
38 set -e
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.
49 # setup directories
50 rm -rf "$BUILDPATH"
51 mkdir -p "$BUILDPATH"
52 rm -rf "$DESTPATH"
53 mkdir -p "$DESTPATH"
55 # expand source
56 tar -C "$BUILDPATH" -xjvf "$TARBALL"
58 # build binary packages
59 if ! (cd "$BUILDPATH"/* && eval $DEBTARGETS) ; then
60 echo "DEB build failed"
61 exit 1
64 # move results to destination directory
65 mv $(find "$BUILDPATH" -type f -name "*.deb" -print) "$DESTPATH"