author dtownsend@oxymoronical.com
Wed, 30 May 2007 14:52:47 -0700
changeset 2010 dc9944e11180150cf16df19d2ed848e206c343a0
parent 1 9b2a99adc05e53cd4010de512f50118594756650
child 12447 05ad4eb47b65c17beca933dac9255c31c59062a2
permissions -rw-r--r--
Testcase for bug 380398: appversion manifest flag is broken in certain situations. r=bsmedberg

# Version: MPL 1.1/GPL 2.0/LGPL 2.1
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
# The Original Code is mozilla.org code.
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
# Contributor(s):
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
# ***** END LICENSE BLOCK *****

DEPTH		= ../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk

REQUIRES	= xpcom \

LOCAL_INCLUDES	= -I$(srcdir)

include $(topsrcdir)/config/config.mk


LIBRARY_NAME = mozcomps
CPPSRCS = nsMetaModule_mozcomps.cpp

include $(topsrcdir)/config/static-config.mk


# See explanation below.
ifeq ($(OS_ARCH),Darwin)
EXTRA_DEPS = force_data_segment.o exported_symbols


include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/config/static-rules.mk

# Force XPCOM_TRANSLATE_NSGM_ENTRY_POINT to be defined so the macros
# in nsIGenericFactory.h will come out in the wash.

# We don't want to link mozcomps against NSS if not necessary
ifneq (,$(findstring crypto,$(MOZ_META_COMPONENTS)))

	$(LIBS_DIR) \
	$(TK_LIBS) \

ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
OS_LIBS	+= -framework QuickTime

ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
OS_LIBS	+= -framework Cocoa

ifeq ($(OS_ARCH),Darwin)

# A limitation exists in the Mach-O format which causes "scattered" relocation
# entries in shared libraries to be limited to a 24-bit address space (16 MB).
# The high 8 bits of the address are dropped.  This can cause problems in
# a mozcomps build, particularly non-optimized builds.  To avoid the problem,
# we move the data segment before the code segment in the libraray.  The data
# segment is relatively small, and all of the relocations in question
# (which are pointers to construction vtables) reside in the
# (__DATA,__const) section.
# See also the 5th item in the TODO section of:
#   http://www.opensource.apple.com/darwinsource/10.2.6/cctools/ld/notes
#  (free APSL registration required)

# Generate a .o file with only a data segment, which we'll link as the first
# object file in the library.  That will cause the data segment to be first.

	ld -sectcreate __DATA __const /dev/null -noseglinkedit -arch ppc -o $@

	echo _nsMetaModule_nsGetModule > $@

# We have to invoke ld directly so that force_data_segment.o can be linked
# before dylib1.o

# force it to be first
SHLIB_LDSTARTFILE = force_data_segment.o -ldylib1.o

# translate gcc link options to corresponding ld options
EXTRA_DSO_LDOPTS := $(subst -dynamiclib,-dylib,$(EXTRA_DSO_LDOPTS))
EXTRA_DSO_LDOPTS := $(subst install_name,dylib_install_name,$(EXTRA_DSO_LDOPTS))
EXTRA_DSO_LDOPTS := $(subst compatibility_version,dylib_compatibility_version,$(EXTRA_DSO_LDOPTS))
EXTRA_DSO_LDOPTS := $(subst current_version,dylib_current_version,$(EXTRA_DSO_LDOPTS))

# It would be nice to limit the exported symbols here, but doing so exposes a
# bug in the linker that causes some C++ static initializers not to run after
# prebinding is updated at runtime (reported as Radar bug 3268595).
#EXTRA_DSO_LDOPTS += -exported_symbols_list exported_symbols

OS_LIBS := -lstdc++ $(OS_LIBS)

endif  # darwin

ifeq ($(OS_ARCH),WINNT)
OS_LIBS	+= ole32.lib shell32.lib

ifeq ($(OS_ARCH),BeOS)
OS_LIBS += -ltracker


_TARGET = $(srcdir)/$(@F)
GARBAGE	+= $(addprefix $(srcdir)/,$(CPPSRCS))
_TARGET = $@

nsMetaModule_%.cpp: nsMetaModule.cpp.in Makefile Makefile.in $(topsrcdir)/config/config.mk
	rm -f $@
	cat $< | \
	sed -e "s|%DECLARE_SUBMODULE_INFOS%|$(foreach m, $($(_META_COMPONENT_NAMES)), extern nsModuleInfo NSMODULEINFO($(m));)|" | \
	sed -e "s|%SUBMODULE_INFOS%|$(foreach m, $($(_META_COMPONENT_NAMES)), \\& NSMODULEINFO($(m)),)|" \
	> $(_TARGET)