aboutsummaryrefslogtreecommitdiff
path: root/games/glbsp/dynamic_libglbsp.diff
blob: 69f68aaa4c48a39549dec58eacb88a5d019120f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
diff -Naur glbsp-2.24-source.orig/Makefile.unx glbsp-2.24-source/Makefile.unx
--- glbsp-2.24-source.orig/Makefile.unx	2007-07-25 23:14:34.000000000 -0400
+++ glbsp-2.24-source/Makefile.unx	2010-03-01 08:37:23.000000000 -0500
@@ -13,7 +13,11 @@
 #    clean   : removes targets and intermediate files
 #
 
-LIB_NAME=libglbsp.a
+libver=3.0.0
+libmajorver=3
+
+LIB_SHORTNAME=libglbsp.so
+LIB_NAME=$(LIB_SHORTNAME).$(libver)
 CMD_NAME=glbsp
 GUI_NAME=glBSPX
 DOC_NAME=glbsp.txt
@@ -24,13 +28,13 @@
 RANLIB=ranlib
 STRIP=strip --strip-unneeded
 
-BASE_FLAGS=-Wall -O2 -I./src -DUNIX -DINLINE_G=inline
+BASE_FLAGS=-Wall -O2 -fPIC -I./src -DUNIX -DINLINE_G=inline
 
 FLTK_DIR=./fltk-1.1.7
 
 INSTALL_PREFIX=/usr/local
 MAN_PREFIX=$(INSTALL_PREFIX)/share/man
-
+LIBDIR=$(INSTALL_PREFIX)/usr/lib
 
 # ----- GENERAL STUFF ----------------------------------------------
 
@@ -64,9 +68,7 @@
 	$(CC) $(LIB_FLAGS) -c $^ -o $@
 
 $(LIB_NAME): $(LIB_OBJS)
-	$(AR) $@ $(LIB_OBJS)
-	$(RANLIB) $@
-
+	$(CC) $^ -o $@ -shared -fPIC -Wl,-soname,$(LIB_SHORTNAME).$(libmajorver)
 
 # ----- CMDLINE PROGRAM ---------------------------------------------
 
@@ -88,6 +90,11 @@
 	chmod 755 $(INSTALL_PREFIX)/bin/$(CMD_NAME)
 	cp glbsp.1 $(MAN_PREFIX)/man1/
 	chmod 644 $(MAN_PREFIX)/man1/glbsp.1
+	mkdir -p $(LIBDIR)
+	strip $(LIB_NAME)
+	install -m0755 $(LIB_NAME) $(LIBDIR)
+	ln -s $(LIB_NAME) $(LIBDIR)/$(LIB_SHORTNAME).$(libmajorver)
+	ln -s $(LIB_SHORTNAME).$(libmajorver) $(LIBDIR)/$(LIB_SHORTNAME)
 
 .PHONY: install