aboutsummaryrefslogtreecommitdiffstats
path: root/main/nspr/nspr-4.8-sonames.patch
blob: d0f5ad801d8be180ba915887daeaa6b9b291937c (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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#! /bin/sh /usr/share/dpatch/dpatch-run
## 81_sonames.dpatch by Mike Hommey <glandium@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add soname support

@DPATCH@

diff --git a/mozilla/nsprpub/config/rules.mk b/mozilla/nsprpub/config/rules.mk
index 794b1ae..235929d 100644
--- a/mozilla/nsprpub/config/rules.mk
+++ b/mozilla/nsprpub/config/rules.mk
@@ -132,6 +132,29 @@ SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION)_shr.a
 else
 ifdef MKSHLIB
 SHARED_LIBRARY	= $(OBJDIR)/lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX)
+SONAME		= $(notdir $(SHARED_LIBRARY))
+
+ifdef SO_VERSION
+ifneq (,$(findstring $(SONAME),$(MKSHLIB)))
+SO_VERSION_MAJOR	:= $(shell echo $(SO_VERSION) | sed 's/^\([^.]*\)\(\.[^.]*\)\?\(\.[^.]*\)\?/\1/')
+SO_VERSION_MINOR	:= $(shell echo $(SO_VERSION) | sed 's/^\([^.]*\)\(\.[^.]*\)\?\(\.[^.]*\)\?/\2/')
+SO_VERSION_MICRO	:= $(shell echo $(SO_VERSION) | sed 's/^\([^.]*\)\(\.[^.]*\)\?\(\.[^.]*\)\?/\3/')
+
+SHARED_LIBRARY_LINKS	:= $(SONAME)
+ifdef SO_VERSION_MINOR
+SHARED_LIBRARY_LINKS	+= $(SONAME).$(SO_VERSION_MAJOR)
+endif
+ifdef SO_VERSION_MICRO
+SHARED_LIBRARY_LINKS	+= $(SHARED_LIBRARY).$(SO_VERSION_MAJOR)$(SO_VERSION_MINOR)
+endif
+
+SONAME			:= $(SONAME).$(SO_VERSION_MAJOR)
+SHARED_LIBRARY		:= $(SHARED_LIBRARY).$(SO_VERSION)
+
+MKSHLINKS		= (cd $(1) && for link in $(SHARED_LIBRARY_LINKS); do rm -f $$link; ln -s $(notdir $(SHARED_LIBRARY)) $$link; done)
+endif
+endif
+
 endif
 endif
 
@@ -165,7 +188,7 @@ OBJS		= $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \
 endif
 
 ALL_TRASH		= $(TARGETS) $(OBJS) $(RES) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \
-			  $(NOSUCHFILE) \
+			  $(SHARED_LIBRARY_LINKS) $(NOSUCHFILE) \
 			  so_locations
 
 ifndef RELEASE_LIBS_DEST
@@ -215,6 +238,7 @@ ifdef RELEASE_HEADERS
 endif
 ifdef RELEASE_LIBS
 	$(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir)/$(lib_subdir)
+	$(call MKSHLINKS,$(DESTDIR)$(libdir)/$(lib_subdir))
 endif
 	+$(LOOP_OVER_DIRS)
 
@@ -310,6 +334,8 @@ $(IMPORT_LIBRARY): $(SHARED_LIBRARY)
 endif
 endif
 
+$(SHARED_LIBRARY_LINKS): %: $(SHARED_LIBRARY)
+
 $(SHARED_LIBRARY): $(OBJS) $(RES) $(MAPFILE)
 	@$(MAKE_OBJDIR)
 	rm -f $@
@@ -332,6 +358,7 @@ ifdef MT
 endif	# MSVC with manifest tool
 else	# WINNT && !GCC
 	$(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(EXTRA_LIBS)
+	$(call MKSHLINKS,.)
 endif	# WINNT && !GCC
 endif	# AIX 4.1
 ifdef ENABLE_STRIP
diff --git a/mozilla/nsprpub/configure.in b/mozilla/nsprpub/configure.in
index 772e288..e4cea9a 100644
--- a/mozilla/nsprpub/configure.in
+++ b/mozilla/nsprpub/configure.in
@@ -1113,7 +1113,7 @@ case "$target" in
         AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC)
         MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)'
         DSO_CFLAGS=-fPIC
-        DSO_LDOPTS='-shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)'
+        DSO_LDOPTS='-shared -Wl,-soname,$(SONAME)'
         STRIP="$STRIP -d"
         case "$target_os" in
         bsdi4.2* | bsdi4.3* | bsdi5.*)
@@ -1311,7 +1311,7 @@ tools are selected during the Xcode/Developer Tools installation.])
     fi
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     DSO_CFLAGS=-fPIC
-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
+    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(SONAME)'
     MDCPUCFG_H=_freebsd.cfg
     PR_MD_CSRCS=freebsd.c
     ;;
@@ -1326,7 +1326,7 @@ tools are selected during the Xcode/Developer Tools installation.])
     # workaround this problem.
     AC_DEFINE(_PR_POLL_WITH_SELECT)
     AC_DEFINE(_USE_BIG_FDS)
-    DSO_LDOPTS='-b +h $(notdir $@)'
+    DSO_LDOPTS='-b +h $(SONAME)'
     PR_MD_CSRCS=hpux.c
     if test "$OS_TEST" = "ia64"; then
         DLL_SUFFIX=so
@@ -1579,7 +1579,7 @@ arm-android-eabi)
     PR_MD_CSRCS=linux.c
     MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
     DSO_CFLAGS=-fPIC
-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
+    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(SONAME)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
@@ -1610,7 +1610,7 @@ arm-android-eabi)
     PR_MD_CSRCS=linux.c
     MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@'
     DSO_CFLAGS=-fPIC
-    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
+    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(SONAME)'
     _OPTIMIZE_FLAGS=-O2
     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
                                    # combo is not yet good at debugging inlined
@@ -1943,7 +1943,7 @@ mips-nec-sysv*)
         else
             OBJECT_FMT=ELF
             DLL_SUFFIX=so
-            DSO_LDOPTS='-shared -Wl,-soname,$(notdir $@)'
+            DSO_LDOPTS='-shared -Wl,-soname,$(SONAME)'
         fi
     fi
 
@@ -1989,7 +1989,7 @@ mips-sony-newsos*)
     AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
     MDCPUCFG_H=_nto.cfg
     PR_MD_CSRCS=nto.c
-    MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(notdir $@) -o $@'
+    MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(SONAME) -o $@'
     DSO_CFLAGS=-fPIC
     DSO_LDOPTS=-shared
     OS_LIBS="$OS_LIBS -lsocket"
@@ -2052,7 +2052,7 @@ mips-sony-newsos*)
     if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
         AC_DEFINE(OSF1V4_MAP_PRIVATE_BUG)
     fi
-    DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
+    DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(SONAME)'
     MDCPUCFG_H=_osf1.cfg
     PR_MD_CSRCS=osf1.c
     ;;
@@ -2119,7 +2119,7 @@ mips-sony-newsos*)
         _OPTIMIZE_FLAGS='-O -F Olimit,4000'
     fi
 
-    DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)'
+    DSO_LDOPTS='-G -z defs -h $(SONAME)'
 
     if test "$OS_RELEASE" = "5.43"; then
         AC_DEFINE(IP_MULTICAST)
@@ -2184,13 +2184,13 @@ mips-sony-newsos*)
         if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
             GCC_USE_GNU_LD=1
         fi
-        DSO_LDOPTS='-shared -Wl,-h,$(notdir $@),-z,combreloc,-z,defs,-z,ignore' 
+        DSO_LDOPTS='-shared -Wl,-h,$(SONAME),-z,combreloc,-z,defs,-z,ignore' 
         if test -n "$USE_B_DIRECT"; then
             DSO_LDOPTS="$DSO_LDOPTS,-Bdirect"
         fi
     else
         DSO_CFLAGS=-KPIC
-        DSO_LDOPTS='-G -h $(notdir $@) -z combreloc -z defs -z ignore'
+        DSO_LDOPTS='-G -h $(SONAME) -z combreloc -z defs -z ignore'
         if test -n "$USE_B_DIRECT"; then
             DSO_LDOPTS="$DSO_LDOPTS -Bdirect"
         fi
diff --git a/mozilla/nsprpub/lib/ds/Makefile.in b/mozilla/nsprpub/lib/ds/Makefile.in
index 82dca03..ab4e64d 100644
--- a/mozilla/nsprpub/lib/ds/Makefile.in
+++ b/mozilla/nsprpub/lib/ds/Makefile.in
@@ -122,6 +122,7 @@ endif
 
 LIBRARY_NAME	= plds
 LIBRARY_VERSION	= $(MOD_MAJOR_VERSION)
+SO_VERSION	= 0d
 
 RELEASE_HEADERS = $(HEADERS)
 RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)
@@ -176,11 +177,13 @@ endif
 export:: $(TARGETS)
 	$(INSTALL) -m 444 $(HEADERS) $(dist_includedir)
 	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
+	$(call MKSHLINKS,$(dist_libdir))
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
 else
 	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
+	$(call MKSHLINKS,$(dist_bindir))
 endif
 endif
diff --git a/mozilla/nsprpub/lib/libc/src/Makefile.in b/mozilla/nsprpub/lib/libc/src/Makefile.in
index 2cafb1a..0d74a4a 100644
--- a/mozilla/nsprpub/lib/libc/src/Makefile.in
+++ b/mozilla/nsprpub/lib/libc/src/Makefile.in
@@ -68,6 +68,7 @@ CSRCS =\
 
 LIBRARY_NAME	= plc
 LIBRARY_VERSION	= $(MOD_MAJOR_VERSION)
+SO_VERSION	= 0d
 
 RELEASE_LIBS = $(TARGETS)
 
@@ -177,11 +178,13 @@ endif
 
 export:: $(TARGETS)
 	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
+	$(call MKSHLINKS,$(dist_libdir))
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
 else
 	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
+	$(call MKSHLINKS,$(dist_bindir))
 endif
 endif
diff --git a/mozilla/nsprpub/pr/src/Makefile.in b/mozilla/nsprpub/pr/src/Makefile.in
index 3514ab1..a86766e 100644
--- a/mozilla/nsprpub/pr/src/Makefile.in
+++ b/mozilla/nsprpub/pr/src/Makefile.in
@@ -325,6 +325,7 @@ endif
 
 LIBRARY_NAME = nspr
 LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
+SO_VERSION = 0d
 
 RELEASE_LIBS = $(TARGETS)
 
@@ -391,12 +392,14 @@ endif
 
 export:: $(TARGETS)
 	$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
+	$(call MKSHLINKS,$(dist_libdir))
 ifdef SHARED_LIBRARY
 ifeq ($(OS_ARCH),HP-UX)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
 	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
 else
 	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
+	$(call MKSHLINKS,$(dist_bindir))
 endif
 endif