Skip to content

Commit

Permalink
Merge pull request #79871 from bruvzg/mingw_prefix_fix
Browse files Browse the repository at this point in the history
[Windows] Try using objcopy and strip with prefix and without prefix.
  • Loading branch information
akien-mga committed Oct 3, 2023
2 parents 6de0613 + a0c388d commit 39bf982
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions platform/windows/platform_windows_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@
"""
import os
from detect import get_mingw_bin_prefix
from detect import try_cmd
from platform_methods import subprocess_main


def make_debug_mingw(target, source, env):
mingw_bin_prefix = get_mingw_bin_prefix(env["mingw_prefix"], env["arch"])
os.system(mingw_bin_prefix + "objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
os.system(mingw_bin_prefix + "strip --strip-debug --strip-unneeded {0}".format(target[0]))
os.system(mingw_bin_prefix + "objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))
if try_cmd("objcopy --version", env["mingw_prefix"], env["arch"]):
os.system(mingw_bin_prefix + "objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
else:
os.system("objcopy --only-keep-debug {0} {0}.debugsymbols".format(target[0]))
if try_cmd("strip --version", env["mingw_prefix"], env["arch"]):
os.system(mingw_bin_prefix + "strip --strip-debug --strip-unneeded {0}".format(target[0]))
else:
os.system("strip --strip-debug --strip-unneeded {0}".format(target[0]))
if try_cmd("objcopy --version", env["mingw_prefix"], env["arch"]):
os.system(mingw_bin_prefix + "objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))
else:
os.system("objcopy --add-gnu-debuglink={0}.debugsymbols {0}".format(target[0]))


if __name__ == "__main__":
Expand Down

0 comments on commit 39bf982

Please sign in to comment.