Upstream tarball 9614
[amule.git] / debian / rules
blobc617df5a51bfd2baf0815df0ba3afd7a64317891
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # This file was originally written by Vollstrecker
5 # Uncomment this to turn on verbose mode.
6 export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
13 #Here are the packages that can't be compiled separate now
14 general_pkgs = "amule-common"\
15 "amule-skin-gnome"\
16 "amule-skin-kde4"\
17 "amule-skin-tango"\
18 "amule-skin-xfce"
20 # First, get the targets from commandline
21 flags = ${MAKECMDGOALS}
23 #First we have to find out, if we are called from dpkg-buildpackage
25 ifeq ("binary", "$(findstring binary, $(flags))")
27 WXCAS = --enable-wxcas
28 CAS = --enable-cas
29 WEBSERVER = --enable-webserver
30 REMOTEGUI = --enable-amule-gui
31 DAEMON = --enable-amule-daemon
32 ALCC = --enable-alcc
33 ALC = --enable-alc
34 AMULECMD = --enable-amulecmd
35 DEBUGGING = --enable-debug --disable-optimize --disable-profile
36 LANGFLAG = --with-language=all
38 else ifeq ("build", "$(findstring build, $(flags))")
40 WXCAS = --enable-wxcas
41 CAS = --enable-cas
42 WEBSERVER = --enable-webserver
43 REMOTEGUI = --enable-amule-gui
44 DAEMON = --enable-amule-daemon
45 ALCC = --enable-alcc
46 ALC = --enable-alc
47 AMULECMD = --enable-amulecmd
48 DEBUGGING = --enable-debug --disable-optimize --disable-profile
49 LANGFLAG = --with-language=all
51 else
52 #Now we have to check what packages are build to configure only them
54 #We have to filter the right targets (wo_ means without)
55 wo_wxcas = $(subst wxcas,, ${flags})
56 wo_alcc = $(subst alcc,, ${flags})
57 wo_amule_utils_gui = $(subst amule-utils-gui,,${flags})
58 wo_all_other_amules = $(subst amulecmd,,$(subst amule-utils-gui,,$(subst amule-utils,,${flags})))
59 LANGUAGE := en_GB
61 ifeq ("wxcas", "$(findstring wxcas, $(flags))")
62 WXCAS = --enable-wxcas
63 endif
65 ifeq ("cas", "$(findstring cas, $(wo_wxcas))")
66 CAS = --enable-cas
67 endif
69 ifeq ("webserver", "$(findstring webserver, $(flags))")
70 WEBSERVER = --enable-webserver
71 endif
73 ifeq ("remotegui", "$(findstring remotegui, $(flags))")
74 REMOTEGUI = --enable-amule-gui
75 endif
77 ifeq ("daemon", "$(findstring daemon, $(flags))")
78 DAEMON = --enable-amule-daemon
79 endif
81 ifeq ("alcc", "$(findstring alcc, $(flags))")
82 ALCC = --enable-alcc
83 endif
85 ifeq ("alc", "$(findstring alc, $(wo_alcc))")
86 ALC = --enable-alc
87 endif
89 ifeq ("amulecmd", "$(findstring amulecmd, $(flags))")
90 AMULECMD = --enable-amulecmd
91 endif
93 ifneq ("amule", "$(findstring amule, $(wo_all_other_amules))")
94 AMULE = --disable-monolithic
95 endif
97 ifneq ("ed2k", "$(findstring ed2k, $(flags))")
98 ED2K = --disable-ed2k
99 endif
101 ifneq ("xas", "$(findstring xas, $(flags))")
102 XAS = --disable-xas
103 endif
105 #Now find out if a Metapackage should be build
106 ifeq ("amule-utils-gui", "$(findstring amule-utils-gui, $(flags))")
107 ALC = --enable-alc
108 REMOTEGUI = --enable-amule-gui
109 WXCAS = --enable-wxcas
110 endif
112 ifeq ("amule-utils", "$(findstring amule-utils, $(wo_amule_utils_gui))")
113 ALCC = --enable-alcc
114 AMULECMD = --enable-amulecmd
115 CAS = --enable-cas
116 endif
118 #Find this whole i18n stuff
119 ifneq ("i18n-en-only", "$(findstring i18n-en-only, $(flags))")
121 ifeq ("i18n-ar", "$(findstring i18n-ar, $(flags))")
122 LANGUAGE := $(LANGUAGE),ar
123 endif
125 ifeq ("i18n-bg", "$(findstring i18n-bg, $(flags))")
126 LANGUAGE := $(LANGUAGE),bg
127 endif
129 ifeq ("i18n-ca", "$(findstring i18n-ca, $(flags))")
130 LANGUAGE := $(LANGUAGE),ca
131 endif
133 ifeq ("i18n-da", "$(findstring i18n-da, $(flags))")
134 LANGUAGE := $(LANGUAGE),da
135 endif
137 ifeq ("i18n-de", "$(findstring i18n-de, $(flags))")
138 LANGUAGE := $(LANGUAGE),de
139 endif
141 ifeq ("i18n-es", "$(findstring i18n-es, $(flags))")
142 LANGUAGE := $(LANGUAGE),es
143 endif
145 ifeq ("i18n-et-ee", "$(findstring i18n-et-ee, $(flags))")
146 LANGUAGE := $(LANGUAGE),et_EE
147 endif
149 ifeq ("i18n-eu", "$(findstring i18n-eu, $(flags))")
150 LANGUAGE := $(LANGUAGE),eu
151 endif
153 ifeq ("i18n-fi", "$(findstring i18n-fi, $(flags))")
154 LANGUAGE := $(LANGUAGE),fi
155 endif
157 ifeq ("i18n-fr", "$(findstring i18n-fr, $(flags))")
158 LANGUAGE := $(LANGUAGE),fr
159 endif
161 ifeq ("i18n-gl", "$(findstring i18n-gl, $(flags))")
162 LANGUAGE := $(LANGUAGE),gl
163 endif
165 ifeq ("i18n-hr", "$(findstring i18n-hr, $(flags))")
166 LANGUAGE := $(LANGUAGE),hr
167 endif
169 ifeq ("i18n-hu", "$(findstring i18n-hu, $(flags))")
170 LANGUAGE := $(LANGUAGE),hu
171 endif
173 ifeq ("i18n-it", "$(findstring i18n-it, $(flags))")
174 LANGUAGE := $(LANGUAGE),it
175 endif
177 ifeq ("i18n-it-ch", "$(findstring i18n-it-ch, $(flags))")
178 LANGUAGE := $(LANGUAGE),it_CH
179 endif
181 ifeq ("i18n-ko-kr", "$(findstring i18n-ko-kr, $(flags))")
182 LANGUAGE := $(LANGUAGE),ko_KR
183 endif
185 ifeq ("i18n-lt", "$(findstring i18n-lt, $(flags))")
186 LANGUAGE := $(LANGUAGE),lt
187 endif
189 ifeq ("i18n-nl", "$(findstring i18n-nl, $(flags))")
190 LANGUAGE := $(LANGUAGE),hl
191 endif
193 ifeq ("i18n-nn", "$(findstring i18n-nn, $(flags))")
194 LANGUAGE := $(LANGUAGE),nn
195 endif
197 ifeq ("i18n-pl", "$(findstring i18n-pl, $(flags))")
198 LANGUAGE := $(LANGUAGE),pl
199 endif
201 ifeq ("i18n-pt-br", "$(findstring i18n-pt-br, $(flags))")
202 LANGUAGE := $(LANGUAGE),pt_BR
203 endif
205 ifeq ("i18n-pt-pt", "$(findstring i18n-pt-pt, $(flags))")
206 LANGUAGE := $(LANGUAGE),pt_PT
207 endif
209 ifeq ("i18n-ru", "$(findstring i18n-ru, $(flags))")
210 LANGUAGE := $(LANGUAGE),ru
211 endif
213 ifeq ("i18n-sl", "$(findstring i18n-sl, $(flags))")
214 LANGUAGE := $(LANGUAGE),sl
215 endif
217 ifeq ("i18n-sv", "$(findstring i18n-sv, $(flags))")
218 LANGUAGE := $(LANGUAGE),sv
219 endif
221 ifeq ("i18n-tr", "$(findstring i18n-tr, $(flags))")
222 LANGUAGE := $(LANGUAGE),tr
223 endif
225 ifeq ("i18n-zh-cn", "$(findstring i18n-zh-cn, $(flags))")
226 LANGUAGE := $(LANGUAGE),zh_CN
227 endif
229 ifeq ("i18n-zh-tw", "$(findstring i18n-zh-tw, $(flags))")
230 LANGUAGE := $(LANGUAGE),zh_TW
231 endif
233 ifeq ($(LANGUAGE),en_GB)
234 LANGUAGE = all
235 endif
237 endif
239 LANGFLAG = --with-language=$(LANGUAGE)
241 #And at Last, find out if we compile a debug-package or not.
242 ifeq ("dbg", "$(findstring dbg, $(flags))")
243 DEBUGGING = --enable-debug --disable-optimize --disable-profile
244 else
245 DEBUGGING = --disable-debug --enable-optimize --disable-profile
246 endif
247 endif
249 #Before we start, I want to introduce two sequences for building the packages
250 #I define two, so I can put the commands for the *-dbg packages between them
251 define stage1
252 dh_testdir -p$(subst -stage1,,$@)
253 dh_testroot -p$(subst -stage1,,$@)
254 dh_installdirs -p$(subst -stage1,,$@)
255 dh_installchangelogs docs/Changelog -p$(subst -stage1,,$@)
256 dh_installdocs -p$(subst -stage1,,$@)
257 dh_install -Xlicense.txt -p$(subst -stage1,,$@)
258 dh_installmenu -p$(subst -stage1,,$@)
259 dh_installdebconf -p$(subst -stage1,,$@)
260 dh_installman -p$(subst -stage1,,$@)
261 dh_link -p$(subst -stage1,,$@)
262 if test -e debian/$(subst -stage1,,$@).override; then \
263 install --mode=644 debian/$(subst -stage1,,$@).override debian/$(subst -stage1,,$@)/usr/share/lintian/overrides/$(subst -stage1,,$@); \
265 touch $@
266 endef
268 define strip-stage
269 dh_strip -p$(subst -dbg,,$@) --dbg-package=$@
270 endef
272 define stage2
273 dh_compress -X.pl -p$(subst -stage2,,$@)
274 dh_perl -p$(subst -stage2,,$@)
275 dh_makeshlibs -p$(subst -stage2,,$@)
276 dh_installdeb -p$(subst -stage2,,$@)
277 dh_shlibdeps -p$(subst -stage2,,$@)
278 dh_gencontrol -p$(subst -stage2,,$@)
279 dh_md5sums -p$(subst -stage2,,$@)
280 dh_fixperms -p$(subst -stage2,,$@)
281 dh_builddeb -p$(subst -stage2,,$@)
282 touch $@
283 endef
285 #Now we configure this whole thing
286 config.status: configure
287 dh_testdir
288 CFLAGS="$(CFLAGS)" dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE)\
289 --with-ccache\
290 --enable-geoip\
291 ${AMULECMD}\
292 ${DEBUGGING}\
293 ${WEBSERVER}\
294 ${CAS}\
295 ${WXCAS}\
296 ${ALC}\
297 ${ALCC}\
298 ${REMOTEGUI}\
299 ${DAEMON}\
300 ${AMULE}\
301 ${ED2K}\
302 $(LANGFLAG)\
303 $(XAS)
305 #And here is the well known clean target
306 clean:
307 dh_testdir
308 dh_testroot
309 dh_clean
310 dh_auto_clean
311 dh_prep
313 #Some generic targets to check the build process
314 build: build-stamp
316 build-stamp: config.status
317 dh_testdir
319 dh_auto_build
321 touch build-stamp
323 #Now we install the packages all together to the tmp-dir inside of debian/
324 install: build
325 dh_testdir
326 dh_testroot
328 dh_auto_install
330 #Now first build the packages that are compiled and installed on every build
331 amule-common: install
333 for pkg in $(general_pkgs); do \
334 dh_testdir -p$$pkg; \
335 dh_testroot -p$$pkg; \
336 dh_installdirs -p$$pkg; \
337 dh_installchangelogs docs/Changelog -p$$pkg; \
338 dh_installdocs -p$$pkg; \
339 dh_install -Xlicense.txt -p$$pkg; \
340 dh_installmenu -p$$pkg; \
341 dh_installdebconf -p$$pkg; \
342 dh_installman -p$$pkg; \
343 dh_link -p$$pkg; \
344 if test -e debian/$$pkg.overrride; then \
345 install --mode=644 debian/$$pkg.override debian/$$pkg/usr/share/lintian/overrides/$$pkg; \
346 fi; \
347 dh_compress -X.pl -p$$pkg; \
348 dh_perl -p$$pkg; \
349 dh_makeshlibs -p$$pkg; \
350 dh_installdeb -p$$pkg; \
351 dh_shlibdeps -p$$pkg; \
352 dh_gencontrol -p$$pkg; \
353 dh_md5sums -p$$pkg; \
354 dh_fixperms -p$$pkg; \
355 dh_builddeb -p$$pkg; \
356 done
357 touch amule-common
359 %-stage1: amule-common
360 ${stage1}
362 %-stage2: %-stage1
363 ${stage2}
365 amule-%-dbg: amule-%-stage1
366 ${stage1}
367 $(strip-stage)
368 ${stage2}
370 amule-dbg: amule-stage1
371 ${stage1}
372 $(strip-stage)
373 ${stage2}
375 amuleweb-dbg: amuleweb-stage1
376 ${stage1}
377 $(strip-stage)
378 ${stage2}
380 #Now just the targets to map the Commandline Name to the package names
381 amule: amule-stage2
382 touch @
384 ed2k: amule-ed2k-stage2
385 touch @
387 cas: amule-cas-stage2
388 touch @
390 wxcas: amule-wxcas-stage2
391 touch @
393 webserver: amuleweb-stage2 amule-theme-default-stage2
394 touch @
396 remotegui: amule-remote-gui-stage2
397 touch @
399 daemon: amule-daemon-stage2
400 touch @
402 alc: amule-alc-stage2
403 touch @
405 alcc: amule-alcc-stage2
406 touch @
408 amulecmd: amule-cmd-stage2
409 touch @
411 xas: amule-xas-stage2
412 touch @
414 ed2k-dbg: amule-ed2k-dbg
415 touch @
417 cas-dbg: amule-cas-dbg
418 touch @
420 wxcas-dbg: amule-wxcas-dbg
421 touch @
423 webserver-dbg: amuleweb-dbg
424 touch @
426 remotegui-dbg: amule-remote-gui-dbg
427 touch @
429 daemon-dbg: amule-daemon-dbg
430 touch @
432 alc-dbg: amule-alc-dbg
433 touch @
435 alcc-dbg: amule-alcc-dbg
436 touch @
438 amulecmd-dbg: amule-cmd-dbg
439 touch @
441 #Here come the Targets for the langauge packages
442 i18n-%: amule-i18n-% ;
444 amule-i18n-%: amule-common
445 ${stage1}
446 ${stage2}
448 #They are just metapackages
449 amule-utils: alcc amulecmd cas
450 ${stage1}
451 ${stage2}
453 amule-utils-gui: alc remotegui wxcas
454 ${stage1}
455 ${stage2}
457 #These are empty (Space after Semicolon)
458 debug-packages: amule-dbg ed2k-dbg cas-dbg wxcas-dbg webserver-dbg remotegui-dbg daemon-dbg alc-dbg alcc-dbg amulecmd-dbg ;
459 normal-packages: amule-utils amule-utils-gui amule ed2k webserver daemon xas ;
460 language-packages: i18n-ar i18n-bg i18n-ca i18n-da i18n-de i18n-en-gb i18n-es i18n-et-ee i18n-eu i18n-fi i18n-fr i18n-gl i18n-hr i18n-hu i18n-it-ch i18n-it i18n-ko-kr i18n-lt i18n-nn i18n-nl i18n-pl i18n-pt-br i18n-pt-pt i18n-ru i18n-sl i18n-sv i18n-tr i18n-zh-cn i18n-zh-tw ;
461 i18n-en-only: ;
463 #If we build from a svn checkout, we need to generate configure
464 configure:
465 ./autogen.sh
467 #Now the targets for dpkg-buildpackage
468 binary-indep: build install
470 binary-arch: debug-packages normal-packages language-packages
472 binary: binary-indep binary-arch
474 help:
475 cat README.Debian-Packages
477 .DEFAULT_GOAL = help
478 .PHONY: build clean binary-indep binary-arch binary install debug-packages normal-packages i18n-only language-packages