Explorar o código

build: Add new run-script to run local scripts

This sets up the environment to be able to run the local scripts using
local modules and data files.
Guillem Jover %!s(int64=14) %!d(string=hai) anos
pai
achega
0aee0c3736
Modificáronse 4 ficheiros con 16 adicións e 4 borrados
  1. 1 0
      Makefile.am
  2. 1 2
      debian/rules
  3. 1 2
      m4/dpkg-arch.m4
  4. 13 0
      run-script

+ 1 - 0
Makefile.am

@@ -29,6 +29,7 @@ EXTRA_DIST = \
 	ChangeLog.old \
 	README.translators \
 	get-version \
+	run-script \
 	doc/README.api \
 	doc/README.feature-removal-schedule \
 	doc/coding-style.txt \

+ 1 - 2
debian/rules

@@ -9,8 +9,7 @@ WFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
 dpkg_buildflags = \
 	DEB_CFLAGS_MAINT_APPEND="$(WFLAGS)" \
 	DEB_CXXFLAGS_MAINT_APPEND="$(WFLAGS)" \
-	PERL5LIB=$(CURDIR)/scripts DPKG_DATADIR=$(CURDIR) \
-	perl $(CURDIR)/scripts/dpkg-buildflags.pl
+	$(CURDIR)/run-script perl $(CURDIR)/scripts/dpkg-buildflags.pl
 
 # These are used for cross-compiling and for saving the configure script
 # from having to guess our platform (since we know it already)

+ 1 - 2
m4/dpkg-arch.m4

@@ -8,8 +8,7 @@
 AC_DEFUN([_DPKG_ARCHITECTURE], [
 AC_REQUIRE([DPKG_PROG_PERL])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
-$2=$(cd $srcdir/scripts; \
-    PERL5LIB=$(pwd) $PERL dpkg-architecture.pl -t$host -q$1 2>/dev/null)
+$2=$($srcdir/run-script $PERL scripts/dpkg-architecture.pl -t$host -q$1 2>/dev/null)
 ])# _DPKG_ARCHITECURE
 
 # DPKG_CPU_TYPE

+ 13 - 0
run-script

@@ -0,0 +1,13 @@
+#!/bin/sh
+
+top_srcdir=`dirname $0`
+
+# To avoid using «readlink -f» or «realpath» we just change into the
+# desired directory and work from there.
+cd "$top_srcdir"
+
+# Set up the environment, to use local perl modules and data files.
+export PERL5LIB=`pwd`/scripts
+export DPKG_DATADIR=`pwd`
+
+exec "$@"