diff --git a/build/macosx/universal/flight.mk b/build/macosx/universal/flight.mk new file mode 100644 index 00000000000..00e2396fe03 --- /dev/null +++ b/build/macosx/universal/flight.mk @@ -0,0 +1,105 @@ +# ***** BEGIN LICENSE BLOCK ***** +# 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 the Mozilla Mac OS X Universal Binary Packaging System +# +# The Initial Developer of the Original Code is Google Inc. +# Portions created by the Initial Developer are Copyright (C) 2006 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Mark Mentovai (Original Author) +# +# 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 ***** + +# BE CAREFUL! This makefile handles a postflight_all rule for a +# multi-project build, so DON'T rely on anything that might differ between +# the two OBJDIRs. + +ifndef OBJDIR +OBJDIR_PPC = $(MOZ_OBJDIR)/ppc +OBJDIR_X86 = $(MOZ_OBJDIR)/i386 +DIST_PPC = $(OBJDIR_PPC)/dist +DIST_X86 = $(OBJDIR_X86)/dist +DIST_UNI = $(DIST_PPC)/universal +OBJDIR = $(OBJDIR_PPC) +endif + +include $(OBJDIR)/config/autoconf.mk + +DIST = $(OBJDIR)/dist + +ifeq ($(MOZ_BUILD_APP),macbrowser) +INSTALLER_DIR = camino/installer +MOZ_PKG_APPNAME = camino +APPNAME_BASE = Camino +BUILDCONFIG_JAR = Contents/MacOS/chrome/embed.jar +else +ifeq ($(MOZ_BUILD_APP),suite) +INSTALLER_DIR = xpinstall/packager +else +INSTALLER_DIR = $(MOZ_BUILD_APP)/installer +endif +MOZ_PKG_APPNAME = $(MOZ_APP_NAME) +APPNAME_BASE = $(MOZ_APP_DISPLAYNAME) +BUILDCONFIG_JAR = Contents/MacOS/chrome/toolkit.jar +endif + +ifdef MOZ_DEBUG +APPNAME = $(APPNAME_BASE)Debug +else +APPNAME = $(APPNAME_BASE) +endif + +postflight_all: +# Build the universal package out of only the bits that would be released. +# Call the packager to set this up. Set UNIVERSAL_BINARY= to avoid producing +# a universal binary too early, before the unified bits have been staged. +# Set MAKE_PACKAGE= to avoid building a dmg. Set SIGN_NSS= to skip shlibsign. + $(MAKE) -C $(OBJDIR_PPC)/$(INSTALLER_DIR) \ + UNIVERSAL_BINARY= MAKE_PACKAGE= SIGN_NSS= + $(MAKE) -C $(OBJDIR_X86)/$(INSTALLER_DIR) \ + UNIVERSAL_BINARY= MAKE_PACKAGE= SIGN_NSS= +# Remove .chk files that may have been copied from the NSS build. These will +# cause unify to warn or fail if present. New .chk files that are +# appropriate for the merged libraries will be generated when the universal +# dmg is built. + rm -f $(DIST_PPC)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/Contents/MacOS/*.chk \ + $(DIST_X86)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/Contents/MacOS/*.chk +# The only difference betewen the two trees now should be the +# about:buildconfig page. Fix it up. + $(TOPSRCDIR)/build/macosx/universal/fix-buildconfig \ + $(DIST_PPC)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/$(BUILDCONFIG_JAR) \ + $(DIST_X86)/$(MOZ_PKG_APPNAME)/$(APPNAME).app/$(BUILDCONFIG_JAR) + mkdir -p $(DIST_UNI)/$(MOZ_PKG_APPNAME) + rm -f $(DIST_X86)/universal + ln -s $(DIST_UNI) $(DIST_X86)/universal + rm -rf $(DIST_UNI)/$(MOZ_PKG_APPNAME)/$(APPNAME).app + $(TOPSRCDIR)/build/macosx/universal/unify \ + $(DIST_PPC)/$(MOZ_PKG_APPNAME)/$(APPNAME).app \ + $(DIST_X86)/$(MOZ_PKG_APPNAME)/$(APPNAME).app \ + $(DIST_UNI)/$(MOZ_PKG_APPNAME)/$(APPNAME).app +# A universal .dmg can now be produced by making in either architecture's +# INSTALLER_DIR. diff --git a/build/macosx/universal/mozconfig b/build/macosx/universal/mozconfig new file mode 100644 index 00000000000..04ef7091cb9 --- /dev/null +++ b/build/macosx/universal/mozconfig @@ -0,0 +1,102 @@ +# ***** BEGIN LICENSE BLOCK ***** +# 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 the Mozilla Mac OS X Universal Binary Packaging System +# +# The Initial Developer of the Original Code is Google Inc. +# Portions created by the Initial Developer are Copyright (C) 2006 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Mark Mentovai (Original Author) +# +# 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 ***** + +# As used here, arguments in $MOZ_BUILD_PROJECTS are suitable as arguments +# to gcc's -arch parameter. +mk_add_options MOZ_BUILD_PROJECTS="ppc i386" + +mk_add_options MOZ_UNIFY_BDATE=1 + +mk_add_options MOZ_POSTFLIGHT_ALL+=build/macosx/universal/flight.mk + +DARWIN_VERSION=`uname -r` +ac_add_app_options ppc --target=powerpc-apple-darwin$DARWIN_VERSION +ac_add_app_options i386 --target=i386-apple-darwin$DARWIN_VERSION + +# ppc builds run on older systems. The minimum SDK for x86 is 10.4u. +ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.2.8.sdk +ac_add_app_options i386 --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk + +# $MOZ_BUILD_APP is only defined when sourced by configure. That's not a +# problem, because the variables it affects only need to be set for +# configure. +if test -n "$MOZ_BUILD_APP" ; then + TARGET_CPU=$MOZ_BUILD_APP + + # When compiling C++, Apple gcc 4.0 produces output that requires a minimum + # of 10.3.9. Use 4.0 for the x86 build, which has a higher minimum than + # that. Use 3.3 for ppc, which must run on older systems. This will + # completely override the compiler selected with the gcc_select command. + if test "$TARGET_CPU" = "ppc" ; then + GCC_VERSION=3.3 + else + GCC_VERSION=4.0 + fi + + # It's not strictly necessary to specify -arch during native builds, but it + # makes the merged about:buildconfig easier to follow, and it reduces + # conditionalized differences between builds. + CC="gcc-$GCC_VERSION -arch $TARGET_CPU" + CXX="g++-$GCC_VERSION -arch $TARGET_CPU" + + # $HOST_CXX is presently unused. $HOST_CC will only be used during a cross + # compile. Always use the 4.0 compiler, since it will always be present and + # will always work. + HOST_CC=gcc-4.0 + HOST_CXX=g++-4.0 + + # These must be set for cross builds, and don't hurt straight builds. + RANLIB=ranlib + AR=ar + AS=$CC + LD=ld + STRIP="strip -x -S" + + NATIVE_CPU=`uname -p` + if test "$NATIVE_CPU" = "powerpc" ; then + NATIVE_CPU=ppc + fi + + # Let configure know that we mean business. + if test "$NATIVE_CPU" != "$TARGET_CPU" ; then + CROSS_COMPILE=1 + fi + + # Each per-CPU build should be entirely oblivious to the fact that a + # universal binary will be produced. The exception is packager.mk, which + # needs to know to look for universal bits when building the .dmg. + UNIVERSAL_BINARY=1 +fi diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 2e8267372a9..d6582adc566 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -591,6 +591,7 @@ NEXT_ROOT = @NEXT_ROOT@ GCC_VERSION = @GCC_VERSION@ XCODEBUILD_VERSION= @XCODEBUILD_VERSION@ HAS_XCODE_2_1 = @HAS_XCODE_2_1@ +UNIVERSAL_BINARY= @UNIVERSAL_BINARY@ VISIBILITY_FLAGS = @VISIBILITY_FLAGS@ WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@ diff --git a/configure.in b/configure.in index 9a149ddc52a..2af9e8bcbce 100644 --- a/configure.in +++ b/configure.in @@ -643,6 +643,10 @@ AC_SUBST(GCC_VERSION) AC_SUBST(XCODEBUILD_VERSION) AC_SUBST(HAS_XCODE_2_1) +dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk +dnl that a universal binary is being produced. +AC_SUBST(UNIVERSAL_BINARY) + dnl ======================================================== dnl = Mac OS X SDK support dnl ======================================================== diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index 5a5b5e8abc2..ba685d1db84 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -124,8 +124,11 @@ ifneq (,$(MOZ_PKG_MAC_EXTRA)) PKG_DMG_FLAGS += $(MOZ_PKG_MAC_EXTRA) endif _ABS_TOPSRCDIR = $(shell cd $(topsrcdir) && pwd) +ifdef UNIVERSAL_BINARY +STAGEPATH = universal/ +endif MAKE_PACKAGE = $(_ABS_TOPSRCDIR)/build/package/mac_osx/pkg-dmg \ - --source "$(MOZ_PKG_APPNAME)" --target "$(PACKAGE)" \ + --source "$(STAGEPATH)$(MOZ_PKG_APPNAME)" --target "$(PACKAGE)" \ --volname "$(MOZ_APP_DISPLAYNAME)" $(PKG_DMG_FLAGS) UNMAKE_PACKAGE = \ set -ex; \ @@ -160,19 +163,25 @@ endif # dummy macro if we don't have PSM built SIGN_NSS = -ifndef CROSS_COMPILE +ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY)) ifdef MOZ_PSM SIGN_NSS = @echo signing nss libraries; +ifdef UNIVERSAL_BINARY +NATIVE_ARCH = $(shell uname -p | sed -e s/powerpc/ppc/) +NATIVE_DIST = $(DIST)/../../$(NATIVE_ARCH)/dist +SIGN_CMD = $(NATIVE_DIST)/bin/run-mozilla.sh $(NATIVE_DIST)/bin/shlibsign -v -i +else SIGN_CMD = $(DIST)/bin/run-mozilla.sh $(DEPTH)/nss/shlibsign -v -i +endif -SOFTOKN = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)softokn3$(DLL_SUFFIX) -FREEBL = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl3$(DLL_SUFFIX) -FREEBL_32FPU = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_32fpu_3$(DLL_SUFFIX) -FREEBL_32INT = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_32int_3$(DLL_SUFFIX) -FREEBL_32INT64 = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_32int64_3$(DLL_SUFFIX) -FREEBL_64FPU = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_64fpu_3$(DLL_SUFFIX) -FREEBL_64INT = $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_64int_3$(DLL_SUFFIX) +SOFTOKN = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)softokn3$(DLL_SUFFIX) +FREEBL = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl3$(DLL_SUFFIX) +FREEBL_32FPU = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_32fpu_3$(DLL_SUFFIX) +FREEBL_32INT = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_32int_3$(DLL_SUFFIX) +FREEBL_32INT64 = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_32int64_3$(DLL_SUFFIX) +FREEBL_64FPU = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_64fpu_3$(DLL_SUFFIX) +FREEBL_64INT = $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH)/$(DLL_PREFIX)freebl_64int_3$(DLL_SUFFIX) SIGN_NSS += $(SIGN_CMD) $(SOFTOKN); \ if test -f $(FREEBL); then $(SIGN_CMD) $(FREEBL); fi; \ @@ -273,14 +282,18 @@ ifdef MOZ_PKG_MANIFEST $(PERL) $(topsrcdir)/xpinstall/packager/xptlink.pl -s $(DIST) -d $(DIST)/xpt -f $(DIST)/$(MOZ_PKG_APPNAME)/components -v else # !MOZ_PKG_MANIFEST ifeq ($(MOZ_PKG_FORMAT),DMG) +# If UNIVERSAL_BINARY, the package will be made from an already-prepared +# STAGEPATH +ifndef UNIVERSAL_BINARY @cd $(DIST) && rsync -auv --copy-unsafe-links $(_APPNAME) $(MOZ_PKG_APPNAME) +endif else @cd $(DIST)/bin && tar $(TAR_CREATE_FLAGS) - * | (cd ../$(MOZ_PKG_APPNAME); tar -xf -) endif # DMG endif # MOZ_PKG_MANIFEST ifndef PKG_SKIP_STRIP @echo "Stripping package directory..." - @cd $(DIST)/$(MOZ_PKG_APPNAME); find . ! -type d \ + @cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME); find . ! -type d \ ! -name "*.js" \ ! -name "*.xpt" \ ! -name "*.gif" \ @@ -307,10 +320,10 @@ ifndef PKG_SKIP_STRIP endif @echo "Removing unpackaged files..." ifdef NO_PKG_FILES - cd $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH); rm -rf $(NO_PKG_FILES) + cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH); rm -rf $(NO_PKG_FILES) endif ifdef MOZ_PKG_REMOVALS - $(SYSINSTALL) $(MOZ_PKG_REMOVALS_GEN) $(DIST)/$(MOZ_PKG_APPNAME)$(_BINPATH) + $(SYSINSTALL) $(MOZ_PKG_REMOVALS_GEN) $(DIST)/$(STAGEPATH)$(MOZ_PKG_APPNAME)$(_BINPATH) endif # MOZ_PKG_REMOVALS @echo "Compressing..." cd $(DIST); $(MAKE_PACKAGE)