# variously stolen code :-)
# (including a debhelper template, GNU copyright 1997 to 1999 by
# Joey Hess, and some ideas found in the ncurses rules file that
-# I quite liked)
+# I quite liked. Thanks!)
#export DH_VERBOSE=1
export DH_COMPAT=2
-# Change this when the release version changes and
-# touch control.in to propagate the change.
-release=2.1
+release:=$(shell dpkg-parsechangelog | sed -n 's/^Source: wxwindows//p')
-# These are the packages we will build
+# Packages to build:
+package_wxbase_lib=libwxbase$(release)
+package_wxbase_dev=libwxbase$(release)-dev
package_gtk_lib=libwxgtk$(release)
package_gtk_dev=libwxgtk$(release)-dev
+package_gtk_py=libwxgtk$(release)-python
+package_doc=wxwin$(release)-doc
+package_examples=wxwin$(release)-examples
-# Dirs to put the various builds object files in
+# Build directories:
+objdir_wxbase_shared=objs_wxbase_sh
+objdir_wxbase_static=objs_wxbase_st
objdir_gtk_shared=objs_gtk_sh
objdir_gtk_static=objs_gtk_st
+objdir_doc_cruft=objs_doc_con
+objdir_doc=docs/wxWindows-manual.html
+objdir_examples=docs/examples
+objdirs=$(objdir_wxbase_shared) $(objdir_wxbase_static) $(objdir_gtk_shared) \
+ $(objdir_gtk_static) $(objdir_doc) $(objdir_examples)
-objdirs=$(objdir_gtk_shared) $(objdir_gtk_static)
+build_stamps=build-wxbase-shared-stamp build-wxbase-static-stamp \
+ build-gtk-shared-stamp build-gtk-static-stamp \
+ build-gtk-python-stamp build-examples-stamp build-doc-stamp
-build_stamps=build-gtk-shared-stamp build-gtk-static-stamp
+wxconfig:=$(shell pwd)/$(objdir_gtk_shared)/wx-config \
+ --prefix=$(shell pwd) \
+ --exec-prefix=$(shell pwd)/$(objdir_gtk_shared)
+# The Rules:
+
debian/control: debian/control.in
sed -e 's/=V/$(release)/g' < debian/control.in > debian/control
-build: debian/control $(build_stamps)
+debian/wxwin-doc.doc-base: debian/wxwin-doc.doc-base.in
+ sed -e 's/=V/$(release)/g' < debian/wxwin-doc.doc-base.in > debian/wxwin-doc.doc-base
+
+build: debian/control debian/wxwin-doc.doc-base $(build_stamps)
+
+build-wxbase-shared-stamp:
+ dh_testdir
+ mkdir $(objdir_wxbase_shared)
+ cd $(objdir_wxbase_shared) \
+ && ../configure --prefix=/usr --disable-gui --enable-burnt_name \
+ && $(MAKE)
+ touch $@
+
+build-wxbase-static-stamp:
+ dh_testdir
+ mkdir $(objdir_wxbase_static)
+ cd $(objdir_wxbase_static) \
+ && ../configure --prefix=/usr --disable-gui --disable-shared \
+ && $(MAKE)
+ touch $@
build-gtk-shared-stamp:
dh_testdir
mkdir $(objdir_gtk_shared)
cd $(objdir_gtk_shared) \
- && ../configure --prefix=/usr --with-gtk \
+ && ../configure --prefix=/usr --with-gtk --enable-burnt_name --disable-newgrid \
&& $(MAKE)
touch $@
&& $(MAKE)
touch $@
+build-gtk-python-stamp: build-gtk-shared-stamp
+ dh_testdir
+ cd utils/wxPython/src \
+ && touch gtk/*.cpp gtk/*.py \
+ && ../distrib/build.py -b WXDIR=../../.. WXCONFIG='$(wxconfig)'
+ cd utils/wxPython/modules/html \
+ && ../../distrib/build.py -b WXDIR=../../../.. WXCONFIG='$(wxconfig)'
+ cd utils/wxPython/modules/utils \
+ && ../../distrib/build.py -b WXDIR=../../../.. WXCONFIG='$(wxconfig)'
+ touch $@
+
+build-doc-stamp: build-gtk-shared-stamp
+ dh_testdir
+ cd $(objdir_gtk_shared)/utils/tex2rtf/src \
+ && $(MAKE)
+ mkdir $(objdir_doc)
+ mkdir $(objdir_doc_cruft)
+ cd $(objdir_doc_cruft) \
+ && LD_LIBRARY_PATH=../$(objdir_gtk_shared)/lib \
+ ../$(objdir_gtk_shared)/utils/tex2rtf/src/tex2rtf \
+ ../docs/latex/wx/manual.tex ../$(objdir_doc)/wxwin.htm -twice -html
+ cp docs/latex/wx/*.gif $(objdir_doc)
+ rm -rf $(objdir_doc_cruft)
+ rm -f $(objdir_doc)/wxwin.con $(objdir_doc)/wxwin.hh* \
+ $(objdir_doc)/wxwin.htx $(objdir_doc)/wxwin.ref
+ touch $@
+
+build-examples-stamp:
+ dh_testdir
+ mkdir $(objdir_examples)
+ cp -a samples $(objdir_examples)
+ cp -a demos $(objdir_examples)
+ cp -a utils/wxPython/demo $(objdir_examples)/wxPython
+ @for d in $(objdir_examples)/demos $(objdir_examples)/samples; do \
+ (cd $$d \
+ && mv Makefile.in Makefile \
+ && rm -f configure* \
+ && find -name 'Makefile.in' -exec rm -f '{}' ';' \
+ && for f in $$(find -type d); do \
+ if [ -f $$f/makefile.unx ]; then \
+ mv $$f/makefile.unx $$f/Makefile; \
+ fi; \
+ done) \
+ done;
+ touch $@
+
clean: debian/control
dh_testdir
dh_testroot
- -rm -rf $(build_stamps) $(objdirs)
+ rm -rf $(build_stamps) $(objdirs)
+ -cd utils/wxPython/src && $(MAKE) clean
+ -cd utils/wxPython/modules/html && $(MAKE) clean
+ -cd utils/wxPython/modules/utils && $(MAKE) clean
dh_clean
- -rm -f debian/$(package_gtk_lib).*
- -rm -f debian/$(package_gtk_dev).*
+ rm -f debian/$(package_wxbase_lib).*
+ rm -f debian/$(package_wxbase_dev).*
+ rm -f debian/$(package_gtk_lib).*
+ rm -f debian/$(package_gtk_dev).*
+ rm -f debian/$(package_gtk_py).*
+ rm -f debian/$(package_doc).*
+ rm -f debian/$(package_examples).*
install: build
+ dh_testdir
+ dh_testroot
+ @for f in dirs docs files postinst; do \
+ echo "generating control file $(package_wxbase_lib).$$f"; \
+ cp debian/libwxbase.$$f debian/$(package_wxbase_lib).$$f; \
+ done;
+ @for f in dirs docs files links postinst prerm; do \
+ echo "generating control file $(package_wxbase_dev).$$f"; \
+ cp debian/libwxbase-dev.$$f debian/$(package_wxbase_dev).$$f; \
+ done;
@for f in dirs docs files postinst; do \
echo "generating control file $(package_gtk_lib).$$f"; \
cp debian/libwxgtk.$$f debian/$(package_gtk_lib).$$f; \
done;
- @for f in dirs docs files; do \
+ @for f in dirs docs files links postinst prerm; do \
echo "generating control file $(package_gtk_dev).$$f"; \
cp debian/libwxgtk-dev.$$f debian/$(package_gtk_dev).$$f; \
done;
- dh_testdir
- dh_testroot
+ @for f in dirs docs files postinst prerm; do \
+ echo "generating control file $(package_gtk_py).$$f"; \
+ cp debian/libwxgtk-python.$$f debian/$(package_gtk_py).$$f; \
+ done;
+ @for f in dirs docs doc-base; do \
+ echo "generating control file $(package_doc).$$f"; \
+ cp debian/wxwin-doc.$$f debian/$(package_doc).$$f; \
+ done;
+ @for f in docs examples; do \
+ echo "generating control file $(package_examples).$$f"; \
+ cp debian/wxwin-examples.$$f debian/$(package_examples).$$f; \
+ done;
dh_clean -k
dh_installdirs
cd $(objdir_gtk_shared) \
&& $(MAKE) install prefix=`pwd`/../debian/tmp/usr
+ rm -f debian/tmp/usr/bin/wx-config
cp $(objdir_gtk_static)/lib/*.a debian/tmp/usr/lib
+ cp -a $(objdir_wxbase_shared)/lib/* debian/tmp/usr/lib
+ cp $(objdir_wxbase_shared)/wxbase-config debian/tmp/usr/bin/
+ cp $(objdir_wxbase_static)/lib/*.a debian/tmp/usr/lib
+ cd utils/wxPython/src \
+ && ../distrib/build.py -i \
+ TARGETDIR=../../../debian/tmp/usr/lib/python1.5/site-packages/wxPython \
+ HELPERLIBDIR=../../../debian/tmp/usr/lib \
+ WXDIR=../../..
+ cd utils/wxPython/modules/html \
+ && ../../distrib/build.py -i \
+ TARGETDIR=../../../../debian/tmp/usr/lib/python1.5/site-packages/wxPython \
+ WXDIR=../../../..
+ cd utils/wxPython/modules/utils \
+ && ../../distrib/build.py -i \
+ TARGETDIR=../../../../debian/tmp/usr/lib/python1.5/site-packages/wxPython \
+ WXDIR=../../../..
+ rm -rf debian/tmp/usr/lib/python1.5/site-packages/wxPython/demo
+ find debian/tmp/usr/lib/python1.5/site-packages/wxPython \
+ -name '*.py?' -exec rm '{}' ';'
dh_movefiles
libpngpf.3 \
zlib.3 \
png.5
- dh_installchangelogs
+ dh_installchangelogs
+ dh_installexamples
+ dh_link
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs
dh_installdeb
- dh_shlibdeps
+ dh_shlibdeps -ldebian/$(package_gtk_lib)/usr/lib:debian/$(package_gtk_py)/usr/lib
dh_gencontrol
dh_md5sums
dh_builddeb