From 1f35c6c94f198ea855d21f984ab77c8a3ddf83dd Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Sun, 11 Dec 2011 13:12:32 +0000 Subject: [PATCH] Automate check for 'use lib' line in bin/stow. --- Build.PL | 26 ++++++++++++++++++++++++++ doc/HOWTO-RELEASE | 9 --------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Build.PL b/Build.PL index c605d41..0dd13bb 100644 --- a/Build.PL +++ b/Build.PL @@ -58,4 +58,30 @@ my $build = Module::Build->new( }, ); +if (system('grep', '-q', '^use lib ', 'bin/stow') >> 8 == 0) { + die <<'EOF'; + +ERROR: bin/stow contains 'use lib' line which could interfere +with CPAN-style installation via Module::Build. To avoid this, +you should run ./configure with parameters which result in +--with-pmdir's value being in Perl's built-in @INC, and then run +'make' (NOT 'make install') to regenerate bin/stow, e.g. + + eval `perl -V:siteprefix` + ./configure --prefix=$siteprefix && make + +or + + ./configure --with-pmdir=`PERL5LIB= perl -le 'print $INC[0]'` && make + +Then re-run this script. + +Note that these parameters are chosen purely to regenerate +bin/stow without a 'use lib' line, so don't run 'make install' +while Stow is configured in this way unless you really want an +installation using these parameters. + +EOF +} + $build->create_build_script(); diff --git a/doc/HOWTO-RELEASE b/doc/HOWTO-RELEASE index 990b8db..3c7954b 100644 --- a/doc/HOWTO-RELEASE +++ b/doc/HOWTO-RELEASE @@ -15,15 +15,6 @@ How to make a new release of GNU Stow (N.B. the CPAN distribution will contain these files, whereas the GNU distribution will not.) - - Make sure bin/stow does not contain a "use lib" line. This - should only happen if the installation directory for Perl - modules (--with-pmdir's default value) is not in Perl's - built-in @INC, which would be caused by ./configure's default - prefix (/usr/local) not matching your Perl's siteprefix, but - the above --prefix should prevent that, as would: - - ./configure --with-pmdir=`perl -le 'print $INC[0]'` - - Make sure all the following commands all run successfully: perl Build.PL