mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-22 20:11:51 +00:00
build script: move prefix member and install() method to base target
This commit is contained in:
parent
e47d1ac69b
commit
e75ea5e3c9
1 changed files with 13 additions and 10 deletions
23
build.py
23
build.py
|
@ -38,6 +38,7 @@ class Target:
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.src_root = ''
|
self.src_root = ''
|
||||||
|
self.prefix = None
|
||||||
self.environment = os.environ
|
self.environment = os.environ
|
||||||
self.options = {}
|
self.options = {}
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ class Target:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def initialize(self, builder: 'Builder'):
|
def initialize(self, builder: 'Builder'):
|
||||||
pass
|
self.prefix = builder.deps_path + self.name
|
||||||
|
|
||||||
def detect(self, builder: 'Builder') -> bool:
|
def detect(self, builder: 'Builder') -> bool:
|
||||||
return False
|
return False
|
||||||
|
@ -64,6 +65,16 @@ class Target:
|
||||||
def post_build(self, builder: 'Builder'):
|
def post_build(self, builder: 'Builder'):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def install(self, builder: 'Builder'):
|
||||||
|
if builder.xcode:
|
||||||
|
return
|
||||||
|
|
||||||
|
if os.path.exists(self.prefix):
|
||||||
|
shutil.rmtree(self.prefix)
|
||||||
|
|
||||||
|
work_path = builder.build_path + self.src_root
|
||||||
|
subprocess.check_call(['make', 'install'], cwd=work_path)
|
||||||
|
|
||||||
|
|
||||||
class MakeTarget(Target):
|
class MakeTarget(Target):
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
|
@ -119,12 +130,9 @@ class ConfigureMakeTarget(Target):
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
self.make = MakeTarget(name)
|
self.make = MakeTarget(name)
|
||||||
self.prefix = None
|
|
||||||
|
|
||||||
def initialize(self, builder: 'Builder'):
|
def initialize(self, builder: 'Builder'):
|
||||||
super().initialize(builder)
|
super().initialize(builder)
|
||||||
|
|
||||||
self.prefix = builder.deps_path + self.name
|
|
||||||
self.options['--prefix'] = self.prefix
|
self.options['--prefix'] = self.prefix
|
||||||
|
|
||||||
self.make.initialize(builder)
|
self.make.initialize(builder)
|
||||||
|
@ -146,12 +154,6 @@ class ConfigureMakeTarget(Target):
|
||||||
|
|
||||||
self.make.build(builder)
|
self.make.build(builder)
|
||||||
|
|
||||||
def install(self, builder: 'Builder'):
|
|
||||||
shutil.rmtree(self.prefix)
|
|
||||||
|
|
||||||
work_path = builder.build_path + self.src_root
|
|
||||||
subprocess.check_call(['make', 'install'], cwd=work_path)
|
|
||||||
|
|
||||||
|
|
||||||
class CMakeTarget(Target):
|
class CMakeTarget(Target):
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
|
@ -198,6 +200,7 @@ class CMakeTarget(Target):
|
||||||
'cmake',
|
'cmake',
|
||||||
builder.xcode and '-GXcode' or '-GUnix Makefiles',
|
builder.xcode and '-GXcode' or '-GUnix Makefiles',
|
||||||
'-DCMAKE_BUILD_TYPE=Release',
|
'-DCMAKE_BUILD_TYPE=Release',
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' + self.prefix,
|
||||||
'-DCMAKE_PREFIX_PATH=' + builder.prefix_path,
|
'-DCMAKE_PREFIX_PATH=' + builder.prefix_path,
|
||||||
'-DCMAKE_OSX_DEPLOYMENT_TARGET=' + builder.os_version,
|
'-DCMAKE_OSX_DEPLOYMENT_TARGET=' + builder.os_version,
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue