From c748dfa24eb7da729e781d3f8cfb277d75b806e4 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Fri, 6 Dec 2013 20:49:07 +0100 Subject: [PATCH] Packages: First experiments with Debian packages. --- debian/compat | 1 + debian/config | 13 +++++++++ debian/control.in | 21 ++++++++++++++ debian/copyright | 6 ++++ debian/mk | 64 ++++++++++++++++++++++++++++++++++++++++++ debian/pkg-lib | 71 +++++++++++++++++++++++++++++++++++++++++++++++ debian/rules | 66 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 242 insertions(+) create mode 100644 debian/compat create mode 100644 debian/config create mode 100644 debian/control.in create mode 100644 debian/copyright create mode 100755 debian/mk create mode 100755 debian/pkg-lib create mode 100755 debian/rules diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..7f8f011e --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/config b/debian/config new file mode 100644 index 00000000..c343f7aa --- /dev/null +++ b/debian/config @@ -0,0 +1,13 @@ +# Default configuration file for debian packages + +Include("default.cfg"); + +UnSet("CONFIG_LOCAL"); +Set("CONFIG_INSTALL_API"); + +Set("CONFIG_DOC"); +Set("CONFIG_CHARSET"); +Set("CONFIG_XML"); +Set("CONFIG_IMAGES"); + +1; diff --git a/debian/control.in b/debian/control.in new file mode 100644 index 00000000..88047b83 --- /dev/null +++ b/debian/control.in @@ -0,0 +1,21 @@ +Source: libucw +Section: apps +Priority: optional +Maintainer: Pavel Charvat +Build-Depends: debhelper (>= 7) +Standards-Version: 3.8.0 + +Package: libucw-@UCW_ABI_VERSION@ +Architecture: any +Depends: ${shlib:Depends}, ${misc:Depends} +Description: LibUCW library + +Package: libucw-dev +Architecture: any +Depends: libucw-@UCW_ABI_VERSION@ (= @VER@), ${shlib:Depends}, ${misc:Depends} +Description: LibUCW development files + +Package: libucw-doc +Architecture: all +Depends: ${shlib:Depends}, ${misc:Depeneds} +Description: LibUCW documentation diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..8ede3994 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,6 @@ +This is the UCW library, which aims to provide a set general purpose tools +for programming in the C language. + +It can be freely distributed and used according to the terms of +the GNU Lesser General Public License, either version 2 or any later +version. Several modules are in public domain. diff --git a/debian/mk b/debian/mk new file mode 100755 index 00000000..16934033 --- /dev/null +++ b/debian/mk @@ -0,0 +1,64 @@ +#!/bin/bash +# A script for building of LibUCW packages +# (c) 2013 Pavel Charvat + +set -e +. debian/pkg-lib + +function usage { + cat >&2 < +Options: +--archonly Build only binary packages +--cleanup Cleanup temporary files when finished +--version= Custom version number of resulting packages (default: autodetect from git-describe) +EOF + exit 1 +} + +function pkg-gen-debian {( + cd $BUILDDIR + echo "Configuring" + ./configure debian/config VER="$VER" TREEHASH="$TREEHASH" $CONF PREFIX=/ INSTALL_INCLUDE_DIR=/usr/include/libucw + + echo "Creating debian/control" + build/genconf debian/control.in debian/control obj/config.mk + + echo "Creating debian/changelog" + export EDITOR=true + CL=debian/changelog + rm -f $CL + dch --changelog=$CL --create --package=$PKG --newversion=$VER "Automatic release." + dch --changelog=$CL --release + sed -i '/Initial release/d' $CL +)} + +ROOT="`pwd`" +PKG=libucw +ARCHONLY= +CLEANUP= +CONF= +while [ -n "$1" ] ; do + case "$1" in + --archonly) ARCHONLY=1 + ;; + --cleanup) CLEANUP=1 + ;; + --version=*) PKGVER="${1:10}" + ;; + *) usage + ;; + esac + shift +done + +pkg-git-version +pkg-git-checkout + +echo $TREEVER >$BUILDDIR/UCW_VERSION +pkg-gen-debian +(cd $BUILDDIR && dpkg-buildpackage -rfakeroot -us -uc ${ARCHONLY:+"-B"}) +[ -z "$ARCHONLY" ] || rm -f debian-tmp/*_all.deb +pkg-get-files debian-tmp/*.{deb,dsc,changes} + +[ -z "$CLEANUP" ] || pkg-cleanup diff --git a/debian/pkg-lib b/debian/pkg-lib new file mode 100755 index 00000000..b4a5ff3b --- /dev/null +++ b/debian/pkg-lib @@ -0,0 +1,71 @@ +# A library of shell functions for building of Debian packages +# (c) 2008--2009 Martin Mares +# (c) 2009--2013 Pavel Charvat + +# Expects: +# PKG name of the package +# ROOT absolute path to the root of the source tree +# PKGVER custom package version + +unset PKG ROOT SRCVER VER + +function pkg-git-version { + TREEVER=`git describe | sed 's/^v//;s/[a-f]$/&-0/'` + TREEHASH=`git rev-parse --verify HEAD` + VER=${PKGVER:-$TREEVER} + SRCVER=${PKGVER:-$VER} + cat < + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +include obj/config.mk + +build: build-stamp + +build-stamp: + dh_testdir + $(MAKE) + #$(MAKE) tests + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + -$(MAKE) clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) DESTDIR=$(CURDIR)/debian/libucw-$(UCW_ABI_VERSION) $(addprefix install-,libucw libucw-charset libucw-xml libucw-images) + $(MAKE) DESTDIR=$(CURDIR)/debian/libucw-dev $(addprefix install-,$(addsuffix -api,libucw libucw-charset libucw-xml libucw-images)) + $(MAKE) DESTDIR=$(CURDIR)/debian/libucw-doc install-libucw-docs + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs +# dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installcron +# dh_installinfo +# dh_installman +# dh_link +# dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_python + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install -- 2.39.2