diff options
author | Guillem Jover <guillem@debian.org> | 2015-05-04 05:41:44 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2015-05-09 06:19:39 +0200 |
commit | 1e61694dcd22ac8b16b55325c31ccc4bcf312f1b (patch) | |
tree | 365b1f7de36d90f5af158df5b4b6a88126b580b9 | |
parent | de6bbfc869da500094a584d95c8d584ae5f75dea (diff) | |
download | dpkg-1e61694dcd22ac8b16b55325c31ccc4bcf312f1b.tar.gz |
build: Allow running scripts from outside the source tree
-rwxr-xr-x | debian/rules | 2 | ||||
-rwxr-xr-x | run-script | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/debian/rules b/debian/rules index efd4b5ea7..f447cd765 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,7 @@ dpkg_buildflags = \ $(if $(call cc_version_lt,4.9),$(hardening_old)) \ DEB_CFLAGS_MAINT_APPEND="$(WFLAGS)" \ DEB_CXXFLAGS_MAINT_APPEND="$(WFLAGS)" \ - $(CURDIR)/run-script perl $(CURDIR)/scripts/dpkg-buildflags.pl + $(CURDIR)/run-script perl 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) diff --git a/run-script b/run-script index cebab5b69..0832f904d 100755 --- a/run-script +++ b/run-script @@ -5,9 +5,15 @@ 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" +cwd=`pwd` +cd "$OLDPWD" # Set up the environment, to use local perl modules and data files. -export PERL5LIB=`pwd`/scripts:`pwd`/dselect/methods -export DPKG_DATADIR=`pwd` +export PERL5LIB=$cwd/scripts:$cwd/dselect/methods +export DPKG_DATADIR=$cwd -exec "$@" +interp=$1 +script=$2 +shift 2 + +exec $interp "$cwd/$script" "$@" |