summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-03 17:22:08 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-03 17:22:08 +0100
commita82d947a594b01af54e056473799ebab619e2bd2 (patch)
treed68a3896a32cd882a3866c4c88dcd6dba85d9c83
parentd00dc2c69164d8a8850d317f2868c6f131b7f679 (diff)
Switch to shared library
-rw-r--r--Makefile35
-rw-r--r--common.mk5
-rw-r--r--debian/changelog6
-rw-r--r--debian/control14
-rw-r--r--debian/libreichwein-dev.install6
-rw-r--r--debian/libreichwein0.install2
6 files changed, 64 insertions, 4 deletions
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 <mail@reichwein.it> 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