From ee8c73d1e23e5352412aebbfa23d38ae7e680314 Mon Sep 17 00:00:00 2001 From: Matthias Paulmier Date: Mon, 2 Jul 2018 12:07:22 +0200 Subject: Add the Standards.pm library The library provides functions for checking that the required files in a given standard (GNU org GNITS) are present. --- bin/automake.in | 47 +----------------------------- lib/Automake/Standards.pm | 74 +++++++++++++++++++++++++++++++++++++++++++++++ lib/Automake/local.mk | 1 + 3 files changed, 76 insertions(+), 46 deletions(-) create mode 100644 lib/Automake/Standards.pm diff --git a/bin/automake.in b/bin/automake.in index b17ad7bd1..301c850e4 100755 --- a/bin/automake.in +++ b/bin/automake.in @@ -70,6 +70,7 @@ use Automake::Requires; use Automake::Rule; use Automake::RuleDef; use Automake::SilentRules; +use Automake::Standards; use Automake::Texi; use Automake::Utils; use Automake::VarDef; @@ -90,8 +91,6 @@ sub append_exeext (&$); sub check_canonical_spelling; sub check_directories_in_var; sub check_directory; -sub check_gnits_standards (); -sub check_gnu_standards (); sub check_libobjs_sources; sub check_trailing_slash ($\$); sub check_typos (); @@ -4396,50 +4395,6 @@ sub scan_autoconf_files () @configure_dist_common = @dist_common; } -################################################################ - -# Do any extra checking for GNU standards. -sub check_gnu_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNU, - qw/INSTALL NEWS README AUTHORS ChangeLog/); - - # Accept one of these three licenses; default to COPYING. - # Make sure we do not overwrite an existing license. - my $license; - foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) - { - if (-f $_) - { - $license = $_; - last; - } - } - require_file ("$am_file.am", GNU, 'COPYING') - unless $license; - } - - for my $opt ('no-installman', 'no-installinfo') - { - msg ('error-gnu', option $opt, - "option '$opt' disallowed by GNU standards") - if option $opt; - } -} - -# Do any extra checking for GNITS standards. -sub check_gnits_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNITS, 'THANKS'); - } -} - ################################################################ diff --git a/lib/Automake/Standards.pm b/lib/Automake/Standards.pm new file mode 100644 index 000000000..854a271ee --- /dev/null +++ b/lib/Automake/Standards.pm @@ -0,0 +1,74 @@ +# Copyright (C) 2018 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +package Automake::Standards; + +use Automake::Channels; +use Automake::Global; +use Automake::Options; +use Automake::Requires; +use Automake::Utils; +use Exporter 'import'; + +use vars qw (@EXPORT); + +@EXPORT = qw (check_gnu_standards check_gnits_standards); + + +# Do any extra checking for GNU standards. +sub check_gnu_standards () +{ + if ($relative_dir eq '.') + { + # In top level (or only) directory. + require_file ("$am_file.am", GNU, + qw/INSTALL NEWS README AUTHORS ChangeLog/); + + # Accept one of these three licenses; default to COPYING. + # Make sure we do not overwrite an existing license. + my $license; + foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) + { + if (-f $_) + { + $license = $_; + last; + } + } + require_file ("$am_file.am", GNU, 'COPYING') + unless $license; + } + + for my $opt ('no-installman', 'no-installinfo') + { + msg ('error-gnu', option $opt, + "option '$opt' disallowed by GNU standards") + if option $opt; + } +} + + +# Do any extra checking for GNITS standards. +sub check_gnits_standards () +{ + if ($relative_dir eq '.') + { + # In top level (or only) directory. + require_file ("$am_file.am", GNITS, 'THANKS'); + } +} + + +1; diff --git a/lib/Automake/local.mk b/lib/Automake/local.mk index b0e0fca66..46668c65f 100644 --- a/lib/Automake/local.mk +++ b/lib/Automake/local.mk @@ -44,6 +44,7 @@ dist_perllib_DATA = \ %D%/Rule.pm \ %D%/RuleDef.pm \ %D%/SilentRules.pm \ + %D%/Standards.pm \ %D%/Texi.pm \ %D%/Utils.pm \ %D%/VarAppend.pm \ -- cgit v1.2.1