Leftovers from IP filter patch
[amule.git] / debian / rules
blob9bf17595972897def0e8c7e1addac46cbd814323
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 WXCAS = --enable-wxcas
30 XAS = --enable-xas
31 CAS = --enable-cas
32 WEBSERVER = --enable-webserver
33 REMOTEGUI = --enable-amule-gui
34 DAEMON = --enable-amule-daemon
35 ALCC = --enable-alcc
36 ALC = --enable-alc
37 AMULECMD = --enable-amulecmd
38 DEBUGGING = --enable-debug --disable-optimize --disable-profile
39 LANGFLAG = --with-language=all
41 else ifeq ("build", "$(findstring build, $(flags))")
43 WXCAS = --enable-wxcas
44 XAS = --enable-xas
45 CAS = --enable-cas
46 WEBSERVER = --enable-webserver
47 REMOTEGUI = --enable-amule-gui
48 DAEMON = --enable-amule-daemon
49 ALCC = --enable-alcc
50 ALC = --enable-alc
51 AMULECMD = --enable-amulecmd
52 DEBUGGING = --enable-debug --disable-optimize --disable-profile
53 LANGFLAG = --with-language=all
55 else
56 #Now we have to check what packages are build to configure only them
58 #We have to filter the right targets (wo_ means without)
59 wo_wxcas = $(subst wxcas,, ${flags})
60 wo_alcc = $(subst alcc,, ${flags})
61 wo_amule_utils_gui = $(subst amule-utils-gui,,${flags})
62 wo_all_other_amules = $(subst amulecmd,,$(subst amule-utils-gui,,$(subst amule-utils,,${flags})))
63 LANGUAGE := en_GB
65 ifeq ("wxcas", "$(findstring wxcas, $(flags))")
66 WXCAS = --enable-wxcas
67 endif
69 ifeq ("cas", "$(findstring cas, $(wo_wxcas))")
70 CAS = --enable-cas
71 endif
73 ifeq ("webserver", "$(findstring webserver, $(flags))")
74 WEBSERVER = --enable-webserver
75 endif
77 ifeq ("remotegui", "$(findstring remotegui, $(flags))")
78 REMOTEGUI = --enable-amule-gui
79 endif
81 ifeq ("daemon", "$(findstring daemon, $(flags))")
82 DAEMON = --enable-amule-daemon
83 endif
85 ifeq ("alcc", "$(findstring alcc, $(flags))")
86 ALCC = --enable-alcc
87 endif
89 ifeq ("alc", "$(findstring alc, $(wo_alcc))")
90 ALC = --enable-alc
91 endif
93 ifeq ("amulecmd", "$(findstring amulecmd, $(flags))")
94 AMULECMD = --enable-amulecmd
95 endif
97 ifneq ("amule", "$(findstring amule, $(wo_all_other_amules))")
98 AMULE = --disable-monolithic
99 endif
101 ifneq ("ed2k", "$(findstring ed2k, $(flags))")
102 ED2K = --disable-ed2k
103 endif
105 ifeq ("xas", "$(findstring xas, $(flags))")
106 XAS = --enable-xas
107 endif
109 #Now find out if a Metapackage should be build
110 ifeq ("amule-utils-gui", "$(findstring amule-utils-gui, $(flags))")
111 ALC = --enable-alc
112 REMOTEGUI = --enable-amule-gui
113 WXCAS = --enable-wxcas
114 endif
116 ifeq ("amule-utils", "$(findstring amule-utils, $(wo_amule_utils_gui))")
117 ALCC = --enable-alcc
118 AMULECMD = --enable-amulecmd
119 CAS = --enable-cas
120 endif
122 #Find this whole i18n stuff
123 ifneq ("i18n-en-only", "$(findstring i18n-en-only, $(flags))")
125 ifeq ("i18n-ar", "$(findstring i18n-ar, $(flags))")
126 LANGUAGE := $(LANGUAGE),ar
127 endif
129 ifeq ("i18n-ast", "$(findstring i18n-ast, $(flags))")
130 LANGUAGE := $(LANGUAGE),ast
131 endif
133 ifeq ("i18n-bg", "$(findstring i18n-bg, $(flags))")
134 LANGUAGE := $(LANGUAGE),bg
135 endif
137 ifeq ("i18n-ca", "$(findstring i18n-ca, $(flags))")
138 LANGUAGE := $(LANGUAGE),ca
139 endif
141 ifeq ("i18n-cs", "$(findstring i18n-cs, $(flags))")
142 LANGUAGE := $(LANGUAGE),cs
143 endif
145 ifeq ("i18n-da", "$(findstring i18n-da, $(flags))")
146 LANGUAGE := $(LANGUAGE),da
147 endif
149 ifeq ("i18n-de", "$(findstring i18n-de, $(flags))")
150 LANGUAGE := $(LANGUAGE),de
151 endif
153 ifeq ("i18n-el", "$(findstring i18n-el, $(flags))")
154 LANGUAGE := $(LANGUAGE),el
155 endif
157 ifeq ("i18n-es", "$(findstring i18n-es, $(flags))")
158 LANGUAGE := $(LANGUAGE),es
159 endif
161 ifeq ("i18n-et-ee", "$(findstring i18n-et-ee, $(flags))")
162 LANGUAGE := $(LANGUAGE),et_EE
163 endif
165 ifeq ("i18n-eu", "$(findstring i18n-eu, $(flags))")
166 LANGUAGE := $(LANGUAGE),eu
167 endif
169 ifeq ("i18n-fi", "$(findstring i18n-fi, $(flags))")
170 LANGUAGE := $(LANGUAGE),fi
171 endif
173 ifeq ("i18n-fr", "$(findstring i18n-fr, $(flags))")
174 LANGUAGE := $(LANGUAGE),fr
175 endif
177 ifeq ("i18n-gl", "$(findstring i18n-gl, $(flags))")
178 LANGUAGE := $(LANGUAGE),gl
179 endif
181 ifeq ("i18n-he", "$(findstring i18n-he, $(flags))")
182 LANGUAGE := $(LANGUAGE),he
183 endif
185 ifeq ("i18n-hr", "$(findstring i18n-hr, $(flags))")
186 LANGUAGE := $(LANGUAGE),hr
187 endif
189 ifeq ("i18n-hu", "$(findstring i18n-hu, $(flags))")
190 LANGUAGE := $(LANGUAGE),hu
191 endif
193 ifeq ("i18n-it", "$(findstring i18n-it, $(flags))")
194 LANGUAGE := $(LANGUAGE),it
195 endif
197 ifeq ("i18n-it-ch", "$(findstring i18n-it-ch, $(flags))")
198 LANGUAGE := $(LANGUAGE),it_CH
199 endif
201 ifeq ("i18n-ja", "$(findstring i18n-ja, $(flags))")
202 LANGUAGE := $(LANGUAGE),ja
203 endif
205 ifeq ("i18n-ko-kr", "$(findstring i18n-ko-kr, $(flags))")
206 LANGUAGE := $(LANGUAGE),ko_KR
207 endif
209 ifeq ("i18n-lt", "$(findstring i18n-lt, $(flags))")
210 LANGUAGE := $(LANGUAGE),lt
211 endif
213 ifeq ("i18n-nl", "$(findstring i18n-nl, $(flags))")
214 LANGUAGE := $(LANGUAGE),hl
215 endif
217 ifeq ("i18n-nn", "$(findstring i18n-nn, $(flags))")
218 LANGUAGE := $(LANGUAGE),nn
219 endif
221 ifeq ("i18n-pl", "$(findstring i18n-pl, $(flags))")
222 LANGUAGE := $(LANGUAGE),pl
223 endif
225 ifeq ("i18n-pt-br", "$(findstring i18n-pt-br, $(flags))")
226 LANGUAGE := $(LANGUAGE),pt_BR
227 endif
229 ifeq ("i18n-pt-pt", "$(findstring i18n-pt-pt, $(flags))")
230 LANGUAGE := $(LANGUAGE),pt_PT
231 endif
233 ifeq ("i18n-ru", "$(findstring i18n-ru, $(flags))")
234 LANGUAGE := $(LANGUAGE),ru
235 endif
237 ifeq ("i18n-sl", "$(findstring i18n-sl, $(flags))")
238 LANGUAGE := $(LANGUAGE),sl
239 endif
241 ifeq ("i18n-sq", "$(findstring i18n-sq, $(flags))")
242 LANGUAGE := $(LANGUAGE),sq
243 endif
245 ifeq ("i18n-sv", "$(findstring i18n-sv, $(flags))")
246 LANGUAGE := $(LANGUAGE),sv
247 endif
249 ifeq ("i18n-tr", "$(findstring i18n-tr, $(flags))")
250 LANGUAGE := $(LANGUAGE),tr
251 endif
253 ifeq ("i18n-uk", "$(findstring i18n-uk, $(flags))")
254 LANGUAGE := $(LANGUAGE),uk
255 endif
257 ifeq ("i18n-zh-cn", "$(findstring i18n-zh-cn, $(flags))")
258 LANGUAGE := $(LANGUAGE),zh_CN
259 endif
261 ifeq ("i18n-zh-tw", "$(findstring i18n-zh-tw, $(flags))")
262 LANGUAGE := $(LANGUAGE),zh_TW
263 endif
265 ifeq ($(LANGUAGE),en_GB)
266 LANGUAGE = all
267 endif
269 endif
271 LANGFLAG = --with-language=$(LANGUAGE)
273 #And at Last, find out if we compile a debug-package or not.
274 ifeq ("dbg", "$(findstring dbg, $(flags))")
275 DEBUGGING = --enable-debug --disable-optimize --disable-profile
276 else
277 DEBUGGING = --disable-debug --enable-optimize --disable-profile
278 endif
279 endif
281 #Before we start, I want to introduce two sequences for building the packages
282 #I define two, so I can put the commands for the *-dbg packages between them
283 define stage1
284 dh_testdir -p$(subst -stage1,,$@)
285 dh_testroot -p$(subst -stage1,,$@)
286 dh_installdirs -p$(subst -stage1,,$@)
287 dh_installchangelogs docs/Changelog -p$(subst -stage1,,$@)
288 dh_installdocs -p$(subst -stage1,,$@)
289 dh_install -Xlicense.txt -p$(subst -stage1,,$@)
290 dh_installmenu -p$(subst -stage1,,$@)
291 dh_installdebconf -p$(subst -stage1,,$@)
292 dh_installman -p$(subst -stage1,,$@)
293 dh_link -p$(subst -stage1,,$@)
294 dh_lintian -p$(subst -stage1,,$@)
295 touch $@
296 endef
298 define strip-stage
299 dh_strip -p$(subst -dbg,,$@) --dbg-package=$@
300 endef
302 define stage2
303 dh_compress -X.pl -p$(subst -stage2,,$@)
304 dh_perl -p$(subst -stage2,,$@)
305 dh_makeshlibs -p$(subst -stage2,,$@)
306 dh_installdeb -p$(subst -stage2,,$@)
307 dh_shlibdeps -p$(subst -stage2,,$@)
308 dh_gencontrol -p$(subst -stage2,,$@)
309 dh_md5sums -p$(subst -stage2,,$@)
310 dh_fixperms -p$(subst -stage2,,$@)
311 dh_builddeb -p$(subst -stage2,,$@)
312 touch $@
313 endef
315 #Now we configure this whole thing
316 config.status: configure
317 dh_testdir
318 CFLAGS="$(CFLAGS)" dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE)\
319 --enable-ccache\
320 --enable-geoip\
321 ${AMULECMD}\
322 ${DEBUGGING}\
323 ${WEBSERVER}\
324 ${CAS}\
325 ${WXCAS}\
326 ${ALC}\
327 ${ALCC}\
328 ${REMOTEGUI}\
329 ${DAEMON}\
330 ${AMULE}\
331 ${ED2K}\
332 $(LANGFLAG)\
333 $(XAS)
335 #And here is the well known clean target
336 clean:
337 dh_testdir
338 dh_testroot
339 dh_clean
340 dh_auto_clean
341 dh_prep
343 #Some generic targets to check the build process
344 build: build-stamp
346 build-stamp: config.status
347 dh_testdir
349 dh_auto_build
351 touch build-stamp
353 #Now we install the packages all together to the tmp-dir inside of debian/
354 install: build
355 dh_testdir
356 dh_testroot
358 dh_auto_install
360 #Now first build the packages that are compiled and installed on every build
361 amule-common: install
363 for pkg in $(general_pkgs); do \
364 dh_testdir -p$$pkg; \
365 dh_testroot -p$$pkg; \
366 dh_installdirs -p$$pkg; \
367 dh_installchangelogs docs/Changelog -p$$pkg; \
368 dh_installdocs -p$$pkg; \
369 dh_install -Xlicense.txt -p$$pkg; \
370 dh_installmenu -p$$pkg; \
371 dh_installdebconf -p$$pkg; \
372 dh_installman -p$$pkg; \
373 dh_link -p$$pkg; \
374 dh_lintian -p$$pkg; \
375 dh_compress -X.pl -p$$pkg; \
376 dh_perl -p$$pkg; \
377 dh_makeshlibs -p$$pkg; \
378 dh_installdeb -p$$pkg; \
379 dh_shlibdeps -p$$pkg; \
380 dh_gencontrol -p$$pkg; \
381 dh_md5sums -p$$pkg; \
382 dh_fixperms -p$$pkg; \
383 dh_builddeb -p$$pkg; \
384 done
385 touch amule-common
387 %-stage1: amule-common
388 ${stage1}
390 %-stage2: %-stage1
391 ${stage2}
393 amule-%-dbg: amule-%-stage1
394 ${stage1}
395 $(strip-stage)
396 ${stage2}
398 amule-dbg: amule-stage1
399 ${stage1}
400 $(strip-stage)
401 ${stage2}
403 amuleweb-dbg: amuleweb-stage1
404 ${stage1}
405 $(strip-stage)
406 ${stage2}
408 #Now just the targets to map the Commandline Name to the package names
409 amule: amule-stage2
410 touch @
412 ed2k: amule-ed2k-stage2
413 touch @
415 cas: amule-cas-stage2
416 touch @
418 wxcas: amule-wxcas-stage2
419 touch @
421 webserver: amuleweb-stage2 amule-theme-default-stage2
422 touch @
424 remotegui: amule-remote-gui-stage2
425 touch @
427 daemon: amule-daemon-stage2
428 touch @
430 alc: amule-alc-stage2
431 touch @
433 alcc: amule-alcc-stage2
434 touch @
436 amulecmd: amule-cmd-stage2
437 touch @
439 xas: amule-xas-stage2
440 touch @
442 ed2k-dbg: amule-ed2k-dbg
443 touch @
445 cas-dbg: amule-cas-dbg
446 touch @
448 wxcas-dbg: amule-wxcas-dbg
449 touch @
451 webserver-dbg: amuleweb-dbg
452 touch @
454 remotegui-dbg: amule-remote-gui-dbg
455 touch @
457 daemon-dbg: amule-daemon-dbg
458 touch @
460 alc-dbg: amule-alc-dbg
461 touch @
463 alcc-dbg: amule-alcc-dbg
464 touch @
466 amulecmd-dbg: amule-cmd-dbg
467 touch @
469 #Here come the Targets for the langauge packages
470 i18n-%: amule-i18n-% ;
472 amule-i18n-%: amule-common
473 ${stage1}
474 ${stage2}
476 #They are just metapackages
477 amule-utils: alcc amulecmd cas
478 ${stage1}
479 ${stage2}
481 amule-utils-gui: alc remotegui wxcas
482 ${stage1}
483 ${stage2}
485 #These are empty (Space after Semicolon)
486 debug-packages: amule-dbg ed2k-dbg cas-dbg wxcas-dbg webserver-dbg remotegui-dbg daemon-dbg alc-dbg alcc-dbg amulecmd-dbg ;
487 normal-packages: amule-utils amule-utils-gui amule ed2k webserver daemon xas ;
488 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-ru i18n-sl i18n-sq i18n-sv i18n-tr i18n-uk i18n-zh-cn i18n-zh-tw ;
489 i18n-en-only: ;
491 #If we build from a svn checkout, we need to generate configure
492 configure:
493 ./autogen.sh
495 #Now the targets for dpkg-buildpackage
496 binary-indep: build install
498 binary-arch: debug-packages normal-packages language-packages
500 binary: binary-indep binary-arch
502 help:
503 cat README.Debian-Packages
505 .DEFAULT_GOAL = help
506 .PHONY: build clean binary-indep binary-arch binary install debug-packages normal-packages i18n-only language-packages