All pastes #444352 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-17 10:29 UTC
rendered paste body
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/dpatch/dpatch.make

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_ARCH  ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

DEBIAN_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: *\(.*\)$$/\1/ p')
DEBIAN_REV_CODE := $(shell echo $(DEBIAN_VERSION) | sed 's/^.*-\([0-9]*\)[^-]*$$/0\1/ ; s/^.*\(..\)$$/\1/')

MOZILLA_PACKAGES := $(shell awk '/^Package: mozilla/ { print $$2 }' $(CURDIR)/debian/control )

BUILD_DATE=$(shell perl -e '($$s,$$m,$$h,$$d,$$M,$$y) = gmtime((stat("client.mk"))[9]); printf "%04d%02d%02d\n",$$y + 1900,$$M + 1,$$d;')

export BUILD_OFFICIAL=1
export MOZ_BUILD_DATE=$(BUILD_DATE)$(DEBIAN_REV_CODE)

CFLAGS = -Wall -pipe

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	OPTFLAGS = -O0
else
	OPTFLAGS = -O2 -fno-strict-aliasing
endif

OPTFLAGS += -g

ifeq ($(DEB_BUILD_ARCH),ppc64)
       OPTFLAGS = -mminimal-toc
endif

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	DEBUGFLAGS = --enable-debug
endif

# Let's give it a try without that
#ifneq ($(DEB_BUILD_ARCH),mips)
#ifneq ($(DEB_BUILD_ARCH),mipsel)
#	CONFIGURE_OPTIONS = --enable-static --disable-shared
#endif
#endif

SHELL=/bin/bash # I use bashisms

TMP_DIR  = $(CURDIR)/debian/tmp
APPLICATIONS_DIR = $(TMP_DIR)/usr/share/applications
DIST = $(CURDIR)/dist

MAINTAINER_SCRIPTS = $(subst .in,,$(wildcard debian/iceape*.p*.in)) debian/mozilla-runner
DESKTOP_FILES = $(subst .in,,$(wildcard debian/*.desktop.in))
MENU_FILES = $(subst .in,,$(wildcard debian/*.menu.in))

config.status: patch-stamp ./configure debian/mozconfig
	dh_testdir

	LDFLAGS="-Wl,--as-needed" \
	MOZCONFIG=debian/mozconfig \
	CFLAGS="$(CFLAGS)" \
	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-optimize="$(OPTFLAGS)"

	#cp -f debian/localstart.html debian/README.Debian $(CURDIR)/xpfe/global/resources/content/
	#cp -f debian/mailstart.xhtml $(CURDIR)/mailnews/base/resources/content/start.xhtml

build: build-stamp
build-stamp:  config.status
	dh_testdir

	# icons
	cd debian/extras && uudecode *.uue

	# generate branding from svg to proper places
	rsvg-convert -w 274 -h 256 -o \
		$(CURDIR)/debian/extras/logo200.png \
		$(CURDIR)/debian/extras/iceape_logo_plain.svg
	touch $(CURDIR)/suite/branding/icons/gtk/seamonkey.png
	rsvg-convert -w 128 -h 128 -o \
		$(CURDIR)/debian/extras/iceape128.png \
		$(CURDIR)/debian/extras/iceape_icon_plain.svg
	rsvg-convert -w 64 -h 64 -o \
		$(CURDIR)/debian/extras/iceape64.png \
		$(CURDIR)/debian/extras/iceape_icon_plain.svg
	rsvg-convert -w 48 -h 48 -o \
		$(CURDIR)/debian/extras/iceape48.png \
		$(CURDIR)/debian/extras/iceape_icon_plain.svg
	rsvg-convert -w 32 -h 32 -o \
		$(CURDIR)/debian/extras/iceape.png \
		$(CURDIR)/debian/extras/iceape_icon_plain.svg
	rsvg-convert -w 16 -h 16 -o \
		$(CURDIR)/debian/extras/iceape16.png \
		$(CURDIR)/debian/extras/iceape_icon_plain.svg

	cp -f $(CURDIR)/debian/extras/logo200.png \
		$(CURDIR)/suite/branding/content/logo.png
	convert $(CURDIR)/debian/extras/iceape.png \
		$(CURDIR)/suite/branding/icons/gtk/default.xpm
	convert $(CURDIR)/debian/extras/iceape.png \
		$(CURDIR)/xpfe/bootstrap/icons/gtk/main-window.xpm
	convert $(CURDIR)/debian/extras/iceape16.png \
		$(CURDIR)/suite/branding/icons/gtk/default16.xpm
	convert $(CURDIR)/debian/extras/iceape16.png \
		$(CURDIR)/xpfe/bootstrap/icons/gtk/main-window16.xpm

	cp -f $(CURDIR)/debian/extras/Throbber-small.gif \
		$(CURDIR)/themes/classic/communicator/brand/throbber-anim.gif
	convert $(CURDIR)/debian/extras/Throbber-small.png \
		$(CURDIR)/themes/classic/communicator/brand/throbber-single.gif
	cp -f $(CURDIR)/debian/extras/Throbber-small.gif \
		$(CURDIR)/themes/classic/communicator/brand/throbber16-anim.gif
	convert $(CURDIR)/debian/extras/Throbber-small.png \
		$(CURDIR)/themes/classic/communicator/brand/throbber16-single.gif

	cp -f $(CURDIR)/debian/extras/Throbber-small.gif \
		$(CURDIR)/themes/modern/communicator/brand/throbber-anim.gif
	convert $(CURDIR)/debian/extras/Throbber-small.png \
		$(CURDIR)/themes/modern/communicator/brand/throbber-single.gif
	cp -f $(CURDIR)/debian/extras/Throbber-small.gif \
		$(CURDIR)/themes/modern/communicator/brand/throbber16-anim.gif
	convert $(CURDIR)/debian/extras/Throbber-small.png \
		$(CURDIR)/themes/modern/communicator/brand/throbber16-single.gif

	# copy debian iceape splash
	cp -f $(CURDIR)/debian/extras/iceape_logo_splash.xpm \
		$(CURDIR)/xpfe/bootstrap/splash.xpm

	# generate calendar images
	#rsvg-convert -w 48 -h 48 -o \
	#	$(CURDIR)/debian/extras/calendar48.png \
	#	$(CURDIR)/debian/extras/calendar.svg
	#convert $(CURDIR)/debian/extras/calendar48.png \
	#	$(CURDIR)/calendar/sunbird/app/default.xpm
	#cp -f $(CURDIR)/debian/extras/calendar48.png \
	#	$(CURDIR)/calendar/resources/content/sunbird_small.png

	# full build
	$(MAKE) BUILD_MODULES=all

	touch build-stamp

clean:: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp debian/*.png debian/extras/*.gif debian/extras/*.png MPL
	rm -f $(CURDIR)/suite/branding/icons/gtk/seamonkey.png
	rm -f $(CURDIR)/themes/classic/communicator/brand/throbber-anim.gif \
		$(CURDIR)/themes/classic/communicator/brand/throbber16-anim.gif \
		$(CURDIR)/themes/classic/communicator/brand/throbber-single.gif \
		$(CURDIR)/themes/classic/communicator/brand/throbber16-single.gif
	rm -f $(CURDIR)/themes/modern/communicator/brand/throbber-anim.gif \
		$(CURDIR)/themes/modern/communicator/brand/throbber16-anim.gif \
		$(CURDIR)/themes/modern/communicator/brand/throbber-single.gif \
		$(CURDIR)/themes/modern/communicator/brand/throbber16-single.gif
	rm -f $(CURDIR)/calendar/resources/content/sunbird_small.png \
		$(CURDIR)/suite/branding/content/logo.png

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean

	dh_clean 


install: install-stamp

install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs -a

	$(MAKE) install DESTDIR=$(TMP_DIR)

	install -d -m 755 $(TMP_DIR)/usr/share/pixmaps
	install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/main-window.xpm $(TMP_DIR)/usr/share/pixmaps/iceape.xpm
	install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/editorWindow.xpm $(TMP_DIR)/usr/share/pixmaps/iceape-composer.xpm
	install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/chatzilla-window.xpm $(TMP_DIR)/usr/share/pixmaps/chatzilla.xpm
	install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/addressbookWindow.xpm $(TMP_DIR)/usr/share/pixmaps/iceape-addressbook.xpm
	install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/messengerWindow.xpm $(TMP_DIR)/usr/share/pixmaps/iceape-mailnews.xpm
	install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/msgcomposeWindow.xpm $(TMP_DIR)/usr/share/pixmaps/iceape-mail-compose.xpm
	#install -m 644 $(TMP_DIR)/usr/lib/iceape/chrome/icons/default/calendar-window.xpm $(TMP_DIR)/usr/share/pixmaps/iceape-calendar.xpm

	$(foreach size,16x16 32x32 48x48 64x64 128x128 scalable,\
	install -d -m 755 $(TMP_DIR)/usr/share/icons/hicolor/$(size)/apps;)
	$(foreach size,16 32 48 64 128,\
	install -m 644 $(CURDIR)/debian/extras/iceape$(size).png $(TMP_DIR)/usr/share/icons/hicolor/$(size)x$(size)/apps/iceape.png;)
	install -m 644 $(CURDIR)/debian/extras/iceape_icon_plain.svg $(TMP_DIR)/usr/share/icons/hicolor/scalable/apps/iceape.svg

	install -d -m 755 $(TMP_DIR)/usr/share/applications
	install -m 644 $(CURDIR)/debian/menu_dir/*.desktop $(TMP_DIR)/usr/share/applications

	install -m 644 $(CURDIR)/debian/extras/*.src $(CURDIR)/debian/extras/*.gif $(TMP_DIR)/usr/lib/iceape/searchplugins

	install -d -m 755 $(TMP_DIR)/usr/sbin
	install -m 755 $(CURDIR)/debian/update-*-chrome $(TMP_DIR)/usr/sbin
	install -m 755 $(CURDIR)/debian/iceape-runner $(TMP_DIR)/usr/bin/iceape

	install -m 644 $(CURDIR)/dist/bin/.autoreg $(CURDIR)/debian/iceape.cfg $(TMP_DIR)/usr/lib/iceape

	install -d -m 755 $(TMP_DIR)/etc/iceape/pref
	install -m 644 $(CURDIR)/debian/base.js $(TMP_DIR)/etc/iceape/pref
	install -m 644 $(CURDIR)/debian/iceaperc $(TMP_DIR)/etc/iceape
	install -m 644 $(CURDIR)/debian/homepagereset.js $(CURDIR)/debian/about_debian.js $(TMP_DIR)/usr/lib/iceape/components

	echo // Debian package version \
		> debian/tmp/usr/lib/iceape/defaults/pref/vendor.js
	echo "pref(\"general.useragent.product\",\"Gecko\");" \
		>> debian/tmp/usr/lib/iceape/defaults/pref/vendor.js
	echo "pref(\"general.useragent.productSub\",\"$(BUILD_DATE)\");" \
		>> debian/tmp/usr/lib/iceape/defaults/pref/vendor.js
	echo "pref(\"general.useragent.extra.iceapeComment\",\"(Debian-$(DEBIAN_VERSION))\");" \
		>> debian/tmp/usr/lib/iceape/defaults/pref/vendor.js

	cp -f LICENSE MPL
	touch install-stamp

define DO_CHROME
	install -d -m 755 $(CURDIR)/debian/$(1)/var/lib/iceape/chrome.d ;
	find $(CURDIR)/debian/$(1)/usr/share/iceape/chrome -maxdepth 1 -name "*.jar" -printf "chrome/%P\n" | while read file; do grep $$file $(TMP_DIR)/usr/lib/iceape/chrome/installed-chrome.txt ; done > $(CURDIR)/debian/$(1)/var/lib/iceape/chrome.d/00$(subst iceape-,,$(1))
endef

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -A -i MPL
	#dh_installmime -i
	dh_installmenu -i
	dh_install -i --sourcedir=debian/tmp
	$(call DO_CHROME,iceape-chatzilla)
	dh_installman -i
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i $(foreach pkg,$(MOZILLA_PACKAGES),-N$(pkg) )
	dh_gencontrol $(foreach pkg,$(MOZILLA_PACKAGES),-p$(pkg) ) -- -v2:1.8+$(DEBIAN_VERSION)
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -A -a MPL
	dh_installexamples -a
	dh_installmime -a
	dh_installmenu -a
	dh_install -a --sourcedir=debian/tmp
	$(call DO_CHROME,iceape-browser)
	grep -v \.jar $(TMP_DIR)/usr/lib/iceape/chrome/installed-chrome.txt >> $(CURDIR)/debian/iceape-browser/var/lib/iceape/chrome.d/00browser
#	$(call DO_CHROME,iceape-calendar)
	$(call DO_CHROME,iceape-dom-inspector)
	$(call DO_CHROME,iceape-mailnews)
	dh_installman -a
	dh_desktop -a
	dh_link -a
	dh_strip -a --dbg-package=iceape-dbg
	for lib in $(CURDIR)/debian/iceape-browser/usr/lib/iceape/libsoftokn3.so $(CURDIR)/debian/iceape-browser/usr/lib/iceape/libfreebl*.so; do \
		LD_LIBRARY_PATH=$(CURDIR)/debian/tmp/usr/lib/iceape $(CURDIR)/security/nss/cmd/shlibsign/*/shlibsign -v -i $$lib; \
	done
	dh_compress -a
	dh_fixperms -a
	#dh_makeshlibs -a -n
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

source: clean
	sh $(CURDIR)/debian/remove.nonfree
	tar -C .. -zcf ../`dpkg-parsechangelog | sed -n '/Source:/ N; s/Source: \(.*\)\nVersion: \(.*:\|\)\(.*\)-[0-9][0-9]*$$/\1_\3/ p'`.orig.tar.gz --exclude=`basename $(CURDIR)`/debian `basename $(CURDIR)`

binary: binary-indep binary-arch
	find debian/tmp -printf %P\\n | sort -u > debian/tmp.list
	find `grep Package: debian/control | awk '{print "debian/"$$2}'` -printf %P\\n | sed 's,usr/share/iceape,usr/lib/iceape,' | sort -u > debian/pkg.list
	diff debian/tmp.list debian/pkg.list | grep "^[<>]" | grep -v "^> DEBIAN" | sort
	rm -f debian/tmp.list debian/pkg.list

.PHONY: build clean clean-patched binary-indep binary-arch binary install source