summaryrefslogtreecommitdiff
path: root/source4/script/installheader.pl
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2006-04-11 11:37:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:03 -0500
commit9cf41988ff6cf0647ec4850f25415ba66845fd70 (patch)
treeb0af5ecca5db64b45b2ab3bf4a83b4050efa18ee /source4/script/installheader.pl
parent970f7122d9095aa95e0513793f69994e235cb1e0 (diff)
downloadsamba-9cf41988ff6cf0647ec4850f25415ba66845fd70.tar.gz
samba-9cf41988ff6cf0647ec4850f25415ba66845fd70.tar.bz2
samba-9cf41988ff6cf0647ec4850f25415ba66845fd70.zip
r15036: Add out of tree build support and see how buildfarm will respond to make constructs
(This used to be commit 9329854489e2c231ffb7986d39009e0936873c11)
Diffstat (limited to 'source4/script/installheader.pl')
-rwxr-xr-xsource4/script/installheader.pl19
1 files changed, 13 insertions, 6 deletions
diff --git a/source4/script/installheader.pl b/source4/script/installheader.pl
index 808ab8d433..e0597ab381 100755
--- a/source4/script/installheader.pl
+++ b/source4/script/installheader.pl
@@ -2,16 +2,18 @@
# Copyright (C) 2006 Jelmer Vernooij
use strict;
use File::Basename;
+use Cwd 'abs_path';
my $includedir = shift;
-
+my $builddir = abs_path($ENV{samba_builddir});
+my $srcdir = abs_path($ENV{samba_srcdir});
sub read_headermap($)
{
my ($fn) = @_;
my %map = ();
my $ln = 0;
- open(MAP, "<headermap.txt");
+ open(MAP, "<$fn");
while(<MAP>) {
$ln++;
s/#.*$//g;
@@ -28,14 +30,19 @@ sub read_headermap($)
return %map;
}
-my %map = read_headermap("headermap.txt");
+my %map = read_headermap("$srcdir/headermap.txt");
sub findmap($)
{
$_ = shift;
s/^\.\///g;
+ s/$builddir\///g;
+ s/$srcdir\///g;
if (! -f $_ && -f "lib/$_") { $_ = "lib/$_"; }
+ if ($srcdir !~ $builddir) {
+ if (! -f "$srcdir/$_" && -f "$srcdir/lib/$_") { $_ = "lib/$_"; }
+ }
return $map{$_};
}
@@ -55,7 +62,7 @@ sub install_header($$)
my $lineno = 0;
- open(IN, "<$src");
+ open(IN, "<$src") || open(IN, "<$srcdir/$src");
open(OUT, ">$dst");
while (<IN>) {
@@ -75,8 +82,8 @@ foreach my $p (@ARGV)
{
my $p2 = findmap($p);
unless ($p2) {
- warn("Unable to map $p");
- next;
+ warn("Unable to map $p");
+ next;
}
print "Installing $p as $includedir/$p2\n";