r10330: Add SConscript to more subsystems. Some of the tdb tools build now.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 19 Sep 2005 22:01:57 +0000 (22:01 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:38:28 +0000 (13:38 -0500)
Start on custom Samba scons tools (for handling proto generation, pidl, etc)
(This used to be commit 4bffe4435944fffa3f9680b5a2fe63f2bdd98003)

15 files changed:
source4/SConstruct
source4/auth/SConscript [new file with mode: 0644]
source4/build/scons/iconv.py [new file with mode: 0644]
source4/build/scons/pidl.py [new file with mode: 0644]
source4/build/scons/proto.py [new file with mode: 0644]
source4/gtk/SConscript [new file with mode: 0644]
source4/lib/SConscript
source4/lib/basic.mk
source4/lib/charset/SConscript
source4/lib/ldb/SConscript [new file with mode: 0644]
source4/lib/popt/SConscript
source4/lib/tdb/SConscript [new file with mode: 0644]
source4/lib/tdb/tools/tdbbackup.c
source4/param/SConscript
source4/smbd/config.mk

index 431cba17fe857c4915775ecb2e58d59605635603..43ca7517fce0dc97f0aec49f6652fe3e9f318692 100644 (file)
@@ -1,11 +1,19 @@
+#!/usr/bin/env python
 #            tastes like -*- python -*-
 
 # This is the experimental scons build script for Samba 4. For a proper 
 # build use the old build system (configure + make). scons may
 # eventually replace this system.
-
-hostenv = Environment(CPPPATH = ['#', '#include', '#lib'])
-
+#
+# Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU GPL
+
+hostenv = Environment(
+               toolpath=['build/scons','.'],
+               tools=['default'],
+               CPPPATH=['#include','#','#lib'], 
+               CCFLAGS='-D_SAMBA_BUILD_'
+               )
 hostenv.Append(CPPPATH = ['#heimdal_build', '#heimdal/lib/krb5',
                          '#heimdal/lib/hdb', '#heimdal/lib/gssapi',
                          '#heimdal/lib/asn1', '#heimdal/lib/des',
@@ -14,23 +22,22 @@ hostenv.Append(CPPPATH = ['#heimdal_build', '#heimdal/lib/krb5',
 
 buildenv = hostenv.Copy()
 
-SConscript('param/SConscript','hostenv')
-SConscript('lib/SConscript','hostenv')
-
 dynenv = hostenv.Copy()
 
+bindir = "bindir"
+
 paths = { 
-       'BINDIR': 'bin',
-       'SBINDIR': 'sbin',
-       'CONFIGFILE': 'cfg',
-       'LOGFILEBASE': 'lfb',
-       'NCALRPCDIR': 'ncalrpc',
-       'LMHOSTSFILE': 'lmhosts',
-       'LIBDIR': 'libdir',
-       'SHLIBEXT': 'ext',
-       'LOCKDIR': 'lockdir',
-       'PIDDIR': 'piddir',
-       'SMB_PASSWD_FILE': 'smbpasswd',
+       'BINDIR': bindir,
+       'SBINDIR': "sbin",
+       'CONFIGFILE': "cfg",
+       'LOGFILEBASE': "lfb",
+       'NCALRPCDIR': "ncalrpc",
+       'LMHOSTSFILE': "lmhosts",
+       'LIBDIR': "libdir",
+       'SHLIBEXT': "ext",
+       'LOCKDIR': "lockdir",
+       'PIDDIR': "piddir",
+       'SMB_PASSWD_FILE': "smbpasswd",
        'PRIVATE_DIR': 'private',
        'SWATDIR': 'swat'
 }
@@ -39,3 +46,6 @@ paths = {
        
 dynconfig = dynenv.Object('dynconfig.c')
 Export('dynconfig')
+
+SConscript(dirs=['param','lib'],exports='hostenv')
+
diff --git a/source4/auth/SConscript b/source4/auth/SConscript
new file mode 100644 (file)
index 0000000..b17b8e5
--- /dev/null
@@ -0,0 +1 @@
+Import('hostenv')
diff --git a/source4/build/scons/iconv.py b/source4/build/scons/iconv.py
new file mode 100644 (file)
index 0000000..ef82dc4
--- /dev/null
@@ -0,0 +1,75 @@
+# Based on the M4 macro by Bruno Haible.
+
+def _CheckIconvPath(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(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
new file mode 100644 (file)
index 0000000..c0c29d2
--- /dev/null
@@ -0,0 +1,32 @@
+"""SCons.Tool.pidl
+
+Tool-specific initialization for pidl (Perl-based IDL compiler)
+
+"""
+
+import SCons.Defaults
+import SCons.Scanner.IDL
+import SCons.Util
+
+idl_scanner = SCons.Scanner.IDL.IDLScan()
+
+pidl_builder = SCons.Builder.Builder(action='$PIDLCOM',
+                                     src_suffix = '.idl',
+                                     suffix='.c',
+                                     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
+
+def exists(env):
+       if (env.Detect('./pidl/pidl')):
+               return 1
+
+       if (env.Detect('pidl')):
+               return 1
+
+       return 0
diff --git a/source4/build/scons/proto.py b/source4/build/scons/proto.py
new file mode 100644 (file)
index 0000000..6a53bfb
--- /dev/null
@@ -0,0 +1,26 @@
+"""SCons.Tool.proto
+
+Tool-specific initialization for mkproto (C Proto File generator)
+
+"""
+
+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)
+
+def generate(env):
+    env['MKPROTO']          = './script/mkproto.sh'
+    env['PROTOCOM']       = '$MKPROTO "$PERL" -h _PROTO_H_ ${TARGETS[0]} $SOURCE'
+    env['BUILDERS']['ProtoHeader'] = proto_builder
+
+def exists(env):
+       return env.Detect('./script/mkproto.sh')
+
+
diff --git a/source4/gtk/SConscript b/source4/gtk/SConscript
new file mode 100644 (file)
index 0000000..dc84db5
--- /dev/null
@@ -0,0 +1,10 @@
+Import('hostenv')
+
+gtksmb = hostenv.StaticLibrary('gtksmb',
+               ['common/gtk-smb.c','common/select.c',
+               'common/gtk_events.c','common/credentials.c'])
+
+hostenv.Program('gregedit', [gtksmb,'tools/gregedit.c'])
+hostenv.Program('gepdump', [gtksmb,'tools/gepdump.c'])
+hostenv.Program('gwcrontab', [gtksmb,'tools/gwcrontab.c'])
+hostenv.Program('gwsam', [gtksmb,'tools/gwsam.c','tools/gwsam_user.c'])
index f1bff77cd0fcbc7d71493b90aa8391b938d7bc87..a4a1f92361fed1add868115be608d44c06f1accf 100644 (file)
@@ -20,8 +20,6 @@ hostenv.StaticLibrary('gencache',['gencache.c'])
 hostenv.StaticLibrary('pidfile',['pidfile.c'])
 hostenv.StaticLibrary('unix_privs',['unix_privs.c'])
 
-SConscript('popt/SConscript','hostenv')
-SConscript('cmdline/SConscript','hostenv')
-SConscript('talloc/SConscript','hostenv')
-SConscript('registry/SConscript','hostenv')
-SConscript('charset/SConscript', 'hostenv')
+SConscript(dirs=['tdb','popt','cmdline','talloc','registry','charset',
+                  'ldb'],
+                  exports='hostenv')
index 86392cfc40cf4cb65d79d4b749283dce6732ed26..3fa9bb354b4266f55e21e37705970aabed54a853 100644 (file)
@@ -47,7 +47,6 @@ ADD_OBJ_FILES = \
                lib/xfile.o \
                lib/debug.o \
                lib/fault.o \
-               lib/pidfile.o \
                lib/signal.o \
                lib/system.o \
                lib/time.o \
@@ -66,7 +65,6 @@ ADD_OBJ_FILES = \
                lib/select.o \
                lib/mutex.o \
                lib/idtree.o \
-               lib/unix_privs.o \
                lib/db_wrap.o \
                lib/gendb.o \
                lib/credentials.o
@@ -76,3 +74,8 @@ REQUIRED_SUBSYSTEMS = \
 # End SUBSYSTEM LIBBASIC
 ##############################
 
+[SUBSYSTEM::PIDFILE]
+OBJ_FILES = lib/pidfile.o
+
+[SUBSYSTEM::UNIX_PRIVS]
+OBJ_FILES = lib/unix_privs.o
index d73d3903092a0cfa9996531b0dc2d28506f7d845..7d9044d547c1168771c2736eebc15d24d90d555f 100644 (file)
@@ -1,5 +1,15 @@
+SConscript('../../build/scons/iconv.py')
 #            tastes like -*- python -*-
-
 Import('hostenv')
-charset = hostenv.StaticLibrary('charset',['iconv.c','charcnv.c'])
+
+#conf = Configure(hostenv, custom_tests = { 'CheckIconv' : CheckIconv })
+#(have_iconv,iconv) = conf.CheckIconv()
+#conf.Finish()
+
+#if not have_iconv:
+#      print "Install iconv for better charset compatibility"
+
+iconv = []
+
+charset = hostenv.StaticLibrary('charset',['iconv.c','charcnv.c',iconv])
 Export('charset')
diff --git a/source4/lib/ldb/SConscript b/source4/lib/ldb/SConscript
new file mode 100644 (file)
index 0000000..1698a7c
--- /dev/null
@@ -0,0 +1,29 @@
+Import('hostenv')
+
+
+hostenv.StaticLibrary('modules/timestamps.c')
+hostenv.StaticLibrary('modules/rdn_name.c')
+hostenv.StaticLibrary('modules/schema.c')
+hostenv.StaticLibrary('ldb_ildap/ldb_ildap.c')
+hostenv.StaticLibrary('modules/ldb_map.c')
+hostenv.StaticLibrary('ldb_sqlite3/ldb_sqlite3.c')
+hostenv.StaticLibrary('ldb_tdb',
+       ['ldb_tdb/ldb_tdb.c','ldb_tdb/ldb_search.c','ldb_tdb/ldb_pack.c',
+        'ldb_tdb/ldb_index.c','ldb_tdb/ldb_cache.c','ldb_tdb/ldb_tdb_wrap.c'])
+
+hostenv.StaticLibrary('ldb', 
+       ['common/ldb.c','common/ldb_ldif.c','common/ldb_parse.c',
+        'common/ldb_parse.c','common/ldb_msg.c','common/ldb_utf8.c',
+        'common/ldb_debug.c','common/ldb_modules.c','common/ldb_match.c',
+        'common/attrib_handlers.c','common/ldb_dn.c'])
+
+hostenv.StaticLibrary('samba/ldif_handlers.c')
+hostenv.StaticLibrary('ldb_cmdline', 'tools/cmdline.c')
+
+hostenv.Program('ldbadd',['tools/ldbadd.c'])
+hostenv.Program('ldbdel',['tools/ldbdel.c'])
+hostenv.Program('ldbmodify',['tools/ldbmodify.c'])
+hostenv.Program('ldbsearch',['tools/ldbsearch.c'])
+hostenv.Program('ldbrename',['tools/ldbrename.c'])
+hostenv.Program('ldbtest',['tools/ldbtest.c'])
+hostenv.Program('oLschema2ldif',['tools/oLschema2ldif.c'])
index 580de920236c1fb4cdde8701f8f1d7f848d8a8b3..fd13edc42f7f978bfcb9e7afbb8360d2919d9212 100644 (file)
@@ -1,5 +1,10 @@
 #            tastes like -*- python -*-
 
 Import('hostenv')
+
+conf = Configure(hostenv)
+conf.env['HAVE_EXTERNAL_POPT'] = conf.CheckLibWithHeader('popt', 'popt.h', 'c', 'poptGetArgs(NULL);')
+conf.Finish()
+
 popt = hostenv.StaticLibrary('popt', ['findme.c','popt.c','poptconfig.c','popthelp.c','poptparse.c'])
 Export('popt')
diff --git a/source4/lib/tdb/SConscript b/source4/lib/tdb/SConscript
new file mode 100644 (file)
index 0000000..d2ebf70
--- /dev/null
@@ -0,0 +1,13 @@
+Import('hostenv')
+tdbenv = hostenv.Copy()
+tdbenv.Append(CPPPATH=['include'])
+tdb = tdbenv.StaticLibrary('tdb',
+       ['common/tdb.c','common/dump.c','common/io.c','common/lock.c',
+        'common/open.c','common/traverse.c','common/freelist.c',
+        'common/error.c','common/tdbutil.c'])
+
+tdbtool = tdbenv.Program('tdbtool', ['tools/tdbtool.c',tdb])
+tdbtorture = tdbenv.Program('tdbtorture', ['tools/tdbtorture.c',tdb])
+tdbdump = tdbenv.Program('tdbdump', ['tools/tdbdump.c',tdb])
+tdbbackup = tdbenv.Program('tdbbackup', ['tools/tdbbackup.c',tdb])
+Default(tdbtool,tdbtorture,tdbdump,tdbbackup)
index 4cb6a8cfddcd228f6363cafc86a269a78c7dd6a5..872ca99f0df4121219314b96031f2ea4022ed2d4 100644 (file)
 #else
 
 #include "includes.h"
+#include "system/filesys.h"
 
 #endif
 
 #include "tdb.h"
-#include "tdbback.h"
 
 /*
   see if one file is newer than another
index 9fe6ffa71b77dc1065ee09e8bd3eead08beed818..15213a8a4d338753c2bb3bda816bd96b630617a8 100644 (file)
@@ -1,7 +1,8 @@
 #            tastes like -*- python -*-
 
 Import('hostenv')
-param = hostenv.StaticLibrary('loadparm',['loadparm.c','params.c'])
+Import('dynconfig')
+param = hostenv.StaticLibrary('loadparm',['loadparm.c','params.c',dynconfig])
 Export('param')
 generic = hostenv.StaticLibrary('generic',['generic.c'])
 Export('generic')
index 37082485f5472894604dcc385be3d97b4e2533b1..24ea69a82a0b942878769ad6c7f43a42ec7f8f32 100644 (file)
@@ -103,6 +103,7 @@ REQUIRED_SUBSYSTEMS = \
                SERVER_SERVICE \
                CONFIG \
                LIBCMDLINE \
-               LIBBASIC
+               LIBBASIC \
+               PIDFILE
 # End BINARY smbd
 #################################