mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 02:11:24 +02:00
scripts: check minimum required macOS vesion is set
We use a compile flag (-mmacosx-version-min) to set the minimum required version of macOS needed to run our binaries. This adds a sanity check that the version is being set as expected.
This commit is contained in:
@ -212,6 +212,12 @@ def check_MACHO_libraries(filename) -> bool:
|
|||||||
ok = False
|
ok = False
|
||||||
return ok
|
return ok
|
||||||
|
|
||||||
|
def check_MACHO_min_os(filename) -> bool:
|
||||||
|
binary = lief.parse(filename)
|
||||||
|
if binary.build_version.minos == [10,14,0]:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def check_PE_libraries(filename) -> bool:
|
def check_PE_libraries(filename) -> bool:
|
||||||
ok: bool = True
|
ok: bool = True
|
||||||
binary = lief.parse(filename)
|
binary = lief.parse(filename)
|
||||||
@ -228,7 +234,8 @@ CHECKS = {
|
|||||||
('LIBRARY_DEPENDENCIES', check_ELF_libraries)
|
('LIBRARY_DEPENDENCIES', check_ELF_libraries)
|
||||||
],
|
],
|
||||||
'MACHO': [
|
'MACHO': [
|
||||||
('DYNAMIC_LIBRARIES', check_MACHO_libraries)
|
('DYNAMIC_LIBRARIES', check_MACHO_libraries),
|
||||||
|
('MIN_OS', check_MACHO_min_os),
|
||||||
],
|
],
|
||||||
'PE' : [
|
'PE' : [
|
||||||
('DYNAMIC_LIBRARIES', check_PE_libraries)
|
('DYNAMIC_LIBRARIES', check_PE_libraries)
|
||||||
|
@ -98,7 +98,7 @@ class TestSymbolChecks(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(call_symbol_check(cc, source, executable, ['-lexpat']),
|
self.assertEqual(call_symbol_check(cc, source, executable, ['-lexpat']),
|
||||||
(1, 'libexpat.1.dylib is not in ALLOWED_LIBRARIES!\n' +
|
(1, 'libexpat.1.dylib is not in ALLOWED_LIBRARIES!\n' +
|
||||||
executable + ': failed DYNAMIC_LIBRARIES'))
|
executable + ': failed DYNAMIC_LIBRARIES MIN_OS'))
|
||||||
|
|
||||||
source = 'test2.c'
|
source = 'test2.c'
|
||||||
executable = 'test2'
|
executable = 'test2'
|
||||||
@ -114,6 +114,19 @@ class TestSymbolChecks(unittest.TestCase):
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
self.assertEqual(call_symbol_check(cc, source, executable, ['-framework', 'CoreGraphics']),
|
self.assertEqual(call_symbol_check(cc, source, executable, ['-framework', 'CoreGraphics']),
|
||||||
|
(1, executable + ': failed MIN_OS'))
|
||||||
|
|
||||||
|
source = 'test3.c'
|
||||||
|
executable = 'test3'
|
||||||
|
with open(source, 'w', encoding="utf8") as f:
|
||||||
|
f.write('''
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
''')
|
||||||
|
|
||||||
|
self.assertEqual(call_symbol_check(cc, source, executable, ['-mmacosx-version-min=10.14']),
|
||||||
(0, ''))
|
(0, ''))
|
||||||
|
|
||||||
def test_PE(self):
|
def test_PE(self):
|
||||||
|
Reference in New Issue
Block a user