libqrcodegen: initial commit, version 1.5.0

This commit is contained in:
Tim Biermann 2020-01-20 19:44:21 +00:00
parent 7831b22f21
commit e941f41cdf
Signed by: tb
GPG Key ID: 42F8B4E30B673606
5 changed files with 215 additions and 0 deletions

16
libqrcodegen/.footprint Normal file
View File

@ -0,0 +1,16 @@
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/include/
drwxr-xr-x root/root usr/include/qrcodegen/
-rw-r--r-- root/root usr/include/qrcodegen/BitBuffer.hpp
-rw-r--r-- root/root usr/include/qrcodegen/QrCode.hpp
-rw-r--r-- root/root usr/include/qrcodegen/QrSegment.hpp
-rw-r--r-- root/root usr/include/qrcodegen/qrcodegen.h
drwxr-xr-x root/root usr/lib/
-rw-r--r-- root/root usr/lib/libqrcodegen.a
lrwxrwxrwx root/root usr/lib/libqrcodegen.so -> libqrcodegen.so.1
-rw-r--r-- root/root usr/lib/libqrcodegen.so.
lrwxrwxrwx root/root usr/lib/libqrcodegen.so.1 -> libqrcodegen.so.
-rw-r--r-- root/root usr/lib/libqrcodegencpp.a
lrwxrwxrwx root/root usr/lib/libqrcodegencpp.so -> libqrcodegencpp.so.1
-rw-r--r-- root/root usr/lib/libqrcodegencpp.so.
lrwxrwxrwx root/root usr/lib/libqrcodegencpp.so.1 -> libqrcodegencpp.so.

7
libqrcodegen/.signature Normal file
View File

@ -0,0 +1,7 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF37WYnAiztWZsjdKPPUiOp8Ad27dEdP4Xs2sfL333Q3aT2nxVqM8gHSJhSGVk4wt/xIPJWB6kjIOElYrK5T/lzAw=
SHA256 (Pkgfile) = d2316a347e2f7d86db4ef2e5d1ebe5cd08c8d491a6d510df77f4421177237b3d
SHA256 (.footprint) = 2daa9a92ed27e2a796e81c61842a73c9fc1a1e04810681b4490619c9b45f7057
SHA256 (libqrcodegen-1.5.0.tar.gz) = 6cf993c10fbf96b5e8f8e4eaad8ea1ca3bbc58fb4d00a4728b4f818c27fb4d5e
SHA256 (c-lib.patch) = e92ec306be621e01a14d9283616efcc4149c4031778c9bb8db71ffed5115f4bb
SHA256 (cpp-lib.patch) = f577f0a44eb82931dd25abafddaf49de1f2d46abe43bdca79380a5c8c4621126

22
libqrcodegen/Pkgfile Normal file
View File

@ -0,0 +1,22 @@
# Description: QR code generator
# URL: https://github.com/nayuki/QR-Code-generator
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on:
name=libqrcodegen
version=1.5.0
release=1
source=(https://github.com/nayuki/QR-Code-generator/archive/v$version/$name-$version.tar.gz
c-lib.patch cpp-lib.patch)
build() {
cp -R QR-Code-generator-$version{,-cpp}
cd QR-Code-generator-$version
# https://raw.githubusercontent.com/OpenMandrivaAssociation/libqrcodegen/master/c-lib.patch
patch -Np1 -i $SRC/c-lib.patch
make DESTDIR=$PKG -C c install
cd $SRC/QR-Code-generator-$version-cpp
# https://raw.githubusercontent.com/OpenMandrivaAssociation/libqrcodegen/master/cpp-lib.patch
patch -Np1 -i $SRC/cpp-lib.patch
make DESTDIR=$PKG -C cpp install
}

85
libqrcodegen/c-lib.patch Normal file
View File

@ -0,0 +1,85 @@
diff --git a/c/Makefile b/c/Makefile
index 99f926b..635faa2 100644
--- a/c/Makefile
+++ b/c/Makefile
@@ -28,13 +28,6 @@
# - CC: The C compiler, such as gcc or clang.
# - CFLAGS: Any extra user-specified compiler flags (can be blank).
-# Mandatory compiler flags
-CFLAGS += -std=c99
-# Diagnostics. Adding '-fsanitize=address' is helpful for most versions of Clang and newer versions of GCC.
-CFLAGS += -Wall -fsanitize=undefined
-# Optimization level
-CFLAGS += -O1
-
# ---- Controlling make ----
@@ -52,18 +45,45 @@ CFLAGS += -O1
# ---- Targets to build ----
LIB = qrcodegen
-LIBFILE = lib$(LIB).a
+LIBFILE = lib$(LIB).so
+ARFILE = lib$(LIB).a
+SO_NAME = $(LIBFILE).1
+REAL_NAME = $(LIBFILE).$(QRCODEGEN_VERSION)
+HEADERS = qrcodegen.h
LIBOBJ = qrcodegen.o
MAINS = qrcodegen-demo qrcodegen-test qrcodegen-worker
+MULTIARCH := $(shell gcc --print-multiarch)
+
+INCLUDEDIR := $(DESTDIR)/usr/include/qrcodegen
+LIBDIR := $(DESTDIR)/usr/lib/$(MULTIARCH)
+
# Build all binaries
-all: $(LIBFILE) $(MAINS)
+all: $(LIBFILE) $(ARFILE) $(MAINS)
# Delete build output
clean:
- rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS)
+ rm -f -- $(LIBOBJ) $(LIBFILE) $(ARFILE) $(MAINS:=.o) $(MAINS)
rm -rf .deps
+install-shared: $(LIBFILE)
+ install -d $(LIBDIR) || true
+ install -m 0644 $(LIBFILE) $(LIBDIR)/$(REAL_NAME)
+ rm -f $(LIBDIR)/$(SO_NAME)
+ ln -s $(REAL_NAME) $(LIBDIR)/$(SO_NAME)
+ rm -f $(LIBDIR)/$(LIBFILE)
+ ln -s $(SO_NAME) $(LIBDIR)/$(LIBFILE)
+
+install-static: $(ARFILE)
+ install -d $(LIBDIR) || true
+ install -m 0644 $(ARFILE) $(LIBDIR)/$(ARFILE)
+
+install-header: $(HEADERS)
+ install -d $(INCLUDEDIR) || true
+ install -m 0644 $(HEADERS) $(INCLUDEDIR)/
+
+install: install-shared install-static install-header
+
# Executable files
%: %.o $(LIBFILE)
$(CC) $(CFLAGS) -o $@ $< -L . -l $(LIB)
@@ -73,12 +93,15 @@ qrcodegen-test: qrcodegen-test.c $(LIBOBJ:%.o=%.c)
$(CC) $(CFLAGS) -DQRCODEGEN_TEST -o $@ $^
# The library
-$(LIBFILE): $(LIBOBJ)
+$(ARFILE): $(LIBOBJ)
$(AR) -crs $@ -- $^
+$(LIBFILE): $(LIBOBJ)
+ $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^
+
# Object files
%.o: %.c .deps/timestamp
- $(CC) $(CFLAGS) -c -o $@ -MMD -MF .deps/$*.d $<
+ $(CC) $(CFLAGS) -fPIC -c -o $@ -MMD -MF .deps/$*.d $<
# Have a place to store header dependencies automatically generated by compiler
.deps/timestamp:

View File

@ -0,0 +1,85 @@
diff --git a/cpp/Makefile b/cpp/Makefile
index 858a1bf..2f8d8ed 100644
--- a/cpp/Makefile
+++ b/cpp/Makefile
@@ -28,13 +28,6 @@
# - CXX: The C++ compiler, such as g++ or clang++.
# - CXXFLAGS: Any extra user-specified compiler flags (can be blank).
-# Mandatory compiler flags
-CXXFLAGS += -std=c++11
-# Diagnostics. Adding '-fsanitize=address' is helpful for most versions of Clang and newer versions of GCC.
-CXXFLAGS += -Wall -fsanitize=undefined
-# Optimization level
-CXXFLAGS += -O1
-
# ---- Controlling make ----
@@ -51,30 +44,60 @@ CXXFLAGS += -O1
# ---- Targets to build ----
-LIB = qrcodegen
-LIBFILE = lib$(LIB).a
+LIB = qrcodegencpp
+LIBFILE = lib$(LIB).so
+ARFILE = lib$(LIB).a
+SO_NAME = $(LIBFILE).1
+REAL_NAME = $(LIBFILE).$(QRCODEGEN_VERSION)
+HEADERS = BitBuffer.hpp QrCode.hpp QrSegment.hpp
LIBOBJ = BitBuffer.o QrCode.o QrSegment.o
MAINS = QrCodeGeneratorDemo QrCodeGeneratorWorker
+MULTIARCH := $(shell gcc --print-multiarch)
+
+INCLUDEDIR := $(DESTDIR)/usr/include/qrcodegen
+LIBDIR := $(DESTDIR)/usr/lib/$(MULTIARCH)
+
# Build all binaries
-all: $(LIBFILE) $(MAINS)
+all: $(LIBFILE) $(ARFILE) $(MAINS)
# Delete build output
clean:
- rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS)
+ rm -f -- $(LIBOBJ) $(LIBFILE) $(ARFILE) $(MAINS:=.o) $(MAINS)
rm -rf .deps
+install-shared: $(LIBFILE)
+ install -d $(LIBDIR) || true
+ install -m 0644 $(LIBFILE) $(LIBDIR)/$(REAL_NAME)
+ rm -f $(LIBDIR)/$(SO_NAME)
+ ln -s $(REAL_NAME) $(LIBDIR)/$(SO_NAME)
+ rm -f $(LIBDIR)/$(LIBFILE)
+ ln -s $(SO_NAME) $(LIBDIR)/$(LIBFILE)
+
+install-static: $(ARFILE)
+ install -d $(LIBDIR) || true
+ install -m 0644 $(ARFILE) $(LIBDIR)/$(ARFILE)
+
+install-header: $(HEADERS)
+ install -d $(INCLUDEDIR) || true
+ install -m 0644 $(HEADERS) $(INCLUDEDIR)/
+
+install: install-shared install-static install-header
+
# Executable files
%: %.o $(LIBFILE)
$(CXX) $(CXXFLAGS) -o $@ $< -L . -l $(LIB)
# The library
-$(LIBFILE): $(LIBOBJ)
+$(ARFILE): $(LIBOBJ)
$(AR) -crs $@ -- $^
+$(LIBFILE): $(LIBOBJ)
+ $(CXX) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^
+
# Object files
%.o: %.cpp .deps/timestamp
- $(CXX) $(CXXFLAGS) -c -o $@ -MMD -MF .deps/$*.d $<
+ $(CXX) $(CXXFLAGS) -fPIC -c -o $@ -MMD -MF .deps/$*.d $<
# Have a place to store header dependencies automatically generated by compiler
.deps/timestamp: