summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-19 22:01:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:28 -0500
commit069e498da2a03bd253a2fcf2b7ff13f266ab63b4 (patch)
tree640f3f77f4a16577c5deab17c4c9216da51bd179 /source4
parent700120068620f32f7affb479dc5986544afed643 (diff)
downloadsamba-069e498da2a03bd253a2fcf2b7ff13f266ab63b4.tar.gz
samba-069e498da2a03bd253a2fcf2b7ff13f266ab63b4.tar.bz2
samba-069e498da2a03bd253a2fcf2b7ff13f266ab63b4.zip
r10330: Add SConscript to more subsystems. Some of the tdb tools build now.
Start on custom Samba scons tools (for handling proto generation, pidl, etc) (This used to be commit 4bffe4435944fffa3f9680b5a2fe63f2bdd98003)
Diffstat (limited to 'source4')
-rw-r--r--source4/SConstruct44
-rw-r--r--source4/auth/SConscript1
-rw-r--r--source4/build/scons/iconv.py75
-rw-r--r--source4/build/scons/pidl.py32
-rw-r--r--source4/build/scons/proto.py26
-rw-r--r--source4/gtk/SConscript10
-rw-r--r--source4/lib/SConscript8
-rw-r--r--source4/lib/basic.mk7
-rw-r--r--source4/lib/charset/SConscript14
-rw-r--r--source4/lib/ldb/SConscript29
-rw-r--r--source4/lib/popt/SConscript5
-rw-r--r--source4/lib/tdb/SConscript13
-rw-r--r--source4/lib/tdb/tools/tdbbackup.c2
-rw-r--r--source4/param/SConscript3
-rw-r--r--source4/smbd/config.mk3
15 files changed, 243 insertions, 29 deletions
diff --git a/source4/SConstruct b/source4/SConstruct
index 431cba17fe..43ca7517fc 100644
--- a/source4/SConstruct
+++ b/source4/SConstruct
@@ -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
index 0000000000..b17b8e580b
--- /dev/null
+++ b/source4/auth/SConscript
@@ -0,0 +1 @@
+Import('hostenv')
diff --git a/source4/build/scons/iconv.py b/source4/build/scons/iconv.py
new file mode 100644
index 0000000000..ef82dc475d
--- /dev/null
+++ b/source4/build/scons/iconv.py
@@ -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
index 0000000000..c0c29d2035
--- /dev/null
+++ b/source4/build/scons/pidl.py
@@ -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
index 0000000000..6a53bfb4ab
--- /dev/null
+++ b/source4/build/scons/proto.py
@@ -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
index 0000000000..dc84db5a3a
--- /dev/null
+++ b/source4/gtk/SConscript
@@ -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'])
diff --git a/source4/lib/SConscript b/source4/lib/SConscript
index f1bff77cd0..a4a1f92361 100644
--- a/source4/lib/SConscript
+++ b/source4/lib/SConscript
@@ -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')
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 86392cfc40..3fa9bb354b 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -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
diff --git a/source4/lib/charset/SConscript b/source4/lib/charset/SConscript
index d73d390309..7d9044d547 100644
--- a/source4/lib/charset/SConscript
+++ b/source4/lib/charset/SConscript
@@ -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
index 0000000000..1698a7cff3
--- /dev/null
+++ b/source4/lib/ldb/SConscript
@@ -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'])
diff --git a/source4/lib/popt/SConscript b/source4/lib/popt/SConscript
index 580de92023..fd13edc42f 100644
--- a/source4/lib/popt/SConscript
+++ b/source4/lib/popt/SConscript
@@ -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
index 0000000000..d2ebf7002f
--- /dev/null
+++ b/source4/lib/tdb/SConscript
@@ -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)
diff --git a/source4/lib/tdb/tools/tdbbackup.c b/source4/lib/tdb/tools/tdbbackup.c
index 4cb6a8cfdd..872ca99f0d 100644
--- a/source4/lib/tdb/tools/tdbbackup.c
+++ b/source4/lib/tdb/tools/tdbbackup.c
@@ -63,11 +63,11 @@
#else
#include "includes.h"
+#include "system/filesys.h"
#endif
#include "tdb.h"
-#include "tdbback.h"
/*
see if one file is newer than another
diff --git a/source4/param/SConscript b/source4/param/SConscript
index 9fe6ffa71b..15213a8a4d 100644
--- a/source4/param/SConscript
+++ b/source4/param/SConscript
@@ -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')
diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk
index 37082485f5..24ea69a82a 100644
--- a/source4/smbd/config.mk
+++ b/source4/smbd/config.mk
@@ -103,6 +103,7 @@ REQUIRED_SUBSYSTEMS = \
SERVER_SERVICE \
CONFIG \
LIBCMDLINE \
- LIBBASIC
+ LIBBASIC \
+ PIDFILE
# End BINARY smbd
#################################