Browse Source

Use the just-built file executable when running several debhelper programs. Closes: #948619

Thanks Andreas Beckmann for the initial suggestion.
Christoph Biedl 4 years ago
parent
commit
ce2ed65574
2 changed files with 15 additions and 0 deletions
  1. 5 0
      debian/rules
  2. 10 0
      debian/run-file/file

+ 5 - 0
debian/rules

@@ -5,6 +5,11 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 # HOWMANY is the number of bytes looked at by file
 CFLAGS += -DHOWMANY=0x18000
 
+ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+	export PATH := $(CURDIR)/debian/run-file:$(PATH)
+	export CURDIR
+endif
+
 %:
 	dh $@
 

+ 10 - 0
debian/run-file/file

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+echo "Just-built file called, args: $@" >&2
+
+export LD_LIBRARY_PATH="$CURDIR/debian/tmp/usr/lib/$DEB_HOST_MULTIARCH"
+exec "$CURDIR/debian/tmp/usr/bin/file" \
+    -m "$CURDIR/debian/tmp/usr/share/file/magic.mgc" \
+    "$@"