#
#
#
# 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.8.4;
use Config;
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,
);