]> mj.ucw.cz Git - libucw.git/blob - debian/mk
Gary: GARY_PUSH and GARY_POP have lost the 2nd argument
[libucw.git] / debian / mk
1 #!/bin/bash
2 # A script for building of LibUCW packages
3 # (c) 2013 Pavel Charvat <pchar@ucw.cz>
4
5 set -e
6 . debian/pkg-lib
7
8 function usage {
9         cat >&2 <<EOF
10 Usage: $0 <options>
11 Options:
12 --archonly      Build only binary packages
13 --cleanup       Cleanup temporary files when finished
14 --version=<ver> Custom version number of resulting packages (default: autodetect from git-describe)
15 EOF
16         exit 1
17 }
18
19 function pkg-gen-debian {(
20         cd $BUILDDIR
21         echo "Configuring"
22         ./configure debian/config VER="$VER" TREEHASH="$TREEHASH" $CONF \
23                 PREFIX=/ \
24                 INSTALL_INCLUDE_DIR=/usr/include/libucw \
25                 INSTALL_DOC_DIR=/usr/share/doc/libucw/html \
26                 INSTALL_CONFIG_DIR=/usr/share/doc/libucw/examples/etc \
27                 UCW_VERSION="$VER" \
28                 UCW_ABI_SUFFIX="-$VER"
29
30         echo "Creating debian/control"
31         build/genconf debian/control.in debian/control obj/config.mk
32
33         echo "Creating debian/changelog"
34         export EDITOR=true
35         CL=debian/changelog
36         rm -f $CL
37         dch --changelog=$CL --create --package=$PKG --newversion=$VER "Automatic release."
38         dch --changelog=$CL --release
39         sed -i '/Initial release/d' $CL
40 )}
41
42 ROOT="`pwd`"
43 PKG=libucw
44 ARCHONLY=
45 CLEANUP=
46 CONF=
47 while [ -n "$1" ] ; do
48         case "$1" in
49         --archonly)     ARCHONLY=1
50                         ;;
51         --cleanup)      CLEANUP=1
52                         ;;
53         --version=*)    PKGVER="${1:10}"
54                         ;;
55         *)              usage
56                         ;;
57         esac
58         shift
59 done
60
61 pkg-git-version
62 pkg-git-checkout
63
64 echo $TREEVER >$BUILDDIR/UCW_VERSION
65 pkg-gen-debian
66 (cd $BUILDDIR && dpkg-buildpackage -rfakeroot -us -uc ${ARCHONLY:+"-B"})
67 [ -z "$ARCHONLY" ] || rm -f debian-tmp/*_all.deb
68 pkg-get-files debian-tmp/*.{deb,dsc,changes}
69
70 [ -z "$CLEANUP" ] || pkg-cleanup