2024-03-11 18:05:37 +00:00
|
|
|
"""Functions used to generate source files during build time"""
|
2024-02-28 13:25:35 +00:00
|
|
|
|
2018-03-17 22:23:55 +00:00
|
|
|
import os
|
2023-11-17 17:31:50 +00:00
|
|
|
from detect import get_mingw_tool
|
2018-03-17 22:23:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def make_debug_mingw(target, source, env):
|
2023-11-17 17:31:50 +00:00
|
|
|
objcopy = get_mingw_tool("objcopy", env["mingw_prefix"], env["arch"])
|
|
|
|
strip = get_mingw_tool("strip", env["mingw_prefix"], env["arch"])
|
|
|
|
|
|
|
|
if not objcopy or not strip:
|
|
|
|
print('`separate_debug_symbols` requires both "objcopy" and "strip" to function.')
|
|
|
|
return
|
|
|
|
|
|
|
|
os.system("{0} --only-keep-debug {1} {1}.debugsymbols".format(objcopy, target[0]))
|
|
|
|
os.system("{0} --strip-debug --strip-unneeded {1}".format(strip, target[0]))
|
|
|
|
os.system("{0} --add-gnu-debuglink={1}.debugsymbols {1}".format(objcopy, target[0]))
|