mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2025-01-31 12:00:35 +00:00
rewrite pkg-config wrapper as python script
set config path and improve logging
This commit is contained in:
parent
f3da8a302d
commit
eadc423867
2 changed files with 60 additions and 4 deletions
1
build.py
1
build.py
|
@ -87,7 +87,6 @@ class Target(BaseTarget):
|
|||
self.environment['PATH'] = self.environment['PATH'] \
|
||||
+ os.pathsep + '/Applications/CMake.app/Contents/bin' \
|
||||
+ os.pathsep + builder.bin_path
|
||||
self.environment['PKG_CONFIG_PATH'] = builder.lib_path + 'pkgconfig'
|
||||
|
||||
for prefix in ('CPP', 'C', 'CXX', 'OBJC', 'OBJCXX'):
|
||||
varname = f'{prefix}FLAGS'
|
||||
|
|
63
deps/pkg-config/bin/pkg-config
vendored
63
deps/pkg-config/bin/pkg-config
vendored
|
@ -1,3 +1,60 @@
|
|||
#!/bin/sh
|
||||
echo "% pkg-config $*" >> pkg-config.log
|
||||
"`dirname \"$0\"`/pkg-config.exe" --define-prefix $*
|
||||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Helper module to build macOS version of various source ports
|
||||
# Copyright (C) 2020 Alexey Lysiuk
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def _main():
|
||||
args = sys.argv[1:]
|
||||
|
||||
with open('pkg-config.log', 'a') as log:
|
||||
cmdline = ' '.join(map(shlex.quote, args))
|
||||
log.write(f'% pkg-config {cmdline}\n')
|
||||
|
||||
bin_path = os.path.dirname(os.path.abspath(__file__)) + os.sep
|
||||
prefix_path = os.path.abspath(bin_path + os.pardir) + os.sep
|
||||
config_path = prefix_path + 'lib/pkgconfig'
|
||||
|
||||
environment = os.environ
|
||||
environment['PKG_CONFIG_PATH'] = config_path
|
||||
|
||||
args = [bin_path + 'pkg-config.exe', '--define-prefix'] + args
|
||||
result = subprocess.run(args, env=environment, capture_output=True)
|
||||
|
||||
stdout = result.stdout.decode('ascii')
|
||||
stderr = result.stderr.decode('ascii')
|
||||
|
||||
with open('pkg-config.log', 'a') as log:
|
||||
log.write('out> ')
|
||||
log.write(stdout if stdout else '\n')
|
||||
log.write('err> ')
|
||||
log.write(stderr if stderr else '\n')
|
||||
|
||||
sys.stdout.write(stdout)
|
||||
sys.stderr.write(stderr)
|
||||
|
||||
sys.exit(result.returncode)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
_main()
|
||||
|
|
Loading…
Reference in a new issue