-
Notifications
You must be signed in to change notification settings - Fork 99
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
Support custom build script #219
Comments
I would prefer to restructure the build-script logic in the package manifest first, see #249, before implementing the logic in Fortran fpm. |
I could not find any previous discussion pertaining to the bootstrap fpm design of the build-script logic. It seems to be something that @everythingfunctional built in initially to get the project off the ground? Edit: I found a former discussion in this issue: #118 Do any of the libraries used to bootstrap fpm actually require a custom build script? If not, I don't see any reasons why not to restructure the build script logic in the manifest. Since fpm is still in an alpha stage, I don't think this will cause many problems for users. |
I did indeed come up with the initial design primarily on my own. I was trying be compatible with what I believed to be common best practice in Makefiles, but we did discuss some changes that probably ought to be made. Primarily I think we concluded that all "inputs" to the build scripts should be through environment variables prefixed with I'm open to suggestions on how such scripts should be specified and executed in |
Thanks @everythingfunctional for the explanation. I suggest we shift to #249 to figure out a specification. |
The discussion in #249 suggested we separate between one-way and two-way build scripts. This issue is for one-way build scripts. The suggestion from @awvwgk was to use the following manifest syntax: build.script = ["make", "-f", "build.mk"] # or just ["build.mk"], make extension is detected
build.script = ["sh", "build.sh"] # or just ["build.sh"], shell extension is detected
build.script = ["python", "build.py"] # or just ["build.py"], Python extension is detected
build.script = ["ruby", "build.rb"] # or just ["build.rb"], Ruby extension is detected
build.script = ["cmake"] # we might detect that it is CMake and run multiple steps for this script The one-way build script is expected to receive inputs via environment variables, and place the compiled libraries in the correct location. I think the following points from @everythingfunctional in #68 (comment) summarize what was the former Haskell implementation:
Regarding point 4, I think it should be excluded from one-way build scripts. A few questions that come to my mind:
|
The Haskell implementation assumed the top level of the project. I would initially lean towards that, but if there's a possibility that we want to support build scripts for executables and/or tests, the perhaps it should go in
I'd have to go back to the discussion to be sure, but IIRC we were leaning towards yes.
I would lean towards starting with just
I think yes, the script receives an environment variable specifying the output folder name. I used
I think it would be perfectly fine for a script to produce more outputs if it wanted too. So long as it produces the necessary library and module files for other Fortran sources to make use of it everything should be fine. Anything else produced probably shouldn't be looked at or relied upon by anything else, but I don't think that's something worth trying to enforce. |
What happens if my project depends on two packages, which export a library with the same name? Can this cause a linking problem? Does the library generated by the one-way build script need to be specified manually under the |
I think this is why fpm should dictate the name of the library to be produced. You already can't depend on two packages with the same name, and fpm uses the name of the package to determine the name of the library. Thus, fpm should dictate to a build script the name of the library file to be produced. With the above, no, you don't need to manually specify the library under the |
Would this imply the convention that a simple build script only produce one library (archive)? Or are you referring here to an Concerning your second paragraph, I was not concerned about users of the package. I know this is handled by fpm already. In my current mental model I assumed that the build script is allowed to generate any number of Addendum: I think I understand your view. I'm guessing that in the haskell-fpm, the implicit rule was that the package and the library produced by the build script share the same basename? |
For a one way build script, fpm wouldn't know that other libraries are produced. I'm guessing we're already including different build directories as include locations in the link commands, so manually adding those additional libraries to the I would argue that a package that produces more than one library should be split into separate packages. I'd say we shouldn't focus any effort trying to explicitly support packages that want to produce multiple library files. You're solution is a perfectly valid workaround (if not explicitly supported), and so we shouldn't try to prevent it, just say it's not guaranteed to be reliable. |
Match behaviour of bootstrap version
The text was updated successfully, but these errors were encountered: