Makefile.PL revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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
#
#
# Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
#
# Makefile.PL for ::Exacct
#
#
# Linker flags note:
# The various .so files that comprise the ::Exacct module need to be able to
# cross-call each other, and therefore to prevent runtime linker errors it is
# necessary to establish linker dependencies between the various .so files.
#
# This causes several problems. The first of these is that perl .so files are
# built in one directory (under ../blib in this case) and installed into
# another, so it is necessary to record the dependency using a path relative to
# the dependent. This can be done with the $ORIGIN linker mechanism.
# The second problem is that it is necessary to specify the name of the
# dependee at link edit time in a manner that doesn't result in the build-time
# path of the dependee being hard coded in to the dependent, as this would
# stop ld.so.1 performing its normal search process for the files. This can't
# .so files aren't prefixed with 'lib'. To do this the -h linker flag is used
# to explicitly set the SONAME in the dependee. This is then used as the name
# of the dependent in the dependee rather than the full path by which it was
# found at link edit time.
#
# For more details, refer to the Linker and Libraries Guide.
#
require 5.6.1;
use strict;
use warnings;
#
# MakeMaker overrides.
#
package MY;
no warnings qw(once);
#
# Overrides that are common to both the ON and non-ON build environments.
#
#
# Force the parent directory to be built first, because the sub-modules all
# have a linker dependency against Exacct.so.
#
sub top_targets
{
my $self = shift(@_);
return($txt);
}
#
# Make 'install' wait for 'all' to complete.
#
sub install
{
my $self = shift(@_);
return($txt);
}
#
# Suppress the setting of LD_RUN_PATH, as it isn't necessary.
#
sub const_loadlibs
{
my $self = shift(@_);
delete($self->{LD_RUN_PATH});
}
sub dynamic_lib
{
my $self = shift(@_);
$txt =~ s/LD_RUN_PATH=\S*\s*//;
return($txt);
}
#
# ON-specific overrides.
#
#
# Override postamble and replace it with one that explicitly records
# the dependency between Exacct.c (generated from Exacct.xs by xsubpp)
# extract_defines). Note we have to mimic the -I processing done by cc
# to find the correct version of the file, as we want the copy from the
# values exported by the perl module stay up-to date with the
# corresponding #defines.
#
*postamble = sub {
return <<'EOF';
done;
};
if (! exists($ENV{RELEASE_BUILD}));
# Don't install POD pages for ON.
#
# Non-ON overrides.
#
} else {
#
# Override postamble and replace it with one that explicitly records
# the dependency between Exacct.c (generated from Exacct.xs by xsubpp)
# by extract_defines). This ensures that the constant values exported
# by the perl module stay up-to date with the corresponding #defines.
#
*postamble = sub {
return <<'EOF';
};
# Install the POD documentation for non-ON builds.
my $man3pfx = '$(INST_MAN3DIR)/Sun::Solaris::Exacct';
);
}
#
# Having set everything up, write the Makefile.
#
package main;
NAME => 'Sun::Solaris::Exacct',
VERSION_FROM => 'Exacct.pm',
H => [ 'exacct_common.xh' ],
LIBS => [ '-lexacct' ],
@defines,
@man3pods,
);