components/desktop/thunderbird/Makefile
author Petr Sumbera <petr.sumbera@oracle.com>
Mon, 05 Dec 2016 07:07:58 -0800
branchs11u3-sru
changeset 7450 a9c2f3d59485
parent 7090 49c102d793d0
child 7555 887e36ad4b59
permissions -rw-r--r--
25100750 Upgrade Thunderbird to version 45.5.1 25100647 problem in TBIRD/MAILER 25182885 problem in TBIRD/MAILER 25142122 Account passwords not visible under security preferences 17583615 Man page outdated, contains Sun branding 22993260 thunderbird has an unlisted build dependency on yasm

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#

# parfait is a bit unhappy (22527218)
export PARFAIT_BUILD=no

COMPILER = gcc
include ../../../make-rules/shared-macros.mk

GCC_ROOT = /usr/gcc/4.8

COMPONENT_NAME=		thunderbird
COMPONENT_VERSION=	45.5.1
COMPONENT_PROJECT_URL=	http://www.mozilla.com/thunderbird
COMPONENT_SRC_NAME =	$(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_SRC = 	$(COMPONENT_SRC_NAME)
COMPONENT_ARCHIVE = 	$(COMPONENT_SRC).source.tar.xz
COMPONENT_ARCHIVE_HASH= \
    sha256:15088086ab8643275f04775002aca02701e30b4d61f108d5380b6e6b7582a24c
MOZILLA_FTP = 		http://ftp.mozilla.org/pub/$(COMPONENT_NAME)/releases/$(COMPONENT_VERSION)
COMPONENT_ARCHIVE_URL=	$(MOZILLA_FTP)/source/$(COMPONENT_ARCHIVE)
COMPONENT_BUGDB=	tbird/mailer

TPNO=			32721	

LIGHTNING_VERSION=	4.7.5.1

# There are a set of .xpi files (as given in the LANG_LIST definition below)
# that we need. These are available under:
# http://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/31.6.0/linux-i686/xpi/
# https://ftp.mozilla.org/pub/calendar/lightning/candidates/4.0.5-candidates/build1/linux-i686/
# We could download and unpack them individually, but instead I've created
# a compressed tarball of them, and made them available from the internal
# Userland mirror. So these need to be re-created by hand each time we rev.
# Downloading them individually can be a problem because firefox/thunderbird 
# collide due to different files with identical .xpi names. 
COMPONENT_ARCHIVE_1 =   	$(COMPONENT_SRC)-xpi.tar.gz
COMPONENT_ARCHIVE_HASH_1 = \
    sha256:976113c074c640e32281972d26b55935238b93ff5ff8903c80bb6ed15f23cd4c
COMPONENT_ARCHIVE_URL_1 =       $(INTERNAL_ARCHIVE_MIRROR)/$(COMPONENT_ARCHIVE_1)

COMPONENT_ARCHIVE_2 =		lightning-$(LIGHTNING_VERSION)-xpi.tar.gz
COMPONENT_ARCHIVE_HASH_2 = \
    sha256:3840c42da82352bbae7defa2b3361b460c9f2f19febc4d0b3fa2335fb201c4d3
COMPONENT_ARCHIVE_URL_2 = 	$(INTERNAL_ARCHIVE_MIRROR)/$(COMPONENT_ARCHIVE_2)

LANG_LIST = ar bg ca cs da de el es-AR es-ES et eu fi \
	fr gl he hu id is it ja ko lt nb-NO nl nn-NO pa-IN pl \
	pt-BR pt-PT ro ru sk sl sq sv-SE tr uk zh-CN zh-TW

CLEAN_PATHS += $(COMPONENT_DIR)/xpi
CLEAN_PATHS += $(COMPONENT_DIR)/xpi-lightning 

# Firefox and Thunderbird share the same firefox*.patch patches. Copy these 
# patches from the Firefox patches directory and the Thunderbird patches to a 
# directory of all files (patches-all), except for Firefox patches 42 and 46, 
# which don't get applied in Thunderbird. (libxul and dtrace patches)
PATCH_DIR=patches-all
CLEAN_PATHS += $(PATCH_DIR)
COPY_COMMON_FILES_1:= $(shell mkdir -p $(PATCH_DIR))
COPY_COMMON_FILES_2:=  \
    $(shell /usr/bin/rsync -ac patches/* ../firefox/patches/* $(PATCH_DIR))
COPY_COMMON_FILES_3:= \
    $(shell /usr/bin/rm -f $(PATCH_DIR)/firefox*42*.patch $(PATCH_DIR)/firefox*46*.patch)

include $(WS_MAKE_RULES)/prep.mk
include $(WS_MAKE_RULES)/configure.mk
include $(WS_MAKE_RULES)/ips.mk

# /usr/sbin for dtrace, SPRO for python modules, PERL as well.
PATH = $(dirname $(CC)):/usr/gnu/bin:/usr/bin:/usr/sbin:$(dirname $(PERL)):$(SPRO_VROOT)/bin

MOZCONFIG =	$(BUILD_DIR_32)/mozconfig

COMPONENT_PRE_CONFIGURE_ACTION += \
	echo "mk_add_options BUILD_OFFICIAL=1" > $(MOZCONFIG) ; \
	echo "mk_add_options MOZILLA_OFFICIAL=1" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-application=mail" >> $(MOZCONFIG) ; \
	echo "ac_add_options --prefix=/usr" >> $(MOZCONFIG) ; \
	echo "ac_add_options --libdir=/usr/lib" >> $(MOZCONFIG) ; \
	echo "ac_add_options --mandir=/usr/share/man" >> $(MOZCONFIG) ; \
	echo "ac_add_options --disable-debug" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-optimize" >> $(MOZCONFIG) ; \
	echo "ac_add_options --disable-tests" >> $(MOZCONFIG) ; \
	echo "ac_add_options --with-system-zlib" >> $(MOZCONFIG) ; \
	echo "ac_add_options --with-system-bz2" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-system-ffi" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-libxul" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-jemalloc" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-official-branding" >> $(MOZCONFIG) ; \
	echo "ac_add_options --disable-updater" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-update-packaging" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-ipc" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-gstreamer" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-system-pixman" >> $(MOZCONFIG) ; \
	echo "ac_add_options --with-intl-api" >> $(MOZCONFIG) ; \
	echo "ac_add_options --disable-crashreporter" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-debug-symbols=no" >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-calendar" >> $(MOZCONFIG) ; \
        echo 'ac_add_options --with-rpath="\\\\\\$$\\$$ORIGIN"' >> $(MOZCONFIG) ; \
	echo "ac_add_options --enable-startup-notification" >> $(MOZCONFIG) ;

CXXFLAGS += 		-Wno-invalid-offsetof -fpermissive
CC +=		$(CC_BITS)
CXX +=		$(CC_BITS)

# enable ctime_r with just two arguments (S11 only)
CFLAGS +=	-D_POSIX_PTHREAD_SEMANTICS

# avoid bus error from libxul (S11 only)
LD_MAP_NOEXDATA.sparc=

CONFIGURE_ENV +=	YASM=$(COMPONENT_DIR)/../../yasm/build/$(MACH32)/yasm
# strip utility dumps core while processing libxul.so (24809759) (S11 only)
ifeq ($(MACH), sparc)
CONFIGURE_ENV +=        STRIP_FLAGS=-x
endif
CONFIGURE_ENV +=	PKG_CONFIG_PATH=$(CONFIGURE_LIBDIR.$(BITS))/pkgconfig
CONFIGURE_ENV +=	OS_DEFINES="-D__USE_LEGACY_PROTOTYPES__"
# -L.../dist/bin needs to be set otherwise it will report missing libnss3.so, 
# libssl3.so, etc, while linking.
# plugin-container calls sendfile -lsendfile (S11 only)
CONFIGURE_ENV +=	LDFLAGS="$(LD_Z_IGNORE) -z interpose -B nodirect -L$(BUILD_DIR_32)/dist/lib -L$(BUILD_DIR_32)/dist/bin -lsendfile"

CONFIGURE_ENV +=	MOZCONFIG=$(MOZCONFIG)
CONFIGURE_ENV +=	"CC=$(CC)"
CONFIGURE_ENV +=	"CXX=$(CXX)"
CONFIGURE_ENV += 	"CFLAGS=$(CFLAGS)"
CONFIGURE_ENV +=	"CXXFLAGS=$(CXXFLAGS)"

# If the configure options are not explicitly set, then configure fails with:
# configure: warning: CC=/usr/gcc/4.8/bin/gcc: invalid host type
# invalid host type
# configure: warning: CXX=/usr/gcc/4.8/bin/gcc: invalid host type
# invalid host type
# configure: error: can only configure for one host and one target at a time
CONFIGURE_OPTIONS = --prefix=$(CONFIGURE_PREFIX)
CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)

COMPONENT_POST_CONFIGURE_ACTION += \
        $(CP) $(MOZCONFIG) $(COMPONENT_SRC)/mozconfig

COMPONENT_POST_BUILD_ACTION = \
        (cd $(@D)/mail/installer ; $(ENV) $(COMPONENT_BUILD_ENV) \
                $(GMAKE) $(COMPONENT_BUILD_ARGS) $(COMPONENT_BUILD_TARGETS))

# Path to lightning extension directory
LIGHTNING_EXT_DIR = \
	$(PROTOUSRLIBDIR)/thunderbird-$(COMPONENT_VERSION)/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}

COMPONENT_POST_INSTALL_ACTION += \
	$(CP) -r $(BUILD_DIR_32)/dist/bin/distribution/extensions/{e2fda1a4-762b-4020-b5ad-a41df1933103}/* \
		$(LIGHTNING_EXT_DIR) ;

COMPONENT_POST_INSTALL_ACTION += \
        $(RM) -rf xpi ; \
        $(TAR) xvf $(COMPONENT_ARCHIVE_1) > /dev/null 2>&1 ; \
	$(TAR) xvf $(COMPONENT_ARCHIVE_2) > /dev/null 2>&1 ; \
        list1='$(LANG_LIST)' ; for f in $$list1 ; do \
            $(CP) xpi/$$f.xpi \
                $(PROTOUSRLIBDIR)/thunderbird-$(COMPONENT_VERSION)/distribution/extensions/[email protected] ; \
	    unzip xpi-lightning/lightning-$(LIGHTNING_VERSION).$$f.linux-i686.xpi \
		chrome/calendar-$$f/\* chrome/lightning-$$f/\* -d \
		    $(LIGHTNING_EXT_DIR)/ ; \
	    echo 'locale calendar '$$f' chrome/calendar-'$$f'/locale/'$$f'/calendar/' >> $(LIGHTNING_EXT_DIR)/chrome.manifest ; \
	    echo 'locale lightning '$$f' chrome/lightning-'$$f'/locale/'$$f'/lightning/' >> $(LIGHTNING_EXT_DIR)/chrome.manifest ; \
	done ;

TB_XPI = $(MOZILLA_FTP)/linux-i686/xpi
LN_XPI = http://ftp.mozilla.org/pub/calendar/lightning/candidates/$(LIGHTNING_VERSION)-candidates/build1/linux-i686

# Run gmake download-xpis and gmake download-lightning-xpis to download tarballs of xpi
# for thunderbird and lightning separately.
# The resulting archives should be uploaded to userland internal archive.
download-xpis:
	@echo "download-xpis"
	$(RM) -r $(COMPONENT_DIR)/xpi $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_1) 
	$(MKDIR) $(COMPONENT_DIR)/xpi
	@echo "downloading thunderbird xpis"
	list1='$(LANG_LIST)' ; for f in $$list1 ; do \
		echo $$f; \
		/usr/bin/curl -s -o $(COMPONENT_DIR)/xpi/$$f.xpi \
			$(TB_XPI)/$$f.xpi ;\
	done
	(cd $(COMPONENT_DIR); \
	    $(TAR) czvf $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_1) xpi )
	/usr/bin/sha256sum $(COMPONENT_ARCHIVE_1)

download-lightning-xpis:
	@echo "download-lightning-xpis"
	$(RM) $(COMPONENT_DIR)/xpi-lightning $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_2)
	$(MKDIR) $(COMPONENT_DIR)/xpi-lightning
	@echo "downloading lightning xpis"
	list1='$(LANG_LIST)' ; for f in $$list1 ; do \
		echo $$f; \
		/usr/bin/curl -s -o $(COMPONENT_DIR)/xpi-lightning/lightning-$(LIGHTNING_VERSION).$$f.linux-i686.xpi \
	                $(LN_XPI)/lightning-$(LIGHTNING_VERSION).$$f.linux-i686.xpi ;\
	done
	(cd $(COMPONENT_DIR); \
	    $(TAR) czvf $(COMPONENT_DIR)/$(COMPONENT_ARCHIVE_2) xpi-lightning )
	/usr/bin/sha256sum $(COMPONENT_ARCHIVE_2)

LIB_LIST.i386 =
LIB_LIST.sparc = $(PROTOUSRLIBDIR)/thunderbird-devel-$(COMPONENT_VERSION)/sdk/lib/cpu/sparcv8plus/libnspr_flt4.so
LIB_LIST = $(LIB_LIST.$(MACH))

COMPONENT_POST_INSTALL_ACTION += \
	slist='$(LIB_LIST)' ; for f in $$slist ; do \
	    $(MKDIR) $(PROTOUSRLIBDIR)/thunderbird-$(COMPONENT_VERSION)/cpu/sparcv8plus ; \
	    $(CP) $$f $(PROTOUSRLIBDIR)/thunderbird-$(COMPONENT_VERSION)/cpu/sparcv8plus/libnspr_flt4.so ; \
	done ;

ASLR_MODE = $(ASLR_ENABLE)

COMPONENT_TEST_DIR =    $(@D)/js/src
COMPONENT_TEST_TARGETS=check-jit-test

configure:	$(CONFIGURE_32)

build:		$(BUILD_32)

install:	$(INSTALL_32)

test:		$(BUILD_32)
	(cd $(BUILD_DIR_32)/$(COMPONENT_TEST_DIR); $(GMAKE) $(COMPONENT_TEST_TARGETS))

$(SOURCE_DIR)/.firefox-%patched: GPATCH_FLAGS += -d $(@D)/mozilla
$(SOURCE_DIR)/.S11.patched: GPATCH_FLAGS += -d $(@D)/mozilla

REQUIRED_PACKAGES += compress/bzip2
ifneq ($(MACH), sparc)
REQUIRED_PACKAGES += developer/yasm
endif
REQUIRED_PACKAGES += library/desktop/atk
REQUIRED_PACKAGES += library/desktop/cairo
REQUIRED_PACKAGES += library/desktop/gdk-pixbuf
REQUIRED_PACKAGES += library/desktop/gtk2
REQUIRED_PACKAGES += library/desktop/pango
REQUIRED_PACKAGES += library/glib2
REQUIRED_PACKAGES += library/gnome/gnome-libs
REQUIRED_PACKAGES += library/graphics/pixman
REQUIRED_PACKAGES += library/libffi
REQUIRED_PACKAGES += library/zlib
REQUIRED_PACKAGES += system/library
REQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime
REQUIRED_PACKAGES += system/library/gcc/gcc-c++-runtime
REQUIRED_PACKAGES += system/library/fontconfig
REQUIRED_PACKAGES += system/library/freetype-2
REQUIRED_PACKAGES += system/library/libdbus
REQUIRED_PACKAGES += system/library/libdbus-glib
REQUIRED_PACKAGES += system/library/math
REQUIRED_PACKAGES += system/linker
REQUIRED_PACKAGES += x11/library/libx11
REQUIRED_PACKAGES += x11/library/libxext
REQUIRED_PACKAGES += x11/library/libxrender
REQUIRED_PACKAGES += x11/library/toolkit/libxt