summaryrefslogtreecommitdiff
path: root/media-sound/gsm/files/gsm-1.0.22-makefile.patch
blob: 9ef9e5a246c6e0550da5033127a16a24276820c2 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
https://src.fedoraproject.org/rpms/gsm/blob/rawhide/f/gsm-makefile.patch

--- a/Makefile
+++ b/Makefile
@@ -44,13 +44,17 @@ WAV49	= -DWAV49
 # CCFLAGS 	= -c -O
 
 CC		= gcc -ansi -pedantic
-CCFLAGS 	= -c -O2 -DNeedFunctionPrototypes=1 -Wall -Wno-comment
+CCFLAGS 	= -c -DNeedFunctionPrototypes=1 -Wall -Wno-comment -D_XOPEN_SOURCE=700 -D_REENTRANT -fPIC
 
 LD 		= $(CC)
 
 # LD		= gcc
 # LDFLAGS 	=
 
+SO_MAJOR = 1
+SO_MINOR = 0
+SO_PATCH = 19
+SO_VER = $(SO_MAJOR).$(SO_MINOR).$(SO_PATCH)
 
 # If your compiler needs additional flags/libraries, regardless of
 # the source compiled, configure them here.
@@ -81,7 +85,7 @@ INSTALL_ROOT	=
 GSM_INSTALL_ROOT = $(INSTALL_ROOT)
 GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
 GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
-GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
+GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
 
 
 # Where do you want to install the toast binaries and their manpage?
@@ -91,12 +95,12 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
 
 TOAST_INSTALL_ROOT	  = $(INSTALL_ROOT)
 TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
-TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
+TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
 
 #  Other tools
 
 SHELL		= /bin/sh
-LN		= ln
+LN		= ln -s
 BASENAME 	= basename
 AR		= ar
 ARFLAGS		= cr
@@ -140,6 +144,7 @@ LFLAGS	= $(LDFLAGS) $(LDINC)
 # Targets
 
 LIBGSM	= $(LIB)/libgsm.a
+LIBGSMSO = $(LIB)/libgsm.so
 
 TOAST	= $(BIN)/toast
 UNTOAST	= $(BIN)/untoast
@@ -257,7 +262,9 @@ STUFF = 	ChangeLog			\
 # Install targets
 
 GSM_INSTALL_TARGETS =	\
-		$(GSM_INSTALL_LIB)/libgsm.a		\
+		$(GSM_INSTALL_LIB)/libgsm.so.$(SO_VER)	\
+		$(GSM_INSTALL_LIB)/libgsm.so.$(SO_MAJOR)\
+		$(GSM_INSTALL_LIB)/libgsm.so		\
 		$(GSM_INSTALL_INC)/gsm.h		\
 		$(GSM_INSTALL_MAN)/gsm.3		\
 		$(GSM_INSTALL_MAN)/gsm_explode.3	\
@@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS =	\
 
 # Target rules
 
-all:		$(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
+all:		$(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
 		@-echo $(ROOT): Done.
 
 tst:		$(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
@@ -299,24 +306,32 @@ install:	toastinstall gsminstall
 
 # The basic API: libgsm
 
+$(LIBGSMSO).$(SO_VER): $(LIB) $(GSM_OBJECTS)
+		$(LD) $(LFLAGS) -o $@ -shared -Xlinker -soname -Xlinker libgsm.so.$(SO_MAJOR) $(GSM_OBJECTS) -lc
+
+$(LIBGSMSO).$(SO_MAJOR): $(LIBGSMSO).$(SO_VER)
+		ln -fs libgsm.so.$(SO_VER) lib/libgsm.so.$(SO_MAJOR)
+
+$(LIBGSMSO): $(LIBGSMSO).$(SO_VER)
+		ln -fs libgsm.so.$(SO_VER) lib/libgsm.so
+
 $(LIBGSM):	$(LIB) $(GSM_OBJECTS)
 		-rm $(RMFLAGS) $(LIBGSM)
 		$(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
 		$(RANLIB) $(LIBGSM)
 
-
 # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
 
-$(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSM)
-		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
+$(TOAST):	$(BIN) $(TOAST_OBJECTS) $(LIBGSMSO)
+		$(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
 
 $(UNTOAST):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(UNTOAST)
-		$(LN) $(TOAST) $(UNTOAST)
+		$(LN) toast $(UNTOAST)
 
 $(TCAT):	$(BIN) $(TOAST)
 		-rm $(RMFLAGS) $(TCAT)
-		$(LN) $(TOAST) $(TCAT)
+		$(LN) toast $(TCAT)
 
 
 # The local bin and lib directories
@@ -352,52 +367,55 @@ toastuninstall:
 
 $(TOAST_INSTALL_BIN)/toast:	$(TOAST)
 		-rm $(RMFLAGS) $@
-		cp $(TOAST) $@
-		chmod 755 $@
+		install -pm755 $(TOAST) $@
 
 $(TOAST_INSTALL_BIN)/untoast:	$(TOAST_INSTALL_BIN)/toast
 		-rm $(RMFLAGS) $@
-		$(LN) $? $@
+		$(LN) -rs $? $@
 
 $(TOAST_INSTALL_BIN)/tcat:	$(TOAST_INSTALL_BIN)/toast
 		-rm $(RMFLAGS) $@
-		$(LN) $? $@
+		$(LN) -rs $? $@
 
 $(TOAST_INSTALL_MAN)/toast.1:	$(MAN)/toast.1
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
 $(GSM_INSTALL_MAN)/gsm.3:	$(MAN)/gsm.3
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
 $(GSM_INSTALL_MAN)/gsm_option.3:	$(MAN)/gsm_option.3
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
 $(GSM_INSTALL_MAN)/gsm_explode.3:	$(MAN)/gsm_explode.3
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
 $(GSM_INSTALL_MAN)/gsm_print.3:	$(MAN)/gsm_print.3
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
 $(GSM_INSTALL_INC)/gsm.h:	$(INC)/gsm.h
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
 $(GSM_INSTALL_LIB)/libgsm.a:	$(LIBGSM)
 		-rm $(RMFLAGS) $@
-		cp $? $@
-		chmod 444 $@
+		install -pm644 $? $@
 
+$(GSM_INSTALL_LIB)/libgsm.so.$(SO_VER):	$(LIBGSMSO).$(SO_VER)
+		-rm $(RMFLAGS) $@
+		install -pm755 $? $@
+
+$(GSM_INSTALL_LIB)/libgsm.so.$(SO_MAJOR):	$(LIBGSMSO).$(SO_MAJOR)
+		-rm $(RMFLAGS) $@
+		ln -s libgsm.so.$(SO_VER) $@
+
+$(GSM_INSTALL_LIB)/libgsm.so:	$(LIBGSMSO)
+		-rm $(RMFLAGS) $@
+		ln -s libgsm.so.$(SO_VER) $@
 
 # Distribution