aboutsummaryrefslogtreecommitdiff
path: root/core/libtls-bearssl
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-10-04 22:53:50 +0300
committerCem Keylan <cem@ckyln.com>2020-10-04 22:53:50 +0300
commit65b3fd06092f5645808e145a36072e18763c999e (patch)
treeae5f2afc6e0818dd562d8c517c12a05f048298e8 /core/libtls-bearssl
parentbd36e113fed47de6ac33e411daf7a0b2a34bcbf6 (diff)
downloadrepository-65b3fd06092f5645808e145a36072e18763c999e.tar.gz
libtls-bearssl: add shared libraries
Diffstat (limited to 'core/libtls-bearssl')
-rwxr-xr-xcore/libtls-bearssl/build2
-rw-r--r--core/libtls-bearssl/checksums1
-rw-r--r--core/libtls-bearssl/patches/shared-lib.patch77
-rw-r--r--core/libtls-bearssl/sources1
4 files changed, 81 insertions, 0 deletions
diff --git a/core/libtls-bearssl/build b/core/libtls-bearssl/build
index 431cc725..3bb90421 100755
--- a/core/libtls-bearssl/build
+++ b/core/libtls-bearssl/build
@@ -1,4 +1,6 @@
#!/bin/sh -e
+patch -p1 < shared-lib.patch
+
make
make DESTDIR="$1" PREFIX=/usr install
diff --git a/core/libtls-bearssl/checksums b/core/libtls-bearssl/checksums
index 8bdebebc..d0e40f14 100644
--- a/core/libtls-bearssl/checksums
+++ b/core/libtls-bearssl/checksums
@@ -1 +1,2 @@
2cda22b73f6bf655fcb89eeed666e02077b7f39f7185e8488e158172bcdea0d6 libtls-bearssl-0.2.tar.gz
+2ad709019974f04e00e6946054b4a83bf5c53e5f392067a4636c85b7cb3bacd8 shared-lib.patch
diff --git a/core/libtls-bearssl/patches/shared-lib.patch b/core/libtls-bearssl/patches/shared-lib.patch
new file mode 100644
index 00000000..cebd29fe
--- /dev/null
+++ b/core/libtls-bearssl/patches/shared-lib.patch
@@ -0,0 +1,77 @@
+From 4dbd01a0b09f58928f96171da1f47b723f1da4ba Mon Sep 17 00:00:00 2001
+From: Cem Keylan <cem@ckyln.com>
+To: libtls-bearssl <~mcf/libtls-bearssl@lists.sr.ht>
+Bcc: Cem Keylan <cem@ckyln.com>
+Date: Fri, 25 Sep 2020 13:05:42 +0300
+Subject: [PATCH] Add shared library to the Makefile
+
+This builds and installs shared libraries from the Makefile, I can
+modify it to build it optionally (like adding a SHARED=1 option) to
+the Makefile.
+
+---
+ .gitignore | 1 +
+ Makefile | 12 ++++++++----
+ 2 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/.gitignore b/.gitignore
+index 9759343..36cbb30 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -1,3 +1,4 @@
+ /libtls.a
+ /libtls.pc
++/libtls.so
+ *.o
+diff --git a/Makefile b/Makefile
+index 6903d2c..3820277 100644
+--- a/Makefile
++++ b/Makefile
+@@ -8,7 +8,7 @@ PREFIX?=/usr/local
+ INCDIR?=$(PREFIX)/include
+ LIBDIR?=$(PREFIX)/lib
+ MANDIR?=$(PREFIX)/share/man
+-CFLAGS+=-Wall -Wpedantic -D _DEFAULT_SOURCE -I .
++CFLAGS+=-Wall -Wpedantic -D _DEFAULT_SOURCE -I . -fPIC
+
+ OBJ=\
+ tls.o\
+@@ -41,7 +41,7 @@ MAN=\
+ man/tls_ocsp_process_response.3\
+ man/tls_read.3
+
+-all: libtls.a
++all: libtls.a libtls.so
+
+ $(OBJ): tls.h tls_internal.h compat.h
+
+@@ -51,20 +51,24 @@ $(OBJ): tls.h tls_internal.h compat.h
+ libtls.a: $(OBJ)
+ $(AR) cr $@ $(OBJ)
+
++libtls.so: $(OBJ)
++ $(CC) -shared -Wl,-soname,libtls.so -o $@ $(OBJ) -lc -lbearssl
++
+ libtls.pc: libtls.pc.in
+ sed -e "s,@version@,$(VERSION),"\
+ -e "s,@libdir@,$(LIBDIR),"\
+ -e "s,@includedir@,$(INCDIR),"\
+ libtls.pc.in >$@.tmp && mv $@.tmp $@
+
+-install: tls.h libtls.a libtls.pc $(MAN)
++install: tls.h libtls.a libtls.pc libtls.so $(MAN)
+ mkdir -p $(DESTDIR)$(INCDIR)
+ cp tls.h $(DESTDIR)$(INCDIR)/
+ mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig/
+ cp libtls.a $(DESTDIR)$(LIBDIR)/
++ cp libtls.so $(DESTDIR)$(LIBDIR)/
+ cp libtls.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
+ mkdir -p $(DESTDIR)$(MANDIR)/man3
+ cp $(MAN) $(DESTDIR)$(MANDIR)/man3/
+
+ clean:
+- rm -f libtls.a libtls.pc $(OBJ)
++ rm -f libtls.a libtls.so libtls.pc $(OBJ)
+--
+2.28.0
+
diff --git a/core/libtls-bearssl/sources b/core/libtls-bearssl/sources
index 7f82d218..d3a51c66 100644
--- a/core/libtls-bearssl/sources
+++ b/core/libtls-bearssl/sources
@@ -1 +1,2 @@
https://git.sr.ht/~mcf/libtls-bearssl/refs/0.2/libtls-bearssl-0.2.tar.gz
+patches/shared-lib.patch