[Templates] Makefile.PL without user interaction (with PATCH)
Axel Gerstmair
Axel Gerstmair <anthill@web.de>
Tue, 29 Apr 2003 15:02:19 +0200
Hello,
I'm currently writing an installation script that sets up and installs
several packages including Template Toolkit. I would like to specify
all Makefile.PL options as arguments, so that I don't need to
intervene manually. This works well with most options. AFAIK I cannot,
however, overwrite the defaults for the optional extras (I'm using
TT_ACCEPT=y to automatically answer all questions). Or did I miss
something obvious?
I've appended a patch which
- adds yet another option, TT_EXTRAS, that sets the default value for
the "Install optional extras?" question.
- shows always the "Configuration complete" message, not just on
Windows
- shows the "Installation Notes" message only if any optional
components are installed
By the way, the current Makefile.PL is rather difficult to read and
understand with all its options and defaults. Andy, have you already
considered using Module::Build instead of EU::MakeMaker for the build
process? -- I'd like to try if this seems reasonable and I find the
time.
Best regards,
Axel
Index: Makefile.PL
===================================================================
RCS file: /template-toolkit/Template2/Makefile.PL,v
retrieving revision 2.37
diff -u -w -b -r2.37 Makefile.PL
--- Makefile.PL 2003/04/23 15:05:13 2.37
+++ Makefile.PL 2003/04/29 12:46:36
@@ -14,7 +14,7 @@
select STDOUT;
use vars qw( $TT_VERSION $TT_PREFIX $TT_IMAGES $TT_RUN_DBI
- $TT_BUILD_DOCS $TT_SPLASH_DOCS $TT_EXAMPLES
+ $TT_BUILD_DOCS $TT_SPLASH_DOCS $TT_EXAMPLES $TT_EXTRAS
$TT_LATEX_ENABLE $TT_LATEX_PATH $TT_PDFLATEX_PATH $TT_DVIPS_PATH
$TT_XS_ENABLE $TT_XS_DEFAULT
$TT_SPLASH_THEME $TT_QUIET $TT_ACCEPT $TT_YES );
@@ -69,6 +69,7 @@
TT_SPLASH use Splash! for docs (y)
TT_THEME Splash! theme (default)
TT_EXAMPLES build HTML examples (y)
+ TT_EXTRAS install optional extras (y)
TT_XS_ENABLE Enable XS Stash (y)
TT_XS_DEFAULT Use XS Stash by default (y)
TT_DBI run DBI tests (y if DBI installed)
@@ -102,6 +103,7 @@
$TT_BUILD_DOCS = 'y';
$TT_SPLASH_DOCS = 'y';
$TT_EXAMPLES = 'y';
+$TT_EXTRAS = 'y';
$TT_SPLASH_THEME = 'default';
$TT_XS_ENABLE = 'y';
$TT_XS_DEFAULT = 'y';
@@ -138,6 +140,7 @@
$TT_BUILD_DOCS = $ttconfig{ TT_DOCS } if defined $ttconfig{ TT_DOCS };
$TT_SPLASH_DOCS = $ttconfig{ TT_SPLASH } if defined $ttconfig{ TT_SPLASH };
$TT_EXAMPLES = $ttconfig{ TT_EXAMPLES } if defined $ttconfig{ TT_EXAMPLES };
+$TT_EXTRAS = $ttconfig{ TT_EXTRAS } if defined $ttconfig{ TT_EXTRAS };
$TT_LATEX_ENABLE = $ttconfig{ TT_LATEX } if defined $ttconfig{ TT_LATEX };
$TT_XS_ENABLE = $ttconfig{ TT_XS_ENABLE } if defined $ttconfig{ TT_XS_ENABLE };
$TT_XS_DEFAULT = $ttconfig{ TT_XS_DEFAULT } if defined $ttconfig{ TT_XS_DEFAULT };
@@ -145,7 +148,7 @@
$TT_ACCEPT = $ttconfig{ TT_ACCEPT } if defined $ttconfig{ TT_ACCEPT };
foreach ($TT_RUN_DBI, $TT_BUILD_DOCS, $TT_SPLASH_DOCS, $TT_EXAMPLES,
- $TT_LATEX_ENABLE, $TT_XS_ENABLE, $TT_XS_DEFAULT ) {
+ $TT_EXTRAS, $TT_LATEX_ENABLE, $TT_XS_ENABLE, $TT_XS_DEFAULT ) {
$_ = 'n' if ! $_;
}
$TT_ACCEPT = 0 if $TT_ACCEPT eq 'n';
@@ -271,15 +274,13 @@
WriteMakefile( %opts );
-if ($WIN32) {
print <<EOF;
Configuration complete. You should now run '$MAKE', '$MAKE test' and
then '$MAKE install'. See the README file for further information.
EOF
-}
-message(<<EOF) if $TT_BUILD_DOCS;
+message(<<EOF) if $TT_PREFIX;
Installation Notes
@@ -603,7 +604,7 @@
EOF
- if (ttprompt('Do you want to install these components?', 'y') =~ /^y/i) {
+ if (ttprompt('Do you want to install these components?', $TT_EXTRAS) =~ /^y/i) {
message(<<EOF);
You can chose any directory for the installation of the additional