Also strip winexe
authorThomas Hood <jdthood@gmail.com>
Thu, 8 Sep 2011 18:04:42 +0000 (20:04 +0200)
committerThomas Hood <jdthood@gmail.com>
Thu, 8 Sep 2011 18:04:42 +0000 (20:04 +0200)
source/wscript

index ca003c31b21ec1a8f0084c24aabefd88aaf15777..4e7bfe8ce5bb6f701b826632bae5750fc8bd036a 100644 (file)
@@ -3,7 +3,7 @@ from Configure import conf
 
 top = '.'
 out = 'build'
-samba = os.path.abspath('../samba')
+sambapath = os.path.abspath('../samba')
 
 def options(ctx):
     ctx.load('compiler_c')
@@ -12,18 +12,19 @@ def configure(ctx):
     # 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):
@@ -37,8 +38,8 @@ 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',
@@ -54,7 +55,7 @@ def build(bld):
     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')