From 7bcfa2307b7e4f1410e05aedf1f76e014c3d58af Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 2 Mar 2019 16:48:46 +0100 Subject: [PATCH] Add infrastructure to build debian packages. This commit adds the usual files below debian/ so that two debian binary packages, liblopsub1 and liblopsub1-dev, can be made with a command like dpkg-buildpackage The bulk of the recipes in debian/rules employ debhelper(7). This has been tested on debian-9 and debian-10. On both systems, lintian(1) reports no warnings and no errors. v4 -> v5 ~~~~~~~~ Avoid the term "all-permissive license" to address copyright concerns pointed out by Thorsten Alteholz. v3 -> v4 ~~~~~~~~ Next round of feedback from Adam Borowski: * soname-less source package * Full description for liblopsub-dev * debian/changelog: UNRELEASED -> unstable v2 -> v3 ~~~~~~~~ Incorporate more feedback from Adam Borowski: * version-gen.sh now works also without a git repository * The soname has been dropped from the name of the development package * library files are installed in the multiarch dir /usr/lib/$triplet v1 -> v2 ~~~~~~~~ Incorporate review comments from Adam Borowski: * Rename package name from lopsub to liblopsub1 to make lintian happy. * Append "-1" to the debian version to make it a non-native package. * Switch source format from "3.0 (native)" to "3.0 (quilt)". * Mention what parts are GPLv3-ed and which are LGPLv3-ed. * Adjustments for building a shared library. * Squash remaining lintian warnings. rewrite de/copyright --- debian/Makefile.debian | 0 debian/changelog | 5 +++ debian/compat | 1 + debian/control | 39 +++++++++++++++++++++++ debian/copyright | 16 ++++++++++ debian/liblopsub-dev.install | 5 +++ debian/liblopsub1.install | 2 ++ debian/rules | 62 ++++++++++++++++++++++++++++++++++++ debian/source/format | 1 + version-gen.sh | 2 ++ 10 files changed, 133 insertions(+) create mode 100644 debian/Makefile.debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/liblopsub-dev.install create mode 100644 debian/liblopsub1.install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/debian/Makefile.debian b/debian/Makefile.debian new file mode 100644 index 0000000..e69de29 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3779a2a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +liblopsub (1.0.2-1) unstable; urgency=low + + * Initial Release. Closes: #925911 + + -- Andre Noll Sun, 3 Mar 2019 00:37:31 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..dec91e9 --- /dev/null +++ b/debian/control @@ -0,0 +1,39 @@ +Source: liblopsub +Section: libdevel +Priority: optional +Maintainer: Andre Noll +Build-Depends: m4, flex, debhelper (>= 10.0) +Standards-Version: 3.9.8 +Homepage: http://people.tuebingen.mpg.de/maan/lopsub +Vcs-Browser: http://git.tuebingen.mpg.de/lopsub.git +Vcs-Git: git://git.tuebingen.mpg.de/lopsub.git + +Package: liblopsub1 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Long Option Parser for Subcommands + Lopsub is an open source library written in C which aims to ease + the task of creating, documenting and parsing the options of Unix + command line utilities. It is suitable for simple commands as well + as complex command line utilities with many subcommands where each + subcommand has its own set of options. Options and documentation are + kept together in a single file which can be translated to C code (to + be included in the application), or to a manual page. The library + supports single-character short options and GNU-style long options. + The public API is well documented and stable. +Homepage: http://people.tuebingen.mpg.de/maan/lopsub + +Package: liblopsub-dev +Architecture: any +Depends: ${shlibs:Depends}, liblopsub1 (= ${binary:Version}), ${misc:Depends} +Description: Long Option Parser for Subcommand - headers + Lopsub is an open source library written in C which aims to ease + the task of creating, documenting and parsing the options of Unix + command line utilities. It is suitable for simple commands as well + as complex command line utilities with many subcommands where each + subcommand has its own set of options. Options and documentation are + kept together in a single file which can be translated to C code (to + be included in the application), or to a manual page. The library + supports single-character short options and GNU-style long options. + The public API is well documented and stable. + This package contains the development environment for the lopsub library. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..95fcd00 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +Copyright 2016 Andre Noll + +This package is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License, version 3 +(lopsubgen), or the GNU Library General Public License, version 3 +(liblopsub). + +On Debian GNU systems, the complete text of the GNU General Public +License can be found in `/usr/share/common-licenses/GPL-3'. The +complete text of the GNU Library General Public License can be found in +'/usr/share/common-licenses/LGPL-3'. + +The examples and all code generated by the utilities are in the +public domain. You are free to do anything you like with the generated +code, including incorporating it into or linking it with proprietary +software. diff --git a/debian/liblopsub-dev.install b/debian/liblopsub-dev.install new file mode 100644 index 0000000..8e6c62d --- /dev/null +++ b/debian/liblopsub-dev.install @@ -0,0 +1,5 @@ +usr/include/* +usr/lib/*/liblopsub.so +usr/bin/lopsubgen +usr/share/man/man1/lopsubgen* +usr/share/man/man5/lopsub-suite* diff --git a/debian/liblopsub1.install b/debian/liblopsub1.install new file mode 100644 index 0000000..6234859 --- /dev/null +++ b/debian/liblopsub1.install @@ -0,0 +1,2 @@ +debian/tmp/usr/share/man/man7/* +debian/tmp/usr/lib/*/liblopsub.so.* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..3ba7a74 --- /dev/null +++ b/debian/rules @@ -0,0 +1,62 @@ +#!/usr/bin/make -f +# Invoke each target with `./debian/rules '. All targets should be +# invoked with the package root as the current directory. + +sourcepackage := liblopsub +package := liblopsub1 +devpackage := liblopsub-dev + +define checkdir + @test -f debian/rules -a -f lopsub.c || \ + (echo Not in correct source directory; exit 1) +endef + +SRCTOP := $(shell pwd) +TMPDIR := $(SRCTOP)/debian/tmp +DESTDIR := $(SRCTOP)/debian/$(package) +DEVDIR := $(SRCTOP)/debian/$(devpackage) +DOCS_DIR := $(DESTDIR)/usr/share/doc/$(package) +DEVDOCS_DIR := $(DEVDIR)/usr/share/doc/$(devpackage) +TRIPLET := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +build-arch: + $(checkdir) + $(MAKE) +build-indep: +build: build-indep build-arch + +clean: + $(checkdir) + -rm -f debian/substvars + $(MAKE) distclean + dh_clean + +INST_OWN = -o root -g root +MAKE_DIR = install -p -d $(INST_OWN) -m 755 +INST_FILE = install -c $(INST_OWN) -m 644 + +binary: build + $(checkdir) + $(MAKE) PREFIX=/usr install DESTDIR=$(TMPDIR) + mv $(TMPDIR)/usr/lib $(TMPDIR)/usr/lib-$(TRIPLET) + $(MAKE_DIR) $(TMPDIR)/usr/lib + mv $(TMPDIR)/usr/lib-$(TRIPLET) $(TMPDIR)/usr/lib/$(TRIPLET) + dh_install -p $(package) + dh_install -p $(devpackage) + $(MAKE_DIR) $(DESTDIR)/DEBIAN $(DOCS_DIR) $(DEVDOCS_DIR) + echo 'activate-noawait ldconfig' > $(DESTDIR)/DEBIAN/triggers + $(INST_FILE) debian/copyright $(DOCS_DIR)/copyright + $(INST_FILE) debian/copyright $(DEVDOCS_DIR)/copyright + $(INST_FILE) debian/changelog $(DOCS_DIR)/changelog.Debian + $(INST_FILE) debian/changelog $(DEVDOCS_DIR)/changelog.Debian + gzip -f9 $(DOCS_DIR)/changelog.Debian + gzip -f9 $(DEVDOCS_DIR)/changelog.Debian + dh_makeshlibs + dh_shlibdeps + dh_strip + dh_shlibdeps + dh_gencontrol + dh_builddeb + +binary-indep binary-arch: binary +.PHONY: clean build binary-arch binary-indep binary diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/version-gen.sh b/version-gen.sh index b20e4c8..bdeeca2 100755 --- a/version-gen.sh +++ b/version-gen.sh @@ -11,6 +11,8 @@ if [ -e '.git' -o -e '../.git' ]; then # if there are differences (exit code 1), the working tree is dirty git diff-index --quiet HEAD || git_ver=$git_ver-dirty ver=$git_ver +elif [ -f debian/changelog ]; then + ver="$(sed -ne '1s/.*(\(.*\)-.*/\1/1; tx; d; :x; p' debian/changelog)" elif [ "${PWD%%-*}" = 'lopsub-' ]; then ver=${PWD##*/lopsub-} fi -- 2.39.5