QR-Code-generator/0003-Generate-both-shared-and-static-libraries.patch
Fridrich Strba a51c6f460b - Update to 1.8.0+git17.856ba8a
https://github.com/nayuki/QR-Code-generator/compare/v1.8.0...856ba8a
- switch build to cmake files from
  https://github.com/EasyCoding/qrcodegen-cmake.git
  - This build also adds the pkgconfig and cmake files for easier
    integration with other projects ( like the upcoming obs-studio
    31.0.0)
  - drop patches:
    0002-Make-use-of-fPIC-parameter-when-building.patch
    0003-Generate-both-shared-and-static-libraries.patch
    0004-Create-install-targets-for-C-and-CPP.patch
- use %ldconfig_scriptlets
- add BR for pkgconfig to ensure we get the pkgconfig provides

OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/QR-Code-generator?expand=0&rev=10
2024-10-09 10:59:20 +00:00

93 lines
2.6 KiB
Diff

From 16351a7ebaf318d21632bbaabf0675a70bb67dc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= <tchvatal@suse.com>
Date: Tue, 3 Dec 2019 12:07:19 +0100
Subject: [PATCH 3/5] Generate both shared and static libraries
---
c/Makefile | 14 ++++++++++----
cpp/Makefile | 14 ++++++++++----
2 files changed, 20 insertions(+), 8 deletions(-)
Index: QR-Code-generator-1.8.0/c/Makefile
===================================================================
--- QR-Code-generator-1.8.0.orig/c/Makefile
+++ QR-Code-generator-1.8.0/c/Makefile
@@ -51,16 +51,19 @@ CFLAGS += -std=c99 -O
# ---- Targets to build ----
LIB = qrcodegen
-LIBFILE = lib$(LIB).a
+ARFILE = lib$(LIB).a
+LIBFILE = lib$(LIB).so
+# Bump the soname number when the ABI changes and gets incompatible
+SO_NAME = $(LIBFILE).1
LIBOBJ = qrcodegen.o
MAINS = qrcodegen-demo qrcodegen-test
# 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
# Executable files
@@ -72,9 +75,12 @@ qrcodegen-test: qrcodegen-test.c $(LIBOB
$(CC) $(CFLAGS) $(LDFLAGS) -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) -fPIC -c -o $@ -MMD -MF .deps/$*.d $<
Index: QR-Code-generator-1.8.0/cpp/Makefile
===================================================================
--- QR-Code-generator-1.8.0.orig/cpp/Makefile
+++ QR-Code-generator-1.8.0/cpp/Makefile
@@ -51,16 +51,19 @@ CXXFLAGS += -std=c++11 -O
# ---- Targets to build ----
LIB = qrcodegencpp
-LIBFILE = lib$(LIB).a
+ARFILE = lib$(LIB).a
+LIBFILE = lib$(LIB).so
+# Bump the soname number when the ABI changes and gets incompatible
+SO_NAME = $(LIBFILE).1
LIBOBJ = qrcodegen.o
MAINS = QrCodeGeneratorDemo
# Build all binaries
-all: $(LIBFILE) $(MAINS)
+all: $(LIBFILE) $(LIBFILE) $(MAINS)
# Delete build output
clean:
- rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS)
+ rm -f -- $(LIBOBJ) $(ARFILE) $(LIBFILE) $(MAINS:=.o) $(MAINS)
rm -rf .deps
# Executable files
@@ -68,9 +71,12 @@ clean:
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< -L . -l $(LIB)
# The library
-$(LIBFILE): $(LIBOBJ)
+$(ARFILE): $(LIBOBJ)
$(AR) -crs $@ -- $^
+$(LIBFILE): $(LIBOBJ)
+ $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^
+
# Object files
%.o: %.cpp .deps/timestamp
$(CXX) $(CXXFLAGS) -fPIC -c -o $@ -MMD -MF .deps/$*.d $<