[posting to the dev list and not httpd-test-dev as I'm interested in more eyes for this one]

Here is the problem:

-------- Original Message --------
Subject: INSTALLARCHLIB vs INSTALLSITELIB w/ nested packages
Date: Sat, 31 Jan 2004 01:14:59 -0800
From: Stas Bekman <[EMAIL PROTECTED]>
Organization: Hope, Humanized
To: [EMAIL PROTECTED]

As some of you may know the Apache-Test package has a dual life. It has its
own life as a separate package. But it is also distributed within the
modperl-2.0 package, as a sub-directory modperl-2.0/Apache-Test/.

The problem we're having is this. When a standalone Apache-Test is built and
installed its files get installed into INSTALLSITELIB (since it has no arch to
install, all pure perl). For example lib/site_perl/5.8.3/Apache/TestRun.pm.
When Apache-Test is installed via modperl-2.0's make install Apache-Test files
end up in INSTALLARCHLIB (since modperl-2.0's own files have arch modules).
For example the same file now gets installed at:
lib/site_perl/5.8.3/i686-linux-thread-multi/Apache/TestRun.pm

Now unless a user uses 'make install UNINST=1', we end up with two versions of
Apache-Test installed. If the user updates her version of Apache-Test (which
will go into INSTALLSITELIB), it won't take any effect since INSTALLARCHLIB
comes before INSTALLSITELIB in @INC. Which is a bad thing.
[...]
-------- End of Original Message --------

Here is a possible working solution, thanks to Michael:

Index: Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Makefile.PL,v
retrieving revision 1.18
diff -u -r1.18 Makefile.PL
--- Makefile.PL 18 Jan 2004 03:17:16 -0000      1.18
+++ Makefile.PL 18 Feb 2004 05:37:23 -0000
@@ -6,8 +6,8 @@
 use strict;
 use warnings;

-# is this file was invoked directly via perl, or via the top-level
-# Makefile.PL, top-level sets this env var
+# was this file invoked directly via perl, or via the top-level
+# (mp2) Makefile.PL? if top-level, this env var will be set
 use constant TOP_LEVEL => !exists $ENV{MOD_PERL_2_BUILD};

 use ExtUtils::MakeMaker;
@@ -76,6 +76,26 @@
     return $string;
 }

+sub MY::constants {
+    my $self = shift;
+
+    my $string = $self->MM::constants;
+
+    # mp2 installs A-T into INSTALLSITEARCH, so in order to avoid
+    # problems when users forget 'make install UNINST=1', trick MM into
+    # installing pure perl modules to the archlib location, when A-T is
+    # not installed as a part of mp2 build
+    if (TOP_LEVEL) {
+        $string .= <<'EOI';
+
+# install into the same location as mod_perl 2.0
+INSTALLSITELIB = $(INSTALLSITEARCH)
+DESTINSTALLSITELIB = $(DESTINSTALLSITEARCH)
+EOI
+    }
+
+    $string;
+}

 sub add_dep {
     my($string, $targ, $add) = @_;


I was hit by this problem quite a few times, so I'd love to see that or another solution go in. I certainly use UNINST=1 in the CPAN prefs, but I never remember to type this when doing 'make install' manually. So ensuring that A-T is always installed into the same dir is a goodness, IMHO.


If someone will be unhappy about it, we can always revert this change, without affecting anybody.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to