Bug 1000994 - Allow specifying SONAME of a shared library in moz.build. r=glandium

This commit is contained in:
Mukilan Thiyagarajan 2014-07-09 00:47:00 +02:00
parent 06433b69a5
commit 3dca759f3f
6 changed files with 39 additions and 16 deletions

View File

@ -64,6 +64,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \
RESOURCE_FILES \
SDK_HEADERS \
SIMPLE_PROGRAMS \
SONAME \
TEST_DIRS \
TIERS \
TOOL_DIRS \
@ -148,6 +149,7 @@ CHECK_VARS := \
XPI_PKGNAME \
INSTALL_EXTENSION_ID \
SHARED_LIBRARY_NAME \
SONAME \
STATIC_LIBRARY_NAME \
$(NULL)

View File

@ -177,6 +177,12 @@ else
SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
endif
ifdef SONAME
DSO_SONAME = $(DLL_PREFIX)$(SONAME)$(DLL_SUFFIX)
else
DSO_SONAME = $(notdir $@)
endif
EMBED_MANIFEST_AT=2
endif # MKSHLIB

View File

@ -1312,8 +1312,8 @@ if test "$GNU_CC"; then
fi
# FIXME: Let us build with strict aliasing. bug 414641.
CFLAGS="$CFLAGS -fno-strict-aliasing"
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
WARNINGS_AS_ERRORS='-Werror'
DSO_CFLAGS=''
DSO_PIC_CFLAGS='-fPIC'
@ -1461,8 +1461,8 @@ elif test "$SOLARIS_SUNPRO_CC"; then
fi
_DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
else
MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
DSO_LDOPTS='-shared'
if test "$GNU_LD"; then
@ -2279,8 +2279,8 @@ ia64*-hpux*)
if test "$LIBRUNPATH"; then
DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
fi
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
;;
*-openbsd*)
@ -2323,8 +2323,8 @@ ia64*-hpux*)
[LDFLAGS=$_SAVE_LDFLAGS])
fi
MOZ_OPTIMIZE_FLAGS="-xO4"
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
MKSHLIB_FORCE_ALL='-z allextract'
MKSHLIB_UNFORCE_ALL='-z defaultextract'
DSO_LDOPTS='-G'

View File

@ -1099,8 +1099,8 @@ if test "$GNU_CC"; then
if test "${OS_ARCH}" != Darwin; then
CFLAGS="$CFLAGS -fgnu89-inline"
fi
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
DSO_LDOPTS='-shared'
if test "$GCC_USE_GNU_LD"; then
# Some tools like ASan use a runtime library that is only
@ -1192,8 +1192,8 @@ elif test "$SOLARIS_SUNPRO_CC"; then
fi
_DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
else
MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
DSO_LDOPTS='-shared'
if test "$GNU_LD"; then
@ -1799,8 +1799,8 @@ ia64*-hpux*)
if test "$LIBRUNPATH"; then
DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
fi
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
;;
*-openbsd*)
@ -1840,8 +1840,8 @@ ia64*-hpux*)
[LDFLAGS=$_SAVE_LDFLAGS])
fi
MOZ_OPTIMIZE_FLAGS="-xO4"
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
MKSHLIB_FORCE_ALL='-z allextract'
MKSHLIB_UNFORCE_ALL='-z defaultextract'
DSO_LDOPTS='-G'

View File

@ -389,6 +389,13 @@ class TreeMetadataEmitter(LoggingMixin):
self._final_libs.append((sandbox['OBJDIR'], libname, final_lib))
passthru.variables['FORCE_STATIC_LIB'] = True
soname = sandbox.get('SONAME')
if soname:
if not sandbox.get('FORCE_SHARED_LIB'):
raise SandboxValidationError('SONAME applicable only for shared libraries')
else:
passthru.variables['SONAME'] = soname
# While there are multiple test manifests, the behavior is very similar
# across them. We enforce this by having common handling of all
# manifests and outputting a single class type with the differences

View File

@ -417,6 +417,14 @@ VARIABLES = {
``BIN_SUFFIX``, the name will remain unchanged.
""", 'binaries'),
'SONAME': (unicode, unicode,
"""The soname of the shared object currently being linked
soname is the "logical name" of a shared object, often used to provide
version backwards compatibility. This variable makes sense only for
shared objects, and is supported only on some unix platforms.
""", 'binaries'),
'HOST_SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list,
"""Compile a list of host executable names.