summaryrefslogtreecommitdiff
path: root/buildtools/mktowscript
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-17 20:21:47 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:38 +1000
commit07eeed33f63754b4fa4ab629e52e423b04b59bb6 (patch)
tree167f6db8447741094edd288e0f3d39e086688c5d /buildtools/mktowscript
parentbb1e36a86baa10be9241d22ce34b8eb9b5784577 (diff)
downloadsamba-07eeed33f63754b4fa4ab629e52e423b04b59bb6.tar.gz
samba-07eeed33f63754b4fa4ab629e52e423b04b59bb6.tar.bz2
samba-07eeed33f63754b4fa4ab629e52e423b04b59bb6.zip
build: heimdal_build waf support
heimdal now mostly builds
Diffstat (limited to 'buildtools/mktowscript')
-rw-r--r--buildtools/mktowscript/mklist.txt2
-rwxr-xr-xbuildtools/mktowscript/mktowscript.pl385
-rwxr-xr-xbuildtools/mktowscript/rebuild_all.sh34
3 files changed, 222 insertions, 199 deletions
diff --git a/buildtools/mktowscript/mklist.txt b/buildtools/mktowscript/mklist.txt
index 86f738bc2c..203c9a3ab3 100644
--- a/buildtools/mktowscript/mklist.txt
+++ b/buildtools/mktowscript/mklist.txt
@@ -28,7 +28,7 @@ source4/cldap_server/config.mk
source4/smb_server/config.mk
source4/smb_server/smb2/config.mk
source4/smb_server/smb/config.mk
-source4/smbd/config.mk
+source4/smbd/config.mk source4/smbd/process_model.mk
source4/kdc/config.mk
source4/dsdb/config.mk
source4/dsdb/samdb/ldb_modules/config.mk
diff --git a/buildtools/mktowscript/mktowscript.pl b/buildtools/mktowscript/mktowscript.pl
index 1db7297261..68fb7c69d3 100755
--- a/buildtools/mktowscript/mktowscript.pl
+++ b/buildtools/mktowscript/mktowscript.pl
@@ -3,10 +3,10 @@
use strict;
use Data::Dumper;
use File::Basename;
+use List::MoreUtils qw(uniq);
-my $filename=$ARGV[0];
-my $dname=dirname($filename);
my $globals;
+my $dname;
sub read_file($)
{
@@ -46,7 +46,9 @@ sub strlist($)
# these need to use the library names
$s =~ s/\bLIBLDB\b/ldb/g;
+ $s =~ s/\bLDB\b/ldb/g;
$s =~ s/\bLIBTALLOC\b/talloc/g;
+ $s =~ s/\bTALLOC\b/talloc/g;
$s =~ s/\bLIBTEVENT\b/tevent/g;
$s =~ s/\bRESOLV\b/resolv/g;
@@ -85,9 +87,9 @@ sub find_file($)
return $b if (-e $b);
return $f if (-e $f);
+
while ($f =~ /\//) {
$f =~ s/^[^\/]+\///g;
- #printf(STDERR "Trying $f in $dname\n");
return $f if (-e $f);
}
my $f2;
@@ -120,7 +122,11 @@ sub find_files($)
$f =~ s/^[.]\///;
$ret .= ' ' . $f;
}
- return strlist($ret);
+ $ret = strlist($ret);
+ my @list = split(/\s+/, $ret);
+ @list = uniq(@list);
+ $ret = trim(join(' ', @list));
+ return $ret;
}
sub read_config_mk($)
@@ -242,186 +248,195 @@ sub read_config_mk($)
}
-my $result = read_config_mk($filename);
-
-#print Dumper $result;
-
-print "# AUTOGENERATED by mktowscript.pl\n# Please remove this notice if hand editing\n\n";
-
-chdir($dname);
-
-foreach my $s (sort {$result->{$a}->{SECNUMBER} <=> $result->{$b}->{SECNUMBER}} keys %{$result}) {
- next if ($s eq "GLOBAL");
- my $sec = $result->{$s};
- if ($sec->{TYPE} eq "SUBCONFIG") {
- my $d = dirname($s);
- next if ($d eq ".");
- printf "bld.BUILD_SUBDIR('%s')\n", dirname($s);
- } else {
- printf "\nbld.SAMBA_%s('%s'", $sec->{TYPE}, $s;
- my $trailer="";
- my $got_src = 0;
-
- foreach my $k (keys %{$sec}) {
- #print "key=$k\n";
-
- next if ($k eq "SECNUMBER");
- next if ($k eq "TYPE");
- if ($k eq "INIT_FUNCTION") {
- $trailer .= sprintf(",\n\tinit_function='%s'", trim($sec->{$k}));
- next;
- }
- if ($k eq "INIT_FUNCTION_SENTINEL") {
- $trailer .= sprintf(",\n\tinit_function_sentinal='%s'", trim($sec->{$k}));
- next;
- }
- if ($k eq "_PY_FILES" ||
- $k eq "EPYDOC_OPTIONS" ||
- $k eq "COV_TARGET" ||
- $k eq "GCOV" ||
- $k eq "PC_FILES" ||
- $k eq "CONFIG4FILE" ||
- $k eq "LMHOSTSFILE4") {
- $trailer .= sprintf(",\n\t# %s='%s'", $k, trim($sec->{$k}));
- next;
- }
- if ($k eq "SUBSYSTEM") {
- $trailer .= sprintf(",\n\tsubsystem='%s'", trim($sec->{$k}));
- next;
- }
- if ($k eq "PRIVATE_DEPENDENCIES") {
- $trailer .= sprintf(",\n\tdeps='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "PUBLIC_DEPENDENCIES") {
- $trailer .= sprintf(",\n\tpublic_deps='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "ALIASES") {
- $trailer .= sprintf(",\n\taliases='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "CFLAGS") {
- $trailer .= sprintf(",\n\tcflags='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "OPTIONS") {
- $trailer .= sprintf(",\n\toptions='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "DIRECTORY") {
- $trailer .= sprintf(",\n\tdirectory='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "LDFLAGS") {
- $trailer .= sprintf(",\n\tldflags='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "INSTALLDIR") {
- $trailer .= sprintf(",\n\tinstalldir='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "ASN1C") {
- $trailer .= sprintf(",\n\tcompiler='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "ET_COMPILER") {
- $trailer .= sprintf(",\n\tcompiler='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "ENABLE") {
- my $v = strlist($sec->{$k});
- if ($v eq "NO") {
- $trailer .= sprintf(",\n\tenabled=False");
- next;
- }
- next if ($v eq "YES");
- die("Unknown ENABLE value $v in $s\n");
- }
- if ($k eq "USE_HOSTCC") {
- my $v = strlist($sec->{$k});
- if ($v eq "YES") {
- $trailer .= sprintf(",\n\tuse_hostcc=True");
- next;
- }
- next if ($v eq "NO");
- die("Unknown HOST_CC value $v in $s\n");
- }
- if ($k eq "$s" . "_VERSION") {
- $trailer .= sprintf(",\n\tvnum='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "$s" . "_SOVERSION") {
- next;
- }
- if ($k eq "LIBRARY_REALNAME") {
- $trailer .= sprintf(",\n\trealname='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "OUTPUT_TYPE") {
- $trailer .= sprintf(",\n\toutput_type='%s'", strlist($sec->{$k}));
- next;
- }
- if ($k eq "AUTOPROTO") {
- my $list = trim(find_files(strlist($sec->{$k})));
- $trailer .= sprintf(",\n\tautoproto='%s'", $list);
- next;
- }
- if ($k eq "PUBLIC_HEADERS") {
- my $list = trim(strlist($sec->{$k}));
- if ($list =~ /\$\(addprefix .*,(.*)\)(.*)$/) {
- $list = trim("$1 $2");
- $list = find_files($list);
- } else {
- $list = trim(find_files(strlist($sec->{$k})));
- }
- $trailer .= sprintf(",\n\tpublic_headers='%s'", $list);
- next;
- }
- if ($k eq "MANPAGES") {
- my $list = trim(find_files(strlist($sec->{$k})));
- $trailer .= sprintf(",\n\tmanpages='%s'", $list);
- next;
- }
- if ($k eq "$s" . "_OBJ_FILES") {
- my $list = trim(strlist($sec->{$k}));
- $list =~ s/\.o/.c/g;
- if ($list =~ /\$\(addprefix .*,(.*)\)(.*)$/) {
- $list = trim("$1 $2");
- $list = find_files($list);
- $list = "'$list'";
- } elsif ($list =~ /\$\(addprefix \$\((\w+)\)(.*),(.*)\)(.*)$/) {
- my $src = trim($3);
- my $dir = "$1$2";
- $dir =~ s/\/$//;
- my $res = "bld.SUBDIR('$dir', '$src')";
- if ($4) {
- $res = "$res + '$4'";
- }
- $list = $res;
- } else {
- $list = find_files($list);
- $list="'$list'";
- }
- $list =~ s/\$\(\w+srcdir\)\///g;
- printf(",\n\t%s", $list);
- $got_src = 1;
- next;
- }
- if ($k eq "HEIMDAL_GSSAPI_KRB5_OBJ_FILES" ||
- $k eq "HEIMDAL_GSSAPI_SPNEGO_OBJ_FILES" ||
- $k eq "HEIMDAL_HEIM_ASN1_DER_OBJ_FILES" ||
- $k eq "HEIMDAL_HX509_OBJH_FILES" ||
- $k eq "HEIMDAL_HX509_OBJG_FILES" ||
- $k eq "HEIMDAL_ROKEN_OBJ_FILES"
- ) {
- next;
- }
- die("Unknown keyword $k in $s\n");
- }
- die("No source list in $s\n") unless $got_src;
- printf("%s\n\t)\n\n", $trailer);
- }
+sub process_results($)
+{
+ my $result = shift;
+
+ foreach my $s (sort {$result->{$a}->{SECNUMBER} <=> $result->{$b}->{SECNUMBER}} keys %{$result}) {
+ next if ($s eq "GLOBAL");
+ my $sec = $result->{$s};
+ if ($sec->{TYPE} eq "SUBCONFIG") {
+ my $d = dirname($s);
+ next if ($d eq ".");
+ printf "bld.BUILD_SUBDIR('%s')\n", dirname($s);
+ } else {
+ printf "\nbld.SAMBA_%s('%s'", $sec->{TYPE}, $s;
+ my $trailer="";
+ my $got_src = 0;
+
+ foreach my $k (keys %{$sec}) {
+ #print "key=$k\n";
+
+ next if ($k eq "SECNUMBER");
+ next if ($k eq "TYPE");
+ if ($k eq "INIT_FUNCTION") {
+ $trailer .= sprintf(",\n\tinit_function='%s'", trim($sec->{$k}));
+ next;
+ }
+ if ($k eq "INIT_FUNCTION_SENTINEL") {
+ $trailer .= sprintf(",\n\tinit_function_sentinal='%s'", trim($sec->{$k}));
+ next;
+ }
+ if ($k eq "_PY_FILES" ||
+ $k eq "EPYDOC_OPTIONS" ||
+ $k eq "COV_TARGET" ||
+ $k eq "GCOV" ||
+ $k eq "PC_FILES" ||
+ $k eq "CONFIG4FILE" ||
+ $k eq "LMHOSTSFILE4") {
+ $trailer .= sprintf(",\n\t# %s='%s'", $k, trim($sec->{$k}));
+ next;
+ }
+ if ($k eq "SUBSYSTEM") {
+ $trailer .= sprintf(",\n\tsubsystem='%s'", trim($sec->{$k}));
+ next;
+ }
+ if ($k eq "PRIVATE_DEPENDENCIES") {
+ $trailer .= sprintf(",\n\tdeps='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "PUBLIC_DEPENDENCIES") {
+ $trailer .= sprintf(",\n\tpublic_deps='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "ALIASES") {
+ $trailer .= sprintf(",\n\taliases='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "CFLAGS") {
+ $trailer .= sprintf(",\n\tcflags='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "OPTIONS") {
+ $trailer .= sprintf(",\n\toptions='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "DIRECTORY") {
+ $trailer .= sprintf(",\n\tdirectory='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "LDFLAGS") {
+ $trailer .= sprintf(",\n\tldflags='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "INSTALLDIR") {
+ $trailer .= sprintf(",\n\tinstalldir='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "ASN1C") {
+ $trailer .= sprintf(",\n\tcompiler='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "ET_COMPILER") {
+ $trailer .= sprintf(",\n\tcompiler='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "ENABLE") {
+ my $v = strlist($sec->{$k});
+ if ($v eq "NO") {
+ $trailer .= sprintf(",\n\tenabled=False");
+ next;
+ }
+ next if ($v eq "YES");
+ die("Unknown ENABLE value $v in $s\n");
+ }
+ if ($k eq "USE_HOSTCC") {
+ my $v = strlist($sec->{$k});
+ if ($v eq "YES") {
+ $trailer .= sprintf(",\n\tuse_hostcc=True");
+ next;
+ }
+ next if ($v eq "NO");
+ die("Unknown HOST_CC value $v in $s\n");
+ }
+ if ($k eq "$s" . "_VERSION") {
+ $trailer .= sprintf(",\n\tvnum='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "$s" . "_SOVERSION") {
+ next;
+ }
+ if ($k eq "LIBRARY_REALNAME") {
+ $trailer .= sprintf(",\n\trealname='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "OUTPUT_TYPE") {
+ $trailer .= sprintf(",\n\toutput_type='%s'", strlist($sec->{$k}));
+ next;
+ }
+ if ($k eq "AUTOPROTO") {
+ my $list = trim(find_files(strlist($sec->{$k})));
+ $trailer .= sprintf(",\n\tautoproto='%s'", $list);
+ next;
+ }
+ if ($k eq "PUBLIC_HEADERS") {
+ my $list = trim(strlist($sec->{$k}));
+ if ($list =~ /\$\(addprefix .*,(.*)\)(.*)$/) {
+ $list = trim("$1 $2");
+ $list = find_files($list);
+ } else {
+ $list = trim(find_files(strlist($sec->{$k})));
+ }
+ $trailer .= sprintf(",\n\tpublic_headers='%s'", $list);
+ next;
+ }
+ if ($k eq "MANPAGES") {
+ my $list = trim(find_files(strlist($sec->{$k})));
+ $trailer .= sprintf(",\n\tmanpages='%s'", $list);
+ next;
+ }
+ if ($k eq "$s" . "_OBJ_FILES") {
+ my $list = trim(strlist($sec->{$k}));
+ $list =~ s/\.o/.c/g;
+ $list =~ s/\.ho/.c/g;
+ if ($list =~ /\$\(addprefix .*,(.*)\)(.*)$/) {
+ $list = trim("$1 $2");
+ $list = find_files($list);
+ $list = "'$list'";
+ } elsif ($list =~ /\$\(addprefix \$\((\w+)\)(.*),(.*)\)(.*)$/) {
+ my $src = trim($3);
+ my $dir = "$1$2";
+ $dir =~ s/\/$//;
+ my $res = "bld.SUBDIR('$dir', '$src')";
+ if ($4) {
+ $res = "$res + '$4'";
+ }
+ $list = $res;
+ } else {
+ $list = find_files($list);
+ $list="'$list'";
+ }
+ $list =~ s/\$\(\w+srcdir\)\///g;
+ printf(",\n\t%s", $list);
+ $got_src = 1;
+ next;
+ }
+ if ($k eq "HEIMDAL_GSSAPI_KRB5_OBJ_FILES" ||
+ $k eq "HEIMDAL_GSSAPI_SPNEGO_OBJ_FILES" ||
+ $k eq "HEIMDAL_HEIM_ASN1_DER_OBJ_FILES" ||
+ $k eq "HEIMDAL_HX509_OBJH_FILES" ||
+ $k eq "HEIMDAL_HX509_OBJG_FILES" ||
+ $k eq "HEIMDAL_ROKEN_OBJ_FILES"
+ ) {
+ next;
+ }
+ die("Unknown keyword $k in $s\n");
+ }
+ die("No source list in $s\n") unless $got_src;
+ printf("%s\n\t)\n\n", $trailer);
+ }
+ }
+}
+
+for (my $i=0; $i <= $#ARGV; $i++) {
+ my $filename=$ARGV[$i];
+ $dname=dirname($filename);
+ my $result = read_config_mk($filename);
+ if ($i != 0) {
+ print "\n\n\n";
+ }
+ print "# AUTOGENERATED by mktowscript.pl from $filename\n# Please remove this notice if hand editing\n\n";
+ die("Unable to chdir to $dname\n") unless chdir($dname);
+ process_results($result);
}
-#print Dumper $result;
diff --git a/buildtools/mktowscript/rebuild_all.sh b/buildtools/mktowscript/rebuild_all.sh
index 5209eee50b..23622b2abe 100755
--- a/buildtools/mktowscript/rebuild_all.sh
+++ b/buildtools/mktowscript/rebuild_all.sh
@@ -1,21 +1,29 @@
#!/bin/bash
cat mklist.txt |
-while read f; do
- echo "Processing $f"
- f="../../$f"
- test -f $f || {
- echo "$f doesn't exist"
- exit 1
- }
- ws="$(dirname $f)/wscript_build"
- if [ -f $ws ]; then
- if ! grep "AUTOGENERATED.by.mktowscript" $ws > /dev/null; then
- echo "Skipping manually edited file $ws"
- continue
+while read line; do
+ ws=""
+ list=""
+ for f in $line; do
+ echo "Processing $f"
+ f="../../$f"
+ test -f $f || {
+ echo "$f doesn't exist"
+ exit 1
+ }
+ ws="$(dirname $f)/wscript_build"
+ if [ -f $ws ]; then
+ if test -s $ws && ! grep "AUTOGENERATED.by.mktowscript" $ws > /dev/null; then
+ echo "Skipping manually edited file $ws"
+ continue
+ fi
fi
+ list="$list $f"
+ done
+ if [ "$list" = "" ]; then
+ continue
fi
- ./mktowscript.pl $f > wscript_build.$$ || {
+ ./mktowscript.pl $list > wscript_build.$$ || {
echo "Failed on $f"
rm -f wscript_build.$$
exit 1