build: Convert winexe to use enabled= in wscript
authorAndrew Bartlett <abartlet@samba.org>
Mon, 5 Dec 2022 09:18:45 +0000 (22:18 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 16 Dec 2022 07:41:38 +0000 (07:41 +0000)
This also allows --without-winexe to stop building the .exe files even if
the compilers are present on the system.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15264

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Dec 16 07:41:38 UTC 2022 on sn-devel-184

examples/winexe/wscript_build

index 143739f3de0e862c0c1b9fa289467997bc4e0af3..364683405c251c6b4c2c5d7c73c6dcd4bbefbb24 100644 (file)
@@ -65,36 +65,44 @@ const DATA_BLOB *%s(void)
 
 winexesvc_binaries = ''
 
+bld.SAMBA_GENERATOR(
+    'winexesvc32_exe',
+    source='winexesvc.c',
+    target='winexesvc32.exe',
+    rule='${WINEXE_CC_WIN32} ${SRC} -o ${TGT} ${WINEXE_LDFLAGS}',
+    enabled=bld.env.build_winexe and bld.env.WINEXE_CC_WIN32)
+
+vars = {"WINEXE_FN": "winexesvc32_exe_binary"}
+bld.SAMBA_GENERATOR(
+    'winexesvc32_exe_binary',
+    source='winexesvc32.exe',
+    target='winexesvc32_exe_binary.c',
+    group='build_source',
+    vars=vars,
+    rule=generate_winexesvc_c_from_exe,
+    enabled=bld.env.build_winexe and bld.env.WINEXE_CC_WIN32)
+
 if bld.env.WINEXE_CC_WIN32:
-    bld.SAMBA_GENERATOR(
-        'winexesvc32_exe',
-        source='winexesvc.c',
-        target='winexesvc32.exe',
-        rule='${WINEXE_CC_WIN32} ${SRC} -o ${TGT} ${WINEXE_LDFLAGS}')
-    vars = {"WINEXE_FN": "winexesvc32_exe_binary"}
-    bld.SAMBA_GENERATOR(
-        'winexesvc32_exe_binary',
-        source='winexesvc32.exe',
-        target='winexesvc32_exe_binary.c',
-        group='build_source',
-        vars=vars,
-        rule=generate_winexesvc_c_from_exe)
     winexesvc_binaries += ' winexesvc32_exe_binary.c'
 
+bld.SAMBA_GENERATOR(
+    'winexesvc64_exe',
+    source='winexesvc.c',
+    target='winexesvc64.exe',
+    rule='${WINEXE_CC_WIN64} ${SRC} -o ${TGT} ${WINEXE_LDFLAGS}',
+    enabled=bld.env.build_winexe and bld.env.WINEXE_CC_WIN64)
+
+vars = {"WINEXE_FN": "winexesvc64_exe_binary"}
+bld.SAMBA_GENERATOR(
+    'winexesvc64_exe_binary',
+    source='winexesvc64.exe',
+    target='winexesvc64_exe_binary.c',
+    group='build_source',
+    vars=vars,
+    rule=generate_winexesvc_c_from_exe,
+    enabled=bld.env.build_winexe and bld.env.WINEXE_CC_WIN64)
+
 if bld.env.WINEXE_CC_WIN64:
-    bld.SAMBA_GENERATOR(
-        'winexesvc64_exe',
-        source='winexesvc.c',
-        target='winexesvc64.exe',
-        rule='${WINEXE_CC_WIN64} ${SRC} -o ${TGT} ${WINEXE_LDFLAGS}')
-    vars = {"WINEXE_FN": "winexesvc64_exe_binary"}
-    bld.SAMBA_GENERATOR(
-        'winexesvc64_exe_binary',
-        source='winexesvc64.exe',
-        target='winexesvc64_exe_binary.c',
-        group='build_source',
-        vars=vars,
-        rule=generate_winexesvc_c_from_exe)
     winexesvc_binaries += ' winexesvc64_exe_binary.c'
 
 if winexesvc_binaries != '':