]> mj.ucw.cz Git - libucw.git/blob - debian/mk
Packages: Improved installation of example configs.
[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
28         echo "Creating debian/control"
29         build/genconf debian/control.in debian/control obj/config.mk
30
31         echo "Creating debian/changelog"
32         export EDITOR=true
33         CL=debian/changelog
34         rm -f $CL
35         dch --changelog=$CL --create --package=$PKG --newversion=$VER "Automatic release."
36         dch --changelog=$CL --release
37         sed -i '/Initial release/d' $CL
38 )}
39
40 ROOT="`pwd`"
41 PKG=libucw
42 ARCHONLY=
43 CLEANUP=
44 CONF=
45 while [ -n "$1" ] ; do
46         case "$1" in
47         --archonly)     ARCHONLY=1
48                         ;;
49         --cleanup)      CLEANUP=1
50                         ;;
51         --version=*)    PKGVER="${1:10}"
52                         ;;
53         *)              usage
54                         ;;
55         esac
56         shift
57 done
58
59 pkg-git-version
60 pkg-git-checkout
61
62 echo $TREEVER >$BUILDDIR/UCW_VERSION
63 pkg-gen-debian
64 (cd $BUILDDIR && dpkg-buildpackage -rfakeroot -us -uc ${ARCHONLY:+"-B"})
65 [ -z "$ARCHONLY" ] || rm -f debian-tmp/*_all.deb
66 pkg-get-files debian-tmp/*.{deb,dsc,changes}
67
68 [ -z "$CLEANUP" ] || pkg-cleanup