Build.PL 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # This file is part of GNU Stow.
  2. #
  3. # GNU Stow is free software: you can redistribute it and/or modify it
  4. # under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # GNU Stow is distributed in the hope that it will be useful, but
  9. # WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. # General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see https://www.gnu.org/licenses/.
  15. use strict;
  16. use warnings;
  17. use Module::Build;
  18. # These are required by the test suite.
  19. use lib "t";
  20. use lib "bin";
  21. my $build = Module::Build->new(
  22. module_name => 'Stow',
  23. keywords => [ qw/stow symlink software package management install/ ],
  24. license => 'gpl',
  25. # Module::Build forces us to use v1.4 of the CPAN Meta Spec:
  26. # https://rt.cpan.org/Ticket/Display.html?id=71502
  27. # 'meta-spec' => {
  28. # version => '2.0',
  29. # url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
  30. # },
  31. meta_add => {
  32. resources => {
  33. license => 'http://www.gnu.org/licenses/gpl-2.0.html' ,
  34. homepage => 'https://savannah.gnu.org/projects/stow',
  35. # Module::Build forces us to use v1.4 of the CPAN Meta Spec:
  36. # https://rt.cpan.org/Ticket/Display.html?id=71502
  37. # bugtracker => {
  38. # web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Stow',
  39. # mailto => 'stow-devel@gnu.org',
  40. # },
  41. #bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Stow',
  42. # Module::Build forces us to use v1.4 of the CPAN Meta Spec:
  43. # https://rt.cpan.org/Ticket/Display.html?id=71502
  44. # repository => {
  45. # url => 'git://git.savannah.gnu.org/stow.git',
  46. # web => 'https://savannah.gnu.org/git/?group=stow',
  47. # type => 'git',
  48. # },
  49. repository => 'git://git.savannah.gnu.org/stow.git',
  50. },
  51. },
  52. requires => {
  53. 'perl' => '5.006',
  54. 'Carp' => 0,
  55. 'IO::File' => 0,
  56. },
  57. script_files => [ 'bin/stow', 'bin/chkstow' ],
  58. all_from => 'lib/Stow.pm.in',
  59. configure_requires => {
  60. 'Module::Build' => 0,
  61. },
  62. build_requires => {
  63. 'Test::More' => 0,
  64. 'Test::Output' => 0,
  65. 'IO::Scalar' => 0,
  66. },
  67. );
  68. if (system('grep', '-q', '^use lib ', 'bin/stow') >> 8 == 0) {
  69. die <<'EOF';
  70. ERROR: bin/stow contains 'use lib' line which could interfere
  71. with CPAN-style installation via Module::Build. To avoid this,
  72. you should run ./configure with parameters which result in
  73. --with-pmdir's value being in Perl's built-in @INC, and then run
  74. 'make' (NOT 'make install') to regenerate bin/stow, e.g.
  75. eval `perl -V:siteprefix`
  76. ./configure --prefix=$siteprefix && make
  77. or
  78. ./configure --with-pmdir=`PERL5LIB= perl -le 'print $INC[0]'` && make
  79. Then re-run this script.
  80. Note that these parameters are chosen purely to regenerate
  81. bin/stow without a 'use lib' line, so don't run 'make install'
  82. while Stow is configured in this way unless you really want an
  83. installation using these parameters.
  84. EOF
  85. }
  86. $build->create_build_script();