]> git.tuebingen.mpg.de Git - lopsub.git/commitdiff
Merge branches 't/debian', 't/dynamic-lib', 't/lls_check_arg_count' and 't/news'
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 17 May 2019 08:26:56 +0000 (10:26 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 17 May 2019 08:26:56 +0000 (10:26 +0200)
This octopus merge combines four branches, two of which were created
with the aim of making the package acceptable for inclusion into
Debian: The t/dynamic-lib branch instructs make to create a dynamic
library instead of the static one, the t/debian branch adds the usual
files below debian/.

The remaining two branches, t/lls_check_arg_count and t/news, contain
only a single commit each. The first improves the wording of an error
message while the second introduces the NEWS file, respectively.

The tree which corresponds to this commit was accepted for Debian
unstable on May 15 2019 as version 1.0.2-1.

15 files changed:
.gitignore
Makefile
NEWS [new file with mode: 0644]
README
debian/Makefile.debian [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/liblopsub-dev.install [new file with mode: 0644]
debian/liblopsub1.install [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/source/format [new file with mode: 0644]
lopsub.7.m4
version-gen.sh

index 3dc13ed7005a2c9beb6dc249caa28ba697395ca8..e7965bb360829380a3b1a5227b26c4c357a80f94 100644 (file)
@@ -5,7 +5,7 @@ config_file.c
 lopsubgen.c
 version.c
 lopsub.h
-liblopsub.a
+liblopsub.*
 lopsubex
 lopsubgen
 lopsubgen-stage1
index 7e44330b4ee335e75327c4c5318bbd234a5b112f..408e3a5ac123dff22cd744a1487e18de3ed53c64 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,9 +23,14 @@ ZCAT := zcat
 
 DATE := $(shell date '+%B %Y')
 GIT_VERSION := $(shell ./version-gen.sh)
+PLAIN_VERSION := $(firstword $(subst -, , $(GIT_VERSION)))
+MAJOR_VERSION := $(firstword $(subst ., , $(PLAIN_VERSION)))
+SONAME := liblopsub.so.$(MAJOR_VERSION)
+REALNAME := liblopsub.so.$(PLAIN_VERSION)
+LINKERNAME:=liblopsub.so
 
 m4_man_pages := lopsub-suite.5.gz lopsub.7.gz
-all := $(m4_man_pages) liblopsub.a lopsubgen lopsubgen.1.gz \
+all := $(m4_man_pages) $(REALNAME) lopsubgen lopsubgen.1.gz \
        lopsubex lopsubex.1.gz
 all: $(all)
 
@@ -64,25 +69,25 @@ lopsubgen.lsg.c lopsubgen.lsg.h: lopsubgen.suite lopsubgen-stage1 \
 lsg1_objs := lopsubgen.o lsg1.o version.o
 lsg_objs := lopsubgen.o lsg.o lopsubgen.lsg.o lopsub.o version.o
 liblopsub_objs := config_file.o lopsub.o version.o
-lopsubex_objs := lopsubex.o lopsubex.lsg.o version.o
+lopsubex_objs := lopsubex.o lopsubex.lsg.o $(liblopsub_objs)
 
 $(lsg_objs) $(liblopsub_objs) $(lopsubex_objs): %.o: %.c
 lopsubgen.o config_file.o:
-       $(CC) -g -c -o $@ ${@:.o=.c}
+       $(CC) -g -c -fPIC -o $@ ${@:.o=.c}
 lsg1.o: lsg.c lsg.h
        $(CC) -g -DSTAGE1 -Wall -g -c $< -o $@
 %.o: %.c
-       $(CC) -Wall -I. -g -c -o $@ $<
+       $(CC) -Wall -I. -g -c -fPIC -o $@ $<
 
 # linking
 lopsubgen-stage1: $(lsg1_objs)
        $(CC) -Wall -g $(lsg1_objs) -o $@
 lopsubgen: $(lsg_objs)
        $(CC) -Wall -g -o $@ $(lsg_objs)
-liblopsub.a: $(liblopsub_objs)
-       $(AR) -rcs $@ $^
-lopsubex: $(lopsubex_objs) liblopsub.a
-       $(CC) -Wall -g -o $@ $^
+$(REALNAME): $(liblopsub_objs)
+       $(CC) --shared -Wl,-soname,liblopsub.so.$(MAJOR_VERSION) -o $@ $^
+lopsubex: $(lopsubex_objs) $(REALNAME)
+       $(CC) -Wall -g -o $@ $(lopsubex_objs)
 
 # web
 html := $(addprefix web/, $(addsuffix .html, \
@@ -104,7 +109,9 @@ install: $(all)
        $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include \
                $(DESTDIR)$(PREFIX)/share/man/man1 $(DESTDIR)$(PREFIX)/share/man/man5 \
                $(DESTDIR)$(PREFIX)/share/man/man7 $(DESTDIR)$(PREFIX)/bin
-       $(INSTALL) -m 644 liblopsub.a $(DESTDIR)$(PREFIX)/lib
+       $(INSTALL) -m 644 $(REALNAME) $(DESTDIR)$(PREFIX)/lib
+       $(LN) -s $(REALNAME) $(DESTDIR)$(PREFIX)/lib/$(SONAME)
+       $(LN) -s $(SONAME) $(DESTDIR)$(PREFIX)/lib/$(LINKERNAME)
        $(INSTALL) -m 755 lopsubgen $(DESTDIR)$(PREFIX)/bin
        $(INSTALL) -m 644 lopsub.h $(DESTDIR)$(PREFIX)/include
        $(INSTALL) -m 644 lopsub-internal.h $(DESTDIR)$(PREFIX)/include
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..97daa7b
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,18 @@
+Noteworthy changes in lopsub-1.0.3 (tba)
+========================================
+* build a shared library instead of a static one
+* debianize the package by adding the usual files below debian/
+* add this NEWS file
+* minor documentation improvements
+
+Noteworthy changes in lopsub-1.0.2 (2019-03-27)
+===============================================
+* fix an invalid free bug
+* install liblopsub.a with mode 644 rather than 755
+* compress man pages
+* install man pages to $PREFIX/share/man rather than $PREFIX/man
+
+Noteworthy changes in lopsub-1.0.1 (2017-11-28)
+===============================================
+* reentrant scanners
+* documentation improvements
diff --git a/README b/README
index a6ffa0b0ce43d6933f52ac03e05c51c051676786..9f77d9eab7fe1ab267faddf00d9c342020cea8f3 100644 (file)
--- a/README
+++ b/README
@@ -10,3 +10,27 @@ Alternatively, run
        man -l ./lopsub.7.m4
 
 to show build and installation instructions.
+
+Installation
+------------
+Build the package with
+
+       make
+
+The suite parser and the config file parser of the lopsub library are
+both generated by running flex(1), a tool for generating programs
+that perform pattern-matching on text. Hence the flex package must
+be installed for the build to succeed. Next, run
+
+       sudo make install
+
+This will install the package in /usr/local.  If you prefer to install
+as an unprivileged user in /somewhere/else, run
+
+       make PREFIX=/somewhere/else install
+
+instead. In this case, you need to specify -I/somewhere/else/include to
+compile the source files of your application and -L/somewhere/else/lib
+for linking. Alternatively, don't run make install at all and specify
+the path to the top level directory of the repository for both -I
+and -L.
diff --git a/debian/Makefile.debian b/debian/Makefile.debian
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..3779a2a
--- /dev/null
@@ -0,0 +1,5 @@
+liblopsub (1.0.2-1) unstable; urgency=low
+
+  * Initial Release. Closes: #925911
+
+ -- Andre Noll <maan@tuebingen.mpg.de>  Sun, 3 Mar 2019 00:37:31 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..f599e28
--- /dev/null
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..dec91e9
--- /dev/null
@@ -0,0 +1,39 @@
+Source: liblopsub
+Section: libdevel
+Priority: optional
+Maintainer: Andre Noll <maan@tuebingen.mpg.de>
+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 (file)
index 0000000..95fcd00
--- /dev/null
@@ -0,0 +1,16 @@
+Copyright 2016 Andre Noll <maan@tuebingen.mpg.de>
+
+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 (file)
index 0000000..8e6c62d
--- /dev/null
@@ -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 (file)
index 0000000..6234859
--- /dev/null
@@ -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 (executable)
index 0000000..3ba7a74
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/make -f
+# Invoke each target with `./debian/rules <target>'.  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 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)
index c728e8bfa490e8e008764d79f7254cb0873d99cf..0813fe1f404eb6a836937b7c299aa4d7c01b9c38 100644 (file)
@@ -29,6 +29,9 @@
 . \}
 
 .TH lopsub 7 "DATE()" GIT_VERSION()
+.SH NAME
+lopsub \- Long option parser for subcommands
+
 .SH About
 
 .B Lopsub
@@ -103,56 +106,9 @@ while the
 utility is licensed under the
 .BR GPLv3 .
 The examples and all code generated by the utilities, however, is
-licensed with a simple all-permissive license. You are free to do
-anything you like with the generated code, including incorporating
-it into or linking it with proprietary software.
-
-.SH Installation
-Grab your copy with
-.IP
-.EX
-git clone git://git.tuebingen.mpg.de/lopsub.git
-.EE
-.PP
-Then build the package with
-.IP
-.EX
-make
-.EE
-.PP
-The suite parser and the config file parser of the
-.B lopsub
-library are both generated by running
-.MONO_ROMAN flex ,
-a tool for generating programs that perform pattern-matching on text. Hence the
-.B flex
-package must be installed for the build to succeed. Next, run
-.IP
-.EX
-sudo make install
-.EE
-.PP
-This will install the package in
-.MONO_ROMAN /usr/local .
-If you prefer to install as an unprivileged user in
-.MONO_ROMAN /somewhere/else ,
-run
-.IP
-.EX
-make PREFIX=/somewhere/else install
-.EE
-.PP
-instead. In this case, you need to specify
-.MONO -I/somewhere/else/include
-to compile the source files of your application and
-.MONO -L/somewhere/else/lib
-for linking. Alternatively, don't run
-.MONO make install
-at all and specify the path to the top level directory of the
-repository for both
-.MONO -I
-and
-.MONO_ROMAN -L .
+licensed under 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.
 
 .SH Quick Start
 Compile and run the minimal example included at the end of
@@ -176,11 +132,26 @@ Alternatively, examine
 or
 .MONO_ROMAN lopsub.h.m4 .
 
-.SH Contact
-Email:
-.MT maan@tuebingen.mpg.de
-Andre Noll
-.ME ,
-Homepage:
+.SH Resources
+
+\(bu
+git clone URL:
+.UR git://git.tuebingen.mpg.de/lopsub.git
+.UE
+
+\(bu
+gitweb:
+.UR http://git.tuebingen.mpg.de/lopsub.git
+.UE
+
+\(bu
+The author's homepage:
 .UR http://people.tuebingen.mpg.de/maan/
 .UE
+
+\(bu
+Send feedback to
+.MT maan@tuebingen.mpg.de
+Andre Noll
+.ME
+
index b20e4c8fe9fe7c15d3bb47f124f00a801cedf2e8..bdeeca2a560a482f09960be2abbc0772d8a18676 100755 (executable)
@@ -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