~midori/midori/packaging-gtk3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/make -f

LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS+=-Wl,--as-needed -Wl,-O1

export DEB_BUILD_HARDENING=1

CMD=$(shell echo $@ | sed 's/override_//')

LIBWEBKIT_PKG=$(shell dpkg-query -p libwebkitgtk-3.0-dev | grep Depends | sed -r 's/.*(libwebkitgtk[^ ]+).*/\1/')
#LIBWEBKIT_PKG="libwebkitgtk-3.0-0"
GTKLAUNCHER=$(shell dpkg-query -L $(LIBWEBKIT_PKG) | grep GtkLauncher)
DISTRO=$(shell lsb_release -is)
CONFIG_FILE=debian/config/$(DISTRO).h
ifneq (0, $(shell test -e $(CONFIG_FILE); echo "$$?"))
	DISTRO=Debian
endif

DEBIAN_DIST_VERSION:= $(shell lsb_release -sr)
CONFIGURE_FLAGS=
# libzeitgeist-dev on Oneiric is too old
ifeq (,$(11.10,$(DEBIAN_DIST_VERSION)))
	CONFIGURE_FLAGS += --disable-zeitgeist
endif

%:
	dh $@

debian/presubj: debian/presubj.in
	@echo "presubj parameters:"
	@echo "Replacing %LIBWEBKIT_PKG% with $(LIBWEBKIT_PKG)"
	@echo "Replacing %GTKLAUNCHER% with $(GTKLAUNCHER)"
	test -f "/var/lib/dpkg/info/$(LIBWEBKIT_PKG).list" || true
	test -f "$(GTKLAUNCHER)" || true
	test -n "$(GTKLAUNCHER)" || true
	sed -e "s,%LIBWEBKIT_PKG%,$(LIBWEBKIT_PKG),g" -e "s,%GTKLAUNCHER%,$(GTKLAUNCHER),g" $@.in > $@

override_dh_install: debian/presubj
	$(CMD) --fail-missing

override_dh_auto_clean:
	make clean || true
	rm -rf _build

override_dh_auto_configure:
	./configure --prefix=/usr --enable-gtk3 $(CONFIGURE_FLAGS)

override_dh_auto_build:
	make

override_dh_auto_test:
	xvfb-run make check || true

override_dh_auto_install:
	make install DESTDIR=../debian/tmp
	rm -f debian/tmp/usr/share/doc/midori/COPYING debian/tmp/usr/share/doc/midori/TRANSLATE
	install -m 0644 debian/$(DISTRO)-config debian/tmp/etc/xdg/midori/config

PRIORITY=$(shell sed -r -e '/DEBIAN_WWW_ALTERNATIVES_PRIORITY/ !d' -e 's/.* ([^ ]*)$$/\1/' $(CONFIG_FILE))

debian/midori-gtk3.postinst: debian/midori-gtk3.postinst.base
	sed "s/DEBIAN_WWW_ALTERNATIVES_PRIORITY/$(PRIORITY)/g" debian/midori-gtk3.postinst.base > debian/midori-gtk3.postinst

override_dh_installdeb: debian/midori-gtk3.postinst
	$(CMD)

override_dh_strip:
	$(CMD) --dbg-package=midori-gtk3-dbg

override_dh_installchangelogs:
	rm -f debian/midori/usr/share/doc/midori/ChangeLog
	dh_installchangelogs ChangeLog