mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-25 21:31:25 +00:00
build script: setup environment variables for all targets
This commit is contained in:
parent
33ec97ea4b
commit
e375d23648
1 changed files with 24 additions and 24 deletions
48
build.py
48
build.py
|
@ -89,6 +89,30 @@ class Target(BaseTarget):
|
||||||
+ os.pathsep + builder.bin_path
|
+ os.pathsep + builder.bin_path
|
||||||
self.environment['PKG_CONFIG_PATH'] = builder.lib_path + 'pkgconfig'
|
self.environment['PKG_CONFIG_PATH'] = builder.lib_path + 'pkgconfig'
|
||||||
|
|
||||||
|
for prefix in ('CPP', 'C', 'CXX', 'OBJC', 'OBJCXX'):
|
||||||
|
varname = f'{prefix}FLAGS'
|
||||||
|
|
||||||
|
self._update_env(varname, f'-I{builder.include_path}')
|
||||||
|
self._set_sdk(builder, varname)
|
||||||
|
self._set_os_version(builder, varname)
|
||||||
|
|
||||||
|
ldflags = 'LDFLAGS'
|
||||||
|
self._update_env(ldflags, f'-L{builder.lib_path}')
|
||||||
|
self._set_sdk(builder, ldflags)
|
||||||
|
self._set_os_version(builder, ldflags)
|
||||||
|
|
||||||
|
def _update_env(self, name: str, value: str):
|
||||||
|
env = self.environment
|
||||||
|
env[name] = env[name] + ' ' + value if name in env else value
|
||||||
|
|
||||||
|
def _set_sdk(self, builder: 'Builder', varname: str):
|
||||||
|
if builder.sdk_path:
|
||||||
|
self._update_env(varname, f'-isysroot {builder.sdk_path}')
|
||||||
|
|
||||||
|
def _set_os_version(self, builder: 'Builder', varname: str):
|
||||||
|
if builder.os_version:
|
||||||
|
self._update_env(varname, f'-mmacosx-version-min={builder.os_version}')
|
||||||
|
|
||||||
def install(self, builder: 'Builder', options: 'CommandLineOptions' = None):
|
def install(self, builder: 'Builder', options: 'CommandLineOptions' = None):
|
||||||
if builder.xcode:
|
if builder.xcode:
|
||||||
return
|
return
|
||||||
|
@ -113,18 +137,6 @@ class MakeTarget(Target):
|
||||||
|
|
||||||
Builder.symlink_directory(builder.source_path, builder.build_path)
|
Builder.symlink_directory(builder.source_path, builder.build_path)
|
||||||
|
|
||||||
for prefix in ('CPP', 'C', 'CXX', 'OBJC', 'OBJCXX'):
|
|
||||||
varname = f'{prefix}FLAGS'
|
|
||||||
|
|
||||||
self._update_env(varname, f'-I{builder.include_path}')
|
|
||||||
self._set_sdk(builder, varname)
|
|
||||||
self._set_os_version(builder, varname)
|
|
||||||
|
|
||||||
ldflags = 'LDFLAGS'
|
|
||||||
self._update_env(ldflags, f'-L{builder.lib_path}')
|
|
||||||
self._set_sdk(builder, ldflags)
|
|
||||||
self._set_os_version(builder, ldflags)
|
|
||||||
|
|
||||||
def build(self, builder: 'Builder'):
|
def build(self, builder: 'Builder'):
|
||||||
assert not builder.xcode
|
assert not builder.xcode
|
||||||
|
|
||||||
|
@ -138,18 +150,6 @@ class MakeTarget(Target):
|
||||||
work_path = builder.build_path + self.src_root
|
work_path = builder.build_path + self.src_root
|
||||||
subprocess.check_call(args, cwd=work_path, env=self.environment)
|
subprocess.check_call(args, cwd=work_path, env=self.environment)
|
||||||
|
|
||||||
def _update_env(self, name: str, value: str):
|
|
||||||
env = self.environment
|
|
||||||
env[name] = env[name] + ' ' + value if name in env else value
|
|
||||||
|
|
||||||
def _set_sdk(self, builder: 'Builder', varname: str):
|
|
||||||
if builder.sdk_path:
|
|
||||||
self._update_env(varname, f'-isysroot {builder.sdk_path}')
|
|
||||||
|
|
||||||
def _set_os_version(self, builder: 'Builder', varname: str):
|
|
||||||
if builder.os_version:
|
|
||||||
self._update_env(varname, f'-mmacosx-version-min={builder.os_version}')
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigureMakeTarget(Target):
|
class ConfigureMakeTarget(Target):
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
|
|
Loading…
Reference in a new issue