[med-svn] [Git][med-team/gcsa2][master] 6 commits: Build and ship a shared libgcsa2 library

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Oct 22 10:21:57 BST 2026



Andreas Tille pushed to branch master at Debian Med / gcsa2


Commits:
ee32ccb3 by Andreas Tille at 2026-10-22T10:43:20+02:00
Build and ship a shared libgcsa2 library

Build the objects as position-independent code and link them into
libgcsa2.so.1.4 with SONAME libgcsa2.so.1.  Install the shared library in
the libgcsa2 package and the development symlink plus static library in
libgcsa2-dev.  Require SDSL 2.4, which provides the API used by gcsa2 1.4.

- - - - -
de4c1703 by Andreas Tille at 2026-10-22T10:43:26+02:00
Add an autopkgtest smoke test

Compile a small consumer against the installed headers and link it
against both the shared and the static libgcsa2 libraries.

- - - - -
b964e65a by Andreas Tille at 2026-10-22T10:43:54+02:00
Close ITP bug

- - - - -
a32bc889 by Andreas Tille at 2026-10-22T10:45:37+02:00
Unversioned devel package

- - - - -
750ecb4f by Andreas Tille at 2026-10-22T10:49:40+02:00
Paragraph for License: Expat

- - - - -
35f7a4b6 by Andreas Tille at 2026-10-22T11:11:30+02:00
Use d-shlibs

- - - - -


12 changed files:

- debian/changelog
- debian/control
- debian/copyright
- debian/gcsa2.install
- − debian/libgcsa2-dev.install
- − debian/lintian-overrides
- + debian/patches/build_shared_library
- debian/patches/series
- debian/rules
- + debian/tests/compile-link
- + debian/tests/control
- + debian/tests/smoke.cpp


Changes:

=====================================
debian/changelog
=====================================
@@ -1,5 +1,5 @@
 gcsa2 (1.4-1) UNRELEASED; urgency=medium
 
-  * Initial release. (Closes: #XXXXXX)
+  * Initial release. (Closes: #1151599)
 
  -- Andreas Tille <tille at debian.org>  Wed, 21 Oct 2026 21:19:31 +0200


=====================================
debian/control
=====================================
@@ -7,7 +7,8 @@ Uploaders:
 Section: science
 Build-Depends:
  debhelper-compat (= 14),
- libsdsl-dev,
+ d-shlibs,
+ libsdsl-dev (>= 2.4),
 Vcs-Browser: https://salsa.debian.org/med-team/gcsa2
 Vcs-Git: https://salsa.debian.org/med-team/gcsa2.git
 Homepage: https://github.com/jltsiren/gcsa2
@@ -24,6 +25,7 @@ Description: BWT-based index for graphs
 
 Package: libgcsa2
 Architecture: any
+Multi-Arch: same
 Section: libs
 Depends:
  ${shlibs:Depends},
@@ -33,18 +35,21 @@ Description: BWT-based index for graphs - library
  BWT-based index for directed graphs. The implementation is based on the
  Succinct Data Structures Library 2.0 (SDSL)
  .
- This package contains the library
+ This package contains the shared library.
 
-Package: libgcsa2-dev
+Package: libgcsa-dev
 Architecture: any
+Multi-Arch: same
 Section: libdevel
 Depends:
- libsdsl-dev,
- ${shlibs:Depends},
+ libgcsa2 (= ${binary:Version}),
+ libsdsl-dev (>= 2.4),
  ${misc:Depends},
+ ${shlibs:Depends},
 Description: BWT-based index for graphs - development files
  A reimplementation of the Generalized Compressed Suffix Array (GCSA), a
  BWT-based index for directed graphs. The implementation is based on the
  Succinct Data Structures Library 2.0 (SDSL)
  .
- This package contains the headers and static library
+ This package contains the headers, the static library, and the
+ development symlink for the shared library.


=====================================
debian/copyright
=====================================
@@ -10,3 +10,22 @@ License: Expat
 Files: debian/*
 Copyright: © 2018 Michael R. Crusoe <michael.crusoe at gmail.com>
 License: Expat
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.


=====================================
debian/gcsa2.install
=====================================
@@ -1,4 +1,4 @@
-bin/build_gcsa /usr/bin
-bin/convert_graph /usr/bin
-bin/gcsa_format /usr/bin
-bin/try_extend /usr/bin
+bin/build_gcsa		usr/bin
+bin/convert_graph	usr/bin
+bin/gcsa_format		usr/bin
+bin/try_extend		usr/bin


=====================================
debian/libgcsa2-dev.install deleted
=====================================
@@ -1 +0,0 @@
-include/gcsa /usr/include/


=====================================
debian/lintian-overrides deleted
=====================================
@@ -1,2 +0,0 @@
-# see https://lists.debian.org/debian-med/2018/06/msg00043.html
-#PKGNAME#: script-with-language-extension usr/bin/*.*


=====================================
debian/patches/build_shared_library
=====================================
@@ -0,0 +1,40 @@
+Description: Build a shared library in addition to the static one
+ Compile the objects as position-independent code and link them into
+ libgcsa2.so.1.4 with SONAME libgcsa2.so.1.
+Author: Andreas Tille <tille at debian.org>
+Last-Update: 2026-10-22
+Assisted-By: deepseek-v4.1-flash-free
+
+--- a/Makefile
++++ b/Makefile
+@@ -50,12 +50,13 @@
+ HEADERS=$(wildcard include/gcsa/*.h)
+ LIBOBJS=$(addprefix $(BUILD_OBJ)/,algorithms.o dbg.o files.o gcsa.o internal.o lcp.o path_graph.o support.o utils.o)
+ LIBRARY=$(BUILD_LIB)/libgcsa2.a
++SHARED_LIBRARY=$(BUILD_LIB)/libgcsa2.so.1.4
+ 
+ PROGRAMS=$(addprefix $(BUILD_BIN)/,build_gcsa convert_graph gcsa_format try_extend)
+ OBSOLETE=build_gcsa convert_graph gcsa_format try_extend
+ 
+ .PHONY: all clean directories test
+-all: directories $(LIBRARY) $(PROGRAMS)
++all: directories $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAMS)
+ 
+ directories: $(BUILD_BIN) $(BUILD_LIB) $(BUILD_OBJ)
+ 
+@@ -69,11 +70,14 @@
+ 	mkdir -p $@
+ 
+ $(BUILD_OBJ)/%.o:$(SOURCE_DIR)/%.cpp $(HEADERS)
+-	$(MY_CXX) $(CPPFLAGS) $(CXXFLAGS) $(CXX_FLAGS) -c -o $@ $<
++	$(MY_CXX) $(CPPFLAGS) $(CXXFLAGS) $(CXX_FLAGS) -fPIC -c -o $@ $<
+ 
+ $(LIBRARY):$(LIBOBJS)
+ 	ar rcs $@ $(LIBOBJS)
+ 
++$(SHARED_LIBRARY):$(LIBOBJS)
++	$(MY_CXX) -shared $(LDFLAGS) $(CXX_FLAGS) -Wl,-soname,libgcsa2.so.1 -o $@ $(LIBOBJS) $(LIBS)
++
+ $(BUILD_BIN)/%:$(BUILD_OBJ)/%.o $(LIBRARY)
+ 	$(MY_CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(CXX_FLAGS) -o $@ $< $(LIBRARY) $(LIBS)
+ 


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 use_debian_sdsl
 drop_unneeded_divsufsort
 add_ldflags_cppflags
+build_shared_library


=====================================
debian/rules
=====================================
@@ -3,35 +3,20 @@
 # DH_VERBOSE := 1
 export LC_ALL=C.UTF-8
 
-# include /usr/share/dpkg/default.mk
-# this provides:
-# DEB_SOURCE: the source package name
-# DEB_VERSION: the full version of the package (epoch + upstream vers. + revision)
-# DEB_VERSION_EPOCH_UPSTREAM: the package's version without the Debian revision
-# DEB_VERSION_UPSTREAM_REVISION: the package's version without the Debian epoch
-# DEB_VERSION_UPSTREAM: the package's upstream version
-# DEB_DISTRIBUTION: the distribution(s) listed in the current entry of debian/changelog
-# SOURCE_DATE_EPOCH: the source release date as seconds since the epoch, as
-#                    specified by <https://reproducible-builds.org/specs/source-date-epoch/>
-
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
 %:
 	dh $@
 
 override_dh_auto_build:
 	dh_auto_build -- MY_CXX=g++ INC_DIR=/usr/include LIB_DIR=/usr/lib
 
-override_dh_auto_install:
-	dh_auto_install
-	mkdir -p debian/libgcsa2-dev/usr/lib/$(shell dpkg-architecture --query DEB_HOST_MULTIARCH)/
-	cp lib/libgcsa2.a debian/libgcsa2-dev/usr/lib/$(shell dpkg-architecture --query DEB_HOST_MULTIARCH)/
-
-### When overriding auto_test make sure DEB_BUILD_OPTIONS will be respected
-#override_dh_auto_test:
-#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-#	do_stuff_for_testing
-#endif
-
-### If you **really** can not use uscan (even not with mode=git) use a debian/get-orig-script
-#get-orig-source:
-#	. debian/get-orig-source
+execute_after_dh_install:
+	ln -s libgcsa2.so.1.4 lib/libgcsa2.so.1
+	ln -s libgcsa2.so.1 lib/libgcsa2.so
+	d-shlibmove --commit \
+		    --multiarch \
+		    --devunversioned \
+		    --exclude-la \
+                    --movedev include/gcsa usr/include \
+                    lib/libgcsa2.so


=====================================
debian/tests/compile-link
=====================================
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -eu
+
+srcdir=$(dirname "$0")
+tmpdir=$(mktemp -d)
+trap 'rm -rf "$tmpdir"' EXIT
+
+cp "$srcdir/smoke.cpp" "$tmpdir/"
+cd "$tmpdir"
+
+CXX=${CXX:-g++}
+MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+# Link against the shared library (the default for -lgcsa2) and run.
+$CXX -std=c++17 -Wall -Wextra -o smoke-shared smoke.cpp -lgcsa2 -lsdsl -fopenmp -pthread
+./smoke-shared
+
+# Link against the static library and run.
+$CXX -std=c++17 -Wall -Wextra -o smoke-static smoke.cpp \
+    "/usr/lib/$MULTIARCH/libgcsa2.a" -lsdsl -fopenmp -pthread
+./smoke-static
+
+echo "shared and static linking both OK"


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,2 @@
+Tests: compile-link
+Depends: libgcsa2, libgcsa2-dev, build-essential, libsdsl-dev


=====================================
debian/tests/smoke.cpp
=====================================
@@ -0,0 +1,15 @@
+#include <gcsa/gcsa.h>
+
+#include <cassert>
+#include <iostream>
+
+int main()
+{
+    gcsa::GCSA index;
+    assert(index.empty());
+    assert(index.size() == 0);
+    assert(index.order() == 0);
+
+    std::cout << "gcsa2 smoke test passed (" << gcsa::GCSA::EXTENSION << ")" << std::endl;
+    return 0;
+}



View it on GitLab: https://salsa.debian.org/med-team/gcsa2/-/compare/4f65e223d319b20a234b32bc0e61371fa5e87688...35f7a4b6ce78f5fe354451fe43607884ae89506e

-- 
View it on GitLab: https://salsa.debian.org/med-team/gcsa2/-/compare/4f65e223d319b20a234b32bc0e61371fa5e87688...35f7a4b6ce78f5fe354451fe43607884ae89506e
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261022/4cdfc5d9/attachment-0001.htm>


More information about the debian-med-commit mailing list