Automate check for 'use lib' line in bin/stow.

This commit is contained in:
Adam Spiers 2011-12-11 13:12:32 +00:00
parent 23fe1510d2
commit 1f35c6c94f
2 changed files with 26 additions and 9 deletions

View file

@ -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(); $build->create_build_script();

View file

@ -15,15 +15,6 @@ How to make a new release of GNU Stow
(N.B. the CPAN distribution will contain these files, whereas (N.B. the CPAN distribution will contain these files, whereas
the GNU distribution will not.) 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: - Make sure all the following commands all run successfully:
perl Build.PL perl Build.PL