From a82d947a594b01af54e056473799ebab619e2bd2 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 3 Jan 2023 17:22:08 +0100 Subject: Switch to shared library --- Makefile | 35 +++++++++++++++++++++++++++++++++-- common.mk | 5 +++-- debian/changelog | 6 ++++++ debian/control | 14 ++++++++++++++ debian/libreichwein-dev.install | 6 ++++++ debian/libreichwein0.install | 2 ++ 6 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 debian/libreichwein-dev.install create mode 100644 debian/libreichwein0.install diff --git a/Makefile b/Makefile index fe17e98..1da3524 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,16 @@ include common.mk +VERSION=$(shell dpkg-parsechangelog --show-field Version) +DISTROS=base debian11 ubuntu2204 ubuntu2210 + PROJECTNAME=libreichwein +DESTDIR=/ + +SONAME1=libreichwein.so +SONAME2=libreichwein.so.0 +SONAME3=libreichwein.so.0.0.0 + CXXFLAGS+= -fvisibility=hidden -fPIC PROGSRC=\ @@ -14,13 +23,23 @@ PROGSRC=\ SRC=$(PROGSRC) HEADERS=$(PROGSRC:.cpp=.h) -all: $(PROJECTNAME).a +all: staticlib sharedlib + +staticlib: $(PROJECTNAME).a + +sharedlib: $(SONAME3) + +$(SONAME3): $(PROGSRC:.cpp=.o) + $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(SONAME2) -o $@ $^ install: mkdir -p $(DESTDIR)/usr/lib cp $(PROJECTNAME).a $(DESTDIR)/usr/lib/ mkdir -p $(DESTDIR)/usr/include/libreichwein cp $(HEADERS) $(DESTDIR)/usr/include/libreichwein/ + install $(SONAME3) $(DESTDIR)/usr/lib/$(SONAME3) + ln -sf $(SONAME3) $(DESTDIR)/usr/lib/$(SONAME2) + ln -sf $(SONAME2) $(DESTDIR)/usr/lib/$(SONAME1) $(PROJECTNAME).a: $(SRC:.cpp=.o) ar rcs $@ $^ @@ -31,13 +50,25 @@ $(PROJECTNAME).a: $(SRC:.cpp=.o) %.o: %.cpp %.d $(CXX) $(CXXFLAGS) -c $< -o $@ +deb: + dpkg-buildpackage -rfakeroot + +deb-src: + dh_clean + dh_auto_clean + dpkg-source -b -I.git -Iresult -Ifastcgi -Icgi-bin . + +$(DISTROS): deb-src + sudo pbuilder build --basetgz /var/cache/pbuilder/$@.tgz --buildresult result/$@ ../libreichwein_$(VERSION).dsc + -debsign result/$@/libreichwein_$(VERSION)_amd64.changes + # dependencies ADD_DEP=Makefile # misc --------------------------------------------------- clean: - -rm -f *.o *.a *.d + -rm -f *.o *.a *.d $(SONAME1) $(SONAME2) $(SONAME3) .PHONY: clean all install diff --git a/common.mk b/common.mk index 0b5c4d8..49a6266 100644 --- a/common.mk +++ b/common.mk @@ -48,13 +48,14 @@ endif # gcc:--coverage CXXFLAGS+=-Wall -I. +CXXFLAGS+=-Wpedantic -gdwarf-4 ifeq ($(CXX),clang++-11) CXXFLAGS+=-std=c++20 #-stdlib=libc++ else ifeq ($(CXX),clang++-14) -CXXFLAGS+=-std=c++2b #-stdlib=libc++ +CXXFLAGS+=-std=c++20 #-stdlib=libc++ else ifeq ($(CXX),clang++-13) -CXXFLAGS+=-std=c++2b #-stdlib=libc++ +CXXFLAGS+=-std=c++20 #-stdlib=libc++ else ifeq ($(CXX),g++-11) CXXFLAGS+=-std=c++20 #-stdlib=libc++ else diff --git a/debian/changelog b/debian/changelog index 1efd71a..9d20da5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libreichwein (1.1) unstable; urgency=medium + + * Shared and static lib + + -- Roland Reichwein Tue, 03 Jan 2023 17:21:51 +0100 + libreichwein (1.0) unstable; urgency=medium * Initial release diff --git a/debian/control b/debian/control index bf2df7b..2bee0a8 100644 --- a/debian/control +++ b/debian/control @@ -8,9 +8,23 @@ Homepage: http://www.reichwein.it/libreichwein/ Package: libreichwein-dev Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libreichwein0 (= ${binary:Version}), +Homepage: http://www.reichwein.it/libreichwein/ +Description: C++ Library by Reichwein.IT + libreichwein is a C++ library developed by Reichwein.IT and + used by several Reichwein.IT projects, including functions + not available in std or boost. + . + This is the package for developers for compiling code against libreichwein. + It includes the header files and static library. + +Package: libreichwein0 +Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Homepage: http://www.reichwein.it/libreichwein/ Description: C++ Library by Reichwein.IT libreichwein is a C++ library developed by Reichwein.IT and used by several Reichwein.IT projects, including functions not available in std or boost. + . + This is the runtime library package including the shared library. diff --git a/debian/libreichwein-dev.install b/debian/libreichwein-dev.install new file mode 100644 index 0000000..81aeaf0 --- /dev/null +++ b/debian/libreichwein-dev.install @@ -0,0 +1,6 @@ +usr/include/libreichwein/file.h +usr/include/libreichwein/mime.h +usr/include/libreichwein/stringutil.h +usr/include/libreichwein/tempfile.h +usr/include/libreichwein/url.h +usr/lib/libreichwein.so diff --git a/debian/libreichwein0.install b/debian/libreichwein0.install new file mode 100644 index 0000000..29e462a --- /dev/null +++ b/debian/libreichwein0.install @@ -0,0 +1,2 @@ +usr/lib/libreichwein.so.0 +usr/lib/libreichwein.so.0.0.0 -- cgit v1.2.3