Skip to content

Commit

Permalink
Support for UEFI target
Browse files Browse the repository at this point in the history
  • Loading branch information
RossComputerGuy committed Dec 23, 2024
1 parent 0025805 commit d3d4aad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/markdown/Reference-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ These are provided by the `.system()` method call.
| openbsd | |
| windows | Native Windows (not Cygwin or MSYS2) |
| sunos | illumos and Solaris |
| uefi | |

Any string not listed above is not guaranteed to remain stable in
future releases.
Expand Down
4 changes: 4 additions & 0 deletions mesonbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2366,6 +2366,10 @@ def determine_filenames(self):
suffix = 'so'
# Android doesn't support shared_library versioning
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
elif self.environment.machines[self.for_machine].is_uefi():
prefix = 'lib'
suffix = 'lib'
self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
else:
prefix = 'lib'
suffix = 'so'
Expand Down
8 changes: 7 additions & 1 deletion mesonbuild/envconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,12 +366,18 @@ def is_irix(self) -> bool:
"""Machine is IRIX?"""
return self.system.startswith('irix')

def is_uefi(self) -> bool:
"""Machine is UEFI?"""
return self.system == 'uefi'

# Various prefixes and suffixes for import libraries, shared libraries,
# static libraries, and executables.
# Versioning is added to these names in the backends as-needed.
def get_exe_suffix(self) -> str:
if self.is_windows() or self.is_cygwin():
return 'exe'
elif self.is_uefi():
return 'efi'
else:
return ''

Expand All @@ -382,7 +388,7 @@ def get_object_suffix(self) -> str:
return 'o'

def libdir_layout_is_win(self) -> bool:
return self.is_windows() or self.is_cygwin()
return self.is_windows() or self.is_cygwin() or self.is_uefi()

class BinaryTable:

Expand Down
3 changes: 3 additions & 0 deletions mesonbuild/utils/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ def is_qnx() -> bool:
def is_aix() -> bool:
return platform.system().lower() == 'aix'

def is_uefi() -> bool:
return platform.system().lower() == 'uefi'

@lru_cache(maxsize=None)
def darwin_get_object_archs(objpath: str) -> 'ImmutableListProtocol[str]':
'''
Expand Down
1 change: 1 addition & 0 deletions test cases/common/132 get define/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ system_define_map = {
'openbsd' : ['__OpenBSD__', '1'],
'gnu' : ['__GNU__', '1'],
'sunos' : ['__sun__', '1'],
'uefi' : ['__uefi__', '1'],

# The __FreeBSD__ define will be equal to the major version of the release
# (ex, in FreeBSD 11.x, __FreeBSD__ == 11). To make the test robust when
Expand Down

0 comments on commit d3d4aad

Please sign in to comment.