Don't allow creation of more than 99 categories
[amule.git] / debian / rules
blobf56325a1aee8ca3bc3659771ca59a3ede5a943be
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
7 export DEB_BUILD_OPTIONS_PARALLEL=3
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-mac-gray"\
18 "amule-skin-priscilla"\
19 "amule-skin-tango"\
20 "amule-skin-xfce"
22 # First, get the targets from commandline
23 flags = ${MAKECMDGOALS}
25 #First we have to find out, if we are called from dpkg-buildpackage
27 ifeq ("binary", "$(findstring binary, $(flags))")
29 PLASMAMULE = --enable-plasmamule
30 WXCAS = --enable-wxcas
31 XAS = --enable-xas
32 CAS = --enable-cas
33 WEBSERVER = --enable-webserver
34 REMOTEGUI = --enable-amule-gui
35 DAEMON = --enable-amule-daemon
36 ALCC = --enable-alcc
37 ALC = --enable-alc
38 AMULECMD = --enable-amulecmd
39 DEBUGGING = --enable-debug --disable-optimize --disable-profile
40 LANGFLAG = --with-language=all
42 else ifeq ("build", "$(findstring build, $(flags))")
44 PLASMAMULE = --enable-plasmamule
45 WXCAS = --enable-wxcas
46 XAS = --enable-xas
47 CAS = --enable-cas
48 WEBSERVER = --enable-webserver
49 REMOTEGUI = --enable-amule-gui
50 DAEMON = --enable-amule-daemon
51 ALCC = --enable-alcc
52 ALC = --enable-alc
53 AMULECMD = --enable-amulecmd
54 DEBUGGING = --enable-debug --disable-optimize --disable-profile
55 LANGFLAG = --with-language=all
57 else
58 #Now we have to check what packages are build to configure only them
60 #We have to filter the right targets (wo_ means without)
61 wo_wxcas = $(subst wxcas,, ${flags})
62 wo_alcc = $(subst alcc,, ${flags})
63 wo_amule_utils_gui = $(subst amule-utils-gui,,${flags})
64 wo_all_other_amules = $(subst amulecmd,,$(subst amule-utils-gui,,$(subst amule-utils,,${flags})))
65 LANGUAGE := en_GB
67 ifeq ("plasmamule", "$(findstring plasmamule, $(flags))")
68 PLASMAMULE = --enable-plasmamule
69 endif
71 ifeq ("wxcas", "$(findstring wxcas, $(flags))")
72 WXCAS = --enable-wxcas
73 endif
75 ifeq ("cas", "$(findstring cas, $(wo_wxcas))")
76 CAS = --enable-cas
77 endif
79 ifeq ("webserver", "$(findstring webserver, $(flags))")
80 WEBSERVER = --enable-webserver
81 endif
83 ifeq ("remotegui", "$(findstring remotegui, $(flags))")
84 REMOTEGUI = --enable-amule-gui
85 endif
87 ifeq ("daemon", "$(findstring daemon, $(flags))")
88 DAEMON = --enable-amule-daemon
89 endif
91 ifeq ("alcc", "$(findstring alcc, $(flags))")
92 ALCC = --enable-alcc
93 endif
95 ifeq ("alc", "$(findstring alc, $(wo_alcc))")
96 ALC = --enable-alc
97 endif
99 ifeq ("amulecmd", "$(findstring amulecmd, $(flags))")
100 AMULECMD = --enable-amulecmd
101 endif
103 ifneq ("amule", "$(findstring amule, $(wo_all_other_amules))")
104 AMULE = --disable-monolithic
105 endif
107 ifneq ("ed2k", "$(findstring ed2k, $(flags))")
108 ED2K = --disable-ed2k
109 endif
111 ifeq ("xas", "$(findstring xas, $(flags))")
112 XAS = --enable-xas
113 endif
115 #Now find out if a Metapackage should be build
116 ifeq ("amule-utils-gui", "$(findstring amule-utils-gui, $(flags))")
117 ALC = --enable-alc
118 REMOTEGUI = --enable-amule-gui
119 WXCAS = --enable-wxcas
120 endif
122 ifeq ("amule-utils", "$(findstring amule-utils, $(wo_amule_utils_gui))")
123 ALCC = --enable-alcc
124 AMULECMD = --enable-amulecmd
125 CAS = --enable-cas
126 endif
128 #Find this whole i18n stuff
129 ifneq ("i18n-en-only", "$(findstring i18n-en-only, $(flags))")
131 ifeq ("i18n-ar", "$(findstring i18n-ar, $(flags))")
132 LANGUAGE := $(LANGUAGE),ar
133 endif
135 ifeq ("i18n-ast", "$(findstring i18n-ast, $(flags))")
136 LANGUAGE := $(LANGUAGE),ast
137 endif
139 ifeq ("i18n-bg", "$(findstring i18n-bg, $(flags))")
140 LANGUAGE := $(LANGUAGE),bg
141 endif
143 ifeq ("i18n-ca", "$(findstring i18n-ca, $(flags))")
144 LANGUAGE := $(LANGUAGE),ca
145 endif
147 ifeq ("i18n-cs", "$(findstring i18n-cs, $(flags))")
148 LANGUAGE := $(LANGUAGE),cs
149 endif
151 ifeq ("i18n-da", "$(findstring i18n-da, $(flags))")
152 LANGUAGE := $(LANGUAGE),da
153 endif
155 ifeq ("i18n-de", "$(findstring i18n-de, $(flags))")
156 LANGUAGE := $(LANGUAGE),de
157 endif
159 ifeq ("i18n-el", "$(findstring i18n-el, $(flags))")
160 LANGUAGE := $(LANGUAGE),el
161 endif
163 ifeq ("i18n-es", "$(findstring i18n-es, $(flags))")
164 LANGUAGE := $(LANGUAGE),es
165 endif
167 ifeq ("i18n-et-ee", "$(findstring i18n-et-ee, $(flags))")
168 LANGUAGE := $(LANGUAGE),et_EE
169 endif
171 ifeq ("i18n-eu", "$(findstring i18n-eu, $(flags))")
172 LANGUAGE := $(LANGUAGE),eu
173 endif
175 ifeq ("i18n-fi", "$(findstring i18n-fi, $(flags))")
176 LANGUAGE := $(LANGUAGE),fi
177 endif
179 ifeq ("i18n-fr", "$(findstring i18n-fr, $(flags))")
180 LANGUAGE := $(LANGUAGE),fr
181 endif
183 ifeq ("i18n-gl", "$(findstring i18n-gl, $(flags))")
184 LANGUAGE := $(LANGUAGE),gl
185 endif
187 ifeq ("i18n-he", "$(findstring i18n-he, $(flags))")
188 LANGUAGE := $(LANGUAGE),he
189 endif
191 ifeq ("i18n-hr", "$(findstring i18n-hr, $(flags))")
192 LANGUAGE := $(LANGUAGE),hr
193 endif
195 ifeq ("i18n-hu", "$(findstring i18n-hu, $(flags))")
196 LANGUAGE := $(LANGUAGE),hu
197 endif
199 ifeq ("i18n-it", "$(findstring i18n-it, $(flags))")
200 LANGUAGE := $(LANGUAGE),it
201 endif
203 ifeq ("i18n-it-ch", "$(findstring i18n-it-ch, $(flags))")
204 LANGUAGE := $(LANGUAGE),it_CH
205 endif
207 ifeq ("i18n-ja", "$(findstring i18n-ja, $(flags))")
208 LANGUAGE := $(LANGUAGE),ja
209 endif
211 ifeq ("i18n-ko-kr", "$(findstring i18n-ko-kr, $(flags))")
212 LANGUAGE := $(LANGUAGE),ko_KR
213 endif
215 ifeq ("i18n-lt", "$(findstring i18n-lt, $(flags))")
216 LANGUAGE := $(LANGUAGE),lt
217 endif
219 ifeq ("i18n-nl", "$(findstring i18n-nl, $(flags))")
220 LANGUAGE := $(LANGUAGE),hl
221 endif
223 ifeq ("i18n-nn", "$(findstring i18n-nn, $(flags))")
224 LANGUAGE := $(LANGUAGE),nn
225 endif
227 ifeq ("i18n-pl", "$(findstring i18n-pl, $(flags))")
228 LANGUAGE := $(LANGUAGE),pl
229 endif
231 ifeq ("i18n-pt-br", "$(findstring i18n-pt-br, $(flags))")
232 LANGUAGE := $(LANGUAGE),pt_BR
233 endif
235 ifeq ("i18n-pt-pt", "$(findstring i18n-pt-pt, $(flags))")
236 LANGUAGE := $(LANGUAGE),pt_PT
237 endif
239 ifeq ("i18n-ro", "$(findstring i18n-ro, $(flags))")
240 LANGUAGE := $(LANGUAGE),ro
241 endif
243 ifeq ("i18n-ru", "$(findstring i18n-ru, $(flags))")
244 LANGUAGE := $(LANGUAGE),ru
245 endif
247 ifeq ("i18n-sl", "$(findstring i18n-sl, $(flags))")
248 LANGUAGE := $(LANGUAGE),sl
249 endif
251 ifeq ("i18n-sq", "$(findstring i18n-sq, $(flags))")
252 LANGUAGE := $(LANGUAGE),sq
253 endif
255 ifeq ("i18n-sv", "$(findstring i18n-sv, $(flags))")
256 LANGUAGE := $(LANGUAGE),sv
257 endif
259 ifeq ("i18n-tr", "$(findstring i18n-tr, $(flags))")
260 LANGUAGE := $(LANGUAGE),tr
261 endif
263 ifeq ("i18n-uk", "$(findstring i18n-uk, $(flags))")
264 LANGUAGE := $(LANGUAGE),uk
265 endif
267 ifeq ("i18n-zh-cn", "$(findstring i18n-zh-cn, $(flags))")
268 LANGUAGE := $(LANGUAGE),zh_CN
269 endif
271 ifeq ("i18n-zh-tw", "$(findstring i18n-zh-tw, $(flags))")
272 LANGUAGE := $(LANGUAGE),zh_TW
273 endif
275 ifeq ($(LANGUAGE),en_GB)
276 LANGUAGE = all
277 endif
279 endif
281 LANGFLAG = --with-language=$(LANGUAGE)
283 #And at Last, find out if we compile a debug-package or not.
284 ifeq ("dbg", "$(findstring dbg, $(flags))")
285 DEBUGGING = --enable-debug --disable-optimize --disable-profile
286 else
287 DEBUGGING = --disable-debug --enable-optimize --disable-profile
288 endif
289 endif
291 #Before we start, I want to introduce two sequences for building the packages
292 #I define two, so I can put the commands for the *-dbg packages between them
293 define stage1
294 dh_testdir -p$(subst -stage1,,$@)
295 dh_testroot -p$(subst -stage1,,$@)
296 dh_installdirs -p$(subst -stage1,,$@)
297 dh_installchangelogs docs/Changelog -p$(subst -stage1,,$@)
298 dh_installdocs -p$(subst -stage1,,$@)
299 dh_install -Xlicense.txt -p$(subst -stage1,,$@)
300 dh_installmenu -p$(subst -stage1,,$@)
301 dh_installdebconf -p$(subst -stage1,,$@)
302 dh_installman -p$(subst -stage1,,$@)
303 dh_installmime -p$(subst -stage1,,$@)
304 dh_link -p$(subst -stage1,,$@)
305 dh_lintian -p$(subst -stage1,,$@)
306 touch $@
307 endef
309 define strip-stage
310 dh_strip -p$(subst -dbg,,$@) --dbg-package=$@
311 endef
313 define stage2
314 dh_compress -X.pl -p$(subst -stage2,,$@)
315 dh_perl -p$(subst -stage2,,$@)
316 dh_makeshlibs -p$(subst -stage2,,$@)
317 dh_installdeb -p$(subst -stage2,,$@)
318 dh_shlibdeps -p$(subst -stage2,,$@)
319 dh_gencontrol -p$(subst -stage2,,$@)
320 dh_md5sums -p$(subst -stage2,,$@)
321 dh_fixperms -p$(subst -stage2,,$@)
322 dh_builddeb -p$(subst -stage2,,$@)
323 touch $@
324 endef
326 #Now we configure this whole thing
327 config.status: configure
328 dh_testdir
329 CFLAGS="$(CFLAGS)" dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE)\
330 LDFLAGS="-Wl,--as-needed ${LDFLAGS}"\
331 --enable-ccache\
332 --enable-geoip\
333 ${PLASMAMULE}\
334 ${AMULECMD}\
335 ${DEBUGGING}\
336 ${WEBSERVER}\
337 ${CAS}\
338 ${WXCAS}\
339 ${ALC}\
340 ${ALCC}\
341 ${REMOTEGUI}\
342 ${DAEMON}\
343 ${AMULE}\
344 ${ED2K}\
345 $(LANGFLAG)\
346 $(XAS)
348 #And here is the well known clean target
349 clean:
350 dh_testdir
351 dh_testroot
352 dh_clean
353 dh_auto_clean
354 dh_prep
356 #Some generic targets to check the build process
357 build: build-stamp
359 build-stamp: config.status
360 dh_testdir
362 dh_auto_build
364 touch build-stamp
366 #Now we install the packages all together to the tmp-dir inside of debian/
367 install: build
368 dh_testdir
369 dh_testroot
371 dh_auto_install
373 #Now first build the packages that are compiled and installed on every build
374 amule-common: install
376 for pkg in $(general_pkgs); do \
377 dh_testdir -p$$pkg; \
378 dh_testroot -p$$pkg; \
379 dh_installdirs -p$$pkg; \
380 dh_installchangelogs docs/Changelog -p$$pkg; \
381 dh_installdocs -p$$pkg; \
382 dh_install -Xlicense.txt -p$$pkg; \
383 dh_installmenu -p$$pkg; \
384 dh_installdebconf -p$$pkg; \
385 dh_installman -p$$pkg; \
386 dh_link -p$$pkg; \
387 dh_lintian -p$$pkg; \
388 dh_compress -X.pl -p$$pkg; \
389 dh_perl -p$$pkg; \
390 dh_makeshlibs -p$$pkg; \
391 dh_installdeb -p$$pkg; \
392 dh_shlibdeps -p$$pkg; \
393 dh_gencontrol -p$$pkg; \
394 dh_md5sums -p$$pkg; \
395 dh_fixperms -p$$pkg; \
396 dh_builddeb -p$$pkg; \
397 done
398 touch amule-common
400 %-stage1: amule-common
401 ${stage1}
403 %-stage2: %-stage1
404 ${stage2}
406 amule-%-dbg: amule-%-stage1
407 ${stage1}
408 $(strip-stage)
409 ${stage2}
411 amule-dbg: amule-stage1
412 ${stage1}
413 $(strip-stage)
414 ${stage2}
416 amuleweb-dbg: amuleweb-stage1
417 ${stage1}
418 $(strip-stage)
419 ${stage2}
421 #Now just the targets to map the Commandline Name to the package names
422 amule: amule-stage2
423 touch @
425 ed2k: amule-ed2k-stage2
426 touch @
428 cas: amule-cas-stage2
429 touch @
431 wxcas: amule-wxcas-stage2
432 touch @
434 webserver: amuleweb-stage2 amule-theme-default-stage2
435 touch @
437 remotegui: amule-remote-gui-stage2
438 touch @
440 daemon: amule-daemon-stage2
441 touch @
443 alc: amule-alc-stage2
444 touch @
446 alcc: amule-alcc-stage2
447 touch @
449 amulecmd: amule-cmd-stage2
450 touch @
452 xas: amule-xas-stage2
453 touch @
455 ed2k-dbg: amule-ed2k-dbg
456 touch @
458 cas-dbg: amule-cas-dbg
459 touch @
461 wxcas-dbg: amule-wxcas-dbg
462 touch @
464 webserver-dbg: amuleweb-dbg
465 touch @
467 remotegui-dbg: amule-remote-gui-dbg
468 touch @
470 daemon-dbg: amule-daemon-dbg
471 touch @
473 alc-dbg: amule-alc-dbg
474 touch @
476 alcc-dbg: amule-alcc-dbg
477 touch @
479 amulecmd-dbg: amule-cmd-dbg
480 touch @
482 plasmamule: amule-plasmamule-stage2
483 touch @
485 plasmamule-dbg: amule-plasmamule-dbg
486 touch @
488 #Here come the Targets for the langauge packages
489 i18n-%: amule-i18n-% ;
491 amule-i18n-%: amule-common
492 ${stage1}
493 ${stage2}
495 #They are just metapackages
496 amule-utils: alcc amulecmd cas
497 ${stage1}
498 ${stage2}
500 amule-utils-gui: alc remotegui wxcas
501 ${stage1}
502 ${stage2}
504 #These are empty (Space after Semicolon)
505 debug-packages: amule-dbg ed2k-dbg cas-dbg wxcas-dbg webserver-dbg remotegui-dbg daemon-dbg alc-dbg alcc-dbg amulecmd-dbg plasmamule-dbg;
506 normal-packages: amule-utils amule-utils-gui amule ed2k webserver daemon xas plasmamule ;
507 language-packages: i18n-ar i18n-ast i18n-bg i18n-ca i18n-cs i18n-da i18n-de i18n-el i18n-en-gb i18n-es i18n-et-ee i18n-eu i18n-fi i18n-fr i18n-gl i18n-he i18n-hr i18n-hu i18n-it-ch i18n-it i18n-ja i18n-ko-kr i18n-lt i18n-nn i18n-nl i18n-pl i18n-pt-br i18n-pt-pt i18n-ro i18n-ru i18n-sl i18n-sq i18n-sv i18n-tr i18n-uk i18n-zh-cn i18n-zh-tw ;
508 i18n-en-only: ;
510 #If we build from a svn checkout, we need to generate configure
511 configure:
512 ./autogen.sh
514 #Now the targets for dpkg-buildpackage
515 binary-indep: build install
517 binary-arch: debug-packages normal-packages language-packages
519 binary: binary-indep binary-arch
521 help:
522 cat README.Debian-Packages
524 .DEFAULT_GOAL = help
525 .PHONY: build clean binary-indep binary-arch binary install debug-packages normal-packages i18n-only language-packages