3 # Copyright (C) 2020 Red Hat, Inc.
5 # SPDX-License-Identifier: GPL-2.0-or-later
16 cmd
= os
.environ
.get("SIGNCODE")
19 subprocess
.run([cmd
, path
])
23 parser
= argparse
.ArgumentParser(description
="QEMU NSIS build helper.")
24 parser
.add_argument("outfile")
25 parser
.add_argument("prefix")
26 parser
.add_argument("srcdir")
27 parser
.add_argument("cpu")
28 parser
.add_argument("nsisargs", nargs
="*")
29 args
= parser
.parse_args()
31 destdir
= tempfile
.mkdtemp()
33 subprocess
.run(["make", "install", "DESTDIR=" + destdir
+ os
.path
.sep
])
35 os
.path
.join(destdir
+ args
.prefix
, "system-emulations.nsh"), "w"
37 os
.path
.join(destdir
+ args
.prefix
, "system-mui-text.nsh"), "w"
39 for exe
in sorted(glob
.glob(
40 os
.path
.join(destdir
+ args
.prefix
, "qemu-system-*.exe")
42 exe
= os
.path
.basename(exe
)
46 Section "{0}" Section_{0}
48 File "${{BINDIR}}\\{1}"
54 if arch
.endswith('w'):
55 desc
= arch
[:-1] + " emulation (GUI)."
57 desc
= arch
+ " emulation."
61 !insertmacro MUI_DESCRIPTION_TEXT ${{Section_{0}}} "{1}"
62 """.format(arch
, desc
))
64 for exe
in glob
.glob(os
.path
.join(destdir
+ args
.prefix
, "*.exe")):
71 "-DSRCDIR=" + args
.srcdir
,
72 "-DBINDIR=" + destdir
+ args
.prefix
,
75 if args
.cpu
== "x86_64":
78 if os
.path
.exists(os
.path
.join(args
.srcdir
, "dll")):
79 makensis
+= ["-DDLLDIR={0}/dll/{1}".format(args
.srcdir
, dlldir
)]
81 makensis
+= ["-DOUTFILE=" + args
.outfile
] + args
.nsisargs
82 subprocess
.run(makensis
)
83 signcode(args
.outfile
)
85 shutil
.rmtree(destdir
)
88 if __name__
== "__main__":