summaryrefslogtreecommitdiff
path: root/source4/build/scons
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-23 16:32:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:48 -0500
commit4be0ae794e4af2354d678fddd7bf1e822ffa9148 (patch)
tree128989d970334e4a896329992e827c4f09b8c035 /source4/build/scons
parentda46c9252ee887602b3e629065ca87b9ed11466f (diff)
downloadsamba-4be0ae794e4af2354d678fddd7bf1e822ffa9148.tar.gz
samba-4be0ae794e4af2354d678fddd7bf1e822ffa9148.tar.bz2
samba-4be0ae794e4af2354d678fddd7bf1e822ffa9148.zip
r10456: More SCons fixes:
- Add framework for fallback generating code - Move pread / pwrite replacement functions to libreplace - Support pidl builds correctly - Support asn1 builds correctly - Move OS-specific checks to lib/replace/SConscript (This used to be commit fbbfad0a1f7dedbf48e835a864f8285f283d72f3)
Diffstat (limited to 'source4/build/scons')
-rw-r--r--source4/build/scons/asn1.py9
-rw-r--r--source4/build/scons/fallback.py34
-rw-r--r--source4/build/scons/iconv.py81
-rw-r--r--source4/build/scons/pidl.py30
4 files changed, 64 insertions, 90 deletions
diff --git a/source4/build/scons/asn1.py b/source4/build/scons/asn1.py
index f0068e20dd..b8b7073151 100644
--- a/source4/build/scons/asn1.py
+++ b/source4/build/scons/asn1.py
@@ -17,17 +17,20 @@ def asn1_emitter(target,source,env):
contents = node.get_contents()
for j in output_re.findall(contents):
targets.append(str(node.get_dir()) + '/asn1_' + j + '.c')
+ targets.append("%s/%s.h" % (str(node.get_dir()), env['ASN1PREFIX']))
return targets, source
asn1_builder = SCons.Builder.Builder(action='$ASN1COM',
src_suffix = '.asn1',
suffix='.c',
+ single_source=True,
emitter = asn1_emitter)
def generate(env):
- env['ASN1'] = './bin/asn1_compile'
- env['ASN1COM'] = '$ASN1 $SOURCE'
- env['BUILDERS']['ASN1'] = asn1_builder
+ env['ASN1'] = './bin/asn1_compile'
+ env['ASN1PREFIX'] = 'asn1'
+ env['ASN1COM'] = 'cd ${SOURCE.dir} && $ASN1 $ASN1PREFIX ${SOURCE.file}'
+ env['BUILDERS']['ASN1'] = asn1_builder
def exists(env):
return env.Detect('asn1_compile')
diff --git a/source4/build/scons/fallback.py b/source4/build/scons/fallback.py
new file mode 100644
index 0000000000..d8db9ec268
--- /dev/null
+++ b/source4/build/scons/fallback.py
@@ -0,0 +1,34 @@
+# Generate fallback configure + Makefile
+# Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
+
+# No support for:
+# - cross-compilation
+# - caching
+# - config.status (?)
+
+import SCons.Defaults
+import SCons.Util
+import SCons.Tool
+
+# Configure structure:
+# - Check for available tools first
+# - Check for available tool capabilities (C99, volatile, etc)
+# - Check for available `base' headers
+# - Check for available types
+# - Check for libs / headers
+def configure_builder(target, source, env):
+ pass
+
+# Makefile structure:
+# - Declare all variables first
+# - Declare targets + dependencies + actions
+
+def makefile_builder(target, source, env):
+ pass
+
+def generate(env):
+ env['BUILDERS']['ConfigureScript'] = configure_builder
+ env['BUILDERS']['MakefileIn'] = makefile_in_builder
+
+def exists(env):
+ return 1
diff --git a/source4/build/scons/iconv.py b/source4/build/scons/iconv.py
deleted file mode 100644
index 940e2d814d..0000000000
--- a/source4/build/scons/iconv.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Based on the M4 macro by Bruno Haible.
-
-def exists(env):
- return True
-
-def generate(env):
- env['custom_tests']['CheckIconv'] = CheckIconv
-
-def _CheckIconvPath(context,path):
- # Some systems have iconv in libc, some have it in libiconv (OSF/1 and
- # those with the standalone portable libiconv installed).
- context.Message("checking for iconv in " + path)
-
- main = """
-int main()
-{
- iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);
- return 0;
-}"""
-
- have_giconv_iconv = context.TryLink("""
-#include <stdlib.h>
-#include <giconv.h>
-""" + main, '.c')
- if have_giconv_iconv:
- context.Result(1)
- return ("giconv.h", "")
-
- have_iconv_iconv = context.TryLink("""
-#include <stdlib.h>
-#include <iconv.h>
-""" + main, '.c')
-
- if have_iconv_iconv:
- context.Result(1)
- return ("iconv.h", "")
-
- #FIXME: Add -lgiconv
- have_giconv_lib_iconv = context.TryLink("""
-#include <stdlib.h>
-#include <giconv.h>
-""" + main, '.c')
- if have_giconv_lib_iconv:
- context.Result(1)
- return ("giconv.h", "-lgiconv")
-
- #FIXME: Add -liconv
- have_iconv_lib_iconv = context.TryLink("""
-#include <stdlib.h>
-#include <iconv.h>
-"""+main,'.c')
-
- if have_iconv_lib_iconv:
- context.Result(1)
- return ("iconv.h", "-liconv")
-
- return None
-
-def CheckIconv(context):
- context.Message("checking for iconv")
-
- look_dirs = ['/usr','/usr/local','/sw']
-
- for p in look_dirs:
- _CheckIconvPath(context,p) #FIXME: Handle return value
-
- if context.TryRun("""
-#include <iconv.h>
-main() {
- iconv_t cd = iconv_open("ASCII", "UCS-2LE");
- if (cd == 0 || cd == (iconv_t)-1) return -1;
- return 0;
-}
-""", '.c'):
- context.Result(1)
- return (1,[])
-
- context.Result(0)
- return (0,[])
diff --git a/source4/build/scons/pidl.py b/source4/build/scons/pidl.py
index b29584c756..0c5c16b0b5 100644
--- a/source4/build/scons/pidl.py
+++ b/source4/build/scons/pidl.py
@@ -10,7 +10,7 @@ import SCons.Scanner
idl_scanner = SCons.Scanner.ClassicCPP("PIDLScan", '.idl', 'CPPPATH', r'depends\(([^,]+),+\)', SCons.Node.FS.default_fs)
-def idl_emitter(target, source, env):
+def ndr_emitter(target, source, env):
result = []
for s in source:
base, ext = SCons.Util.splitext(str(s).split('/')[-1])
@@ -19,16 +19,34 @@ def idl_emitter(target, source, env):
result.append('gen_ndr/%s.h' % base)
return result, source
-pidl_builder = SCons.Builder.Builder(action='$PIDLCOM',
- emitter = idl_emitter,
+ndr_builder = SCons.Builder.Builder(action='$NDRCOM',
+ emitter = ndr_emitter,
src_suffix = '.idl',
scanner = idl_scanner)
+def tdr_emitter(target, source, env):
+ result = []
+ for s in source:
+ base, ext = SCons.Util.splitext(str(s).split('/')[-1])
+ result.append('%s/tdr_%s.c' % (s.get_dir(), base))
+ result.append('%s/tdr_%s.h' % (s.get_dir(), base))
+ result.append('%s/%s.h' % (s.get_dir(), base))
+ return result, source
+
+tdr_builder = SCons.Builder.Builder(action='$TDRCOM',
+ emitter = tdr_emitter,
+ src_suffix = '.idl',
+ single_source = True,
+ scanner = idl_scanner)
+
def generate(env):
env['PIDL'] = env.Detect(['./pidl/pidl', 'pidl'])
- env['PIDLFLAGS'] = ['--outputdir', 'librpc/gen_ndr', '--ndr-header', '--ndr-parser', '--header']
- env['PIDLCOM'] = '$PIDL $PIDLFLAGS -- $SOURCE'
- env['BUILDERS']['NdrMarshaller'] = pidl_builder
+ env['NDRFLAGS'] = ['--outputdir', 'librpc/gen_ndr','--ndr-header', '--ndr-parser','--header']
+ env['TDRFLAGS'] = ['--tdr-parser', '--tdr-header','--header']
+ env['NDRCOM'] = '$PIDL $NDRFLAGS -- $SOURCES'
+ env['TDRCOM'] = 'cd ${SOURCE.dir} && $PIDL $TDRFLAGS -- ${SOURCE.file}'
+ env['BUILDERS']['NdrMarshaller'] = ndr_builder
+ env['BUILDERS']['TdrMarshaller'] = tdr_builder
def exists(env):
return env.Detect(['./pidl/pidl','pidl'])