File: rules

package info (click to toggle)
clanlib 0.5.4-1-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,320 kB
  • ctags: 10,893
  • sloc: cpp: 76,056; xml: 3,281; sh: 2,961; perl: 1,204; asm: 837; makefile: 775
file content (237 lines) | stat: -rwxr-xr-x 6,755 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# GNU copyright 1997 by Joey Hess.
#
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.

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

# This is the debhelper compatability version to use.
export DH_COMPAT=3

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

soname=0
vername=0.5.1

tmpdir=debian/tmp
shell=/bin/sh

pkg=clanlib
pkg-doc=$(pkg)-doc
pkg-dev=$(pkg)-dev
pkg-exa=$(pkg)-examples


MOVEBEFORE="$(pkg)-gl" \
           "$(pkg)-gui" \
           "$(pkg)-jpeg" \
           "$(pkg)-mikmod" \
           "$(pkg)-network" \
           "$(pkg)-png" \
           "$(pkg)-sound" \
           "$(pkg)-ttf" \
           "$(pkg)-vorbis" 
#           "$(pkg)-lua" \

NODOCS-INDEP="$(pkg-exa)"
NODOCS-ARCHDEP=$(MOVEBEFORE) \
               "$(pkg-dev)"

DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null)

ifeq ($(DEB_HOST_ARCH),i386)
	use_asm386=yes
else
	use_asm386=no
endif

CFLAGS := -fPIC
ifeq ($(DEB_HOST_ARCH),hppa)
	CFLAGS += -ffunction-sections
endif
ifeq ($(DEB_HOST_ARCH),mipsel)
	CFLAGS += -ffunction-sections
endif
ifeq ($(DEB_HOST_ARCH),powerpc)
	CFLAGS += -ffunction-sections
endif


debian_patches = bounds bufferoverflow gcc3 dfb makefile

config.status: patched-stamp
	dh_testdir
	# Add here commands to compile the package.
	#./autogen.sh
	CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" ./configure --enable-x11 --enable-directfb --enable-opengl --x-includes=/usr/include/X11 \
	--enable-clansound --disable-lua --enable-network --enable-png --enable-vidmode \
	--enable-dyn --prefix=/usr --enable-asm386=$(use_asm386)  --disable-smalljpeg

build: patched-stamp build-stamp
build-stamp: config.status
	dh_testdir
	$(MAKE)
	#$(MAKE) docs
	touch build-stamp

clean: reverse-patches
	dh_testdir
	dh_testroot
	rm -f build-stamp 

	# Add here commands to clean up after the build process.
	# save manpage do get not removed by the quite rude upstream Makefile
	mv debian/clanlib-config.1 debian/clanlib-config.one
	-$(MAKE) distclean
	-cd Documentation; $(MAKE) distclean

	dh_clean
	# ... and get the manpage right back
	mv debian/clanlib-config.one debian/clanlib-config.1

install: debian/$(pkg-doc)/usr/share/doc/$(pkg-doc)
debian/$(pkg-doc)/usr/share/doc/$(pkg-doc): DH_OPTIONS=
debian/$(pkg-doc)/usr/share/doc/$(pkg-doc):
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	if [ ! -f debian/clanlib-config.1 ] ; then exit -1 ; fi
	# Add here commands to install the package into debian/tmp.
	$(MAKE) install prefix=$(CURDIR)/debian/tmp/usr
	if [ ! -f debian/clanlib-config.1 ] ; then exit -1 ; fi
	
	## strangely enough libclanPNG.a is not installed
	cp -a Libs/libclanPNG.a $(CURDIR)/debian/tmp/usr/lib
	
	$(MAKE) docs_install prefix=$(CURDIR)/debian/tmp/usr/share \
	HTML_PREFIX=$(CURDIR)/debian/tmp/usr/share/doc/$(pkg)/html

	# Don't know why dh_installdirs does not create this.
	# It works manually, but fails while package build :-( ...
	mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/$(pkg)/examples
	cp -a Documentation/Examples/* $(CURDIR)/debian/tmp/usr/share/doc/$(pkg)/examples

	# Remove some CVS stuff and fix permissions of JPG files
	find $(CURDIR)/debian/tmp -name .cvsignore -exec rm -f \{\} \;
	find $(CURDIR)/debian/tmp -name "*.jpg" -exec chmod 644 \{\} \;

	# The static libraries are HUGE, so we'll strip them before moving (so they'll
	# take a lot less space during the move avoiding a possible full filesystem)
	dh_strip -pclanlib -Pdebian/tmp
	for move in $(MOVEBEFORE) ; do \
	   dh_movefiles --package=$${move} ; \
	done
	dh_movefiles --package=$(pkg-dev)
	dh_movefiles --package=$(pkg)
	dh_movefiles --package=$(pkg-exa)
	dh_movefiles --package=$(pkg-doc)
	mv debian/$(pkg-doc)/usr/share/doc/$(pkg) debian/$(pkg-doc)/usr/share/doc/$(pkg-doc)

# Build architecture-independent files here.
# Pass -i to all debhelper commands in this target to reduce clutter.
binary-indep: DH_OPTIONS=-i
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs -p$(pkg)
#	dh_installexamples
#	dh_installmenu
#	dh_installinfo
	dh_installchangelogs -p$(pkg) -p$(pkg-doc)
	for nodoc in $(NODOCS-INDEP) ; do \
	  rm -rf $(CURDIR)/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
	  ln -s $(pkg) $(CURDIR)/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
        done
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
#	dh_perl
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
# Pass -a to all debhelper commands in this target to reduce clutter.
binary-arch: DH_OPTIONS=-a
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_installdocs  -p$(pkg)
#	dh_installexamples
#	dh_installmenu
#	dh_installinfo
	dh_installchangelogs -p$(pkg) 
	dh_installman -p$(pkg) debian/clanlib-config.1
	for nodoc in $(NODOCS-ARCHDEP) ; do \
	  rm -rf $(CURDIR)/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
	  ln -s $(pkg) $(CURDIR)/debian/$${nodoc}/usr/share/doc/$${nodoc} ; \
        done
	dh_strip
	dh_link
	dh_compress
	dh_fixperms
	DH_COMPAT=4 dh_makeshlibs -V
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: binary binary-arch binary-indep build clean install apply-patches reverse-patches

# ---------------------------------------------------------------------------
# various rules to unpack addons and (un)apply patches.
# borrowed from egcs package

patch_dir	= debian/patches

apply-patches: patched-stamp
reverse-patches:
	@for stamp in none patched-*; do \
	  case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
	  patch=`echo $$stamp | sed -e 's/patched-//'`; \
	  echo "trying to revert patch $$patch ..."; \
	  if [ -x $(patch_dir)/$$patch.dpatch ]; then true; else \
	    chmod +x $(patch_dir)/$$patch.dpatch; fi; \
	  if $(patch_dir)/$$patch.dpatch -unpatch; then \
	    echo "reverted $$patch patch."; \
	    rm -f $$stamp; \
	  else \
	    echo "error in reverting $$patch patch."; \
	    exit 1; \
	  fi; \
	done
	@echo "Removing patched-stamp"
	@rm -f patched-stamp

patched-%: $(patch_dir)/%.dpatch
	@if [ -x $< ]; then true; else chmod +x $<; fi
	@if [ -f $@ ]; then \
	  echo "$* patches already applied."; exit 1; \
	fi
	$< -patch
	@echo "$* patches applied." > $@

patched-stamp: $(foreach p,$(debian_patches),patched-$(p))
	@echo -e "\nPatches applied:" >> pxxx
	@for i in none $(debian_patches); do \
	  if [ -r debian/patches/$$i.dpatch ]; then \
	    echo -e "\n$$i:" >> pxxx; \
	    sed -n 's/^# *DP: */  /p' debian/patches/$$i.dpatch >> pxxx; \
	  fi \
	done
	@echo "Writing patched-stamp"
	@mv -f pxxx patched-stamp

# vi: ts=8 sw=8 ai nowrap