#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
#
# MM_Solaris_ON.pm overrides various parts of MakeMaker so that perl modules
# 1. parse_args is overriden to merge the values of DEFINE specified in
# Makefile.PL and on the command line. The default behaviour is that
# the command line value overwrites any value specified in Makefile.PL.
# 2. constants() is overriden to add the include paths specified in the
# ENVCPPFLAGS[1-n] environment variables to the compiler command-line so
# that the compiler looks in the proto area for include files.
# 3. ext() is overriden to add the library paths specified in the
# ENVLDLIBS[1-n] and STUBENVLDLIBS[1-n] environment variables to
# the linker command-line so that the linker looks in the proto area
# for libraries.
#
# Plug into Makemaker - see ExtUtils::MM_*.pm
package ExtUtils::MM_Solaris_ON;
use strict;
use warnings;
$VERSION = '1.3';
#
# The default MakeMaker parse_args function overwrites DEFINE values passed
# to WriteMakefile with the values specified on the command line, which is
# obviously broken. This overrides the default implementation and merges the
# WriteMakefile and command line versions. See ExtUtils::MakeMaker.pm for
# details of the parse_args() method. Because parse_args isn't an overrideable
# MakeMaker method, we have to pull some dirty tricks with the MakeMaker stash
# to make this work.
#
our $real_parse_args;
BEGIN {
no warnings qw(redefine);
}
sub parse_args
{
}
#
# The constants() method works out the compiler flags needed to build a module.
# Override it to take into account the current settings of the ENVCPPFLAGS[1-n]
# ExtUtils::MM_Unix for details of the constants() method.
#
sub constants
{
my ($self) = @_;
# Find all the ENVCPPFLAGS[1-n] environment variables
# Prepopulate @protos with $ENV{ROOT} if it is set
}
sort(keys(%ENV)))) {
# Ignore everything except '-I' flags.
next unless ($ip =~ s!^-I(.*)$!$1!);
# Add to newincs if not seen before.
#
# If the path points to somewhere under a proto area,
# figure out the top of the proto area & save for later.
#
}
# Search INC string, prepending the proto areas to any absolute paths.
# Deal with -I flags
if (my ($p) = $_ =~ /^-I(.*)$/) {
# Only prepend to absolute paths
if ($self->file_name_is_absolute($p)) {
my $ppp = "$pp$p";
push(@newincs, "-I$ppp")
}
# Pass relative paths through.
} else {
}
# Pass anything else through.
} else {
push(@newincs, $_);
}
}
# Call the default Unix constants() method (see MM_Unix.pm)
}
#
# The ext() method works out the linker flags required to build a module.
# Override it to take into account the current settings of the ENVLDLIBS[1-n]
# and STUBENVLDLIBS[1-n] environment variables when building as part of
# See ExtUtils::Liblist for details of the ext() method.
#
sub ext
{
# Find all the STUBENVLDLIBS[1-n] and ENVLDLIBS[1-n] environment
# variables. The stubs must be used before the non-stubs, so use
# two passes
sort(keys(%ENV)))) {
# Ignore everything except '-L' flags
next unless ($lp =~ s!^-L(.*)$!$1!);
# Add to lib_prefix if not seen before
#
# If the path points to somewhere under a proto area,
# figure out the top of the proto area & save for later
#
}
sort(keys(%ENV)))) {
# Ignore everything except '-L' flags
next unless ($lp =~ s!^-L(.*)$!$1!);
# Add to lib_prefix if not seen before
#
# If the path points to somewhere under a proto area,
# figure out the top of the proto area & save for later
#
}
# Search libs string, prepending the proto areas to any absolute paths
%lib_seen = ();
foreach (split(' ', $libs)) {
# Deal with -L flags
if (my ($p) = $_ =~ /^-L(.*)$/) {
# Only prepend to absolute paths
if ($self->file_name_is_absolute($p)) {
my $ppp = "$pp$p";
push(@newlibs, "-L$ppp")
}
# Pass relative paths through
} else {
}
# Pass anything else through
} else {
push(@newlibs, $_);
}
}
# Call the default Unix ext() method (see Liblist.pm)
$verbose, $need_names);
#
# Prepend any missing members of @lib_prefix onto LDLOADLIBS.
# Do this after calling ext() as ext() will strip out all the -L flags
# if passed an empty library list. Note we don't touch EXTRALIBS as
# it is only used to create the extralibs.ld file, and we don't want
# the ON environment leaking out into shipped files.
#
$prefix .= ' ';
# By default any directories containing libraries are returned as part
# as it results in the proto area being stored in RPATH in the resulting
# perl module.so files, so we null it out here.
#
return (@retval);
}
1;