Author: jelmer
Date: 2005-09-20 17:49:19 +0000 (Tue, 20 Sep 2005)
New Revision: 10356

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10356

Log:
Make the proto generator work with scons

Modified:
   branches/SAMBA_4_0/source/SConstruct
   branches/SAMBA_4_0/source/build/scons/
   branches/SAMBA_4_0/source/build/scons/et.py
   branches/SAMBA_4_0/source/build/scons/iconv.py
   branches/SAMBA_4_0/source/build/scons/pidl.py
   branches/SAMBA_4_0/source/build/scons/proto.py
   branches/SAMBA_4_0/source/lib/SConscript


Changeset:
Modified: branches/SAMBA_4_0/source/SConstruct
===================================================================
--- branches/SAMBA_4_0/source/SConstruct        2005-09-20 17:33:07 UTC (rev 
10355)
+++ branches/SAMBA_4_0/source/SConstruct        2005-09-20 17:49:19 UTC (rev 
10356)
@@ -9,7 +9,7 @@
 
 hostenv = Environment(
                toolpath=['build/scons','.'],
-               tools=['default'],
+               tools=['default','pidl','proto','et'],
                CPPPATH=['#include','#','#lib'], 
                 CPPDEFINES={'_SAMBA_BUILD_': None},
                )
@@ -53,9 +53,13 @@
 dynconfig = dynenv.Object('dynconfig.c')
 Export('dynconfig')
 
+proto_files = []
+
 SConscript(
                
dirs=['param','lib','torture','rpc_server','cldap_server','libcli',
                
'nbt_server','client','ldap_server','libnet','nsswitch','web_server',
                
'smbd','dsdb','heimdal_build','ntptr','kdc','smb_server','ntvfs',
                'winbind','scripting','auth'],
-               exports='buildenv hostenv')
+               exports='buildenv hostenv proto_files')
+
+hostenv.CProtoHeader(target='include/proto.h',source = proto_files)


Property changes on: branches/SAMBA_4_0/source/build/scons
___________________________________________________________________
Name: svn:ignore
   + *.pyc


Modified: branches/SAMBA_4_0/source/build/scons/et.py
===================================================================
--- branches/SAMBA_4_0/source/build/scons/et.py 2005-09-20 17:33:07 UTC (rev 
10355)
+++ branches/SAMBA_4_0/source/build/scons/et.py 2005-09-20 17:49:19 UTC (rev 
10356)
@@ -5,22 +5,29 @@
 """
 
 import SCons.Defaults
-import SCons.Scanner.ET
 import SCons.Util
+import SCons.Tool
 
-et_scanner = SCons.Scanner.ET.ETScan()
-
 et_builder = SCons.Builder.Builder(action='$ETCOM',
                                      src_suffix = '.et',
-                                     suffix='.c',
-                                     scanner = et_scanner)
+                                     suffix='.c')
 
 def generate(env):
-    env['ET']          = 'FIXME'
-    env['PROTOCOM']       = '$ET $SOURCE'
+    env['ET']          = env.Detect('et_compile')
+    env['ETCOM']       = '$ET $SOURCE'
     env['BUILDERS']['ET'] = et_builder
 
 def exists(env):
-       return env.Detect('FIXME')
+       return env.Detect(['et_compile'])
 
+def generate(env):
+    """Add Builders and construction variables for lex to an Environment."""
+    c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
 
+    c_file.add_action('.l', SCons.Defaults.LexAction)
+    cxx_file.add_action('.ll', SCons.Defaults.LexAction)
+
+    env['LEX']      = env.Detect('flex') or 'lex'
+    env['LEXFLAGS'] = SCons.Util.CLVar('')
+    env['LEXCOM']   = '$LEX $LEXFLAGS -t $SOURCES > $TARGET'
+    

Modified: branches/SAMBA_4_0/source/build/scons/iconv.py
===================================================================
--- branches/SAMBA_4_0/source/build/scons/iconv.py      2005-09-20 17:33:07 UTC 
(rev 10355)
+++ branches/SAMBA_4_0/source/build/scons/iconv.py      2005-09-20 17:49:19 UTC 
(rev 10356)
@@ -1,6 +1,12 @@
 # Based on the M4 macro by Bruno Haible.
 
-def _CheckIconvPath(path):
+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)
@@ -58,7 +64,7 @@
        look_dirs = ['/usr','/usr/local','/sw']
 
        for p in look_dirs:
-               _CheckIconvPath(p) #FIXME: Handle return value
+               _CheckIconvPath(context,p) #FIXME: Handle return value
 
        if context.TryRun("""
 #include <iconv.h>

Modified: branches/SAMBA_4_0/source/build/scons/pidl.py
===================================================================
--- branches/SAMBA_4_0/source/build/scons/pidl.py       2005-09-20 17:33:07 UTC 
(rev 10355)
+++ branches/SAMBA_4_0/source/build/scons/pidl.py       2005-09-20 17:49:19 UTC 
(rev 10356)
@@ -16,17 +16,10 @@
                                      scanner = idl_scanner)
 
 def generate(env):
-    env['PIDL']          = 'pidl'
-       env['PIDLCPP']           = env['CPP']
-    env['PIDLFLAGS']     = []
-    env['PIDLCOM']       = 'CPP=$PIDLCPP $PIDL $PIDLFLAGS -- $SOURCE'
-    env['BUILDERS']['NdrMarshaller'] = pidl_builder
+       env['PIDL']          = env.Detect('pidl') or './pidl/pidl'
+       env['PIDLFLAGS']     = []
+       env['PIDLCOM']       = 'CPP=$CPP $PIDL $PIDLFLAGS -- $SOURCE'
+       env['BUILDERS']['NdrMarshaller'] = pidl_builder
 
 def exists(env):
-       if (env.Detect('./pidl/pidl')):
-               return 1
-
-       if (env.Detect('pidl')):
-               return 1
-
-       return 0
+       return env.Detect(['./pidl/pidl','pidl'])

Modified: branches/SAMBA_4_0/source/build/scons/proto.py
===================================================================
--- branches/SAMBA_4_0/source/build/scons/proto.py      2005-09-20 17:33:07 UTC 
(rev 10355)
+++ branches/SAMBA_4_0/source/build/scons/proto.py      2005-09-20 17:49:19 UTC 
(rev 10356)
@@ -5,22 +5,16 @@
 """
 
 import SCons.Defaults
-import SCons.Scanner.C
 import SCons.Util
 
-c_scanner = SCons.Scanner.C.CScan()
-
 proto_builder = SCons.Builder.Builder(action='$PROTOCOM',
-                                     src_suffix = '.idl',
-                                     suffix='.h',
-                                     scanner = c_scanner)
+                                     src_suffix = '.c',
+                                     suffix='.h')
 
 def generate(env):
-    env['MKPROTO']          = './script/mkproto.sh'
-    env['PROTOCOM']       = '$MKPROTO "$PERL" -h _PROTO_H_ ${TARGETS[0]} 
$SOURCE'
-    env['BUILDERS']['ProtoHeader'] = proto_builder
+       env['MKPROTO']          = './script/mkproto.sh'
+       env['PROTOCOM']       = '$MKPROTO "$PERL" -h _PROTO_H_ ${TARGETS[0]} 
$SOURCE'
+       env['BUILDERS']['CProtoHeader'] = proto_builder
 
 def exists(env):
        return env.Detect('./script/mkproto.sh')
-
-

Modified: branches/SAMBA_4_0/source/lib/SConscript
===================================================================
--- branches/SAMBA_4_0/source/lib/SConscript    2005-09-20 17:33:07 UTC (rev 
10355)
+++ branches/SAMBA_4_0/source/lib/SConscript    2005-09-20 17:49:19 UTC (rev 
10356)
@@ -1,13 +1,13 @@
 Import('hostenv')
 #            tastes like -*- python -*-
 
-basic = hostenv.StaticLibrary('basic', 
-       ['version.c', 'xfile.c', 'debug.c', 'fault.c', 
+basic_files = ['version.c', 'xfile.c', 'debug.c', 'fault.c', 
         'signal.c', 'system.c', 'time.c', 'genrand.c', 'dprintf.c',
         'util_str.c', 'util_strlist.c', 'util_unistr.c', 'util_file.c',
         'data_blob.c', 'util.c', 'util_sock.c', 'substitute.c', 
         'fsusage.c', 'ms_fnmatch.c', 'select.c', 'mutex.c', 'idtree.c',
-        'unix_privs.c', 'db_wrap.c', 'gendb.c', 'credentials.c'])
+        'db_wrap.c', 'gendb.c', 'credentials.c']
+basic = hostenv.StaticLibrary('basic', basic_files)
 Export('basic')
 
 hostenv.StaticLibrary('netif', ['netif/interface.c', 'netif/netif.c'])

Reply via email to