File: rules

package info (click to toggle)
hugin 0.7.0~svn3191%2Bbeta5-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 18,680 kB
  • ctags: 14,527
  • sloc: cpp: 66,749; ansic: 6,140; sh: 3,338; makefile: 575; perl: 113; java: 29; xml: 9
file content (174 lines) | stat: -rwxr-xr-x 4,640 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/make -f
# -*- makefile -*-
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

BUILD_DIR=build-dir

include /usr/share/quilt/quilt.make

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

LDFLAGS=-Wl,--as-needed -Wl,-z,defs
CMAKE_LDFLAGS=-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" -DCMAKE_MODULE_LINKER_FLAGS="$(LDFLAGS)" -DCMAKE_SHARED_LINKER_FLAGS="$(LDFLAGS)"

# Upstream version can be overriden so as to fetch newer revisions
# without having to modify the top-most changelog entry
UVERSION  ?= $(shell dpkg-parsechangelog | perl -ne 'print "$$1\n" if (/^Version: (.*?)(?:\.dfsg)?\-.*?$$/)')
UREVISION  = $(shell echo $(UVERSION) | sed -e 's/^.*svn//')
UTRUNK     = https://hugin.svn.sourceforge.net/svnroot/hugin/hugin/trunk

# Where to store which manpages are generated (upstream keeps some manpages
# both under .pod and .1 formats).
GENERATED_MANPAGES=debian/generated-manpages

maint-svn-snapshot:
	@echo "Latest trunk:      $(shell LANG=C svn info $(UTRUNK) | grep Revision | awk -F": " '{print $$2}')"
	@echo "Upstream version:  $(UVERSION)"
	@echo "Upstream revision: $(UREVISION)"
	[ ! -f ../hugin_$(UVERSION).orig.tar.gz ] || (echo "Upstream tarball exists already. Aborting."; exit 1)
	svn export -q -r $(UREVISION) $(UTRUNK) debian/svn/hugin-$(UVERSION)
	tar cfz ../hugin_$(UVERSION).orig.tar.gz -C debian/svn hugin-$(UVERSION)
	echo "../hugin_$(UVERSION).orig.tar.gz ready"
	rm -rf debian/svn

configure: patch configure-stamp
configure-stamp:
	dh_testdir
	# Configure the package.
	mkdir $(BUILD_DIR)
	cd $(BUILD_DIR) && cmake -DCMAKE_INSTALL_PREFIX=/usr $(CMAKE_LDFLAGS) ..
	touch $@


build: build-arch build-indep

build-arch:  build-stamp
build-indep: build-stamp

build-stamp: configure

	# Compile the package.
	$(MAKE) -C $(BUILD_DIR)

	# Build manpages.
	for i in doc/*.pod ; do \
		if [ ! -f $${i%%.pod}.1 ] ; then \
			pod2man --center "HUGIN TOOLS" \
				--release $(UVERSION) \
				$$i -o $${i%%.pod}.1 ; \
			echo $${i%%.pod}.1 >> $(GENERATED_MANPAGES) ; \
		fi ; \
	done

	# Quick and dirty hack, upstream ships /usr/bin/autooptimiser and
	# doc/autooptimizer.pod
	cp doc/autooptimizer.1 doc/autooptimiser.1
	echo doc/autooptimiser.1 >> $(GENERATED_MANPAGES)

	touch $@

clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp configure-stamp

	# Clean up after the build process.
	rm -rf $(BUILD_DIR)

	# Clean generated manpages.
	if [ -f $(GENERATED_MANPAGES) ] ; then \
		for i in `cat $(GENERATED_MANPAGES)` ; do \
			rm -f $$i ; \
		done ; \
	fi
	rm -f $(GENERATED_MANPAGES)

	dh_clean

install: install-indep install-arch
install-indep:
	dh_testdir
	dh_testroot
	dh_installdirs -i

	# Install the indep part of the package
	$(MAKE) -f debian/rules DH_OPTIONS=-i install-stamp

	dh_install --sourcedir=debian/tmp -i

install-arch:
	dh_testdir
	dh_testroot
	dh_installdirs -s

	# Install the arch part of the package
	$(MAKE) -f debian/rules DH_OPTIONS=-s install-stamp

	dh_install --sourcedir=debian/tmp -s

install-stamp:
	dh_testdir
	dh_testroot
	dh_clean -k

	# Install the package into debian/tmp.
	$(MAKE) install -C $(BUILD_DIR) DESTDIR=$(CURDIR)/debian/tmp

	# Get rid of extra license file
	rm debian/tmp/usr/share/hugin/xrc/data/help_en_EN/LICENCE.manual

	# Get rid of .so, which aren't actually needed
	find debian/tmp -name '*.so' -delete

	touch $@

binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installman
	dh_desktop
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common

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