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"
38 os
.path
.join(destdir
+ args
.prefix
, "qemu-system-*.exe")
40 exe
= os
.path
.basename(exe
)
44 Section "{0}" Section_{0}
46 File "${{BINDIR}}\\{1}"
53 for exe
in glob
.glob(os
.path
.join(destdir
+ args
.prefix
, "*.exe")):
60 "-DSRCDIR=" + args
.srcdir
,
61 "-DBINDIR=" + destdir
+ args
.prefix
,
64 if args
.cpu
== "x86_64":
67 if os
.path
.exists(os
.path
.join(args
.srcdir
, "dll")):
68 makensis
+= "-DDLLDIR={0}/dll/{1}".format(args
.srcdir
, dlldir
)
70 makensis
+= ["-DOUTFILE=" + args
.outfile
] + args
.nsisargs
71 subprocess
.run(makensis
)
72 signcode(args
.outfile
)
74 shutil
.rmtree(destdir
)
77 if __name__
== "__main__":