]> mj.ucw.cz Git - libucw.git/commitdiff
Packages: First experiments with Debian packages.
authorPavel Charvat <pchar@ucw.cz>
Fri, 6 Dec 2013 19:49:07 +0000 (20:49 +0100)
committerPavel Charvat <pchar@ucw.cz>
Fri, 6 Dec 2013 19:49:07 +0000 (20:49 +0100)
debian/compat [new file with mode: 0644]
debian/config [new file with mode: 0644]
debian/control.in [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/mk [new file with mode: 0755]
debian/pkg-lib [new file with mode: 0755]
debian/rules [new file with mode: 0755]

diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/config b/debian/config
new file mode 100644 (file)
index 0000000..c343f7a
--- /dev/null
@@ -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 (file)
index 0000000..88047b8
--- /dev/null
@@ -0,0 +1,21 @@
+Source: libucw
+Section: apps
+Priority: optional
+Maintainer: Pavel Charvat <pchar@ucw.cz>
+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 (file)
index 0000000..8ede399
--- /dev/null
@@ -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 (executable)
index 0000000..1693403
--- /dev/null
+++ b/debian/mk
@@ -0,0 +1,64 @@
+#!/bin/bash
+# A script for building of LibUCW packages
+# (c) 2013 Pavel Charvat <pchar@ucw.cz>
+
+set -e
+. debian/pkg-lib
+
+function usage {
+       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)
+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 (executable)
index 0000000..b4a5ff3
--- /dev/null
@@ -0,0 +1,71 @@
+# A library of shell functions for building of Debian packages
+# (c) 2008--2009 Martin Mares <mj@ucw.cz>
+# (c) 2009--2013 Pavel Charvat <pchar@ucw.cz>
+
+# 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 <<EOF
+###
+### Source tree version: $TREEVER
+### Source tree hash: $TREEHASH
+### Debian binary package version: $VER
+### Debian source package version: $SRCVER
+###
+### Hey, did you commit everything? Or added it to the index?
+###
+
+EOF
+}
+
+function pkg-git-checkout {
+       BUILDDIR=debian-tmp/$PKG-$SRCVER
+       rm -rf debian-tmp
+       mkdir -p $BUILDDIR
+       git checkout-index -a --prefix=$BUILDDIR/
+}
+
+function pkg-fake-changelog {
+       echo "Creating automatic changelogs for package $PKG version $VER"
+       (
+               export EDITOR=true
+               CL=debian/changelog
+               rm -f $CL
+               dch --changelog $CL --create --package $PKG --newversion $VER "Automatic release. See /usr/share/doc/$PKG/changelog for the true story."
+               dch --changelog $CL --release
+               sed -i '/Initial release/d' $CL
+       )
+}
+
+function pkg-cleanup {
+       echo -n "Press return to delete temp files... "
+       read YES
+       rm -rf $ROOT/debian-tmp
+}
+
+function pkg-get-files {
+       echo
+       echo "Generated files:"
+       FILES=
+       unset FILES_ARY[@]
+       for F in "$@" ; do
+               if [ -f "$F" ] ; then
+                       FILES="$FILES${FILES:+,}$F"
+                       FILES_ARY[${#FILES_ARY[@]}]="$F"
+                       echo "$F"
+               fi
+       done
+       if [ -z "$FILES" ] ; then
+               echo "No files found"
+               return 1
+       fi
+}
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..88441da
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/make -f
+# debian/rules for LibUCW
+# (c) 2013 Pavel Charvat <pchar@ucw.cz>
+
+# 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