develooper Front page | perl.perl5.porters | Postings from January 2003

MakeMaker on-the-fly detection

Thread Previous | Thread Next
From:
Rob Brown
Date:
January 6, 2003 13:53
Subject:
MakeMaker on-the-fly detection
Message ID:
Pine.LNX.4.44.0301061417490.22042-100000@rox.roobik.com
The simplest general solution that I could derive that
works (barely) on all versions is the following:

---- snip ----
perl Makefile.PL `perl -MExtUtils::MakeMaker -e 'if ($ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/) {print "PREFIX=/tmp/destdir/usr";}'`
make 
make test
make install `perl -MExtUtils::MakeMaker -e 'if ($ExtUtils::MakeMaker::VERSION <= 6.05) {print "PREFIX=/tmp/destdir/usr";} else {print "DESTDIR=/tmp/destdir";}'`
---- snap ----

Axel was right.  Since the source package should be
the same no matter what version of perl and the lines
to build the package must be contained within the
source, the detection must be within the spec file
itself.  Otherwise you'll need different source
rpms for different versions of perl or MakeMaker,
which defeats the purpose of having one source rpm
for everything.

If there's a simpler solution, let me know.  It
might simplify things to force an upgrade for those
with MakeMaker 5.91 .. 6.05, but we can't force
anyone to downgrade to an older version just so
we can have a static method to build the package.

Of course, once there exists such a version that
is both newer and supports the PREFIX= on the
"make install" line, we could simply widen the
range of "unsupported version" and hard code it
back to old PREFIX= method.  Then just force
upgrade if within the range before building.

Other Ideas?

--
Rob

On Wed, 1 Jan 2003, Michael G Schwern wrote:
> With this in mind, you probably want to do something like this:
> 
>      require ExtUtils::MakeMaker;
>      if( $ExtUtils::MakeMaker::VERSION <= 5.45 ) {
>      	 perl Makefile.PL
> 	 make
> 	 make install PREFIX=$RPM_TMP_ROOT/usr
>      }
>      elsif( $ExtUtils::MakeMaker::VERSION >= 6.06 ) {
>      	 perl Makefile.PL
> 	 make
> 	 make install DESTDIR=$RPM_TMP_ROOT
>      }
>      else {
>      	 unsupported version of MakeMaker, please upgrade.
>      }


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About