-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OS/2 support #14106
base: master
Are you sure you want to change the base?
Add OS/2 support #14106
Changes from all commits
d7d00e0
5c7173f
7de24f2
b803e47
b4e65a1
07657e1
c79a8f7
b02b585
9b10e28
a7bba31
ab93c96
6b40729
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,7 @@ class DFeatures(TypedDict): | |
cs_kwargs) | ||
|
||
known_exe_kwargs = known_build_target_kwargs | {'implib', 'export_dynamic', 'pie', 'vs_module_defs'} | ||
known_shlib_kwargs = known_build_target_kwargs | {'version', 'soversion', 'vs_module_defs', 'darwin_versions', 'rust_abi'} | ||
known_shlib_kwargs = known_build_target_kwargs | {'version', 'soversion', 'vs_module_defs', 'darwin_versions', 'rust_abi', 'shortname'} | ||
known_shmod_kwargs = known_build_target_kwargs | {'vs_module_defs', 'rust_abi'} | ||
known_stlib_kwargs = known_build_target_kwargs | {'pic', 'prelink', 'rust_abi'} | ||
known_jar_kwargs = known_exe_kwargs | {'main_class', 'java_resources'} | ||
|
@@ -2167,14 +2167,16 @@ def post_init(self) -> None: | |
# See our FAQ for more detailed rationale: | ||
# https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa | ||
if not hasattr(self, 'prefix'): | ||
self.prefix = 'lib' | ||
self.prefix = '' if self.environment.machines[self.for_machine].is_os2() else 'lib' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this violate the rational for why we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If meson build system requires 'lib' prefix for a static lib, I'll do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment above points to https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa which describes the reasoning:
How does OS/2 handle this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On OS/2, there are no official distinctions between static libs and an import libs. However, conventionally gcc + kLIBC uses And linkers search libraries with
If
|
||
if not hasattr(self, 'suffix'): | ||
if self.uses_rust(): | ||
if self.rust_crate_type == 'rlib': | ||
# default Rust static library suffix | ||
self.suffix = 'rlib' | ||
elif self.rust_crate_type == 'staticlib': | ||
self.suffix = 'a' | ||
elif self.environment.machines[self.for_machine].is_os2() and self.get_option(OptionKey('emxomf')): | ||
self.suffix = 'lib' | ||
else: | ||
if 'c' in self.compilers and self.compilers['c'].get_id() == 'tasking': | ||
self.suffix = 'ma' if self.options.get_value('b_lto') and not self.prelink else 'a' | ||
|
@@ -2248,6 +2250,7 @@ def __init__( | |
# Max length 2, first element is compatibility_version, second is current_version | ||
self.darwin_versions: T.Optional[T.Tuple[str, str]] = None | ||
self.vs_module_defs = None | ||
self.shortname = None | ||
# The import library this target will generate | ||
self.import_filename = None | ||
# The debugging information file this target will generate | ||
|
@@ -2372,6 +2375,15 @@ 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_os2(): | ||
suffix = 'dll' | ||
# Import library is called foo_dll.a or foo_dll.lib | ||
import_filename_tpl = '{0.name}_dll' | ||
import_filename_tpl += '.lib' if self.environment.coredata.get_option(OptionKey('emxomf')) else '.a' | ||
self.filename_tpl = '{0.shortname}' if self.shortname else '{0.name}' | ||
if self.soversion: | ||
self.filename_tpl += '{0.soversion}' | ||
self.filename_tpl += '.{0.suffix}' | ||
else: | ||
prefix = 'lib' | ||
suffix = 'so' | ||
|
@@ -2389,6 +2401,14 @@ def determine_filenames(self): | |
if self.suffix is None: | ||
self.suffix = suffix | ||
self.filename = self.filename_tpl.format(self) | ||
if self.environment.machines[self.for_machine].is_os2(): | ||
# OS/2 does not allow a longer DLL name than 8 chars | ||
name = os.path.splitext(self.filename)[0] | ||
if len(name) > 8: | ||
name = name[:8] | ||
if self.soversion: | ||
name = name[:-len(self.soversion)] + self.soversion | ||
self.filename = '{}.{}'.format(name, self.suffix) | ||
if import_filename_tpl: | ||
self.import_filename = import_filename_tpl.format(self) | ||
# There may have been more outputs added by the time we get here, so | ||
|
@@ -2418,6 +2438,9 @@ def process_kwargs(self, kwargs): | |
# Visual Studio module-definitions file | ||
self.process_vs_module_defs_kw(kwargs) | ||
|
||
# OS/2 uses a 8.3 name for a DLL | ||
self.shortname = kwargs.get('shortname') | ||
|
||
rust_abi = kwargs.get('rust_abi') | ||
rust_crate_type = kwargs.get('rust_crate_type') | ||
if rust_crate_type: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,7 @@ class ArgparseKWs(TypedDict, total=False): | |
'pkg_config_path', | ||
'cmake_prefix_path', | ||
'vsenv', | ||
'emxomf', | ||
} | ||
|
||
@total_ordering | ||
|
@@ -647,6 +648,7 @@ def add_to_argparse(self, name: str, parser: argparse.ArgumentParser, help_suffi | |
(OptionKey('wrap_mode'), BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback', 'nopromote'])), | ||
(OptionKey('force_fallback_for'), BuiltinOption(UserArrayOption, 'Force fallback for those subprojects', [])), | ||
(OptionKey('vsenv'), BuiltinOption(UserBooleanOption, 'Activate Visual Studio environment', False, readonly=True)), | ||
(OptionKey('emxomf'), BuiltinOption(UserBooleanOption, "Whether to use OMF format on OS/2", False)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how I feel about configuring the object format from a global option, I need to think more about this, but it might be more appropriate as a compiler option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think, it would be coolI if possible to change the object format without modifying meson.build file. And it's possible to prepare compiler options depending on the global option. |
||
|
||
# Pkgconfig module | ||
(OptionKey('pkgconfig.relocatable'), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'shortname' needs to be added to the documentation for shared_library in the docs section.
Additionally, in interpreter/type_checking.py you need to add:
to the
_EXCLUSIVE_SHARED_LIB_KWS
list.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll try.