Imported Upstream version 1.0.0
[platform/upstream/js.git] / patches / libname-changes.patch
1 diff --git a/README b/README
2 --- a/README
3 +++ b/README
4 @@ -1,7 +1,59 @@
5  1.  The latest release notes for SpiderMonkey can be found at:
6  
7        https://developer.mozilla.org/En/SpiderMonkey/1.8.5
8  
9  
10  2.  js/jsd contains code for debugging support for the JavaScript engine in js/src.
11  
12 +
13 +Packaging Notes
14 +---------------
15 +This release is based on revision 5f8f494a4c29 of https://hg.mozilla.org/releases/mozilla-2.0, with
16 +a few trivial changes applied to improve the manageability of the standalone-release. In addition 
17 +to running autoconf 2.13 before bundling the release, the changes in the patches directory were
18 +applied.
19 +
20 +This standalone release introduces a new, experimental, naming convention for the SpiderMonkey
21 +shared library.  This naming convention will not be rolled back into the mainline Mozilla source
22 +tree, however the relevant patches are included with this distribution.
23 +
24 +Note: Please copy wes@page.ca on bugs related to packaging this standalone release.
25 +
26 +Linux and non-Mac OS X Unices
27 +-----------------------------
28 +Previous releases and the master source repositories build a shared library named libmozjs.so. In
29 +an effort to make version identification easier for embedders and OS distribution maintainers, this
30 +standalone release builds libmozjs185.so.1.0.0  (.dylib.1.0.0 on Mac OS X).
31 +
32 +libmozjs185 indicates that this is the SpiderMonkey library which implements JavaScript 1.8.5. The
33 +1.0.0 suffix is of the form major.minor.micro revision.  While it is unlikely that more than one 
34 +official source release for a given version of JavaScript will be published, it has happened in the
35 +past (e.g JS 1.4-1), and we want to provide clear direction in case there is a compelling need:
36 +
37 +* a change in major revision number indicates a change which is ABI and API incompatible with the
38 +  previous release,
39 +
40 +* a change in minor revision number indicates a change which is ABI incompatible, but API 
41 +  compatible with the previous release,
42 +
43 +* a change in micro revision number indicates a change which is both ABI and API compatible with
44 +  the previous release.
45
46 +A symbolic link will be provided linking libmoz185.js.so to this library, along with
47 +libmoz185.js.so.1.0 when building the install target.
48 +
49 +Most embeddings building on Unix or Linux should link against libmozjs185.so.1.0.
50 +
51 +The static library has been renamed, from libjs_static.a to libmozjs185-1.0.a.
52 +
53 +Mac OS X
54 +--------
55 +The versioning rules and symbolic links are the same as for the other flavours of Unix, but the
56 +library name is now libmozjs185.1.0.0.dylib.
57 +
58 +Most embeddings building on Mac OS X should link against libmozjs185.1.0.dylib.
59 +
60 +Microsoft Windows
61 +-----------------
62 +The versioning rules are the same as for Unix, but the the library name is now 
63 +libmozjs185-1.0.dll. Symbolic links will not be created.
64 diff --git a/js/src/Makefile.in b/js/src/Makefile.in
65 --- a/js/src/Makefile.in
66 +++ b/js/src/Makefile.in
67 @@ -66,18 +66,25 @@ ifdef ENABLE_TESTS
68  DIRS += jsapi-tests
69  endif
70  endif
71  
72  ifdef ENABLE_TESTS
73  DIRS += tests
74  endif
75  
76 +SRCREL_VERSION      = 1.0.0
77 +SRCREL_ABI_VERSION  := $(word 1,$(subst ., ,$(SRCREL_VERSION))).$(word 2,$(subst ., ,$(SRCREL_VERSION)))
78 +
79  MODULE             = js
80 -LIBRARY_NAME       = mozjs
81 +ifeq (,$(HOST_BIN_SUFFIX))
82 +LIBRARY_NAME       = mozjs185
83 +else
84 +LIBRARY_NAME       = mozjs185-$(SRCREL_ABI_VERSION)
85 +endif
86  STATIC_LIBRARY_NAME = js_static
87  GRE_MODULE         = 1
88  
89  LIBS           = $(NSPR_LIBS) 
90  
91  ifdef GNU_CXX
92  ifdef INTEL_CXX
93  # icc gets special optimize flags
94 @@ -789,16 +796,17 @@ endif
95  
96  # Compute the linker flags that programs linking against SpiderMonkey should
97  # pass to get SpiderMonkey and its dependencies, beyond just the -L and -l
98  # for the SpiderMonkey library itself.
99  # - EXTRA_DSO_LDOPTS includes the NSPR -L and -l flags.
100  # - OS_LIBS includes libraries selected by the configure script.
101  # - EXTRA_LIBS includes libraries selected by this Makefile.
102  JS_CONFIG_LIBS=$(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) 
103 +JS_CONFIG_MOZ_JS_LIBS=-L$(libdir) -l$(LIBRARY_NAME)
104  
105  # The configure script invokes this rule explicitly at configure time!
106  # It's important that js-config be ready by the time we're done
107  # configuring, because we may be running other configure scripts that
108  # would like to run js-config themselves, before js is built.
109  #
110  # This file and rules.mk go through a certain amount of work to decide
111  # which libraries to build, what to name them, and what flags to pass
112 @@ -814,34 +822,80 @@ js-config: js-config.in Makefile $(DEPTH
113         -e 's|$(at)prefix$(at)|$(prefix)|' \
114         -e 's|$(at)exec_prefix$(at)|$(exec_prefix)|' \
115         -e 's|$(at)includedir$(at)|$(includedir)|' \
116         -e 's|$(at)libdir$(at)|$(libdir)|' \
117         -e 's|$(at)MOZILLA_VERSION$(at)|$(MOZILLA_VERSION)|' \
118         -e 's|$(at)LIBRARY_NAME$(at)|$(LIBRARY_NAME)|' \
119         -e 's|$(at)NSPR_CFLAGS$(at)|$(NSPR_CFLAGS)|' \
120         -e 's|$(at)JS_CONFIG_LIBS$(at)|$(JS_CONFIG_LIBS)|' \
121 -       -e 's|$(at)MOZ_JS_LIBS$(at)|$(MOZ_JS_LIBS)|' \
122 +       -e 's|$(at)MOZ_JS_LIBS$(at)|$(JS_CONFIG_MOZ_JS_LIBS)|' \
123         && mv js-config.tmp $@ && chmod +x $@
124  
125  SCRIPTS = js-config
126  SDK_BINARY = js-config
127  
128 +pkg_config_files = \
129 +       mozjs185.pc \
130 +       $(NULL)
131 +
132 +GARBAGE += $(pkg_config_files)
133 +
134 +%.pc: $(srcdir)/%.pc.in Makefile
135 +       cat $< | sed \
136 +       -e "s|%prefix%|$(prefix)|" \
137 +       -e "s|%includedir%|$(includedir)|" \
138 +       -e "s|%libdir%|$(libdir)|" \
139 +       -e 's|%MOZILLA_VERSION%|$(MOZILLA_VERSION)|' \
140 +       > $@ && chmod 644 $@
141 +
142 +install:: $(pkg_config_files)
143 +       @echo pkg_config_file: $(pkg_config_files)
144 +       $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(libdir)/pkgconfig
145 +
146  install:: $(INSTALLED_HEADERS)
147         $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)
148  
149  install:: $(SCRIPTS)
150         $(SYSINSTALL) $^ $(DESTDIR)$(bindir)
151  
152 +ifeq (,$(HOST_BIN_SUFFIX))
153 +ifeq (.dylib,$(DLL_SUFFIX))
154 +# Mac OS X
155 +SHLIB_ANY_VER   := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY)
156 +SHLIB_ABI_VER   := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY:$(DLL_SUFFIX)=.$(SRCREL_ABI_VERSION)$(DLL_SUFFIX))
157 +SHLIB_EXACT_VER := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY:$(DLL_SUFFIX)=.$(SRCREL_VERSION)$(DLL_SUFFIX))
158 +$(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -install_name $(SHLIB_ABI_VER)
159 +$(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -current_version $(SRCREL_VERSION)
160 +$(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -compatibility_version $(SRCREL_ABI_VERSION)
161 +else
162 +# Generic Unix / Linux
163 +SHLIB_ANY_VER   := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY)
164 +SHLIB_ABI_VER   := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY).$(SRCREL_ABI_VERSION)
165 +SHLIB_EXACT_VER := $(DESTDIR)$(libdir)/$(SHARED_LIBRARY).$(SRCREL_VERSION)
166 +$(SHARED_LIBRARY): EXTRA_DSO_LDOPTS += -Wl,-soname,$(notdir $(SHLIB_ABI_VER))
167 +endif
168 +endif
169 +
170  install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
171  ifneq (,$(LIBRARY))
172         $(SYSINSTALL) $(LIBRARY) $(DESTDIR)$(libdir)
173 +       mv -f $(DESTDIR)$(libdir)/$(LIBRARY) $(subst $(STATIC_LIBRARY_NAME),mozjs185-$(SRCREL_ABI_VERSION),$(DESTDIR)$(libdir)/$(LIBRARY))
174  endif
175  ifneq (,$(SHARED_LIBRARY))
176 +ifeq (,$(HOST_BIN_SUFFIX))
177 +       @[ ! -h $(SHLIB_ANY_VER) ] || rm -f $(SHLIB_ANY_VER)
178 +endif
179         $(SYSINSTALL) $(SHARED_LIBRARY) $(DESTDIR)$(libdir)
180 +ifeq (,$(HOST_BIN_SUFFIX))
181 +       mv -f $(SHLIB_ANY_VER) $(SHLIB_EXACT_VER)
182 +       @[ ! -h $(SHLIB_ABI_VER) ] || rm -f $(SHLIB_ABI_VER)
183 +       ln -s $(SHLIB_EXACT_VER) $(SHLIB_ABI_VER)
184 +       ln -s $(SHLIB_ABI_VER) $(SHLIB_ANY_VER)
185 +endif
186  endif
187  ifneq (,$(IMPORT_LIBRARY))
188         $(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir)
189  endif
190  
191  # Extra dependancies and rules for auto-generated headers
192  host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl
193  
194 diff --git a/js/src/mozjs185.pc.in b/js/src/mozjs185.pc.in
195 new file mode 100644
196 --- /dev/null
197 +++ b/js/src/mozjs185.pc.in
198 @@ -0,0 +1,10 @@
199 +prefix=%prefix%
200 +libdir=%libdir%
201 +includedir=%includedir%
202 +
203 +Name: SpiderMonkey 1.8.5
204 +Description: The Mozilla library for JavaScript 1.8.5
205 +Version: %MOZILLA_VERSION%
206 +Requires: nspr >= 4.7
207 +Libs: -L${libdir} -lmozjs185
208 +Cflags: -I${includedir}/js