Skip to content

Commit 74bae96

Browse files
committed
Makefile: Make Perl path install-time configurable
Add support for specifying the Perl interpreter path used in installed Perl scripts. If no path is specified, the default '/usr/bin/perl' is used. Set variable LCOV_PERL_PATH to specify a different path, for example: make install LCOV_PERL_PATH=/usr/local/bin/perl Unset this variable to keep the current path: make install LCOV_PERL_PATH= Signed-off-by: Peter Oberparleiter <[email protected]>
1 parent 0b378cb commit 74bae96

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ VERSION := $(shell bin/get_version.sh --version)
1515
RELEASE := $(shell bin/get_version.sh --release)
1616
FULL := $(shell bin/get_version.sh --full)
1717

18+
# Set this variable during 'make install' to specify the Perl interpreter used in
19+
# installed scripts, or leave empty to keep the current interpreter.
20+
export LCOV_PERL_PATH := /usr/bin/perl
21+
1822
PREFIX := /usr/local
1923

2024
CFG_DIR := $(PREFIX)/etc

bin/install.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ do_install()
3636

3737
install -d $(dirname $TARGET)
3838
install -p $PARAMS $SOURCE $TARGET
39+
if [ -n "$LCOV_PERL_PATH" ] ; then
40+
# Replace Perl interpreter specification
41+
sed -e "1 s%^#\!.*perl.*$%#\!$LCOV_PERL_PATH%" -i $TARGET
42+
fi
3943
}
4044

4145

@@ -51,7 +55,7 @@ do_uninstall()
5155
# Does target exist?
5256
if test -r $TARGET ; then
5357
# Is target of the same version as this package?
54-
if diff -I '^our \$lcov_version' -I '^\.TH ' $SOURCE $TARGET >/dev/null; then
58+
if diff -I '^our \$lcov_version' -I '^\.TH ' -I '^#!' $SOURCE $TARGET >/dev/null; then
5559
rm -f $TARGET
5660
else
5761
echo WARNING: Skipping uninstall for $TARGET - versions differ! >&2

0 commit comments

Comments
 (0)