Skip to content

Commit

Permalink
[WIP]: envconfig: Add support for secure operation system
Browse files Browse the repository at this point in the history
There are many secure operation systems likes optee from linaro,
trusty from Google, and many SoC vendor has its own proprietary
one.

They don't really share many APIs, we could build trusted
application with meson as long as you prepare a proper
staging sysroot and correct cross properties.
  • Loading branch information
hizukiayaka committed Oct 23, 2023
1 parent ae7a9b0 commit 12d37f7
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 @@ -160,6 +160,7 @@ These are provided by the `.system()` method call.
| linux | |
| netbsd | |
| openbsd | |
| teeos | Any secure Operating System, likes optee, trusty |
| windows | Any version of Windows |
| sunos | illumos and Solaris |

Expand Down
6 changes: 6 additions & 0 deletions mesonbuild/envconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ def is_openbsd(self) -> bool:
"""
return self.system == 'openbsd'

def is_teeos(self) -> bool:
"""
Machine is a secure Operating System (optee/trusty)
"""
return self.system == 'teeos'

def is_dragonflybsd(self) -> bool:
"""Machine is DragonflyBSD?"""
return self.system == 'dragonfly'
Expand Down
3 changes: 2 additions & 1 deletion mesonbuild/linkers/linkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,8 @@ def import_library_args(self, implibname: str) -> T.List[str]:
return self._apply_prefix('--out-implib=' + implibname)

def thread_flags(self, env: 'Environment') -> T.List[str]:
if env.machines[self.for_machine].is_haiku():
m = env.machines[self.for_machine]
if m.is_haiku() or m.is_teeos():
return []
return ['-pthread']

Expand Down
5 changes: 5 additions & 0 deletions mesonbuild/utils/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class _VerPickleLoadable(Protocol):
'is_osx',
'is_qnx',
'is_sunos',
'is_teeos',
'is_windows',
'is_wsl',
'iter_regexin_iter',
Expand Down Expand Up @@ -650,6 +651,10 @@ def is_openbsd() -> bool:
return platform.system().lower() == 'openbsd'


def is_teeos() -> bool:
return platform.system().lower() == 'teeos'


def is_windows() -> bool:
platname = platform.system().lower()
return platname == 'windows'
Expand Down
2 changes: 2 additions & 0 deletions test cases/common/132 get define/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ system_define_map = {
# being run on various versions of FreeBSD, just test that the define is
# set.
'freebsd' : ['__FreeBSD__'],
# TEE likes OpenTEE didn't define any thing
'teeos' : [],
}

foreach lang : ['c', 'cpp']
Expand Down

0 comments on commit 12d37f7

Please sign in to comment.