summaryrefslogtreecommitdiff
path: root/source4/script
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
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')
-rwxr-xr-xsource4/script/build_idl.sh8
-rw-r--r--source4/script/buildtree.pl40
-rwxr-xr-xsource4/script/installheader.pl19
-rwxr-xr-xsource4/script/mkproto.pl15
4 files changed, 70 insertions, 12 deletions
diff --git a/source4/script/build_idl.sh b/source4/script/build_idl.sh
index aaf0ef8383..1b38245e17 100755
--- a/source4/script/build_idl.sh
+++ b/source4/script/build_idl.sh
@@ -6,22 +6,22 @@ PIDL_EXTRA_ARGS="$*"
[ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
-PIDL="$PERL ./pidl/pidl --outputdir librpc/gen_ndr --header --ndr-parser --server --client --dcom-proxy --com-header --swig --ejs $PIDL_EXTRA_ARGS"
+PIDL="$PERL $srcdir/pidl/pidl --outputdir librpc/gen_ndr --header --ndr-parser --server --client --dcom-proxy --com-header --swig --ejs $PIDL_EXTRA_ARGS"
if [ x$FULLBUILD = xFULL ]; then
echo Rebuilding all idl files in librpc/idl
- $PIDL librpc/idl/*.idl || exit 1
+ $PIDL $srcdir/librpc/idl/*.idl || exit 1
exit 0
fi
list=""
-for f in librpc/idl/*.idl ; do
+for f in $srcdir/librpc/idl/*.idl ; do
basename=`basename $f .idl`
ndr="librpc/gen_ndr/ndr_$basename.c"
# blergh - most shells don't have the -nt function
if [ -f $ndr ]; then
- if [ x`find $f -newer $ndr -print` = x$f ]; then
+ if [ x$srcdir/`find $f -newer $ndr -print` = x$f ]; then
list="$list $f"
fi
else
diff --git a/source4/script/buildtree.pl b/source4/script/buildtree.pl
new file mode 100644
index 0000000000..41cbb3ad76
--- /dev/null
+++ b/source4/script/buildtree.pl
@@ -0,0 +1,40 @@
+#! /usr/bin/perl -w
+ eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+ if 0; #$running_under_some_shell
+
+use strict;
+use File::Find ();
+use File::Path qw(mkpath);
+use Cwd 'abs_path';
+
+# Set the variable $File::Find::dont_use_nlink if you're using AFS,
+# since AFS cheats.
+
+# for the convenience of &wanted calls, including -eval statements:
+use vars qw/*name *dir *prune/;
+*name = *File::Find::name;
+*dir = *File::Find::dir;
+*prune = *File::Find::prune;
+my $builddir = abs_path($ENV{samba_builddir});
+my $srcdir = abs_path($ENV{samba_srcdir});
+sub wanted;
+
+
+
+# Traverse desired filesystems
+File::Find::find({wanted => \&wanted, no_chdir => 1}, $srcdir);
+exit;
+
+
+sub wanted {
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$newdir);
+
+ if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
+ (-d _) && (($newdir = abs_path($_)) !~ /$builddir/))
+ {
+ $newdir =~ s!$srcdir!$builddir!;
+ mkpath($newdir);
+ print("Creating $newdir\n");
+ }
+}
+
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";
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl
index 097a5cb18f..c2dc547c12 100755
--- a/source4/script/mkproto.pl
+++ b/source4/script/mkproto.pl
@@ -9,6 +9,8 @@ use strict;
# use warnings;
use Getopt::Long;
+use File::Basename;
+use File::Path;
#####################################################################
# read a file into a string
@@ -21,6 +23,8 @@ my $_public = "";
my $_private = "";
my $public_data = \$_public;
my $private_data = \$_private;
+my $builddir = undef;
+my $srcdir = undef;
sub public($)
{
@@ -57,7 +61,9 @@ GetOptions(
},
'public-define=s' => \$public_define,
'private-define=s' => \$private_define,
- 'help' => \&usage
+ 'help' => \&usage,
+ 'builddir=s' => sub { my ($f,$v) = @_; $builddir = $v; },
+ 'srcdir=s' => sub { my ($f,$v) = @_; $srcdir = $v; }
) or exit(1);
if (not defined($public_define) and defined($public_file)) {
@@ -143,7 +149,9 @@ sub process_file($$$)
$filename =~ s/\.o$/\.c/g;
- open(FH, "< $filename") || die "Failed to open $filename";
+ if (!open(FH, "< $builddir/$filename")) {
+ open(FH, "< $srcdir/$filename") || die "Failed to open $filename";
+ }
$private_file->("\n/* The following definitions come from $filename */\n\n");
@@ -198,6 +206,7 @@ sub process_file($$$)
close(FH);
}
+
print_header(\&public, $public_define);
if ($public_file ne $private_file) {
print_header(\&private, $private_define);
@@ -232,6 +241,7 @@ my $old_private_data = file_load($private_file);
if (not defined($old_public_data) or ($old_public_data ne $$public_data))
{
+ mkpath(dirname($public_file), 0, 0755);
open(PUBLIC, ">$public_file") or die("Can't open `$public_file': $!");
print PUBLIC "$$public_data";
close(PUBLIC);
@@ -240,6 +250,7 @@ if (not defined($old_public_data) or ($old_public_data ne $$public_data))
if (($public_file ne $private_file) and (
not defined($old_private_data) or ($old_private_data ne $$private_data))) {
+ mkpath(dirname($private_file), 0, 0755);
open(PRIVATE, ">$private_file") or die("Can't open `$private_file': $!");
print PRIVATE "$$private_data";
close(PRIVATE);