[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automake::Config
From: |
Alexandre Duret-Lutz |
Subject: |
Re: Automake::Config |
Date: |
Wed, 06 Aug 2003 23:20:00 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
[...]
adl> This patch introduces a config.h equivalent:
adl> Automake::Config, so that these variables are substituted
adl> in one accessible place.
I'm installing it as follows.
2003-08-06 Alexandre Duret-Lutz <address@hidden>
* lib/Automake/Config.in: New file.
* lib/Automake/Makefile.am (nodist_perllib_DATA, do_subst,
CLEANFILES): New variables.
(Config.pm): New rule.
* Makefile.am (maintainer-check): Adjust expected differences
between automake.in and automake.
* aclocal.in, automake.in: Use Automake::Config.
Index: Makefile.am
===================================================================
RCS file: /cvs/automake/automake/Makefile.am,v
retrieving revision 1.216
diff -u -r1.216 Makefile.am
--- Makefile.am 29 Jul 2003 20:32:31 -0000 1.216
+++ Makefile.am 6 Aug 2003 21:17:49 -0000
@@ -97,7 +97,7 @@
## This check avoids accidental configure substitutions in the source.
## There are exactly 8 lines that should be modified. This works out
## to 28 lines of diffs.
- @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 28; then \
+ @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 20; then \
echo "found too many diffs between automake.in and automake"; 1>&2; \
diff -c $(srcdir)/automake.in automake; \
exit 1; \
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.82
diff -u -r1.82 aclocal.in
--- aclocal.in 9 Jul 2003 22:09:27 -0000 1.82
+++ aclocal.in 6 Aug 2003 21:17:50 -0000
@@ -33,16 +33,13 @@
unshift @INC, $perllibdir;
}
+use Automake::Config;
use Automake::General;
use Automake::Configure_ac;
use Automake::XFile;
use Automake::FileUtils;
use File::stat;
-# Some constants.
-$VERSION = '@VERSION@';
-$APIVERSION = '@APIVERSION@';
-$PACKAGE = '@PACKAGE@';
# Note that this isn't pkgdatadir, but a separate directory.
# Note also that the versioned directory is handled later.
$acdir = '@datadir@/aclocal';
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1493
diff -u -r1.1493 automake.in
--- automake.in 5 Aug 2003 09:25:16 -0000 1.1493
+++ automake.in 6 Aug 2003 21:17:55 -0000
@@ -121,6 +121,7 @@
package Automake;
use strict;
+use Automake::Config;
use Automake::General;
use Automake::XFile;
use Automake::Channels;
@@ -141,12 +142,6 @@
## ----------- ##
## Constants. ##
## ----------- ##
-
-# Parameters set by configure. Not to be changed. NOTE: assign
-# VERSION as string so that e.g. version 0.30 will print correctly.
-my $VERSION = '@VERSION@';
-my $PACKAGE = '@PACKAGE@';
-my $libdir = '@datadir@/@address@hidden@APIVERSION@';
# Some regular expressions. One reason to put them here is that it
# makes indentation work better in Emacs.
Index: bootstrap
===================================================================
RCS file: /cvs/automake/automake/bootstrap,v
retrieving revision 1.11
diff -u -r1.11 bootstrap
--- bootstrap 2 Jun 2003 21:59:14 -0000 1.11
+++ bootstrap 6 Aug 2003 21:17:55 -0000
@@ -90,28 +90,29 @@
mkdir automake-$APIVERSION
cp -rf lib/* automake-$APIVERSION
+dosubst ()
+{
+ sed -e "address@hidden@%$PERL%g" \
+ -e "address@hidden@%$VERSION%g" \
+ -e "address@hidden@%$APIVERSION%g" \
+ -e "address@hidden@%$PACKAGE%g" \
+ -e "address@hidden@%$datadir%g" \
+ -e "address@hidden@%$BOOTSTRAP_SHELL%g" $1 > $2
+}
+
+
+# Create temporary replacement for lib/Automake/Config.pm
+dosubst automake-$APIVERSION/Automake/Config.in \
+ automake-$APIVERSION/Automake/Config.pm
+
# Create temporary replacement for aclocal
-sed -e "address@hidden@%$PERL%g" \
- -e "address@hidden@%$VERSION%g" \
- -e "address@hidden@%$APIVERSION%g" \
- -e "address@hidden@%$PACKAGE%g" \
- -e "address@hidden@%$datadir%g" \
- -e "address@hidden@%$BOOTSTRAP_SHELL%g" \
- aclocal.in >aclocal.tmp
+dosubst aclocal.in aclocal.tmp
# Overwrite amversion.m4
-sed -e "address@hidden@%$VERSION%g" \
- -e "address@hidden@%$APIVERSION%g" \
- m4/amversion.in >m4/amversion.m4
+dosubst m4/amversion.in m4/amversion.m4
# Create temporary replacement for automake
-sed -e "address@hidden@%$PERL%g" \
- -e "address@hidden@%$VERSION%g" \
- -e "address@hidden@%$APIVERSION%g" \
- -e "address@hidden@%$PACKAGE%g" \
- -e "address@hidden@%$datadir%g" \
- -e "address@hidden@%$BOOTSTRAP_SHELL%g" \
- automake.in >automake.tmp
+dosubst automake.in automake.tmp
# Run the autotools.
$PERL ./aclocal.tmp -I m4
@@ -121,3 +122,4 @@
# Remove temporary files and directories
rm -rf aclocal-$APIVERSION automake-$APIVERSION
rm -f aclocal.tmp automake.tmp
+rm -f lib/Automake/Config.pm
Index: lib/Automake/Config.in
===================================================================
RCS file: lib/Automake/Config.in
diff -N lib/Automake/Config.in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/Automake/Config.in 6 Aug 2003 21:17:56 -0000
@@ -0,0 +1,52 @@
+# Copyright (C) 2003 Free Software Foundation, Inc. -*- Perl -*-
+
+# 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, 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+package Automake::Config;
+use strict;
+
+use vars qw (@ISA @EXPORT);
+
address@hidden = qw (Exporter);
address@hidden = qw ($APIVERSION $PACKAGE $VERSION $libdir);
+
+use vars qw ($APIVERSION $PACKAGE $VERSION $libdir);
+
+# Parameters set by configure. Not to be changed. NOTE: assign
+# VERSION as string so that e.g. version 0.30 will print correctly.
+$APIVERSION = '@APIVERSION@';
+$PACKAGE = '@PACKAGE@';
+$VERSION = '@VERSION@';
+$libdir = '@datadir@/@address@hidden@APIVERSION@';
+
+1;;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
Index: lib/Automake/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- lib/Automake/Makefile.am 9 Jul 2003 22:09:28 -0000 1.15
+++ lib/Automake/Makefile.am 6 Aug 2003 21:17:56 -0000
@@ -35,3 +35,21 @@
Version.pm \
XFile.pm \
Wrap.pm
+
+nodist_perllib_DATA = \
+ Config.pm
+
+CLEANFILES = $(nodist_perllib_DATA)
+
+## We can't use configure to do the substitution here; we must do it
+## by hand. We use a funny notation here to avoid configure
+## substitutions in our text.
+do_subst = sed -e 's,address@hidden@],$(datadir),g' -e
's,address@hidden@],$(PERL),g' \
+ -e 's,address@hidden@],@configure_input@,g' \
+ -e 's,address@hidden@],$(PACKAGE),g' \
+ -e 's,address@hidden@],$(VERSION),g' \
+ -e 's,address@hidden@],$(APIVERSION),g' \
+ -e 's,address@hidden@],$(SHELL),g'
+
+Config.pm: Config.in
+ $(do_subst) <$(srcdir)/Config.in >$@
--
Alexandre Duret-Lutz