On Sunday, March 02, 2014 02:47:30 PM Christoph Biedl wrote: > there are two tickets for obviously the same goal, merging. > > However, the patches are somewhat different. Can you two please check > both (#709558, #720655), and give me an idea which is better, and why?
Here's an updated version of my patch, with some of Eleanor's patch merged in. It also updates to use DEB_BUILD_PROFILES which recently landed in dpkg, and the Build-Profiles field support which just a couple days ago made it into debhelper (hence the bump in the debhelper Build-Depends version). So with that, you could bootstrap with something like: dpkg-buildpackage -Pstage1 -d -b -uc (I don't know why Eleanor's patch drops --fail-missing on bootstrap builds; I didn't have any issues on my test when I left it in.) -- Daniel Schepler
diff -urN file-5.17.old/debian/control file-5.17/debian/control --- file-5.17.old/debian/control 2014-02-13 15:12:58.000000000 -0800 +++ file-5.17/debian/control 2014-03-02 06:53:00.573330371 -0800 @@ -3,7 +3,7 @@ Priority: standard Maintainer: Luk Claes <[email protected]> Build-Depends: - debhelper (>= 9), autotools-dev, python-all-dev, python3-all-dev, zlib1g-dev + debhelper (>= 9.20140227), autotools-dev, python-all-dev, python3-all-dev, zlib1g-dev Standards-Version: 3.9.4 Homepage: http://www.darwinsys.com/file/ @@ -59,6 +59,7 @@ Section: python Priority: optional Architecture: any +Build-Profiles: !stage1 Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}, libmagic1 (= ${binary:Version}) @@ -73,6 +74,7 @@ Section: python Priority: optional Architecture: all +Build-Profiles: !stage1 Depends: ${misc:Depends}, ${python3:Depends}, libmagic1 (>= ${binary:Version}) Provides: ${python3:Provides} diff -urN file-5.17.old/debian/rules file-5.17/debian/rules --- file-5.17.old/debian/rules 2014-02-13 15:12:58.000000000 -0800 +++ file-5.17/debian/rules 2014-03-02 07:11:39.114126943 -0800 @@ -2,7 +2,9 @@ SHELL := sh -e +ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) -include /usr/share/python/python.mk +endif DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) @@ -17,11 +19,17 @@ # HOWMANY is the number of bytes looked at by file CFLAGS += -DHOWMANY=0x18000 +ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) PYTHON_VERSIONS=$(shell pyversions -r debian/control) PYTHON3_VERSIONS=$(shell py3versions -r debian/control) +endif %: +ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) dh ${@} --with autotools_dev,python2,python3 +else + dh ${@} --with autotools_dev +endif override_dh_auto_clean: dh_auto_clean @@ -33,6 +41,7 @@ override_dh_auto_build: dh_auto_build +ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) for python in $(PYTHON_VERSIONS); \ do \ (cd python && $$python setup.py build_ext \ @@ -44,6 +53,7 @@ (cd python && $$python setup.py build_ext \ -L$(CURDIR)/src/.libs); \ done +endif override_dh_auto_configure: dh_auto_configure -- $(CROSS) --prefix=/usr --datadir=\$${prefix}/share --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --mandir=\$${prefix}/share/man --enable-fsect-man5 --enable-static --disable-silent-rules CFLAGS="$(CFLAGS)" @@ -56,6 +66,7 @@ install -D -m 0644 magic/magic.local debian/tmp/etc/magic install -D -m 0644 magic/magic.local debian/tmp/etc/magic.mime +ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) for python in $(PYTHON_VERSIONS); \ do \ (cd python && $$python setup.py install --no-compile \ @@ -67,6 +78,7 @@ (cd python && $$python setup.py install --no-compile \ --root=$(CURDIR)/debian/python3-magic $(py_setup_install_args)); \ done +endif # Installing additional headers mkdir -p debian/libmagic-dev/usr/include/file @@ -82,7 +94,23 @@ dh_install --fail-missing override_dh_shlibdeps: +ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) + # use just built file in dh_shlibdeps + PATH=$(CURDIR)/debian/file/usr/bin:$$PATH \ + LD_LIBRARY_PATH=$(CURDIR)/debian/libmagic1/usr/lib/$(DEB_HOST_MULTIARCH)$${LD_LIBRARY_PATH+:$${LD_LIBRARY_PATH}} \ + MAGIC=$(CURDIR)/debian/libmagic1/usr/share/file/magic.mgc \ + dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib +else dh_shlibdeps -Llibmagic1 -ldebian/libmagic1/usr/lib +endif override_dh_strip: +ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) + # use just built file in dh_strip + PATH=$(CURDIR)/debian/file/usr/bin:$$PATH \ + LD_LIBRARY_PATH=$(CURDIR)/debian/libmagic1/usr/lib/$(DEB_HOST_MULTIARCH)$${LD_LIBRARY_PATH+:$${LD_LIBRARY_PATH}} \ + MAGIC=$(CURDIR)/debian/libmagic1/usr/share/file/magic.mgc \ + dh_strip --dbg-package=file-dbg +else dh_strip --dbg-package=file-dbg +endif

