top = '.'
out = 'build'
-samba = os.path.abspath('../samba')
+sambapath = os.path.abspath('../samba')
def options(ctx):
ctx.load('compiler_c')
# Configure winexe
ctx.find_program([ a + '-' + p + '-gcc' for a in ['i386', 'i586' ] for p in ['mingw32', 'mingw32msvc'] ], var='CC_WIN32')
ctx.find_program([ a + '-' + p + '-gcc' for a in ['x86_64', 'amd64'] for p in ['mingw32', 'mingw32msvc'] ], var='CC_WIN64')
+ ctx.find_program('strip', var='STRIP')
ctx.load('compiler_c')
print "Patching Samba files"
# Don't include pyldb-util because we can't statically link it
- os.system('cd ' + samba + ' && sed -i "s/ pyldb-util / /" lib/ldb-samba/wscript_build')
+ os.system('cd ' + sambapath + ' && sed -i "s/ pyldb-util / /" lib/ldb-samba/wscript_build')
# Patch Samba wscript to omit unneeded functions
- os.system('cd ' + samba + ''' && grep -q "conf.ADD_CFLAGS('-ffunction-sections') # added by winexe waf" wscript || sed -i "s^\( *\)conf.env.toplevel_build = True^\\1conf.env.toplevel_build = True\\n\\1conf.ADD_CFLAGS('-ffunction-sections') # added by winexe waf\\n\\1conf.ADD_LDFLAGS('-Wl,--gc-sections') # added by winexe waf^" wscript''')
- # Patch Samba wscript_build to include this wscript in the samba waf build tree
- os.system('cd ' + samba + ''' && grep -q "bld\.RECURSE('\.\./source') # added by winexe waf" wscript_build || sed -i "s^bld\.RECURSE('source3')^bld.RECURSE('source3')\\nbld.RECURSE('../source') # added by winexe waf^" wscript_build''')
+ os.system('cd ' + sambapath + ''' && grep -q "conf.ADD_CFLAGS('-ffunction-sections') # added by winexe waf" wscript || sed -i "s^\( *\)conf.env.toplevel_build = True^\\1conf.env.toplevel_build = True\\n\\1conf.ADD_CFLAGS('-ffunction-sections') # added by winexe waf\\n\\1conf.ADD_LDFLAGS('-Wl,--gc-sections') # added by winexe waf^" wscript''')
+ # Patch Samba wscript_build to include this wscript in the Samba waf build tree
+ os.system('cd ' + sambapath + ''' && grep -q "bld\.RECURSE('\.\./source') # added by winexe waf" wscript_build || sed -i "s^bld\.RECURSE('source3')^bld.RECURSE('source3')\\nbld.RECURSE('../source') # added by winexe waf^" wscript_build''')
print "Chaining to Samba waf configure"
- os.system('cd ' + samba + ' && ./buildtools/bin/waf configure --bundled-libraries=ALL --nonshared-binary=winexe -C')
+ os.system('cd ' + sambapath + ' && ./buildtools/bin/waf configure --bundled-libraries=ALL --nonshared-binary=winexe -C')
@conf
def windows_program(self, *k, **kw):
def build(bld):
if bld.env._SAMBA_BUILD_ == 4:
- # We have been called back by samba waf.
- # Create a task generator for winexe
+ # We have been called back by Samba waf.
+ # Create a Samba-waf task generator for winexe
bld.SAMBA_BINARY (
binname='winexe',
source='winexe.c svcinstall.c async.c build/winexesvc32_exe.c build/winexesvc64_exe.c',
bld(rule='${SRC[0].abspath()} winexesvc32_exe ${SRC[1]} > ${TGT}', target='winexesvc32_exe.c', source='bin2c winexesvc32.exe')
bld(rule='${SRC[0].abspath()} winexesvc64_exe ${SRC[1]} > ${TGT}', target='winexesvc64_exe.c', source='bin2c winexesvc64.exe')
- # Create task generator for samba + winexe
- bld(rule='cd ' + samba + ' && ./buildtools/bin/waf build --targets=winexe && cp -p bin/winexe ${TGT[0].abspath()}',
+ # Create a task generator for winexe (including hunks of Samba)
+ bld(rule='cd ' + sambapath + ' && ./buildtools/bin/waf build --targets=winexe && cp -p bin/winexe ${TGT[0].abspath()} && ${STRIP} ${TGT[0].abspath()}',
target='winexe',
source='winexe.c svcinstall.c async.c winexesvc32_exe.c winexesvc64_exe.c')