]> mj.ucw.cz Git - libucw.git/blobdiff - debian/mk
Released as 6.5.7.
[libucw.git] / debian / mk
index e485233779e5f859dcbc0f86c8bd0c97804ac9ee..84b92b5f32053b06b6b13df23325e52271da59a1 100755 (executable)
--- a/debian/mk
+++ b/debian/mk
@@ -1,6 +1,6 @@
 #!/bin/bash
 # A script for building of LibUCW packages
 #!/bin/bash
 # A script for building of LibUCW packages
-# (c) 2013 Pavel Charvat <pchar@ucw.cz>
+# (c) 2013--2017 Pavel Charvat <pchar@ucw.cz>
 
 set -e
 . debian/pkg-lib
 
 set -e
 . debian/pkg-lib
@@ -9,9 +9,14 @@ function usage {
        cat >&2 <<EOF
 Usage: $0 <options>
 Options:
        cat >&2 <<EOF
 Usage: $0 <options>
 Options:
---archonly      Build only binary packages
---cleanup       Cleanup temporary files when finished
---version=<ver> Custom version number of resulting packages (default: autodetect from git-describe)
+--archonly             Build only binary packages
+--no-source            Don't build source files
+--cleanup              Cleanup temporary files when finished
+--version=<ver>                Custom version number of resulting packages (default: autodetect from git-describe)
+--abi-version=<ver>    Custom version number of the LibUCW's ABI (default: defined in ucw/default.cfg)
+--gen-script=<script>  Custom script to postprocess
+--extra-conf=<args>    Add extra arguments to the configure script
+--no-checkout          Expect manually checked out sources to build directory (useful for chrooted building; --version is mandatory)
 EOF
        exit 1
 }
 EOF
        exit 1
 }
@@ -23,13 +28,16 @@ function pkg-gen-debian {(
                PREFIX=/ \
                INSTALL_INCLUDE_DIR=/usr/include/libucw \
                INSTALL_DOC_DIR=/usr/share/doc/libucw/html \
                PREFIX=/ \
                INSTALL_INCLUDE_DIR=/usr/include/libucw \
                INSTALL_DOC_DIR=/usr/share/doc/libucw/html \
-               INSTALL_CONFIG_DIR=/usr/share/doc/libucw/examples/etc \
-               UCW_VERSION="$VER" \
-               UCW_ABI_SUFFIX="-$VER"
+               INSTALL_CONFIG_DIR=/usr/share/doc/libucw/examples/etc
 
        echo "Creating debian/control"
        build/genconf debian/control.in debian/control obj/config.mk
 
 
        echo "Creating debian/control"
        build/genconf debian/control.in debian/control obj/config.mk
 
+       if [ -n "$GEN_SCRIPT" ] ; then
+               echo "Executing $GEN_SCRIPT"
+               eval "$GEN_SCRIPT"
+       fi
+
        echo "Creating debian/changelog"
        export EDITOR=true
        CL=debian/changelog
        echo "Creating debian/changelog"
        export EDITOR=true
        CL=debian/changelog
@@ -42,17 +50,29 @@ function pkg-gen-debian {(
 ROOT="`pwd`"
 PKG=libucw
 ARCHONLY=
 ROOT="`pwd`"
 PKG=libucw
 ARCHONLY=
+NO_SOURCE=
 CLEANUP=
 CONF=
 CLEANUP=
 CONF=
+GEN_SCRIPT=
 while [ -n "$1" ] ; do
        case "$1" in
        --archonly)     ARCHONLY=1
                        ;;
 while [ -n "$1" ] ; do
        case "$1" in
        --archonly)     ARCHONLY=1
                        ;;
+       --no-source)    NO_SOURCE=1
+                       ;;
        --cleanup)      CLEANUP=1
                        ;;
        --version=*)    PKGVER="${1:10}"
                        ;;
        --cleanup)      CLEANUP=1
                        ;;
        --version=*)    PKGVER="${1:10}"
                        ;;
-        *)             usage
+       --abi-version=*)CONF="$CONF UCW_ABI_SUFFIX=-${1:14}"
+                       ;;
+       --gen-script=*) GEN_SCRIPT="${1:13}"
+                       ;;
+       --extra-conf=*) CONF="$CONF ${1:13}"
+                       ;;
+       --no-checkout)  PKG_NO_CHECKOUT=1
+                       ;;
+       *)              usage
                        ;;
        esac
        shift
                        ;;
        esac
        shift
@@ -61,10 +81,17 @@ done
 pkg-git-version
 pkg-git-checkout
 
 pkg-git-version
 pkg-git-checkout
 
-echo $TREEVER >$BUILDDIR/UCW_VERSION
+echo $VER >$BUILDDIR/UCW_VERSION
 pkg-gen-debian
 pkg-gen-debian
-(cd $BUILDDIR && dpkg-buildpackage -rfakeroot -us -uc ${ARCHONLY:+"-B"})
+
+BUILDOPTS=
+if [ -n "$ARCHONLY" ] ; then
+       BUILDOPTS=-B
+elif [ -n "$NO_SOURCE" ] ; then
+       BUILDOPTS=-b
+fi
+(cd $BUILDDIR && dpkg-buildpackage -rfakeroot -us -uc $BUILDOPTS)
 [ -z "$ARCHONLY" ] || rm -f debian-tmp/*_all.deb
 [ -z "$ARCHONLY" ] || rm -f debian-tmp/*_all.deb
-pkg-get-files debian-tmp/*.{deb,dsc,changes}
+pkg-get-files debian-tmp/*.{deb,dsc,changes,tar.gz}
 
 [ -z "$CLEANUP" ] || pkg-cleanup
 
 [ -z "$CLEANUP" ] || pkg-cleanup