All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bastian Germann <bage@debian.org>
To: linux-xfs@vger.kernel.org
Cc: Bastian Germann <bage@debian.org>, Zixing Liu <zixing.liu@canonical.com>
Subject: [PATCH 5/6] debian: Modernize build script
Date: Thu, 12 Sep 2024 09:20:52 +0200	[thread overview]
Message-ID: <20240912072059.913-6-bage@debian.org> (raw)
In-Reply-To: <20240912072059.913-1-bage@debian.org>

- Use autoreconf template, this will now properly installs the
  translation files
- Use $(CURDIR) to replace `pwd` syntax

Link: https://bugs.launchpad.net/ubuntu/+source/xfsprogs/+bug/2076309
Suggested-by: Zixing Liu <zixing.liu@canonical.com>
Signed-off-by: Bastian Germann <bage@debian.org>
---
 debian/rules | 80 +++++++++++++++++-----------------------------------
 1 file changed, 26 insertions(+), 54 deletions(-)

diff --git a/debian/rules b/debian/rules
index 98dafcab..7c9f90e6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,8 @@
 
 export DH_VERBOSE=1
 
+export AUTOHEADER=true
+
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     PMAKEFLAGS += -j$(NUMJOBS)
@@ -15,9 +17,7 @@ package = xfsprogs
 develop = xfslibs-dev
 bootpkg = xfsprogs-udeb
 
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
 
 version = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
 target ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
@@ -26,9 +26,9 @@ udebpkg = $(bootpkg)_$(version)_$(target).udeb
 dirme  = debian/$(package)
 dirdev = debian/$(develop)
 dirdi  = debian/$(bootpkg)
-pkgme  = DIST_ROOT=`pwd`/$(dirme);  export DIST_ROOT;
-pkgdev = DIST_ROOT=`pwd`/$(dirdev); export DIST_ROOT;
-pkgdi  = DIST_ROOT=`pwd`/$(dirdi); export DIST_ROOT;
+pkgme  = DIST_ROOT=$(CURDIR)/$(dirme);  export DIST_ROOT;
+pkgdev = DIST_ROOT=$(CURDIR)/$(dirdev); export DIST_ROOT;
+pkgdi  = DIST_ROOT=$(CURDIR)/$(dirdi); export DIST_ROOT;
 stdenv = @GZIP=-q; export GZIP;
 
 configure_options = \
@@ -42,35 +42,20 @@ configure_options = \
 	--localstatedir=/var
 
 options = export DEBUG=-DNDEBUG DISTRIBUTION=debian \
-	  INSTALL_USER=root INSTALL_GROUP=root \
+	  INSTALL_USER=root INSTALL_GROUP=root LDFLAGS='$(LDFLAGS)' \
 	  LOCAL_CONFIGURE_OPTIONS="$(configure_options) --enable-editline=yes --enable-blkid=yes" ;
 diopts  = $(options) \
 	  export OPTIMIZER=-Os LOCAL_CONFIGURE_OPTIONS="$(configure_options) --enable-gettext=no" ;
-checkdir = test -f debian/rules
 
-build: build-arch build-indep
-build-arch: built
-build-indep: built
-built: dibuild config
-	@echo "== dpkg-buildpackage: build" 1>&2
-	$(MAKE) $(PMAKEFLAGS) default
-	touch built
+%:
+	dh $@
 
-config: .gitcensus
-.gitcensus:
-	@echo "== dpkg-buildpackage: configure" 1>&2
-	$(checkdir)
-	AUTOHEADER=/bin/true dh_autoreconf
-	dh_update_autotools_config
-	# runs configure with $(options)
-	$(options) $(MAKE) $(PMAKEFLAGS) include/builddefs
-	cp -f include/install-sh .
+override_dh_auto_configure:
+	dh_testdir
 	touch .gitcensus
 
-dibuild:
-	$(checkdir)
+override_dh_auto_build:
 	@echo "== dpkg-buildpackage: installer" 1>&2
-	# runs configure with $(options)
 	if [ ! -f mkfs/mkfs.xfs-$(bootpkg) ]; then \
 		$(diopts) $(MAKE) include/builddefs; \
 		mkdir -p include/xfs; \
@@ -83,46 +68,33 @@ dibuild:
 		mv mkfs/mkfs.xfs mkfs/mkfs.xfs-$(bootpkg); \
 		$(MAKE) distclean; \
 	fi
+	@echo "== dpkg-buildpackage: configure" 1>&2
+	# runs configure with $(options)
+	$(options) $(MAKE) $(PMAKEFLAGS) include/builddefs
+	cp -f include/install-sh .
+	@echo "== dpkg-buildpackage: build" 1>&2
+	$(MAKE) $(PMAKEFLAGS) default
 
-clean:
+execute_before_dh_clean:
 	@echo "== dpkg-buildpackage: clean" 1>&2
-	$(checkdir)
+	dh_testdir
 	-rm -f built .gitcensus mkfs/mkfs.xfs-$(bootpkg)
 	$(MAKE) distclean
 	-rm -rf $(dirme) $(dirdev) $(dirdi)
-	-rm -f debian/*substvars debian/files* debian/*.debhelper
-	dh_autoreconf_clean
-	dh_clean
-
-binary-indep:
 
-binary-arch: checkroot built
+override_dh_auto_install:
 	@echo "== dpkg-buildpackage: binary-arch" 1>&2
-	$(checkdir)
 	-rm -rf $(dirme) $(dirdev) $(dirdi)
+	dh_testdir
 	$(pkgme)  $(MAKE) -C . install
 	$(pkgdev) $(MAKE) -C . install-dev
 	$(pkgdi)  $(MAKE) -C debian install-d-i
 	install -D -m 0755 debian/local/initramfs.hook debian/xfsprogs/usr/share/initramfs-tools/hooks/xfs
-	rmdir debian/xfslibs-dev/usr/share/doc/xfsprogs
 	rm -f debian/xfslibs-dev/usr/lib/$(DEB_HOST_MULTIARCH)/libhandle.la
 	rm -f debian/xfslibs-dev/usr/lib/$(DEB_HOST_MULTIARCH)/libhandle.a
-	dh_installdocs -XCHANGES
-	dh_installchangelogs
-	dh_strip
-	dh_compress
-	dh_fixperms
-	dh_makeshlibs
-	dh_installsystemd -p xfsprogs --no-restart-after-upgrade --no-stop-on-upgrade system-xfs_scrub.slice xfs_scrub_all.timer
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
 
-checkroot:
-	test 0 -eq `id -u`
+override_dh_installdocs:
+	dh_installdocs -XCHANGES
 
-.PHONY: binary binary-arch binary-indep clean checkroot
+override_dh_installsystemd:
+	dh_installsystemd -p xfsprogs --no-restart-after-upgrade --no-stop-on-upgrade system-xfs_scrub.slice xfs_scrub_all.timer
-- 
2.45.2


  parent reply	other threads:[~2024-09-12  7:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12  7:20 [PATCH 0/6] debian: Debian and Ubuntu archive changes Bastian Germann
2024-09-12  7:20 ` [PATCH 1/6] debian: Update debhelper-compat level Bastian Germann
2024-09-12  7:20 ` [PATCH 2/6] debian: Update public release key Bastian Germann
2024-09-12  7:20 ` [PATCH 3/6] debian: Prevent recreating the orig tarball Bastian Germann
2024-09-12  7:20 ` [PATCH 4/6] debian: Add Build-Depends: systemd-dev Bastian Germann
2024-09-16 22:35   ` Darrick J. Wong
2024-09-12  7:20 ` Bastian Germann [this message]
2024-09-12  7:20 ` [PATCH 6/6] debian: Correct the day-of-week on 2024-09-04 Bastian Germann
2024-09-13  5:42 ` [PATCH 0/6] debian: Debian and Ubuntu archive changes Carlos Maiolino
2024-09-16 22:38   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2024-10-02  1:04 [PATCHSET 1/6] xfsprogs: " Darrick J. Wong
2024-10-02  1:07 ` [PATCH 5/6] debian: Modernize build script Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240912072059.913-6-bage@debian.org \
    --to=bage@debian.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zixing.liu@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.