Annotated mingw-6 changes to clazzes-org debian packages

 summarizes the most important changes to debian packages 

debian/control

Key changes:

  • mingw-w32-pkg-config and mingw-w64-pkg-config are deprecated, use mingw-w64-tools, which contains tools for both architectures (w32/w64).
  • mingw-w32-gcc and mingw-w64-gcc are deprecated, simply use g++-mingw-w64, which contains all compilers for both architectures (w32/w64).

  • Split packages to dev and runtime package
  • Root runtime dependencies are mingw-w64-gcc-rt resp. mingw-w64-g++-rt and mingw-w32-gcc-rt resp. mingw-w32-g++-rt 
  • Root development dependencies are mingw-w64-i686-dev (w32) and mingw-w64-x86-64-dev (w64)
  • Correctly refer to upstream dev/runtime packages like mingw-w64-zlib, mingw-w64-zlib-dev and other likewise dependencies of your package (not shown in the example below...)
  • Depend on debhelper >= 9
  • Distribution is jessie, generation is 6
Index: debian/control
===================================================================
--- debian/control	(.../mingw-w64-libiconv-1.13.1)	(Revision 560)
+++ debian/control	(.../mingw-w64-libiconv-1.14)	(Arbeitskopie)
@@ -2,18 +2,28 @@
 Priority: extra
 Section: devel
 Maintainer: Wolfgang Glas <wolfgang.glas@iteg.at>
-Build-Depends: cdbs, debhelper (>> 5), mingw-w32-gcc, mingw-w64-gcc
+Build-Depends: cdbs, debhelper (>= 9), g++-mingw-w64, mingw-w64-tools
 XBCS-PBA-Category: mingw
-XBCS-PBA-Generation: 5
-XBCS-PBA-Distributions: squeeze wheezy
+XBCS-PBA-Generation: 6
+XBCS-PBA-Distributions: jessie
 XBCS-PBA-Repositories: deb.clazzes.org
 
 Package: mingw-w64-libiconv
 Architecture: all
-Depends: mingw-w64-gcc
+Depends: mingw-w64-gcc-rt
 Description: This is the libiconv port to mingw-w64.
 
+Package: mingw-w64-libiconv-dev
+Architecture: all
+Depends: mingw-w64-x86-64-dev, mingw-w64-libiconv (= ${Source-Version})
+Description: This package contain header files and import libraries of the libiconv port to mingw-w64.
+
 Package: mingw-w32-libiconv
 Architecture: all
-Depends: mingw-w32-gcc
+Depends: mingw-w32-gcc-rt
 Description: This is the libiconv port to mingw-w32.
+
+Package: mingw-w32-libiconv-dev
+Architecture: all
+Depends: mingw-w64-i686-dev, mingw-w32-libiconv (= ${Source-Version})
+Description: This package contain header files and import libraries of the libiconv port to mingw-w32.

Result: http://svn.clazzes.org/svn/mingw-pkg/trunk/mingw-w64-deb/mingw-w64-libiconv-1.14/debian/control

debian/rules

Key changes:

  • Split deb and runtime packages.
  • Do not include /usr/share/cdbs/1/rules/debhelper.mk
  • Use dh wildcard rule as described e.g. in https://wiki.debian.org/IntroDebianPackaging
  • Define DEB_UPSTREAM_VERSION on your own as seen below, if you need it. (Not needed for most packages...)
  • Move $(prefix)/lib and $(prefix)/include to $(devprefix) (likewise for w32...)
  • IMPORTANT: Add debian/devhost.txt.gz, debian/*.substvars and debian/*.debhelper.log to the list of cleaned files. (If you don't do this, you will suffer from really crazy effects on rebuilds!!!)
  • Do not clean debian/compat, add it to the svn repository.

The fiddling with libiconv.pc is specific to the libiconv example, most modern autoconf packages come with a suitable *.pc file installed in the correct location.

 Index: debian/rules
===================================================================
--- debian/rules	(.../mingw-w64-libiconv-1.13.1)	(Revision 560)
+++ debian/rules	(.../mingw-w64-libiconv-1.14)	(Arbeitskopie)
@@ -1,10 +1,11 @@
 #!/usr/bin/make -f
 
-include /usr/share/cdbs/1/rules/debhelper.mk
+DEB_UPSTREAM_VERSION ?= $(shell dpkg-parsechangelog | sed -rne 's/^Version: ([0-9.]+)[-+].*$$/\1/p')
 
 prefix=/usr
 
 package = mingw-w64-libiconv
+devpackage = mingw-w64-libiconv-dev
 target = x86_64-w64-mingw32
 prefix = /usr/$(target)
 docdir = debian/$(package)/usr/share/doc/$(package)
@@ -12,6 +13,7 @@
 DESTDIR = $(shell /bin/pwd)/debian/$(package)
 
 package32 = mingw-w32-libiconv
+devpackage32 = mingw-w32-libiconv-dev
 target32 = i686-w64-mingw32
 prefix32 = /usr/$(target32)
 docdir32 = debian/$(package32)/usr/share/doc/$(package32)
@@ -24,11 +26,23 @@
 
 DEB_DH_ALWAYS_EXCLUDE := .svn
 
+
+%:
+	dh $@
+
 # do not strip anything.
 # call 'strip' on a mingw lib*.a file causes the ranlib information to
 # be discarded rendering the libraries useless.
-DEB_DH_STRIP_ARGS := -Xlib
+override_dh_strip:
 
+override_dh_shlibdeps:
+
+export DEB_CFLAGS_MAINT_SET  = -O2 -Wall
+export DEB_LDFLAGS_MAINT_SET =
+
+build-indep: common-build-indep
+install-indep: common-install-indep
+
 INSTALL_PROGRAM = install
 
 common-build-indep::
@@ -44,7 +58,7 @@
 
 clean::
 	rm -f compile common-install-indep common-build-indep
-	rm -rf *~ debian/$(package) debian/$(package32) debian/*~ debian/files* debian/substvars debian/compat
+	rm -rf *~ debian/$(package) debian/$(devpackage) debian/$(package32) debian/$(devpackage32) debian/*~ debian/files* debian/substvars debian/devhost.txt.gz debian/*.substvars debian/*.debhelper.log
 	rm -rf $(builddir)
 	rm -rf $(builddir32)
 
@@ -55,15 +69,23 @@
 
 common-install-indep::
 	rm -rf debian/$(package)
+	rm -rf debian/$(devpackage)
 	mkdir debian/$(package)
 	cd $(builddir) && make DESTDIR=$(DESTDIR) install
-	cd debian/$(package)$(prefix)/lib; ln -s ../bin/libiconv-2.dll libiconv.dll
+	mkdir -p debian/$(devpackage)/usr/$(target)
+	mv debian/$(package)/usr/$(target)/include debian/$(devpackage)/usr/$(target)
+	mv debian/$(package)/usr/$(target)/lib debian/$(devpackage)/usr/$(target)
+	rm -rf debian/$(package)/usr/$(target)/share
 	rm -rf debian/$(package32)
+	rm -rf debian/$(devpackage32)
 	mkdir debian/$(package32)
 	cd $(builddir32) && make DESTDIR=$(DESTDIR32) install
-	cd debian/$(package32)$(prefix32)/lib; ln -s ../bin/libiconv-2.dll libiconv.dll
-	mkdir -p debian/$(package)/usr/x86_64-w64-mingw32/lib/pkgconfig
-	sed -e 's/__VERSION__/$(DEB_UPSTREAM_VERSION)/' -e 's/__arch__/x86_64-w64-mingw32/' < pc/libiconv.pc > debian/$(package)/usr/x86_64-w64-mingw32/lib/pkgconfig/libiconv.pc
-	mkdir -p debian/$(package32)/usr/i686-w64-mingw32/lib/pkgconfig
-	sed -e 's/__VERSION__/$(DEB_UPSTREAM_VERSION)/' -e 's/__arch__/i686-w64-mingw32/' < pc/libiconv.pc > debian/$(package32)/usr/i686-w64-mingw32/lib/pkgconfig/libiconv.pc
+	mkdir -p debian/$(devpackage32)/usr/$(target32)
+	mv debian/$(package32)/usr/$(target32)/include debian/$(devpackage32)/usr/$(target32)
+	mv debian/$(package32)/usr/$(target32)/lib debian/$(devpackage32)/usr/$(target32)
+	rm -rf debian/$(package32)/usr/$(target32)/share
+	mkdir -p debian/$(devpackage)/usr/$(target)/lib/pkgconfig
+	sed -e 's/__VERSION__/$(DEB_UPSTREAM_VERSION)/' -e 's/__arch__/$(target)/' < pc/libiconv.pc > debian/$(devpackage)/usr/$(target)/lib/pkgconfig/libiconv.pc
+	mkdir -p debian/$(devpackage32)/usr/$(target32)/lib/pkgconfig
+	sed -e 's/__VERSION__/$(DEB_UPSTREAM_VERSION)/' -e 's/__arch__/$(target32)/' < pc/libiconv.pc > debian/$(devpackage32)/usr/$(target32)/lib/pkgconfig/libiconv.pc
 	touch common-install-indep

Result: http://svn.clazzes.org/svn/mingw-pkg/trunk/mingw-w64-deb/mingw-w64-libiconv-1.14/debian/rules

debian/compat

Please add a debian/compat file to svn with a singel line containing the number '9' and never delete this file with 

 Index: debian/compat
===================================================================
--- debian/compat	(.../mingw-w64-libiconv-1.13.1)	(Revision 0)
+++ debian/compat	(.../mingw-w64-libiconv-1.14)	(Revision 609)
@@ -0,0 +1 @@
+9

Portable projects examples