You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andrew Wyllie <wy...@dilex.net> on 2003/10/03 23:05:04 UTC

[MP2] problem with command line args to perl Makefile.PL (includes patch)

(I originally tried sending this to the dev list but it did not seem
to go through for some reason...)


I was running into a problem trying to build MP2 with a name other
than mod_perl.so.  After poking around for a while I found that the
MP_LIBNAME arg on the command line was not replacing the default
value of mod_perl.so, but just appending it.  So if I specify something
like:

        perl Makefile.pl MP_LIBNAME=mod_perl-2.0_cvs

I get back something like:

        mod_perl dso library will be built as mod_perl mod_perl_1.99.10.so
        mod_perl static library will be built as mod_perl mod_perl_1.99.10.a

Anyway, I patched lib/ModPerl/BuildOptions.pm so that you can tell the script
whether you want to append the command line arg or replace it.  The patch is
included here, but someone should check to make sure that the options I have
selected as appendable/replaceable are in fact such.


thanks
Andrew




Index: lib/ModPerl/BuildOptions.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/ModPerl/BuildOptions.pm,v
retrieving revision 1.21
diff -u -r1.21 BuildOptions.pm
--- lib/ModPerl/BuildOptions.pm	13 Aug 2003 22:54:10 -0000	1.21
+++ lib/ModPerl/BuildOptions.pm	2 Oct 2003 18:49:18 -0000
@@ -83,10 +83,15 @@
                 }
             }
 
-            if ($self->{$key}) {
-                $self->{$key} .= ' ';
+            if ( $table->{$key}->{'append'} ){
+            	if ($self->{$key}) {
+                    $self->{$key} .= ' ';
+            	}
+                $self->{$key} .= $val;
+
+            } else {
+                $self->{$key} = $val;
             }
-            $self->{$key} .= $val;
 
             print "   $key = $val\n" if $opts & VERBOSE;
         }
@@ -137,7 +142,7 @@
 
 sub usage {
     my $table = table();
-    my @opts = map { "$_ - $table->{$_}" } sort keys %$table;
+    my @opts = map { "$_ - $table->{$_}->{'val'}" } sort keys %$table;
     join "\n", @opts;
 }
 
@@ -151,8 +156,8 @@
         s/^\s+//; s/\s+$//;
         next if /^\#/ || /^$/;
         last if /^__END__/;
-        my($key, $val) = split /\s+/, $_, 2;
-        $table{'MP_' . $key} = $val;
+        my($key, $append, $val) = split /\s+/, $_, 3;
+        $table{'MP_' . $key} = { append => $append, val => $val};
     }
 
     return \%table;
@@ -166,24 +171,32 @@
 
 1;
 
+# data format:
+# key	append	description
+# where:
+#     key:    is the option name
+#     append: is whether we want to replace a default option (0)
+#             or append the arg to the option (1)
+#     desc:   descripttion for this option
+
 __DATA__
 
-USE_GTOP	Link with libgtop and enable libgtop reporting
-DEBUG		Turning on debugging (-g -lperld) and tracing
-MAINTAINER	Maintainer mode: DEBUG=1 -DAP_DEBUG -Wall ...
-CCOPTS		Add to compiler flags
-TRACE		Turn on tracing
-USE_DSO		Build mod_perl as a dso
-USE_STATIC	Build mod_perl static
-INST_APACHE2	Install *.pm relative to Apache2/ directory
-PROMPT_DEFAULT	Accept default value for all would-be prompts
-OPTIONS_FILE	Read options from given file
-STATIC_EXTS	Build Apache::*.xs as static extensions
-APXS            Path to apxs
-AP_PREFIX	Apache installation or source tree prefix
-APR_CONFIG	Path to apr-config
-XS_GLUE_DIR     Directories containing extension glue
-INCLUDE_DIR     Add directories to search for header files
-GENERATE_XS     Generate XS code based on httpd version
-LIBNAME         Name of the modperl dso library (default is mod_perl)
-COMPAT_1X       Compile-time mod_perl 1.0 backcompat (default is on)
+USE_GTOP	0	Link with libgtop and enable libgtop reporting
+DEBUG		0	Turning on debugging (-g -lperld) and tracing
+MAINTAINER	0	Maintainer mode: DEBUG=1 -DAP_DEBUG -Wall ...
+CCOPTS		1	Add to compiler flags
+TRACE		0	Turn on tracing
+USE_DSO		0	Build mod_perl as a dso
+USE_STATIC	0	Build mod_perl static
+INST_APACHE2	0	Install *.pm relative to Apache2/ directory
+PROMPT_DEFAULT	0	Accept default value for all would-be prompts
+OPTIONS_FILE	0	Read options from given file
+STATIC_EXTS	0	Build Apache::*.xs as static extensions
+APXS            0	Path to apxs
+AP_PREFIX	0	Apache installation or source tree prefix
+APR_CONFIG	0	Path to apr-config
+XS_GLUE_DIR     1	Directories containing extension glue
+INCLUDE_DIR     1	Add directories to search for header files
+GENERATE_XS     0	Generate XS code based on httpd version
+LIBNAME         0	Name of the modperl dso library (default is mod_perl)
+COMPAT_1X       0	Compile-time mod_perl 1.0 backcompat (default is on)

----- End forwarded message -----

----- End forwarded message -----