1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-10 13:57:47 +03:00

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 commit is contained in:
Jelmer Vernooij 2005-09-19 22:01:57 +00:00 committed by Gerald (Jerry) Carter
parent 4d7bc667f7
commit 4bffe44359
15 changed files with 242 additions and 28 deletions

View 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.
#
# Copyright (C) 2005 Jelmer Vernooij <jelmer@samba.org>
# Published under the GNU GPL
hostenv = Environment(CPPPATH = ['#', '#include', '#lib'])
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')

1
source/auth/SConscript Normal file
View File

@ -0,0 +1 @@
Import('hostenv')

View File

@ -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,[])

View File

@ -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

View File

@ -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')

10
source/gtk/SConscript Normal file
View File

@ -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'])

View 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')

View 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

View 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')

29
source/lib/ldb/SConscript Normal file
View File

@ -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'])

View 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')

13
source/lib/tdb/SConscript Normal file
View File

@ -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)

View File

@ -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

View 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')

View File

@ -103,6 +103,7 @@ REQUIRED_SUBSYSTEMS = \
SERVER_SERVICE \
CONFIG \
LIBCMDLINE \
LIBBASIC
LIBBASIC \
PIDFILE
# End BINARY smbd
#################################