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

[cmake] Install in a platform-specific directory #493

Closed

Conversation

Steelskin
Copy link

The current shared library installation setup only installs the shared library into /lib. Since this is a Swift library, it should be installed in /lib/swift/${os} along with the swiftmodule directory.

The current shared library installation setup only installs the shared
library into `/lib`. Since this is a Swift library, it should be
installed in `/lib/swift/${os}` along with the swiftmodule directory.
@etcwilde
Copy link
Contributor

Since this is a Swift library, it should be installed in /lib/swift/${os} along with the swiftmodule directory.

This is actually not really a great practice that Swift has fallen into (you wouldn't see <insert random C++ library name> inside of /usr/lib/c++. <prefix>/lib/swift should really be reserved for the swift standard library, though that ship has kind of sailed. The ${os} is also an oddity since an SDK should really describe a single platform (if we see a macosx/ directory in an SDK describing Debian, we've messed up somewhere). I'd prefer that we push folks toward using the values that GNUInstallDirs sets, and then adjusting if necessary. It knows how to set the install directories for the various Linux distros, which certainly have opinions about where things should go.

@compnerd, I know you have opinions on these things too.

@Steelskin
Copy link
Author

My main concern is that the install directory is inconsistent across swift repositories. For instance, swift-argument-parser, swift-system and swift-collections install in <prefix>/lib/swift/${os} while this repo and swift-driver install in <prefix>/lib.
As another point of data, the macOS Swift toolchain installs the TSC libraries in /usr/lib/swift/macosx.

I have no idea what would be the right thing to do.

@compnerd
Copy link
Member

@etcwilde I agree that installing the libraries into /usr/lib/swift/{os} is an anti-pattern. I'd argue even the standard library should belong in /usr/lib. Using GNUInstallDirs seems like the right approach to me.

@Steelskin
Copy link
Author

I had an offline chat with @compnerd and we agreed that the dynamic libraries should be kept to the directory from GNUInstallDirs, while the swiftmodules should still be kept to the per-target directory under lib/swift/${os}. I am closing this PR and will open a new one with the correct changes.

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.

3 participants