1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
package fake;
use strict;
# UPDATE: this actually won't help to autoconf, because `use' statements
# are executed at compile time. So this file is basically a mistake. :)
# from autoconf_2.5.spec:
# %define __spec_autodep_custom_pre export autom4te_perllibdir=%buildroot%_datadir/%realname%suff
#
# from /usr/bin/autoheader-2.5:
# BEGIN
# {
# my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf-2.5';
# unshift @INC, "$datadir";
# }
# use Autom4te::ChannelDefs;
# use Autom4te::Channels;
# use Autom4te::Configure_ac;
# use Autom4te::FileUtils;
# use Autom4te::General;
# use Autom4te::XFile;
#
# The problem is that whenever autoconf is getting built, modules from
# /usr/share/autoconf-2.5 of already installed autoconf package are used
# instead of those in %buildroot.
#
# To solve this @INC should be reordered at INIT stage, so that %buildroot
# directories take precedence.
#
# Typical invocation:
# perl -Mfake -MO=Deparse $RPM_BUILD_ROOT/usr/bin/autoheader-2.5
sub adjusted_inc {
my @inc;
foreach my $path (grep { /^\// } @INC) {
push @inc, "$ENV{RPM_BUILD_ROOT}$path"
unless index($path, $ENV{RPM_BUILD_ROOT}) == 0
and grep { $_ eq "$ENV{RPM_BUILD_ROOT}$path" } @inc;
push @inc, $path unless grep { $_ eq $path } @inc;
}
return @inc;
}
INIT {
@INC = adjusted_inc()
if $ENV{RPM_BUILD_ROOT};
}
1;
|