]> 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.

.gitignore
Makefile
NEWS [new file with mode: 0644]
lopsub.c

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
index 44abc93348c7b6e4120caeeea620c0f6504d46bb..d495663408d12fbe85f471a1ba406c3b5c64dcaf 100644 (file)
--- a/lopsub.c
+++ b/lopsub.c
@@ -724,9 +724,11 @@ int lls_check_arg_count(const struct lls_parse_result *lpr,
 {
        if (errctx)
                *errctx = NULL;
+       assert(min_argc <= max_argc);
        if (lpr->num_inputs < min_argc) {
-               xasprintf(errctx, "at least %u non-option args required, "
-                       "%u given", min_argc, lpr->num_inputs);
+               xasprintf(errctx, "%s %u non-option args required, %u given",
+                       min_argc < max_argc? "at least" : "exactly",
+                       min_argc, lpr->num_inputs);
                return -E_LLS_BAD_ARG_COUNT;
        }
        if (lpr->num_inputs > max_argc) {
@@ -734,8 +736,10 @@ int lls_check_arg_count(const struct lls_parse_result *lpr,
                        xasprintf(errctx, "no non-option args allowed, "
                                "%u given", lpr->num_inputs);
                else
-                       xasprintf(errctx, "at most %u non-option args allowed, "
-                               "%u given", max_argc, lpr->num_inputs);
+                       xasprintf(errctx, "%s %u non-option args allowed, "
+                               "%u given", min_argc < max_argc?
+                               "at most" : "exactly",
+                               max_argc, lpr->num_inputs);
                return -E_LLS_BAD_ARG_COUNT;
        }
        return 1;