Skip to content
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

builder-module: Fix cmake libdir value #610

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

bbhtt
Copy link
Contributor

@bbhtt bbhtt commented Jul 5, 2024

Fixes 8c036e0

It is being set to $prefix/lib but CMAKE_INSTALL_LIBDIR is not an absolute path by convention 1:

It should be a path relative to the installation prefix

When it is set to /app/lib, it is causing issues in applications 2

Fixes 8c036e0

It is being set to `$prefix/lib` but CMAKE_INSTALL_LIBDIR is not an
absolute path by convention [1]:

> It should be a path relative to the installation prefix

When it is set to `/app/lib`, it is causing issues in applications [2]

[1]: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#result-variables

[2]: flathub/io.github.martinrotter.rssguard#73 (comment)
@@ -1788,7 +1788,7 @@ builder_module_build_helper (BuilderModule *self,
if (libdir)
g_ptr_array_add (configure_args_arr, g_strdup_printf ("-DCMAKE_INSTALL_LIBDIR:PATH='%s'", libdir));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This libdir can also be an absolute path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's user input though, if they set wrong values they will get weird behaviour back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say the default is /app/lib. It was clearly intended to support absolute paths and it should be fine to accommodate both.

Copy link
Contributor Author

@bbhtt bbhtt Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what to do? You should be able to already set that to an absolute path if required for some reason in the manifest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

          if (libdir && g_path_is_absolute (libdir))
            g_ptr_array_add (configure_args_arr, g_strdup_printf ("-DCMAKE_INSTALL_FULL_LIBDIR:PATH='%s'", libdir));
          else if (libdir)
            g_ptr_array_add (configure_args_arr, g_strdup_printf ("-DCMAKE_INSTALL_LIBDIR:PATH='%s'", libdir));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that setting CMAKE_INSTALL_FULL_LIBDIR, will have no effect on the build if it is not being used as a variable in cmakelists.txt/in other places. I've seen very few software use the FULL paths in pkgconfig or cmakelists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAKE_INSTALL_LIBDIR is more universally used, there is also stuff that uses it wrongly as an absolute path too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm that is unfortunate.

Anyway this PR is fine, that was a pre-existing issue.

@TingPing TingPing merged commit 745d6b7 into flatpak:main Jul 5, 2024
5 checks passed
@bbhtt bbhtt deleted the bbhtt/fix-cmake-libdir branch July 5, 2024 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants