summaryrefslogtreecommitdiff
path: root/src/minefield-packager.mk.in
diff options
context:
space:
mode:
authorFabien Tassin <fta@sofaraway.org>2008-03-24 02:59:57 +0100
committerFabien Tassin <fta@sofaraway.org>2008-03-24 02:59:57 +0100
commited39212ecf461e6409c7882a6a7b5fc45ea4c03f (patch)
tree6cbb0071a0f867a8d0e6cdcae6ab74fa55320ec1 /src/minefield-packager.mk.in
parentde24e5d7574702755e81c25c84ea73e27026e64e (diff)
* [ minefield-packager ]
+ New module creating debs from Firefox nightly built tarballs - add src/minefield-packager.mk.in - add src/minefield-packager/debian/* - update src/Makefile - update README * Add $(extra_mk_dirs) to install a full directory and use it for minefield-packager/debian and (mozclient/)patches - update src/Makefile
Diffstat (limited to 'src/minefield-packager.mk.in')
-rw-r--r--src/minefield-packager.mk.in114
1 files changed, 114 insertions, 0 deletions
diff --git a/src/minefield-packager.mk.in b/src/minefield-packager.mk.in
new file mode 100644
index 0000000..9b46d01
--- /dev/null
+++ b/src/minefield-packager.mk.in
@@ -0,0 +1,114 @@
+#!/usr/bin/make -f
+
+URLBASE := http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
+MACHINE := $(shell uname -m)
+WORKDIR := temp-$(shell echo $$$$)
+BUILDSTAMP := $(WORKDIR)/build-stamp
+PKGNAME := firefox-minefield
+
+MOZDEVSCRIPT_DIR := minefield-packager
+LIBDIR := $(MOZDEVSCRIPT_DIR)/
+
+ifeq (,$(filter i686 x86_64,$(MACHINE)))
+$(error $(MACHINE) is not a supported platform)
+endif
+
+LINE := $(shell wget -qO - $(URLBASE) | grep linux-$(MACHINE).tar.bz2)
+
+ifeq (,$(LINE))
+$(error Could not find a valid archive for $(MACHINE))
+endif
+
+FILE := $(shell echo '$(LINE)' | cut -d'"' -f8)
+
+#############################
+
+GARBAGE += $(WORKDIR)
+
+.PHONY: build
+build: $(BUILDSTAMP) make_deb clean
+
+$(BUILDSTAMP):
+ rm -rf $(WORKDIR)
+ mkdir -p $(WORKDIR)/debian/tmp/DEBIAN $(WORKDIR)/debian/tmp/usr/lib
+ wget -P $(WORKDIR) $(URLBASE)$(FILE)
+ tar -C $(WORKDIR)/debian/tmp -jxf $(WORKDIR)/$(FILE)
+ mv $(WORKDIR)/debian/tmp/firefox $(WORKDIR)/debian/tmp/usr/lib/$(PKGNAME)
+ touch $(BUILDSTAMP)
+
+#############################
+
+make_deb_targets = \
+ $(WORKDIR)/debian/tmp/usr/bin/$(PKGNAME) \
+ $(WORKDIR)/debian/tmp/usr/share/applications/$(PKGNAME).desktop \
+ $(WORKDIR)/debian/tmp/usr/share/pixmaps/$(PKGNAME).png \
+ $(WORKDIR)/debian/tmp/DEBIAN/changelog \
+ $(WORKDIR)/debian/tmp/DEBIAN/control \
+ $(WORKDIR)/debian/tmp/DEBIAN/md5sums \
+ $(NULL)
+
+make_deb: BUILDID = $(shell grep ^BuildID $(WORKDIR)/debian/tmp/usr/lib/$(PKGNAME)/platform.ini | cut -d= -f2)
+make_deb: VERSION = $(shell echo $(FILE) | sed -e 's/^[^-]*-//' | cut -d. -f1,2 | sed -e 's/pre/~/' -e 's/\([ab]\)/~\1/')
+make_deb: PACKDATE := $(shell date -R)
+make_deb: $(BUILDSTAMP) $(WORKDIR)/shlibs.local $(make_deb_targets)
+ fakeroot dpkg-deb -b $(WORKDIR)/debian/tmp .
+
+#############################
+
+$(WORKDIR)/debian/tmp/usr/bin/$(PKGNAME): $(BUILDSTAMP)
+ mkdir -p $(WORKDIR)/debian/tmp/usr/bin
+ cd $(WORKDIR)/debian/tmp/usr/bin ; ln -s ../lib/$(PKGNAME)/firefox $(PKGNAME)
+
+#############################
+
+$(WORKDIR)/debian/tmp/usr/share/applications/$(PKGNAME).desktop: $(LIBDIR)debian/pkgname.desktop.in $(BUILDSTAMP)
+ mkdir -p $(WORKDIR)/debian/tmp/usr/share/applications
+ cat $< | sed \
+ -e 's/@PKGNAME@/$(PKGNAME)/g' \
+ > $@
+
+#############################
+
+$(WORKDIR)/debian/tmp/usr/share/pixmaps/$(PKGNAME).png: $(BUILDSTAMP)
+ mkdir -p $(WORKDIR)/debian/tmp/usr/share/pixmaps
+ cp $(WORKDIR)/debian/tmp/usr/lib/$(PKGNAME)/icons/mozicon128.png $(WORKDIR)/debian/tmp/usr/share/pixmaps/$(PKGNAME).png
+
+#############################
+
+$(WORKDIR)/debian/tmp/DEBIAN/changelog: $(LIBDIR)debian/changelog.in $(BUILDSTAMP)
+ cat $< | sed \
+ -e 's/@PKGNAME@/$(PKGNAME)/g' \
+ -e 's/@VERSION@/$(VERSION)build$(BUILDID)/g' \
+ -e 's/@DATE@/$(PACKDATE)/g' \
+ > $@
+
+#############################
+
+$(WORKDIR)/debian/tmp/DEBIAN/control: DEPENDS = $(shell sed -e 's/, $$//' $(WORKDIR)/deps)
+$(WORKDIR)/debian/tmp/DEBIAN/control: ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+$(WORKDIR)/debian/tmp/DEBIAN/control: $(LIBDIR)debian/control.in $(BUILDSTAMP)
+ cat $< | sed \
+ -e 's/@PKGNAME@/$(PKGNAME)/g' \
+ -e 's/@ARCH@/$(ARCH)/g' \
+ -e 's/@VERSION@/$(VERSION)build$(BUILDID)/g' \
+ -e 's/@DEPENDS@/$(DEPENDS)/g' \
+ > $@
+
+#############################
+
+$(WORKDIR)/shlibs.local: SOFILES = $(shell cd $(WORKDIR)/debian/tmp ; find usr -type f -print0 | xargs -0 file | awk '$$2 ~ /^ELF/ {print $$1}' | sed 's/:$$//')
+$(WORKDIR)/shlibs.local: SONAMES = $(foreach sofile,$(SOFILES),$(shell objdump -p $(WORKDIR)/debian/tmp/$(sofile) | awk '$$1 == "SONAME" && $$2 !~ /^\.\// {print $$2}'))
+$(WORKDIR)/shlibs.local:
+ (echo "Source: $(PKGNAME)"; echo ; echo "Package: $(PKGNAME)" ; echo "Depends:") > $(WORKDIR)/debian/control
+ (for soname in $(SONAMES) ; do echo $$soname | sed -e 's/\(.*\)\.so\.\(.*\)/\1 \2 \1-\2/' -e 's/.*\.so$$//' ; done) | sort -u | grep -vE '^$$' > $(WORKDIR)/shlibs.local || test $$? = 1
+ cd $(WORKDIR); (for file in $(SOFILES); do LD_LIBRARY_PATH=debian/tmp/usr/lib/$(PKGNAME) dpkg-shlibdeps -O -Lshlibs.local "debian/tmp/$$file" | sed -e 's/^shlibs:Depends=//' -e 's/, /\n/g'; done) | sort -u | tr '\n' ',' | sed -e 's/ *,/, /g' > deps
+ rm -f $(WORKDIR)/shlibs.local $(WORKDIR)/debian/control
+
+#############################
+
+$(WORKDIR)/debian/tmp/DEBIAN/md5sums:
+ (cd $(WORKDIR)/debian/tmp && find usr -type f -print0 | xargs -0 md5sum) > $@
+
+.PHONY: clean
+clean:
+ @rm -rf $(GARBAGE)