Skip to content

Commit

Permalink
haiku: fix devel lib install path
Browse files Browse the repository at this point in the history
Haiku have separate install paths for libraries used by runtime loader
and compiler. Runtime loader library search path is `$prefix/lib`.
Compiler search path (for `ld -lXXX` argumets) is `$prefix/develop/lib`.
  • Loading branch information
X547 committed Jan 30, 2025
1 parent c616f1e commit 87ade04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,12 @@ def generate_target_install(self, d: InstallData) -> None:
d.targets.append(i)

for alias, to, tag in t.get_aliases():
alias = os.path.join(first_outdir, alias)
symlinkDir = first_outdir
if tag == 'devel':
symlinkDir = self.environment.get_import_lib_dir()
alias = os.path.join(symlinkDir, alias)
if first_outdir != symlinkDir:
to = os.path.join(os.path.relpath(first_outdir, symlinkDir), to)
s = InstallSymlinkData(to, alias, first_outdir, t.subproject, tag, allow_missing=True)
d.symlinks.append(s)

Expand Down
6 changes: 6 additions & 0 deletions mesonbuild/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,9 @@ def get_build_dir(self) -> str:

def get_import_lib_dir(self) -> str:
"Install dir for the import library (library used for linking)"
m = self.machines.host
if m.is_haiku():
return 'develop/lib'
return self.get_libdir()

def get_shared_module_dir(self) -> str:
Expand All @@ -933,6 +936,9 @@ def get_jar_dir(self) -> str:

def get_static_lib_dir(self) -> str:
"Install dir for the static library"
m = self.machines.host
if m.is_haiku():
return 'develop/lib'
return self.get_libdir()

def get_prefix(self) -> str:
Expand Down
5 changes: 4 additions & 1 deletion mesonbuild/modules/pkgconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ def _generate_pkgconfig_file(self, state: ModuleState, deps: DependenciesHelper,
if optname == 'prefix':
ofile.write('prefix={}\n'.format(self._escape(prefix)))
else:
dirpath = PurePath(_as_str(coredata.get_option(OptionKey(optname))))
if optname == 'libdir':
dirpath = PurePath(state.environment.get_import_lib_dir())
else:
dirpath = PurePath(_as_str(coredata.get_option(OptionKey(optname))))
ofile.write('{}={}\n'.format(optname, self._escape('${prefix}' / dirpath)))
if uninstalled and not dataonly:
ofile.write('srcdir={}\n'.format(self._escape(srcdir)))
Expand Down

0 comments on commit 87ade04

Please sign in to comment.