summaryrefslogtreecommitdiffstats
path: root/platform/windows/platform_windows_builders.py
blob: fc52e3945601a5d2e15c879eff582de5fdca7554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""Functions used to generate source files during build time"""

import os
from detect import get_mingw_tool


def make_debug_mingw(target, source, env):
    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]))