You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.1 KiB
62 lines
2.1 KiB
2 weeks ago
|
From b1ed73b72d63c44a2e081abae35c061844adb338 Mon Sep 17 00:00:00 2001
|
||
|
From: Alessandro Astone <ales.astone@gmail.com>
|
||
|
Date: Fri, 26 Jan 2024 15:08:12 +0100
|
||
|
Subject: [PATCH] Set library SONAME with version
|
||
|
|
||
|
---
|
||
|
Makefile | 13 ++++++++++---
|
||
|
1 file changed, 10 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/Makefile b/Makefile
|
||
|
index 95ccdc3..a646f76 100644
|
||
|
--- a/Makefile
|
||
|
+++ b/Makefile
|
||
|
@@ -4,6 +4,8 @@
|
||
|
|
||
|
default: build/debug/mujs build/debug/mujs-pp
|
||
|
|
||
|
+SOVERSION = 1
|
||
|
+
|
||
|
CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
|
||
|
|
||
|
OPTIM = -O3
|
||
|
@@ -84,7 +86,8 @@ build/sanitize/mujs: main.c one.c $(SRCS) $(HDRS)
|
||
|
|
||
|
build/debug/libmujs.$(SO): one.c $(SRCS) $(HDRS)
|
||
|
@mkdir -p $(@D)
|
||
|
- $(CC) $(CFLAGS) -g -fPIC -shared -o $@ one.c -lm
|
||
|
+ $(CC) $(CFLAGS) -g -fPIC -shared -Wl,-soname,libmujs.so.$(SOVERSION) -o $@.$(SOVERSION) one.c -lm
|
||
|
+ ln -sf libmujs.so.$(SOVERSION) $@
|
||
|
build/debug/libmujs.o: one.c $(SRCS) $(HDRS)
|
||
|
@mkdir -p $(@D)
|
||
|
$(CC) $(CFLAGS) -g -c -o $@ one.c
|
||
|
@@ -97,7 +100,8 @@ build/debug/mujs-pp: pp.c build/debug/libmujs.o
|
||
|
|
||
|
build/release/libmujs.$(SO): one.c $(SRCS) $(HDRS)
|
||
|
@mkdir -p $(@D)
|
||
|
- $(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -o $@ one.c -lm
|
||
|
+ $(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -Wl,-soname,libmujs.so.$(SOVERSION) -o $@.$(SOVERSION) one.c -lm
|
||
|
+ ln -sf libmujs.so.$(SOVERSION) $@
|
||
|
build/release/libmujs.o: one.c $(SRCS) $(HDRS)
|
||
|
@mkdir -p $(@D)
|
||
|
$(CC) $(CFLAGS) $(OPTIM) -c -o $@ one.c
|
||
|
@@ -131,7 +135,9 @@ install-static: install-common build/release/libmujs.a
|
||
|
install -m 644 build/release/libmujs.a $(DESTDIR)$(libdir)
|
||
|
|
||
|
install-shared: install-common build/release/libmujs.$(SO)
|
||
|
- install -m 755 build/release/libmujs.$(SO) $(DESTDIR)$(libdir)
|
||
|
+ install -m 755 build/release/libmujs.$(SO).$(SOVERSION) $(DESTDIR)$(libdir)
|
||
|
+ cp -af build/release/libmujs.$(SO) $(DESTDIR)$(libdir)
|
||
|
+ chmod 755 $(DESTDIR)$(libdir)
|
||
|
|
||
|
install: install-static
|
||
|
|
||
|
@@ -142,6 +148,7 @@ uninstall:
|
||
|
rm -f $(DESTDIR)$(libdir)/pkgconfig/mujs.pc
|
||
|
rm -f $(DESTDIR)$(libdir)/libmujs.a
|
||
|
rm -f $(DESTDIR)$(libdir)/libmujs.$(SO)
|
||
|
+ rm -f $(DESTDIR)$(libdir)/libmujs.$(SO).$(SOVERSION)
|
||
|
|
||
|
tarball:
|
||
|
git archive --format=zip --prefix=mujs-$(VERSION)/ HEAD > mujs-$(VERSION).zip
|