Fix format string warnings (promoted to errors) in calls to PyErr_Format(). New...
[freewx/wx.git] / debian / rules
1 #!/usr/bin/make -f
2 # debian/rules file to build packages from wx source
3 #
4 # Sculpted 13/2/2000 by Ron Lee <ron@debian.org> from new and
5 # variously stolen code :-)
6 # It makes copious use of the debhelper utilities written by
7 # Joey Hess and others.
8
9 SHELL = /bin/bash
10
11 #export DH_VERBOSE=1
12
13 # Parallelism in debian/rules causes problems:
14 # https://bugs.debian.org/742657
15 .NOTPARALLEL:
16
17 include /usr/share/python/python.mk
18 export DH_OPTIONS
19
20 # WXPYTHON_VERSION = $(shell dpkg-parsechangelog | sed -ne '/^Version: /s@Version: \(.*\)@\1@p')
21
22 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
23
24 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
25
26     # The standard way to specify the number of jobs.
27     JOB_COUNT := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
28
29 else ifdef CONCURRENCY_LEVEL
30
31   # A user who knows what they want, that's like gold...
32   # respect their precious opinion of how much blue smoke to use.
33   JOB_COUNT := $(CONCURRENCY_LEVEL)
34
35 else ifdef DISTCC_HOSTS
36
37  # Otherwise, if they have a cluster, try to put it to good use.
38   JOB_COUNT := $(shell set $${DISTCC_HOSTS} > /dev/null 2>&1 ; echo $$\#)
39
40  # Not much faster, but it might keep you warm in winter...
41  #JOB_COUNT := $(shell set $${DISTCC_HOSTS} > /dev/null 2>&1 ; echo $$(($$\# + $$\#)))
42
43 endif
44
45 ifdef JOB_COUNT
46   FAST_MAKE = $(MAKE) -j $(JOB_COUNT)
47 else
48   FAST_MAKE = $(MAKE)
49 endif
50
51 PYVERS := $(shell pyversions -vr)
52
53 # If another source package is to supply the common binary packages
54 # for a particular Debian release, then define these variables to indicate
55 # the $(release) that is expected to provide it.  Do not define them at
56 # all if this is to be the default (or only) wx source package for the
57 # target release.  There are two variables because in wx 3.0, wxPython will be
58 # a separate source package.
59
60 DEBIAN_WX_DEFAULT_VERSION = 3.0
61 DEBIAN_WXPYTHON_DEFAULT_VERSION = 3.0
62
63 # This will extract a flavour out of the changelog and flavour the
64 # packages and binaries with it.  'Official' builds should use a
65 # changelog entry with a source package of the form wxwidgets$RELEASE.
66 # Flavoured builds may use wxwidgets$RELEASE-$FLAVOUR, where any
67 # descriptive alphanumeric name will do for FLAVOUR.  This will allow
68 # a custom build to be installed alongside the mainline ones without
69 # conflict.
70 DEBIAN_WXFLAVOUR := $(shell dpkg-parsechangelog | sed -ne '/^Source: /s@.*wxwidgets[0-9.]\+-\?\(.*\)@\1@p')
71
72
73 wx_major_version_number := $(shell sed -n 's/^wx_major_version_number=//p' configure.in)
74 wx_minor_version_number := $(shell sed -n 's/^wx_minor_version_number=//p' configure.in)
75 wx_release_number       := $(shell sed -n 's/^wx_release_number=//p' configure.in)
76 wx_subrelease_number    := $(shell sed -n 's/^wx_subrelease_number=//p' configure.in)
77
78 release := $(wx_major_version_number).$(wx_minor_version_number)
79
80 so_cur := $(shell sed 's,<set var="WX_CURRENT">\([0-9]\+\)</set>,\1,p;d' build/bakefiles/version.bkl)
81 so_age := $(shell sed 's,<set var="WX_AGE">\([0-9]\+\)</set>,\1,p;d' build/bakefiles/version.bkl)
82 soversion := $(shell expr $(so_cur) - $(so_age))
83
84 sorelease := $(release:%-$(DEBIAN_WXFLAVOUR)=%)-$(soversion)$(addprefix -,$(DEBIAN_WXFLAVOUR))
85
86 # In some places we use the full version number, including the micro version,
87 # for the development releases (which can be incompatible for the same major
88 # and minor version) but just the major.minor for the stable releases (which
89 # are supposed to be compatible), this variable contains the appropriate value
90 ifeq ($(shell expr '$(wx_minor_version_number)' : '.*[02468]$$'),0)
91     # Odd minor version, so development release.
92     compatible_release := $(release).$(wx_release_number)
93 else
94     compatible_release := $(release)
95 endif
96
97 # Base value for alternative priorities.
98 alt_prio  := $(subst .,,$(release))
99
100 pytoolkit := gtk2
101 wxsubdir  := wx-$(compatible_release)-$(pytoolkit)-unicode
102
103 cross_host  := i586-mingw32msvc
104 cross_build := $(shell /usr/share/misc/config.guess)
105
106 config_cache       = ../config_deb.cache
107 config_cache_cross = ../config_deb_cross.cache
108
109
110 # build options
111 COMMON_CONFIGURE_OPTIONS := \
112     --prefix=/usr \
113     --cache-file=$(config_cache) \
114     --with-flavour=$(DEBIAN_WXFLAVOUR) \
115     --with-zlib=sys \
116     --with-expat=sys \
117     $(shell dpkg-buildflags --export=configure)
118
119 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
120 COMMON_CONFIGURE_OPTIONS += --disable-optimise
121 endif
122
123 BASE_CONFIGURE_OPTIONS = $(COMMON_CONFIGURE_OPTIONS) \
124     --disable-gui \
125         --libdir=\$${exec_prefix}/lib/$(DEB_HOST_MULTIARCH)
126
127 GTK_CONFIGURE_OPTIONS = $(COMMON_CONFIGURE_OPTIONS) \
128     --with-gtk \
129     --without-gnomeprint \
130     --with-opengl \
131     --enable-sound \
132     --with-sdl \
133     --enable-display \
134     --enable-geometry \
135     --enable-graphics_ctx \
136     --with-libjpeg=sys \
137     --with-libpng=sys \
138     --with-libtiff=sys \
139     --enable-mediactrl \
140     --libdir=\$${exec_prefix}/lib/$(DEB_HOST_MULTIARCH)
141
142 MSW_CONFIGURE_OPTIONS = \
143     --with-msw \
144     --with-opengl \
145     --enable-display
146
147 # For the MSW packages, enabling threads in wx means that your application will
148 # have a dependency on mingwm10.dll.  If you don't use threads, this is just an
149 # annoyance, so default to disabling them.  If you want a wx package to use in
150 # a threaded application then comment out the next line.
151 MSW_CONFIGURE_OPTIONS += --disable-threads
152
153 PY_WX_CONFIG_OPTIONS = --version=$(release) --toolkit=$(pytoolkit) --static=no
154
155 WX_UNICODE ?= 1
156 # Needed in binary-cross, and perhaps other sub-invocations of debian/rules.
157 export WX_UNICODE
158
159 ifeq ($(WX_UNICODE),1)
160     COMMON_CONFIGURE_OPTIONS += --enable-unicode
161     MSW_CONFIGURE_OPTIONS += --enable-unicode
162     PY_WX_CONFIG_OPTIONS += --unicode
163     PY_UNICODE="UNICODE=1"
164
165     # for compatibility with the existing 2.6 packages, we don't use "u" in
166     # the Unicode (default) package names
167     unicode_suffix :=
168 else
169     # but we do need to use something for non-Unicode packages to distinguish
170     # them
171     PY_UNICODE=
172     unicode_suffix := -ansi
173 endif
174
175 # Packages to build:
176 package_wxbase_lib      := libwxbase$(sorelease)$(unicode_suffix)
177 package_wxbase_dev      := libwxbase$(release)$(unicode_suffix)-dev
178 package_wxbase_dbg      := libwxbase$(release)$(unicode_suffix)-dbg
179
180 package_gtk_lib         := libwxgtk$(sorelease)$(unicode_suffix)
181 package_gtk_dev         := libwxgtk$(release)$(unicode_suffix)-dev
182 package_gtk_dbg         := libwxgtk$(release)$(unicode_suffix)-dbg
183
184 package_gtkmedia_lib         := libwxgtk-media$(sorelease)$(unicode_suffix)
185 package_gtkmedia_dev         := libwxgtk-media$(release)$(unicode_suffix)-dev
186 package_gtkmedia_dbg         := libwxgtk-media$(release)$(unicode_suffix)-dbg
187
188 package_gtk_py_lib      := python-wxgtk$(release)$(unicode_suffix)
189 package_gtk_py_ver       = python-wxversion
190 package_gtk_py_tools     = python-wxtools
191
192 package_headers         := wx$(release)-headers
193 package_i18n            := wx$(release)-i18n
194 package_doc             := wx$(release)-doc
195 package_examples        := wx$(release)-examples
196 package_common           = wx-common
197
198 package_gtk_dbg_py      := python-wxgtk$(release)$(unicode_suffix)-dbg
199
200 package_msw_dev         := libwxmsw$(release)$(unicode_suffix)-dev
201 package_msw_dbg         := libwxmsw$(release)$(unicode_suffix)-dbg
202 package_headers_msw     := wx$(release)-headers-msw
203
204 # The packages listed here will not be built by default.
205 extra_packages := \
206                   $(package_msw_dev) $(package_msw_dbg) $(package_headers_msw)
207
208 ifdef DEBIAN_WX_DEFAULT_VERSION
209
210 # The packages listed here are common to all wx versions, and may be provided
211 # by another source package if more than one is in the release simultaneously.
212   extra_packages += $(package_common)
213
214 endif
215
216 ifdef DEBIAN_WXPYTHON_DEFAULT_VERSION
217
218 # The packages listed here are common to all wx versions, and may be provided
219 # by another source package if more than one is in the release simultaneously.
220   extra_packages += $(package_gtk_py_ver) $(package_gtk_py_tools)
221
222 endif
223
224 # Build directories:
225 objdir_wxbase_shared       = objs_wxbase_sh
226 objdir_wxbase_debug        = objs_wxbase_d
227 objdir_gtk_shared          = objs_gtk_sh
228 objdir_gtk_debug           = objs_gtk_d
229 objdir_gtk_install         = objs_gtk_install
230 objdir_doc_cruft           = objs_doc_con
231 objdir_doc                 = docs/wx-manual.html
232 objdir_examples            = docs/examples
233 objdir_i18n                = locale
234
235 objdir_msw_shared          = objs_msw_sh
236 objdir_msw_static          = objs_msw_st
237 objdir_msw_dbg             = objs_msw_d
238 objdir_msw_install         = objs_msw_install
239
240 objdirs := $(objdir_wxbase_shared) $(objdir_wxbase_debug)                  \
241            $(objdir_gtk_shared) $(objdir_gtk_debug) $(objdir_gtk_install)  \
242            $(objdir_doc_cruft) $(objdir_doc) $(objdir_examples)            \
243            $(objdir_msw_shared) $(objdir_msw_static) $(objdir_msw_dbg)     \
244            $(objdir_msw_install)
245
246 #       note that the i18n package is actually arch indep (once built)
247 #       but must be built (and installed) during the arch any phase as
248 #       it's pulled out of the wxGTK shared lib package.
249 #
250 #       similarly some of the wxpython packages are arch indep too, but
251 #       all files for it are installed during the arch any phase.
252
253
254 # Build stamps:
255 build_arch_stamps = build-wxbase-shared-stamp build-wxbase-debug-stamp    \
256                     build-gtk-shared-stamp build-gtk-shared-contrib-stamp \
257                     build-gtk-debug-stamp build-gtk-debug-contrib-stamp   \
258                     build-i18n-stamp build-gtk-py-stamp build-gtk-dbg-py-stamp
259
260 build_indep_stamps = build-examples-stamp build-doc-stamp
261
262 build_cross_stamps = build-msw-shared-stamp build-msw-static-stamp build-msw-dbg-stamp
263
264 build_stamps_native := $(build_arch_stamps) $(build_indep_stamps)
265
266 build_stamps := $(build_stamps_native) $(build_cross_stamps)
267
268
269 # Install targets:
270 install_all_arch = install-wxbase-lib install-wxbase-dev install-wxbase-dbg  \
271                    install-gtk-lib install-gtk-dev install-gtk-dbg        \
272                    install-gtkmedia-lib install-gtkmedia-dev \
273                    install-gtkmedia-dbg \
274                    install-headers install-i18n            \
275                    install-gtk-py install-gtk-dbg-py
276
277 ifndef DEBIAN_WX_DEFAULT_VERSION
278
279   install_all_arch += install-common
280
281 endif
282
283 install_all_indep = install-examples install-doc
284
285 install_all_cross = install-msw-dev install-msw-dbg install-headers-msw
286
287 install_all_native := $(install_all_arch) $(install_all_indep)
288
289 install_all := $(install_all_native) $(install_all_cross)
290
291
292 # wxPython uses this to build in-tree
293 wxconfig     := $(shell pwd)/$(objdir_gtk_shared)/wx-config --no_rpath
294 wxconfig-dbg := $(shell pwd)/$(objdir_gtk_debug)/wx-config --no_rpath
295
296 # and this after it is installed.
297 py_wxconfig  := wx-config $(PY_WX_CONFIG_OPTIONS) --debug=no
298 pyd_wxconfig := wx-config $(PY_WX_CONFIG_OPTIONS) --debug
299
300
301 #contrib_libs := $(subst CVS,,$(notdir $(wildcard contrib/include/wx/*)))
302
303
304 # The Rules:
305
306 config.guess config.sub:
307         ln -sf /usr/share/misc/config.guess /usr/share/misc/config.sub .
308
309 debian/control: debian/control.in
310         sed -e 's/=V/$(release)/g;s/=SOV/$(sorelease)/g;s/=U/$(unicode_suffix)/g'\
311                 < debian/control.in > debian/control
312
313 control-files-stamp: debian/control
314         dh_testdir
315         @for f in postinst prerm; do                                         \
316                 echo "generating control file $(package_wxbase_dev).$$f";    \
317                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g;s/=MA/$(DEB_HOST_MULTIARCH)/g' \
318                         < debian/libwxbase-dev.$$f                           \
319                         > debian/$(package_wxbase_dev).$$f;                  \
320         done
321         @for f in postinst prerm; do                                         \
322                 echo "generating control file $(package_wxbase_dbg).$$f";    \
323                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g;s/=MA/$(DEB_HOST_MULTIARCH)/g' \
324                         < debian/libwxbase-dbg.$$f                           \
325                         > debian/$(package_wxbase_dbg).$$f;                  \
326         done
327         @for f in postinst prerm; do                                         \
328                 echo "generating control file $(package_gtk_dev).$$f";       \
329                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g;s/=MA/$(DEB_HOST_MULTIARCH)/g' \
330                         < debian/libwxgtk-dev.$$f                            \
331                         > debian/$(package_gtk_dev).$$f;                     \
332         done
333         @for f in postinst prerm; do                                         \
334                 echo "generating control file $(package_gtk_dbg).$$f";       \
335                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g;s/=MA/$(DEB_HOST_MULTIARCH)/g' \
336                         < debian/libwxgtk-dbg.$$f                            \
337                         > debian/$(package_gtk_dbg).$$f;                     \
338         done
339         @for f in docs postinst prerm; do                                    \
340                 echo "generating control file $(package_gtk_py_lib).$$f";    \
341                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g'            \
342                         < debian/python-wxgtk.$$f                            \
343                         > debian/$(package_gtk_py_lib).$$f;                  \
344         done
345         @echo "generating control file $(package_gtk_dbg_py).docs"
346         @cp debian/python-wxgtk.docs debian/$(package_gtk_dbg_py).docs
347         @for f in docs doc-base; do                                          \
348                 echo "generating control file $(package_doc).$$f";           \
349                 sed -e 's/=V/$(release)/g' < debian/wx-doc.$$f               \
350                         > debian/$(package_doc).$$f;                         \
351         done
352         @for f in examples; do                                               \
353                 echo "generating control file $(package_examples).$$f";      \
354                 cp debian/wx-examples.$$f debian/$(package_examples).$$f;    \
355         done
356         @for f in postinst prerm; do                                         \
357                 echo "generating control file $(package_msw_dev).$$f";       \
358                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g'            \
359                     -e  's/=H/$(cross_host)/g;'                              \
360                         < debian/libwxmsw-dev.$$f                            \
361                         > debian/$(package_msw_dev).$$f;                     \
362         done
363         @for f in postinst prerm; do                                         \
364                 echo "generating control file $(package_msw_dbg).$$f";       \
365                 sed -e  's/=V/$(release)/g;s/=PRIO/$(alt_prio)/g'            \
366                     -e  's/=H/$(cross_host)/g;'                              \
367                         < debian/libwxmsw-dbg.$$f                            \
368                         > debian/$(package_msw_dbg).$$f;                     \
369         done
370 #       @echo "generating control file $(package_common).menu";              \
371 #               sed -e 's/=V/$(release)/g' < debian/wx-common.menu           \
372 #                       > debian/$(package_common).menu
373         @echo "generating control file lintian-override";                    \
374                 sed -e  's/=V/$(release)/g;s/=SOV/$(sorelease)/g'            \
375                     -e  's/=U/$(unicode_suffix)/'                            \
376                         < debian/lintian-override.in                         \
377                         > debian/lintian-override;                           \
378         touch $@
379
380 build-arch: control-files-stamp $(build_arch_stamps)
381 build-indep: control-files-stamp $(build_indep_stamps)
382 build_all: control-files-stamp $(build_stamps_native)
383
384 # Really we should probably do nothing here until we know which
385 # binary target is being called, but alpha builds were exploding
386 # (compiler segfaults) in random places when building under fakeroot
387 # from the binary-arch target.  Build all -arch files here then, and
388 # let the -indep stuff fend for itself later.
389
390 build: build-stamp build-arch
391 build-stamp:
392
393
394 # The wx2.6 build system makes us run around in circles to get a separate
395 # libwxbase.  We need to configure it here in order to get the correct
396 # config files to use it alone, but there is no point building it as the
397 # wxgtk build is going to do that again anyway.  We'll move the relevant
398 # files out when that is done.
399
400 configure-wxbase-shared-stamp: config.guess
401         dh_testdir
402         mkdir -p $(objdir_wxbase_shared)
403         cd $(objdir_wxbase_shared) \
404             && ../configure $(BASE_CONFIGURE_OPTIONS)
405         touch $@
406
407 build-wxbase-shared-stamp: configure-wxbase-shared-stamp
408         dh_testdir
409         # Nothing to build here, move along...
410         #$(FAST_MAKE) -C $(objdir_wxbase_shared)
411         touch $@
412
413 configure-wxbase-debug-stamp: config.guess
414         dh_testdir
415         mkdir -p $(objdir_wxbase_debug)
416         cd $(objdir_wxbase_debug)                                       \
417             && ../configure $(BASE_CONFIGURE_OPTIONS) --enable-debug
418         touch $@
419
420 build-wxbase-debug-stamp: configure-wxbase-debug-stamp
421         dh_testdir
422         # Nothing to build here, move along...
423         #$(FAST_MAKE) -C $(objdir_wxbase_debug)
424         touch $@
425
426 configure-gtk-shared-stamp: config.guess
427         dh_testdir
428         mkdir -p $(objdir_gtk_shared)
429         cd $(objdir_gtk_shared) \
430             && ../configure $(GTK_CONFIGURE_OPTIONS)
431         touch $@
432
433 build-gtk-shared-stamp: configure-gtk-shared-stamp
434         dh_testdir
435         $(FAST_MAKE) -C $(objdir_gtk_shared)
436         cd $(objdir_gtk_shared)/lib && ln -s . $(DEB_HOST_MULTIARCH)
437         touch $@
438
439
440 configure-gtk-debug-stamp: config.guess
441         dh_testdir
442         mkdir -p $(objdir_gtk_debug)
443         cd $(objdir_gtk_debug) \
444             && ../configure $(GTK_CONFIGURE_OPTIONS) --enable-debug
445         touch $@
446
447 build-gtk-debug-stamp: configure-gtk-debug-stamp
448         dh_testdir
449         $(FAST_MAKE) -C $(objdir_gtk_debug)
450         cd $(objdir_gtk_debug)/lib && ln -s . $(DEB_HOST_MULTIARCH)
451         touch $@
452
453
454 build-gtk-shared-contrib-stamp: build-gtk-shared-stamp
455         dh_testdir
456         $(FAST_MAKE) -C $(objdir_gtk_shared)/contrib/src
457         $(FAST_MAKE) -C $(objdir_gtk_shared)/utils/wxrc
458         touch $@
459
460
461 build-gtk-debug-contrib-stamp: build-gtk-debug-stamp
462         dh_testdir
463         $(FAST_MAKE) -C $(objdir_gtk_debug)/contrib/src
464         touch $@
465
466
467 purge-dbg-py:
468         @if [ ! -e build-gtk-py-stamp ]; then                           \
469                 $(MAKE) -f debian/rules clean-py;                       \
470         fi
471         $(RM) build-gtk-dbg-py-stamp
472
473 build-gtk-py-stamp: $(PYVERS:%=build-gtk-py%-stamp) # purge-dbg-py
474         touch $@
475
476 build-gtk-py%-stamp: build-gtk-shared-stamp # purge-dbg-py
477         dh_testdir
478         touch docs/lgpl.txt
479         cd wxPython \
480                 && python$* ./setup.py build                    \
481                                                 WX_CONFIG='$(wxconfig)' \
482                                                 WXPORT=$(pytoolkit)     \
483                                                 $(PY_UNICODE)           \
484                                                 FLAVOUR=$(DEBIAN_WXFLAVOUR)
485         touch $@
486
487 build-doc-stamp: build-gtk-shared-stamp
488         dh_testdir
489         # the tarball may already have the generated docs in it
490         if [ ! -e docs/html/wx/index.html ]; then \
491                 $(FAST_MAKE) -C $(objdir_gtk_shared)/utils/tex2rtf/src; \
492                 rm -rf $(objdir_doc); \
493                 rm -rf $(objdir_doc_cruft); \
494                 mkdir $(objdir_doc); \
495                 mkdir $(objdir_doc_cruft); \
496                 cd $(objdir_doc_cruft); \
497                 LD_LIBRARY_PATH=../$(objdir_gtk_shared)/lib:$(LD_LIBRARY_PATH) \
498                    ../$(objdir_gtk_shared)/utils/tex2rtf/src/tex2rtf           \
499                    ../docs/latex/wx/manual.tex                                 \
500                    ../$(objdir_doc)/wx$(release)-manual.html                   \
501                    -twice -html;                                               \
502                 cd -; \
503                 cp docs/latex/wx/*.gif $(objdir_doc); \
504                 rm -rf $(objdir_doc_cruft); \
505                 rm -f $(objdir_doc)/wx$(release)-manual.{con,hh*,htx,ref}; \
506         else \
507                 mkdir $(objdir_doc); \
508                 cp docs/html/wx/* $(objdir_doc); \
509                 mv $(objdir_doc)/index.html $(objdir_doc)/wx-$(release)-manual_contents.html; \
510         fi
511         touch $@
512
513 build-examples-stamp: build-gtk-shared-stamp
514         dh_testdir
515         mkdir -p $(objdir_examples)
516
517         # copy all samples and the Makefile generated for libwxgtk.
518         # Some files in the sources are randomly executable, so don't
519         # just use cp -a here.
520         cp -dR --preserve=timestamps samples $(objdir_examples)
521         rm -f $(objdir_examples)/samples/Makefile
522         cp -a $(objdir_gtk_shared)/samples/Makefile $(objdir_examples)/samples
523
524         find $(objdir_examples)/samples -name 'Makefile.in' -delete
525         for f in `find $(objdir_examples)/samples -name makefile.unx` ; do \
526                 mv $$f `dirname $$f`/Makefile ; \
527         done
528
529         cp -a wxPython/demo $(objdir_examples)/wxPython
530         # Remove useless file.
531         rm -f $(objdir_examples)/wxPython/b
532         # Stop files being randomly executable.
533         -chmod a-x \
534                 $(objdir_examples)/samples/Info.plist \
535                 $(objdir_examples)/samples/aui/descrip.mms \
536                 $(objdir_examples)/samples/db/descrip.mms \
537                 $(objdir_examples)/samples/docview/docview.r \
538                 $(objdir_examples)/samples/internat/ar/internat.mo \
539                 $(objdir_examples)/samples/internat/ar/internat.po \
540                 $(objdir_examples)/samples/minimal/minimal.plc \
541                 $(objdir_examples)/samples/xrc/descrip.mms \
542                 $(objdir_examples)/wxPython/bmp_source/customcontrol.png
543
544         echo "generating unpack_examples.sh script"
545         sed -e 's/=V/$(release)/g' < debian/unpack_examples.sh.in       \
546                                    > debian/unpack_examples.sh
547         chmod 755 debian/unpack_examples.sh
548
549         touch $@
550
551 build-i18n-stamp: build-gtk-shared-stamp
552         dh_testdir
553
554         # touch .po files first, since if they are not already up
555         # to date then _now_ is not the time to fix it.
556         # That should have been been done before the release was tagged.
557         cd $(objdir_i18n) \
558                 && touch *.po \
559                 && $(MAKE) allmo
560         touch $@
561
562 purge-release-py:
563         @if [ ! -e build-gtk-dbg-py-stamp ]; then                       \
564                 $(MAKE) -f debian/rules clean-py;                       \
565         fi
566         $(RM) build-gtk-py-stamp
567
568 build-gtk-dbg-py-stamp: $(PYVERS:%=build-gtk-dbg-py%-stamp) # purge-release-py
569         touch $@
570
571 build-gtk-dbg-py%-stamp: build-gtk-debug-stamp # purge-release-py
572         dh_testdir
573         touch docs/lgpl.txt
574         cd wxPython                                                     \
575                 && python$*-dbg ./setup.py build                        \
576                                             WX_CONFIG='$(wxconfig-dbg)' \
577                                             WXPORT=$(pytoolkit)         \
578                                             $(PY_UNICODE)               \
579                                             FLAVOUR=$(addsuffix -,$(DEBIAN_WXFLAVOUR))dbg
580         touch $@
581
582
583 configure-msw-shared-stamp: config.guess
584         dh_testdir
585         mkdir -p $(objdir_msw_shared)
586         cd $(objdir_msw_shared)                                         \
587                 && ../configure --prefix=/usr/$(cross_host)             \
588                                 --cache-file=$(config_cache_cross)      \
589                                 --host=$(cross_host)                    \
590                                 --build=$(cross_build)                  \
591                                 --with-flavour=$(DEBIAN_WXFLAVOUR)      \
592                                 $(MSW_CONFIGURE_OPTIONS)
593         touch $@
594
595 build-msw-shared-stamp: configure-msw-shared-stamp
596         dh_testdir
597         $(FAST_MAKE) -C $(objdir_msw_shared)
598         touch $@
599
600 configure-msw-static-stamp: config.guess
601         dh_testdir
602         mkdir -p $(objdir_msw_static)
603         cd $(objdir_msw_static)                                         \
604                 && ../configure --prefix=/usr/$(cross_host)             \
605                                 --cache-file=$(config_cache_cross)      \
606                                 --host=$(cross_host)                    \
607                                 --build=$(cross_build)                  \
608                                 --with-flavour=$(DEBIAN_WXFLAVOUR)      \
609                                 $(MSW_CONFIGURE_OPTIONS)                \
610                                 --disable-shared
611         touch $@
612
613 build-msw-static-stamp: configure-msw-static-stamp
614         dh_testdir
615         $(FAST_MAKE) -C $(objdir_msw_static)
616         touch $@
617
618 configure-msw-dbg-stamp: config.guess
619         dh_testdir
620         mkdir -p $(objdir_msw_dbg)
621         cd $(objdir_msw_dbg)                                            \
622                 && ../configure --prefix=/usr/$(cross_host)             \
623                                 --cache-file=$(config_cache_cross)      \
624                                 --host=$(cross_host)                    \
625                                 --build=$(cross_build)                  \
626                                 --with-flavour=$(DEBIAN_WXFLAVOUR)      \
627                                 --enable-debug
628         touch $@
629
630 build-msw-dbg-stamp: configure-msw-dbg-stamp
631         dh_testdir
632         $(FAST_MAKE) -C $(objdir_msw_dbg)
633         touch $@
634
635
636 clean-py:
637         cd wxPython && \
638             rm -rf build-options.cache build*/ wx/*.py build_options.py src/wx.pth wx/build/build_options.py
639
640         # What to do about src/__version__.py ???
641
642
643 # We do the equivalent of this above by removing build, unfortunately
644 # it's not enough by itself to get the tree properly clean again.
645 #               && ./setup.py clean
646
647 clean: debian/control clean-py
648         dh_testdir
649         dh_testroot
650
651         rm -rf config_deb.cache config_deb_cross.cache *-stamp $(objdirs)
652
653         dh_clean
654         rm -f debian/$(package_wxbase_lib).* \
655               debian/$(package_wxbase_dev).* \
656               debian/$(package_wxbase_dbg).* \
657               debian/$(package_gtk_lib).* \
658               debian/$(package_gtk_dev).* \
659               debian/$(package_gtk_dbg).* \
660               debian/$(package_gtk_py_lib).* \
661               debian/$(package_headers).* \
662               debian/$(package_i18n).* \
663               debian/$(package_doc).* \
664               debian/$(package_examples).* \
665               debian/$(package_gtk_dbg_py).* \
666               debian/$(package_msw_dev).* \
667               debian/$(package_msw_dbg).* \
668               debian/lintian-override \
669               debian/unpack_examples.sh \
670               config.guess config.sub
671         rm -rf include/wx-$(release)
672         find -name '*.py[co]' -delete
673
674 install_arch: build-arch $(install_all_arch)
675
676 install: build_all $(install_all_native)
677
678 install-wxbase-lib: DH_OPTIONS=-p$(package_wxbase_lib)
679 install-wxbase-lib: build-wxbase-shared-stamp install-gtk-shared-stamp
680         dh_testdir
681         dh_testroot
682         dh_prep
683         @# No, this is not a typo, we steal these libs from the gtk build.
684         dh_install $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/libwx_base*.so.*     usr/lib/$(DEB_HOST_MULTIARCH)
685         dh_installdirs usr/share/lintian/overrides
686         grep ^$(package_wxbase_lib): debian/lintian-override > debian/$(package_wxbase_lib)/usr/share/lintian/overrides/$(package_wxbase_lib)
687
688 install-wxbase-dev: DH_OPTIONS=-p$(package_wxbase_dev)
689 install-wxbase-dev: build-wxbase-shared-stamp install-gtk-shared-stamp
690         dh_testdir
691         dh_testroot
692         dh_prep
693         @# No, this is not a typo, we steal these libs from the gtk build.
694         dh_install $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/libwx_base*.so       usr/lib/$(DEB_HOST_MULTIARCH)
695         dh_install $(objdir_wxbase_shared)/lib/wx/include       usr/lib/$(DEB_HOST_MULTIARCH)/wx
696         dh_install $(objdir_wxbase_shared)/lib/wx/config/base*  usr/lib/$(DEB_HOST_MULTIARCH)/wx/config
697
698 install-wxbase-dbg: DH_OPTIONS=-p$(package_wxbase_dbg)
699 install-wxbase-dbg: build-wxbase-debug-stamp
700         dh_testdir
701         dh_testroot
702         dh_prep
703         @# No, this is not a typo, we steal these libs from the gtk debug build.
704         dh_install $(objdir_gtk_debug)/lib/libwx_base*          usr/lib/$(DEB_HOST_MULTIARCH)
705         dh_install $(objdir_wxbase_debug)/lib/wx/include        usr/lib/$(DEB_HOST_MULTIARCH)/wx
706         dh_install $(objdir_wxbase_debug)/lib/wx/config/base*   usr/lib/$(DEB_HOST_MULTIARCH)/wx/config
707         dh_installdirs usr/share/lintian/overrides
708         grep ^$(package_wxbase_dbg): debian/lintian-override > debian/$(package_wxbase_dbg)/usr/share/lintian/overrides/$(package_wxbase_dbg)
709
710 install-gtk-shared-stamp: build-gtk-shared-stamp build-gtk-shared-contrib-stamp
711         dh_testdir
712         mkdir -p $(objdir_gtk_install)
713         cd $(objdir_gtk_shared) \
714                 && $(MAKE) install prefix=`pwd`/../$(objdir_gtk_install)
715         cd $(objdir_gtk_shared)/contrib/src \
716                 && $(MAKE) install prefix=`pwd`/../../../$(objdir_gtk_install)
717         touch $@
718
719 install-gtk-lib: DH_OPTIONS=-p$(package_gtk_lib)
720 install-gtk-lib: install-gtk-shared-stamp
721         dh_testdir
722         dh_testroot
723         dh_prep
724         dh_install -Xmedia $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/libwx_gtk*.so.*      usr/lib/$(DEB_HOST_MULTIARCH)
725         dh_installdirs usr/share/lintian/overrides
726         grep ^$(package_gtk_lib): debian/lintian-override > debian/$(package_gtk_lib)/usr/share/lintian/overrides/$(package_gtk_lib)
727
728 install-gtk-dev: DH_OPTIONS=-p$(package_gtk_dev)
729 install-gtk-dev: install-gtk-shared-stamp
730         dh_testdir
731         dh_testroot
732         dh_prep
733         dh_install -Xmedia $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/libwx_gtk*.so        usr/lib/$(DEB_HOST_MULTIARCH)
734         dh_install -Xmediactrl $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/wx/include       usr/lib/$(DEB_HOST_MULTIARCH)/wx
735         dh_install $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/wx/config/gtk*       usr/lib/$(DEB_HOST_MULTIARCH)/wx/config
736
737 install-gtk-dbg: DH_OPTIONS=-p$(package_gtk_dbg)
738 install-gtk-dbg: build-gtk-debug-stamp build-gtk-debug-contrib-stamp
739         dh_testdir
740         dh_testroot
741         dh_prep
742         dh_install -Xmedia $(objdir_gtk_debug)/lib/libwx_gtk*           usr/lib/$(DEB_HOST_MULTIARCH)
743         dh_install $(objdir_gtk_debug)/lib/wx/include           usr/lib/$(DEB_HOST_MULTIARCH)/wx
744         dh_install $(objdir_gtk_debug)/lib/wx/config/gtk*       usr/lib/$(DEB_HOST_MULTIARCH)/wx/config
745         dh_installdirs usr/share/lintian/overrides
746         grep ^$(package_gtk_dbg): debian/lintian-override > debian/$(package_gtk_dbg)/usr/share/lintian/overrides/$(package_gtk_dbg)
747
748 install-gtkmedia-lib: DH_OPTIONS=-p$(package_gtkmedia_lib)
749 install-gtkmedia-lib: install-gtk-shared-stamp
750         dh_testdir
751         dh_testroot
752         dh_prep
753         dh_install $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/libwx_gtk*media*.so.*        usr/lib/$(DEB_HOST_MULTIARCH)
754         dh_installdirs usr/share/lintian/overrides
755         grep ^$(package_gtkmedia_lib): debian/lintian-override > debian/$(package_gtkmedia_lib)/usr/share/lintian/overrides/$(package_gtkmedia_lib)
756
757 install-gtkmedia-dev: DH_OPTIONS=-p$(package_gtkmedia_dev)
758 install-gtkmedia-dev: install-gtk-shared-stamp
759         dh_testdir
760         dh_testroot
761         dh_prep
762         dh_install $(objdir_gtk_install)/lib/$(DEB_HOST_MULTIARCH)/libwx_gtk*media*.so  usr/lib/$(DEB_HOST_MULTIARCH)
763
764 install-gtkmedia-dbg: DH_OPTIONS=-p$(package_gtkmedia_dbg)
765 install-gtkmedia-dbg: build-gtk-debug-stamp build-gtk-debug-contrib-stamp
766         dh_testdir
767         dh_testroot
768         dh_prep
769         dh_install $(objdir_gtk_debug)/lib/libwx_gtk*media*     usr/lib/$(DEB_HOST_MULTIARCH)
770         dh_installdirs usr/share/lintian/overrides
771         grep ^$(package_gtkmedia_dbg): debian/lintian-override > debian/$(package_gtkmedia_dbg)/usr/share/lintian/overrides/$(package_gtkmedia_dbg)
772
773 install-gtk-py-lib: DH_OPTIONS=-p$(package_gtk_py_lib)
774 install-gtk-py-lib: install-gtk-py-lib-pre $(PYVERS:%=install-gtk-pylib%)
775         /bin/echo -n "$(wxsubdir)" > debian/$(package_gtk_py_lib)/usr/lib/wx/python/wx$(release).pth
776 install-gtk-py-lib-pre:
777         dh_testdir
778         dh_testroot
779         dh_prep
780 install-gtk-pylib%: install-gtk-py-lib-pre build-gtk-py%-stamp
781         dh_testdir
782         dh_testroot
783         dh_installdirs usr/lib/wx/python
784         cd wxPython                                                             \
785                 && python$* ./setup.py install                          \
786                               --install-layout=deb \
787                               --prefix=`pwd`/../debian/$(package_gtk_py_lib)/usr \
788                               WX_CONFIG='$(wxconfig)'                           \
789                               SYS_WX_CONFIG='$(py_wxconfig)'                    \
790                               WXPORT=$(pytoolkit)                               \
791                               $(PY_UNICODE)                                     \
792                               FLAVOUR=$(DEBIAN_WXFLAVOUR)
793
794         cp -a include/wx-$(release) \
795             debian/$(package_headers)/usr/include
796
797         rm -f debian/$(package_gtk_py_lib)/usr/lib/python$*/$(call py_sitename,$*)/wx.pth
798
799         find debian/$(package_gtk_py_lib)/usr/lib/python$* -name '*.py?' -delete
800
801         # Fix image-file-in-usr-lib lintian warnings.
802         mkdir -p debian/$(package_gtk_py_lib)/usr/share/$(package_gtk_py_lib)/XRCed/plugins/
803         cp -rf debian/$(package_gtk_py_lib)/usr/lib/python$*/$(call py_sitename,$*)/$(wxsubdir)/wx/tools/XRCed/plugins/bitmaps debian/$(package_gtk_py_lib)/usr/share/$(package_gtk_py_lib)/XRCed/plugins/
804         -rm -rf debian/$(package_gtk_py_lib)/usr/lib/python$*/$(call py_sitename,$*)/$(wxsubdir)/wx/tools/XRCed/plugins/bitmaps
805
806         # This is rather bogus, it's included in the main copyright file now though.
807         rm -f debian/$(package_gtk_py_lib)/usr/lib/python$*/$(call py_sitename,$*)/$(wxsubdir)/wx/tools/XRCed/license.txt
808
809 install-gtk-py-ver: DH_OPTIONS=-p$(package_gtk_py_ver)
810 install-gtk-py-ver: install-gtk-py-lib
811         dh_testdir
812         dh_testroot
813         dh_prep
814
815 ifndef DEBIAN_WXPYTHON_DEFAULT_VERSION
816
817         dh_movefiles --sourcedir=debian/$(package_gtk_py_lib) \
818                 $(foreach pv,$(PYVERS),$(call py_libdir,$(pv))/wxversion.py)
819         for v in $(foreach pv,$(PYVERS),debian/$(package_gtk_py_ver)$(call py_libdir,$(pv))/wx.pth); do \
820           ln -sf ../../wx/python/wx.pth $$v; \
821         done
822 else
823         rm -f debian/$(package_gtk_py_lib)/usr/lib/python*/*/wxversion.py
824 endif
825
826
827
828 install-gtk-py-tools: DH_OPTIONS=-p$(package_gtk_py_tools)
829 install-gtk-py-tools: install-gtk-py-ver
830         dh_testdir
831         dh_testroot
832         dh_prep
833
834 install-gtk-py: DH_OPTIONS=-p$(package_gtk_py_tools)
835 install-gtk-py: install-gtk-py-tools
836
837 ifndef DEBIAN_WXPYTHON_DEFAULT_VERSION
838
839         dh_movefiles --sourcedir=debian/$(package_gtk_py_lib) usr/bin
840
841         dh_installman debian/wxPython-tools.1
842         dh_link usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/img2py.1     \
843                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/img2xpm.1    \
844                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/img2png.1    \
845                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/pycrust.1    \
846                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/xrced.1      \
847                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/helpviewer.1 \
848                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/pyalacarte.1 \
849                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/pyalamode.1  \
850                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/pywrap.1     \
851                 usr/share/man/man1/wxPython-tools.1 usr/share/man/man1/pywxrc.1
852
853         rm debian/$(package_gtk_py_tools)/usr/bin/pyshell
854 endif
855         mkdir -p debian/$(package_gtk_py_tools)/usr/share/pixmaps
856         mkdir -p debian/$(package_gtk_py_tools)/usr/share/applications
857
858         cp debian/pycrust.xpm                   debian/$(package_gtk_py_tools)/usr/share/pixmaps/pycrust.xpm
859         cp debian/xrced.xpm                     debian/$(package_gtk_py_tools)/usr/share/pixmaps/xrced.xpm
860         cp wxPython/wx/py/PyCrust_32.png        debian/$(package_gtk_py_tools)/usr/share/pixmaps/pycrust.png
861         cp wxPython/wx/tools/XRCed/XRCed_32.png debian/$(package_gtk_py_tools)/usr/share/pixmaps/xrced.png
862         cp debian/pycrust.desktop               debian/$(package_gtk_py_tools)/usr/share/applications
863         cp debian/xrced.desktop                 debian/$(package_gtk_py_tools)/usr/share/applications
864
865         rm -r debian/$(package_gtk_py_lib)/usr/bin
866
867
868 install-common: DH_OPTIONS=-p$(package_common)
869 install-common: install-gtk-shared-stamp
870         dh_testdir
871         dh_testroot
872         dh_prep
873
874         dh_install $(objdir_gtk_install)/share/bakefile/presets usr/share/bakefile
875         dh_install $(objdir_gtk_install)/share/bakefile/presets/wx*.bkl usr/share/bakefile/presets
876
877         dh_install $(objdir_gtk_install)/share/aclocal usr/share
878         dh_installman debian/wx-config.1
879
880         dh_install $(objdir_gtk_shared)/utils/wxrc/wxrc usr/bin
881         dh_installman debian/wxrc-tools.1
882         dh_link usr/share/man/man1/wxrc-tools.1 usr/share/man/man1/wxrc.1
883
884
885 install-headers: DH_OPTIONS=-p$(package_headers)
886 install-headers: install-gtk-shared-stamp
887         dh_testdir
888         dh_testroot
889         dh_prep
890
891 # The only way to be really sure we get the univ headers correct is to install
892 # them.  Do that in a scratch dirs, and move the gtk ones last, so at least
893 # they win in the result of any uncaught conflict.
894
895 #       cd $(objdir_gtk_univ) \
896 #               && $(MAKE) install prefix=`pwd`/../$(objdir_univ_install)/usr
897
898 #       dh_movefiles --sourcedir=$(objdir_univ_install)
899         dh_install $(objdir_gtk_install)/include        usr
900
901 install-i18n: DH_OPTIONS=-p$(package_i18n)
902 install-i18n: build-i18n-stamp install-gtk-shared-stamp
903         dh_testdir
904         dh_testroot
905         dh_prep
906         # We end up with usr/share/locale/zh/LC_MESSAGES/ empty in 2.8.12.1.
907         find $(objdir_gtk_install)/share/locale -type d -empty -delete
908         dh_install $(objdir_gtk_install)/share/locale   usr/share
909
910 install-doc: DH_OPTIONS=-p$(package_doc)
911 install-doc: build-doc-stamp
912         dh_testdir
913         dh_testroot
914         dh_prep
915
916         @# Link this monstrosity with an overly obfuscated name
917         @# to something that both people and browsers can expect to find.
918         dh_link usr/share/doc/$(package_doc)/wx-manual.html/wx-$(release)-manual_contents.html \
919                 usr/share/doc/$(package_doc)/wx-manual.html/index.html
920
921 install-examples: DH_OPTIONS=-p$(package_examples)
922 install-examples: build-examples-stamp
923         dh_testdir
924         dh_testroot
925         dh_prep
926
927 install-gtk-dbg-py: DH_OPTIONS=-p$(package_gtk_dbg_py)
928 install-gtk-dbg-py: install-gtk-dbg-py-pre $(PYVERS:%=install-gtk-dbg-py%)
929 install-gtk-dbg-py-pre:
930         dh_testdir
931         dh_testroot
932         dh_prep
933 install-gtk-dbg-py%: install-gtk-dbg-py-pre build-gtk-dbg-py%-stamp
934         dh_testdir
935         dh_testroot
936         dh_installdirs usr/lib/wx/python
937         cd wxPython                                                             \
938                 && python$*-dbg ./setup.py install                              \
939                               --install-layout=deb \
940                               --prefix=`pwd`/../debian/$(package_gtk_dbg_py)/usr \
941                               WX_CONFIG='$(wxconfig-dbg)'                       \
942                               SYS_WX_CONFIG='$(pyd_wxconfig)'                   \
943                               WXPORT=$(pytoolkit)                               \
944                               $(PY_UNICODE)                                     \
945                               FLAVOUR=$(addsuffix -,$(DEBIAN_WXFLAVOUR))dbg
946
947         mv debian/$(package_gtk_dbg_py)/usr/lib/python$*/$(call py_sitename,$*)/$(wxsubdir)-dbg \
948                 debian/$(package_gtk_dbg_py)/usr/lib/python$*/$(call py_sitename,$*)/$(wxsubdir)
949
950         -find debian/$(package_gtk_dbg_py) -name '*_d.so'
951         find debian/$(package_gtk_dbg_py) ! -type d ! -name '*.so' -delete
952         find debian/$(package_gtk_dbg_py) -depth -type d -empty -delete
953
954
955 install-msw-dev: DH_OPTIONS=-p$(package_msw_dev)
956 install-msw-dev: build-msw-shared-stamp build-msw-static-stamp
957         dh_testdir
958         dh_testroot
959         dh_prep
960         dh_install $(objdir_msw_shared)/lib/*.dll*                   usr/$(cross_host)/lib
961         dh_install $(objdir_msw_shared)/lib/wx/include               usr/$(cross_host)/lib/wx
962         dh_install $(objdir_msw_shared)/lib/wx/config/$(cross_host)* usr/$(cross_host)/lib/wx/config
963         dh_install $(objdir_msw_static)/lib/*.a                      usr/$(cross_host)/lib
964         dh_install $(objdir_msw_static)/lib/wx/include               usr/$(cross_host)/lib/wx
965         dh_install $(objdir_msw_static)/lib/wx/config/$(cross_host)* usr/$(cross_host)/lib/wx/config
966         $(cross_host)-strip --strip-debug debian/$(package_msw_dev)/usr/$(cross_host)/lib/*.a
967
968         @# As a special case for the cross packages, we link their config
969         @# under /usr as well as under the normal cross prefix.  This way
970         @# --prefix=/usr/$(cross_host) and --prefix=/usr --host=$(cross_host)
971         @# will have a congruent effect on wx-config.
972         @( for f in `ls -1 debian/$(package_msw_dev)/usr/$(cross_host)/lib/wx/config`; do \
973               all_cfg="$${all_cfg} usr/$(cross_host)/lib/wx/config/$$f usr/lib/wx/config/$$f"; \
974               echo "linking cross config /usr/$(cross_host)/lib/wx/config/$$f"; \
975            done;                                                                \
976            dh_link $${all_cfg};                                                 \
977          )
978
979 install-msw-dbg: DH_OPTIONS=-p$(package_msw_dbg)
980 install-msw-dbg: build-msw-dbg-stamp
981         dh_testdir
982         dh_testroot
983         dh_prep
984         dh_install $(objdir_msw_dbg)/lib/*.dll*                   usr/$(cross_host)/lib
985         dh_install $(objdir_msw_dbg)/lib/wx/include               usr/$(cross_host)/lib/wx
986         dh_install $(objdir_msw_dbg)/lib/wx/config/$(cross_host)* usr/$(cross_host)/lib/wx/config
987         # No static lib, they're freakin' huge!
988         #$(cross_host)-strip --strip-debug debian/$(package_msw_dbg)/usr/$(cross_host)/lib/*.a
989
990         @( for f in `ls -1 debian/$(package_msw_dbg)/usr/$(cross_host)/lib/wx/config`; do \
991               all_cfg="$${all_cfg} usr/$(cross_host)/lib/wx/config/$$f usr/lib/wx/config/$$f"; \
992               echo "linking cross config /usr/$(cross_host)/lib/wx/config/$$f"; \
993            done;                                                                \
994            dh_link $${all_cfg};                                                 \
995          )
996
997 install-headers-msw: DH_OPTIONS=-p$(package_headers_msw)
998 install-headers-msw:
999         dh_testdir
1000         dh_testroot
1001         dh_prep
1002
1003         cd $(objdir_msw_shared) \
1004                 && $(MAKE) install prefix=`pwd`/../$(objdir_msw_install)
1005
1006 #       Symlink all the headers that will be installed by the main -headers
1007 #       package to where the cross compiler will expect them.
1008         @( for f in `ls -1 $(objdir_msw_install)/include/wx-$(release)/wx`; do  \
1009               all_h="$${all_h} usr/include/wx-$(release)/wx/$$f usr/$(cross_host)/include/wx-$(release)/wx/$$f"; \
1010               echo "linking header /usr/include/wx-$(release)/wx/$$f"; \
1011            done;                                                       \
1012            dh_link $${all_h};                                          \
1013          )
1014
1015 #       But install this lot for real.
1016         rm -f debian/$(package_headers_msw)/usr/$(cross_host)/include/wx-$(release)/wx/msw
1017         dh_install $(objdir_msw_install)/include/wx-$(release)/wx/msw  usr/$(cross_host)/include/wx-$(release)/wx
1018
1019 binary-common:
1020         dh_testdir
1021         dh_testroot
1022         dh_installchangelogs docs/changes.txt
1023         dh_installdocs
1024         dh_installexamples
1025         dh_installmenu
1026         dh_link
1027         dh_python2
1028
1029         @# Don't strip debug libs at all, and strip cross libs elsewhere
1030         @# with the cross host tools until dh_strip gets smarter.
1031 ifneq (, $(filter -a, $(DH_OPTIONS)))
1032         dh_strip -N$(package_gtk_dbg) -N$(package_wxbase_dbg) \
1033                  -N$(package_msw_dev) -N$(package_msw_dbg) \
1034                  -N$(package_gtk_py_lib) -N$(package_gtk_dbg_py)
1035         DH_OPTIONS= dh_strip -p$(package_gtk_py_lib) --dbg-package=$(package_gtk_dbg_py)
1036 endif
1037         dh_compress -X.py
1038         dh_fixperms
1039
1040         @# Don't do this for the dbg-py special build because dh_makeshlibs
1041         @# will crap out if it is called with no packages to act on.
1042 ifneq ($(DH_OPTIONS),-p$(package_gtk_dbg_py))
1043         dh_makeshlibs -N$(package_gtk_py_lib) -V
1044 endif
1045
1046         dh_installdeb
1047         dh_shlibdeps -ldebian/$(package_wxbase_lib)/usr/lib:debian/$(package_wxbase_dbg)/usr/lib:debian/$(package_gtk_lib)/usr/lib:debian/$(package_gtk_dbg)/usr/lib:debian/$(package_gtkmedia_lib):debian/$(package_gtkmedia_dbg)
1048         dh_gencontrol
1049         dh_md5sums
1050         dh_builddeb -- -Zxz
1051
1052 # Build architecture-independent files here.
1053 # Note that you currently can't build the indep packages without first
1054 # building the arch specific package files needed to create them.
1055 binary-indep: build_all install
1056         $(MAKE) -f debian/rules \
1057                 DH_OPTIONS="-i $(addprefix -N,$(extra_packages))" \
1058                 binary-common
1059
1060 # Build just the architecture-dependent files here.
1061 binary-arch: build-arch install_arch
1062         $(MAKE) -f debian/rules \
1063                 DH_OPTIONS="-a $(addprefix -N,$(extra_packages))" \
1064                 binary-common
1065         rm -rf debian/$(package_gtk_dbg_py)/usr/share/doc/$(package_gtk_dbg_py)
1066         ln -s $(package_gtk_py_lib) debian/$(package_gtk_dbg_py)/usr/share/doc/$(package_gtk_dbg_py)
1067
1068 # Build all packages target.
1069 binary: binary-arch binary-indep
1070
1071
1072 # This is a special target for building the wxMSW-cross packages.
1073 # It's not currently called during the official package build run
1074 # but may be run separately to build the extra packages.
1075 # There is an implied build dep on the mingw32 cross compiler
1076 # that is not in the control file.
1077 binary-cross: control-files-stamp $(install_all_cross)
1078         $(MAKE) -f debian/rules \
1079                 DH_OPTIONS="-p$(package_msw_dev) -p$(package_msw_dbg) -p$(package_headers_msw)" \
1080                 binary-common
1081
1082
1083 # Build wxPython against libwxgtk-dbg.  This package will conflict
1084 # with the release build one, but may be useful to some people.
1085 binary-dbg-py: control-files-stamp install-gtk-dbg-py
1086         $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_dbg_py)" binary-common
1087
1088
1089 ############################################################################
1090 #
1091 # Some rules to build a subset of the complete list of packages that can be
1092 # built.  Beware that packages produced with these rules may *NOT*
1093 # be compatible with packages built using the 'binary' target or even with
1094 # Debian policy.  Do not distribute packages built with these rules, they
1095 # are currently useful for rapid in-house testing by developers only.
1096
1097 DH_OPTIONS_GTK := -p$(package_wxbase_lib) -p$(package_gtk_lib) -p$(package_headers)
1098
1099 # libwxgtk shared lib package
1100 binary-gtk: control-files-stamp install-gtk-lib install-wxbase-lib install-headers install-gtkmedia-lib
1101         $(MAKE) -f debian/rules DH_OPTIONS="$(DH_OPTIONS_GTK)" binary-common
1102
1103 binary-gtk-dev: control-files-stamp install-gtk-dev install-gtkmedia-dev install-wxbase-dev install-headers
1104         $(MAKE) -f debian/rules \
1105             DH_OPTIONS="-p$(package_wxbase_dev) -p$(package_gtk_dev) -p$(package_gtkmedia_dev) $(DH_OPTIONS_GTK)" \
1106             binary-common
1107
1108 binary-gtk-dbg: control-files-stamp install-gtk-dbg install-wxbase-dbg install-headers install-gtkmedia-dbg
1109         $(MAKE) -f debian/rules \
1110             DH_OPTIONS="-p$(package_wxbase_dbg) -p$(package_gtk_dbg) -p$(package_headers)" \
1111             binary-common
1112
1113 # docs package
1114 binary-doc: control-files-stamp install-doc
1115         $(MAKE) -f debian/rules DH_OPTIONS=-p$(package_doc) binary-common
1116
1117 binary-fast:control-files-stamp install-gtk-dbg install-msw-dev install-headers install-headers-msw
1118         $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_dbg) -p$(package_msw_dev) -p$(package_headers) -p$(package_headers_msw)" binary-common
1119
1120 .PHONY: build build_all build-arch build-indep                          \
1121         clean clean-py purge-release-py purge-dbg-py                    \
1122         binary-indep binary-arch binary binary-common                   \
1123         binary-gtk binary-gtk-dev binary-gtk-dbg                        \
1124         binary-wxbase binary-wxbase-dev binary-wxbase-dbg               \
1125         binary-doc binary-cross binary-dbg-py                           \
1126         install install_arch install-gtk-lib install-gtk-dev            \
1127         install-gtk-dbg                                                 \
1128         install-gtkmedia-lib install-gtkmedia-dbg install-gtkmedia-dev  \
1129         install-gtk-py install-gtk-py-tools install-gtk-py-ver          \
1130         install-gtk-py-lib install-gtk-dbg-py                           \
1131         install-common install-headers install-i18n install-doc         \
1132         install-examples install-msw-dev install-msw-dbg install-headers-msw