]> mj.ucw.cz Git - libucw.git/blob - debian/mk
Merge branch 'master' of ssh://jabberwock.ucw.cz/projects/libucw/GIT/libucw
[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 --abi-version=<ver>     Custom version number of the LibUCW's ABI (default: defined in ucw/default.cfg)
16 EOF
17         exit 1
18 }
19
20 function pkg-gen-debian {(
21         cd $BUILDDIR
22         echo "Configuring"
23         ./configure debian/config VER="$VER" TREEHASH="$TREEHASH" $CONF \
24                 PREFIX=/ \
25                 INSTALL_INCLUDE_DIR=/usr/include/libucw \
26                 INSTALL_DOC_DIR=/usr/share/doc/libucw/html \
27                 INSTALL_CONFIG_DIR=/usr/share/doc/libucw/examples/etc
28
29         echo "Creating debian/control"
30         build/genconf debian/control.in debian/control obj/config.mk
31
32         echo "Creating debian/changelog"
33         export EDITOR=true
34         CL=debian/changelog
35         rm -f $CL
36         dch --changelog=$CL --create --package=$PKG --newversion=$VER "Automatic release."
37         dch --changelog=$CL --release
38         sed -i '/Initial release/d' $CL
39 )}
40
41 ROOT="`pwd`"
42 PKG=libucw
43 ARCHONLY=
44 CLEANUP=
45 CONF=
46 while [ -n "$1" ] ; do
47         case "$1" in
48         --archonly)     ARCHONLY=1
49                         ;;
50         --cleanup)      CLEANUP=1
51                         ;;
52         --version=*)    PKGVER="${1:10}"
53                         ;;
54         --abi-version=*)CONF="$CONF UCW_ABI_SUFFIX=-${1:14}"
55                         ;;
56         *)              usage
57                         ;;
58         esac
59         shift
60 done
61
62 pkg-git-version
63 pkg-git-checkout
64
65 echo $TREEVER >$BUILDDIR/UCW_VERSION
66 pkg-gen-debian
67 (cd $BUILDDIR && dpkg-buildpackage -rfakeroot -us -uc ${ARCHONLY:+"-B"})
68 [ -z "$ARCHONLY" ] || rm -f debian-tmp/*_all.deb
69 pkg-get-files debian-tmp/*.{deb,dsc,changes}
70
71 [ -z "$CLEANUP" ] || pkg-cleanup