-
Notifications
You must be signed in to change notification settings - Fork 108
Implement fpm-install command #257
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
Conversation
728516a
to
3ce893a
Compare
In the help text I like the new word "archies" but I think "archives" is probably better (It's old meaning for the ackkk-ackkk sound of anti-aircraft gunnery is pretty much obsolete, so I think it might catch on though) :> |
It would be useful long-term to be able to set access permits, ownership and group but given there is not a platform-independent way to do that with pure Fortran it is problematic, although easy to do on POSIX platforms. Do you intend it to be able to create the specified directories if needed or must all target directories pre-exisit? |
Should the default be to not rebuild and a --build switch be available instead of the opposite? I think that would be a more expected behavior. Althought the risk is low I would like to install an executable I have run tests on first, typically. |
The help_install should be added to the list of help produced when you ask for the entire manual, and the |
I haven't added file permissions yet, because I wasn't sure how to do it on non-POSIX platforms.
Actually, missing directories are automatically created.
The CMake install behaviour is exactly this, you have to invoke a separate CMake command to actually build before installing, which I find annoying. In meson install you get automatically a rebuild if required, with an incremental rebuild like in #248 we can always rebuild without much additional cost. I'm mainly orienting my strategy on the meson commands because it is in fact my main build system and I think it is well thought out.
Will add it there. |
I want to see |
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.
Thanks @awvwgk, implementation looks great and it appears to work nicely. Left a few minor comments. 👍
It would also be good to add fpm install
to the general fpm --help
/fpm help
/fpm --list
outputs.
5950357
to
bece4d7
Compare
At first glance I like it and I've been wanting something like it for a while now. A couple requests/suggestions though.
|
Sounds good, what is the preferred prefix for Windows? I usually don't use the default prefix and always set my own to cope with the various software from different sources on my machines.
Not sure about this, my expectation on the install command is to get complete project exported to another prefix. What is included in the installation should be the decision of the project maintainer rather than the user or packager. It is hard to tell as user or packager which parts of a project can be installed independently. If a project provides executables that can be installed independently, we should rather encourage splitting the project. |
If you start installing libraries from different projects, you start to reintroduce the problem sandboxing them into the project for building solved in the first place. Right now we are statically linking (at least the Haskell version is). I know it's "inefficient" because you might end up with executables with the same copy of some library, but I think it's far more common that you'll have executables that need different versions of some library. At least that's the experience other languages have had. With fpm, I no longer need to install libraries or worry about coming up with some common version that satisfies my needs for every project I'm working on. Given that, I don't know why I would ever install a library. I understand that for some people old habits die hard, and there are use cases where you would want to install a library, so I'm fine with having a way to do it, but I want a way not to do it. |
Maybe we are talking about a different problems here.
I don't disagree with this point, for executables this works completely fine. As somebody packaging I would like to see a way to opt-out of the static linking, of course 😉. I see the conflict here and don't want to impose this on fpm, because it is out of scope for the project, however I will try to implement a solution with
But for this point I disagree. There are several scenarios were I want to install a library. Use cases are
Since this cases are the exception, a project has to opt-in on installing the library. Projects that want to install a library usually will do this for a good reason. |
It seems like the default behaviour (of only installing executables) addresses your concern @everythingfunctional — are you happy for this PR move forward? |
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.
The help text should indicate the default subdirectory names lib
,bin
,include
and indicate what gets installed by default and show a few examples. Since there is not (yet?) any category for executables except test and app currently I often have dozens of demo and performance tests that I do not want installed but are currently "apps". Allowing for a list of names would help; having some way in the toml file to designated demos might be another approach; it is not clear to the user if they say to install executables will they just get executables from app/ or also from test/ and/or other directories specified in the fpm.toml file. I had to look at the code and/or empirically test to detrmine what happens with a more complex project. That needs described to the user.
I have to rebase this branch and incorporate the |
- abstract some platform specifics in the unit tests
- use $HOME/.local as user prefix on Unix platforms (fallback is /usr/local) - use %APPDATA%\local as user prefix on Windows (fallback is C:\)
- update documentation to include default settings
Thanks for you patience on this PR. I rebased against the latest changes to allow checking how the To address the comments above, by default all executables from the projects are installed, examples and tests are not considered for installation. If a project opts-in to installing a library, the archive and the module files are installed as well. |
The only not addressed issue in the PR are the file permissions on POSIX systems together with the Unless there is anything blocking this PR I will merge within the next week. |
Thank you for this implementation. I just played with it now and it works. I have three suggestions:
or something similar. Currently |
Thanks for the comments, I included a check if the project is actually installable.
The preference seems to be an executable-only focus for now, to allow library projects the opt-in
Since our help pages are currently catman pages, I try to follow the conventions for man pages here. It seems to be a convention for man pages of subcommands like |
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.
Sounds good, +1 from me.
Name conficts with man pages were designed for their suffix to be a category, as there are often conflicts. Think of test, for example.
will go directly to it. And you can list all the related man pages . So if all the man pages have the fpm suffix you can find them. In the past the solution was often to add a subcommand to your program like So there other ways; and perhaps just using topic.1fpm.gz files and adding a "man" subcommand or making Anyway, since I think those questions are unanswered that just writing it up as "install" is less confusing; albeit the git and cargo So, for example, if I enter git help rebase It actually calls man(1). Not sure how many users do the man of the git commands directly versus Anyway, I think we should expect that the main way to get on-line help will be "fpm help topic". Whether that calls man for formatting or a web browser or displays flat text or info files is then hidden from a new user. If that is true, there is no technical reason to follow the git(1) or cargo(1) convention other than how we want someone to see the pages when using man(1) directly. |
looking around, there seem to be about eight approaches. Note that openssl does both but using links instead of ".so" files:
So they make a topic.1ssl.gz file and then link openssl-genpkey.1ssl.gz to it so
all work |
@urbanjost Thanks for the explanation, my knowledge about man is limited to the content of |
A user developing a library or module (ie. does not even have an app/ directory) that they want installed for usage outside of fpm
To know they have to edit their fpm.toml file and add I think a library install should be trigged if you specify the --libdir OR --includedir switch regardless of the setting. As it is if I do
install will do nothing and produce no message, which is very unintuitive. At a minimum the help text could say something like
After trying it with more complex projects I would like it to
Although theoretically if all your components were in fpm installing libraries and modules would not be needed, External files are going to be around for a while. Users will want to make not just applications but libraries available to non-fpm users; and people will develop dynamic libraries that need to be in user load paths. |
It looks like there is some mixed opinion on the installation of libraries. I disagree that most users will want to install their library system-wide and I do not believe that we should be encouraging users to do so. Unlike the c programming language, Fortran does not have a standard ABI and hence it does not make sense for users to install their libraries system wide since the compiled library is specific to the compiler vendor and version. Moreover, there is no agreed-upon standard for where to store the necessary module files, which are similarly binary incompatible between compilers and compiler versions. As @awvwgk pointed out, there are valid exceptions to this – primarily exporting non-module (legacy) Fortran or c APIs – however most users should be using Fortran modules and, in the case of third-party build scripts, should be encouraged to be compatible as an fpm dependency by placing outputs in the correct location. As such I believe the behaviour currently implemented in this PR (only executables are installed by default) is strongly preferred. |
I'm with @LKedward on this one. There are too many issues associated with installing libraries and so we don't really want to encourage users to do it, so it shouldn't be the default. Not the least of which is that if it doesn't install the dependencies too, then the installed library still isn't usable. I think (maybe hope) that this will very quickly become the vast majority of libraries that have this problem. I think it's fine to have a way to install them, because there are times you really want to do it, but it shouldn't be the default. Other than that, I'm all good for this to go forward. |
With all the good arguments, I now agree that not installing the library is a saner default. |
@urbanjost I added the The installation of libraries is a tricky thing, we currently have no resolution of the dependencies at all, but only one library target in the |
I also do not want installing libraries to be the default unless I specify the --libdir and/or --libinclude pathnames; but the options exist |
Thanks for the clarification, I considered |
Thanks everyone for the review and discussions. I'll go ahead and merge later today. |
Noticed I require some working install command, when working on the
fpm-dist
command. Therefore, I coded up an installer type and implemented thefpm-install
command.Related #71
Command-line interface:
Installation configuration: