diff options
author | Dmitry Bogatov <KAction@debian.org> | 2018-11-28 03:30:54 +0000 |
---|---|---|
committer | Dmitry Bogatov <KAction@debian.org> | 2018-11-28 03:46:24 +0000 |
commit | 480f4d0190d9eb2cc44502e49749d18658d77270 (patch) | |
tree | df47478c0b80e60b9add6754c47f655e73064f6b | |
parent | d4747b9992d834ff16f4c2e21a69c7bea892a9f2 (diff) |
Simplify rebuilding with diet libc
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rwxr-xr-x | debian/rules | 44 |
3 files changed, 42 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog index dd646f2..2115b32 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ ucspi-unix (1.0-1) UNRELEASED; urgency=medium * Remove unneed link from package description * Convert `debian/copyright' to dep-5 format * Record build environment with `dh-buildinfo' + * Simplify rebuilding with diet libc -- Dmitry Bogatov <KAction@debian.org> Wed, 28 Nov 2018 00:50:23 +0000 diff --git a/debian/control b/debian/control index ec233d0..0e09131 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ Build-Depends: groff, libbg-dev, man-db, + dietlibc-dev (>= 0.34~cvs20160606-3) [alpha amd64 arm64 armeb armel armhf hppa i386 mips mipsel mips64el powerpc powerpcspe ppc64 ppc64el s390x sparc64 x32] <!pkg.ucspi-unix.nodietlibc>, Standards-Version: 4.2.1 Homepage: https://untroubled.org/ucspi-unix diff --git a/debian/rules b/debian/rules index 5b19842..013eb22 100755 --- a/debian/rules +++ b/debian/rules @@ -4,12 +4,48 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all include /usr/share/dpkg/default.mk export CFLAGS += $(shell getconf LFS_CFLAGS) export LDFLAGS += $(shell getconf LFS_LDFLAGS) -export prefix=debian/ucspi-unix/usr -export mandir=share/man +export prefix = $(CURDIR)/debian/ucspi-unix/usr +export mandir = share/man + + +# Package is built twice, with glibc and diet libc, but only $(FLAVOR) +# version is installed. This way following is achieved: +# +# * diet version is protected from bitrot +# * switching to diet version for downstream/local rebuild is as +# smooth, as possible. +FLAVOR = glibc + +HAVE_DIETLIBC=no +ifeq ($(shell dpkg -s dietlibc-dev | grep -o installed), installed) + HAVE_DIETLIBC=yes + BUILT_USING := $(shell dpkg-query -f'$${source:Package} (= $${source:Version})' -W dietlibc-dev) + DIET_LIBDIR := $(shell diet -L gcc) +endif +ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) + HAVE_DIETLIBC=no +endif + %: dh $@ --with buildinfo override_dh_auto_configure: - echo '$(CC) $(CFLAGS) $(CPPFLAGS)' > conf-cc - echo '$(CC) $(LDFLAGS)' > conf-ld + mkdir -p diet glibc + find -maxdepth 1 -type f -printf '../%f\0' | xargs -0 ln -sft diet/ + find -maxdepth 1 -type f -printf '../%f\0' | xargs -0 ln -sft glibc/ + rm diet/conf-* glibc/conf-* + echo '$(CC) $(CFLAGS) $(CPPFLAGS)' > glibc/conf-cc + echo '$(CC) $(LDFLAGS)' > glibc/conf-ld + echo 'diet gcc $(CFLAGS) $(CPPFLAGS)' > diet/conf-cc + echo 'diet gcc $(LDFLAGS)' > diet/conf-ld + +override_dh_auto_build: + $(MAKE) -C diet + $(MAKE) -C glibc + +override_dh_auto_install: + $(MAKE) -C $(FLAVOR) install + +override_dh_auto_clean: + rm -fr glibc/ diet/ |