summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-30 19:18:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:04 -0500
commit83acc688e3cb21d3fe25129f1fa1522872e6eec2 (patch)
tree093ee254dd6ffb0da50e745cb4c70241c94aecb5 /source4/build
parent87a97acdfecbeb3651112639d2bb7eab3372171e (diff)
downloadsamba-83acc688e3cb21d3fe25129f1fa1522872e6eec2.tar.gz
samba-83acc688e3cb21d3fe25129f1fa1522872e6eec2.tar.bz2
samba-83acc688e3cb21d3fe25129f1fa1522872e6eec2.zip
r12615: prepare building with ../samba4/source/configure --srcdir=../samba4/source/
metze (This used to be commit bf35c74218476fc568e251bb337e794ed9d51fac)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/m4/env.m413
-rw-r--r--source4/build/smb_build/config_mk.pm20
-rw-r--r--source4/build/smb_build/env.pm9
-rw-r--r--source4/build/smb_build/input.pm3
-rw-r--r--source4/build/smb_build/main.pl2
-rw-r--r--source4/build/smb_build/makefile.pm2
6 files changed, 32 insertions, 17 deletions
diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4
index f156bd34b9..c20160fdb5 100644
--- a/source4/build/m4/env.m4
+++ b/source4/build/m4/env.m4
@@ -7,10 +7,19 @@ dnl
AC_CANONICAL_HOST
-SMB_VERSION_STRING=`cat include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
+AC_SUBST(srcdir)
+export srcdir;
+
+# we always set builddir to "." as that's nicer than
+# having the absolute path of the current work directory
+builddir=.
+AC_SUBST(builddir)
+export builddir;
+
+SMB_VERSION_STRING=`cat ${srcdir}/include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2`
echo "SAMBA VERSION: ${SMB_VERSION_STRING}"
-SAMBA_VERSION_SVN_REVISION=`cat include/version.h | grep 'SAMBA_VERSION_SVN_REVISION' | cut -d ' ' -f3-`
+SAMBA_VERSION_SVN_REVISION=`cat ${srcdir}/include/version.h | grep 'SAMBA_VERSION_SVN_REVISION' | cut -d ' ' -f3-`
if test -n "${SAMBA_VERSION_SVN_REVISION}";then
echo "BUILD REVISION: ${SAMBA_VERSION_SVN_REVISION}"
fi
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index f5703d5b93..405298eef2 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -94,19 +94,19 @@ use vars qw(@parsed_files);
#
# $filename - the path of the config.mk file
# which should be parsed
-sub run_config_mk($$)
+sub run_config_mk($$$)
{
- sub run_config_mk($$);
- my ($input, $filename) = @_;
+ sub run_config_mk($$$);
+ my ($input, $srcdir, $filename) = @_;
my $result;
my $linenum = -1;
my $infragment = 0;
my $section = "GLOBAL";
my $makefile = "";
- push (@parsed_files, $filename);
+ push (@parsed_files, $srcdir."/".$filename);
- open(CONFIG_MK, $filename) or die("Can't open `$filename'\n");
+ open(CONFIG_MK, $srcdir."/".$filename) or die("Can't open `$srcdir/$filename'\n");
my @lines = <CONFIG_MK>;
close(CONFIG_MK);
@@ -136,7 +136,7 @@ sub run_config_mk($$)
# include
if ($line =~ /^include (.*)$/) {
- $makefile .= run_config_mk($input, dirname($filename)."/$1");
+ $makefile .= run_config_mk($input, $srcdir, dirname($filename)."/$1");
next;
}
@@ -163,7 +163,7 @@ sub run_config_mk($$)
next;
}
- die("$filename:$linenum: Bad line while parsing $filename");
+ die("$srcdir."/".$filename:$linenum: Bad line while parsing $srcdir."/".$filename");
}
foreach my $section (keys %{$result}) {
@@ -171,18 +171,18 @@ sub run_config_mk($$)
my $sectype = $section_types->{$type};
if (not defined($sectype)) {
- die($filename.":[".$section."] unknown section type \"".$type."\"!");
+ die($srcdir."/".$filename.":[".$section."] unknown section type \"".$type."\"!");
}
$input->{$name}{NAME} = $name;
$input->{$name}{TYPE} = $type;
- $input->{$name}{BASEDIR} = dirname($filename);
+ $input->{$name}{BASEDIR} = $srcdir."/".dirname($filename);
foreach my $key (values %{$result->{$section}}) {
$key->{VAL} = smb_build::input::strtrim($key->{VAL});
my $vartype = $sectype->{$key->{KEY}};
if (not defined($vartype)) {
- die($filename.":[".$section."]: unknown attribute type \"$key->{KEY}\"!");
+ die($srcdir."/".$filename.":[".$section."]: unknown attribute type \"$key->{KEY}\"!");
}
if ($vartype eq "string") {
$input->{$name}{$key->{KEY}} = $key->{VAL};
diff --git a/source4/build/smb_build/env.pm b/source4/build/smb_build/env.pm
index 1ad8e23d36..09d8eb1536 100644
--- a/source4/build/smb_build/env.pm
+++ b/source4/build/smb_build/env.pm
@@ -31,8 +31,13 @@ sub _set_config($$)
$self->{config} = $config;
- $self->{config}->{srcdir} = '.';
- $self->{config}->{builddir} = '.';
+ if (not defined($self->{config}->{srcdir})) {
+ $self->{config}->{srcdir} = '.';
+ }
+
+ if (not defined($self->{config}->{builddir})) {
+ $self->{config}->{builddir} = '.';
+ }
if ($self->{config}->{prefix} eq "NONE") {
$self->{config}->{prefix} = $self->{config}->{ac_default_prefix};
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index ad0a275120..ceddd75c3f 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -5,10 +5,11 @@
# Copyright (C) Jelmer Vernooij 2004
# Released under the GNU GPL
+use config;
use strict;
package smb_build::input;
-my $srcdir = ".";
+my $srcdir = $config::config{srcdir};
sub strtrim($)
{
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index 80f2e5fe9a..2b6594d809 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -16,7 +16,7 @@ use strict;
my $INPUT = {};
-my $mkfile = smb_build::config_mk::run_config_mk($INPUT, "main.mk");
+my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, "main.mk");
my $subsystem_output_type;
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index c804032275..e28aaec9d1 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -480,7 +480,7 @@ sub ProtoHeader($$)
$self->output("$dir/$ctx->{PUBLIC_PROTO_HEADER}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c)\n");
$self->output("\t\@echo \"Creating $dir/$ctx->{PRIVATE_PROTO_HEADER}$comment\"\n");
- $self->output("\t\@\$(PERL) \${srcdir}/script/mkproto.pl --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
+ $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
}
sub write($$)