im/app/Makefile.in
author Sebastian Hengst <archaeopteryx@coole-files.de>
Wed, 18 Mar 2015 11:00:30 +0100
changeset 28711 0ff227238c802c22c3875a2aba7e353a30f748f1
parent 27996 1f6763b45c6743634d7cee235993191c0c3e6d39
child 27850 2df52b46e5b974fab1dfee0a87cabc37037b013f
permissions -rw-r--r--
Bug 1144128 - sync mozconfig.common after bug 1123815 landed (enable-devtools-perf). r=jcranmer

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

AB_CD = $(MOZ_UI_LOCALE)

GRE_MILESTONE = $(shell $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
GRE_BUILDID = $(shell $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)

LICENSE_TXT_FILE = $(topsrcdir)/im/LICENSE.txt

MOZ_SOURCE_STAMP = $(firstword $(shell hg -R $(topsrcdir) parent --template="{node|short}\n" 2>/dev/null))
ifdef MOZ_SOURCE_STAMP
DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
endif

SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
ifdef SOURCE_REPO
DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
endif

DEFINES += \
  -DAB_CD=$(AB_CD) \
  -DINSTANTBIRD_ICO=\"$(DIST)/branding/instantbird.ico\" \
  -DGRE_MILESTONE=$(GRE_MILESTONE) \
  -DGRE_BUILDID=$(GRE_BUILDID) \
   $(NULL)

ifdef LIBXUL_SDK
include $(topsrcdir)/config/rules.mk
else
# Build a binary bootstrapping with XRE_main

DIST_FILES = application.ini

ifndef MOZ_WINCONSOLE
ifdef MOZ_DEBUG
MOZ_WINCONSOLE = 1
else
MOZ_WINCONSOLE = 0
endif
endif

# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
NSDISTMODE = copy

include $(topsrcdir)/config/config.mk

ifeq ($(OS_ARCH),WINNT)
# png to ico converter. The function takes 5 arguments, in order: source png
# file, left, top, size, output ico file.
png2ico = $(PYTHON) $(srcdir)/png2ico.py $(1) $(2) $(3) $(4) $(5)

# Extract the icons we care about embedding into the EXE
available-16.ico: $(topsrcdir)/chat/themes/available-16.png $(srcdir)/png2ico.py
	$(call png2ico,$(topsrcdir)/chat/themes/available-16.png,0,0,16,available-16.ico)

away-16.ico: $(topsrcdir)/chat/themes/away-16.png $(srcdir)/png2ico.py
	$(call png2ico,$(topsrcdir)/chat/themes/away-16.png,0,0,16,away-16.ico)

offline-16.ico: $(topsrcdir)/chat/themes/offline-16.png $(srcdir)/png2ico.py
	$(call png2ico,$(topsrcdir)/chat/themes/offline-16.png,0,0,16,offline-16.ico)

embedded-icons:: available-16.ico away-16.ico offline-16.ico
GARBAGE += available-16.ico away-16.ico offline-16.ico

# Rebuild instantbird.exe if the manifest changes - it's included by splash.rc.
# (this dependency should really be just for instantbird.exe, not other targets)
# Note the manifest file exists in the tree, so we use the explicit filename
# here.
EXTRA_DEPS += instantbird.exe.manifest
endif

include $(topsrcdir)/config/rules.mk

ifeq ($(OS_ARCH),WINNT)

$(RESFILE): embedded-icons

endif

ifneq ($(OS_ARCH),WINNT)
libs::
	cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)

GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, all.js all-instantbird.js channel-prefs.js chat-prefs.js)
endif # ! WinNT

endif # LIBXUL_SDK

ifneq (,$(filter windows gtk gtk2,$(MOZ_WIDGET_TOOLKIT)))
ifneq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
ICON_SUFFIX=.ico
else
ICON_SUFFIX=.png
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
ICON_DIR=gtk
else
ICON_DIR=$(MOZ_WIDGET_TOOLKIT)
endif

DESKTOP_ICONS = \
	$(NULL)

BRANDED_ICONS = \
	blistWindow \
	convWindow \
	default \
	$(NULL)

ifeq ($(ICON_DIR),gtk)
DESKTOP_ICONS_SMALL=$(patsubst %,%16,$(DESKTOP_ICONS))
DESKTOP_ICONS_LARGE=$(patsubst %,%48,$(DESKTOP_ICONS))
BRANDED_ICONS_SMALL=$(patsubst %,%16,$(BRANDED_ICONS))
BRANDED_ICONS_LARGE=$(patsubst %,%48,$(BRANDED_ICONS))
endif

DESKTOP_ICON_FILES = $(addsuffix $(ICON_SUFFIX), $(DESKTOP_ICONS) $(DESKTOP_ICONS_SMALL) $(DESKTOP_ICONS_LARGE))
BRANDED_ICON_FILES = $(addsuffix $(ICON_SUFFIX), $(BRANDED_ICONS) $(BRANDED_ICONS_SMALL) $(BRANDED_ICONS_LARGE))

#libs:: $(addprefix icons/$(ICON_DIR)/,$(DESKTOP_ICON_FILES))
#	$(INSTALL) $^ $(DIST)/bin/chrome/icons/default

libs:: $(addprefix $(DIST)/branding/,$(BRANDED_ICON_FILES))
	$(INSTALL) $^ $(DIST)/bin/chrome/icons/default
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
libs::
	$(INSTALL) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
endif

ifneq (,$(filter-out WINNT Darwin,$(OS_ARCH)))
ifdef LIBXUL_SDK
libs::
	cp $(LIBXUL_DIST)/bin/xulrunner-stub$(BIN_SUFFIX) $(DIST)/bin/$(STUBNAME)
endif

GARBAGE +=  $(MOZ_APP_NAME)
GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, all.js all-instantbird.js channel-prefs.js)
endif

ifneq (,$(filter gtk gtk2,$(MOZ_WIDGET_TOOLKIT)))
ICON_FILES	= \
		$(DIST)/branding/default16.png \
		$(DIST)/branding/mozicon128.png \
		$(DIST)/branding/mozicon50.xpm \
		$(DIST)/branding/mozicon16.xpm \
		$(NULL)

libs::
	$(INSTALL) $(ICON_FILES) $(DIST)/bin/icons
endif

ifdef MOZ_SPLASHSCREEN
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
libs::
	if test -f $(DIST)/branding/splash.bmp; then \
	  $(INSTALL) $(IFLAGS1) $(DIST)/branding/splash.bmp $(DIST)/bin; \
        fi
endif
endif

libs:: $(LICENSE_TXT_FILE)
ifeq ($(OS_ARCH),WINNT)
	$(EXIT_ON_ERROR) \
	for file in $^; do \
	$(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $$file > $(FINAL_TARGET)/`basename $$file`; \
	done
else
	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
endif

module.ver: module.ver.in $(DEPTH)/config/autoconf.mk
	sed 's/@''MODULE_PRODUCTVERSION@/'`echo $(INSTANTBIRD_VERSION) | sed 's/[a-z].*//; s/\./,/g; s/^\([0-9]*,[0-9]*\)$$/\1,0/; s/^\([0-9]*,[0-9]*,[0-9]*\)$$/\1,0/'`'/;s/@''MODULE_PRODUCTVERSION_STRING@/$(INSTANTBIRD_VERSION)/' $< > $@

_RC_STRING += -SRCDIR .
module.rc: module.ver

GARBAGE += module.ver

libs:: $(srcdir)/profile/prefs.js
	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile

ifdef ENABLE_TESTS
# XXX This is a hack to ensure that we get the right xpcshell.ini for our tests.
# mozilla-central does this in testing/xpcshell-tests which means that it is very
# hard for anyone to specify anything else.
libs::
	$(INSTALL) $(topsrcdir)/im/test/xpcshell.ini $(DEPTH)/_tests/xpcshell
	cp $(topsrcdir)/im/test/xpcshell.ini $(DEPTH)/_tests/xpcshell/all-test-dirs.list
endif

ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))

MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)

ifdef MOZ_DEBUG
MAC_APP_NAME := $(MAC_APP_NAME)Debug
endif

AB_CD = $(MOZ_UI_LOCALE)

AB := $(firstword $(subst -, ,$(AB_CD)))

clean clobber repackage::
	$(RM) -r $(DIST)/$(MOZ_MACBUNDLE_NAME)

tools repackage:: $(PROGRAM)
	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(MOZ_MACBUNDLE_NAME) --exclude English.lproj
	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
	sed -e "s/%APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Info.plist
	sed -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj/InfoPlist.strings
	rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources
	rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
ifdef LIBXUL_SDK
	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/instantbird
else
	$(RM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
	rsync -aL $(PROGRAM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
endif
	cp -RL $(DIST)/branding/instantbird.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/instantbird.icns
	printf APPLMOZM > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/PkgInfo
else
ifdef LIBXUL_SDK
libs::
	cp $(LIBXUL_DIST)/bin/$(XULRUNNER_STUB_NAME)$(BIN_SUFFIX) $(DIST)/bin/instantbird$(BIN_SUFFIX)
endif
endif

ifdef LIBXUL_SDK
ifndef SKIP_COPY_XULRUNNER
libs::
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Frameworks
else
	$(NSINSTALL) -D $(DIST)/bin/xulrunner
	(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
endif # cocoa
endif # SKIP_COPY_XULRUNNER
endif # LIBXUL_SDK

# Note that anything you do to dist/ down here isn't going to make it into the
# Mac build, since it's already been copied over to the .app, above.