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

Easily create a Spack package #79

Open
certik opened this issue May 14, 2020 · 8 comments
Open

Easily create a Spack package #79

certik opened this issue May 14, 2020 · 8 comments

Comments

@certik
Copy link
Member

certik commented May 14, 2020

This issue is similar to #70 but for Spack instead of Conda. Essentially for people that use Spack (myself included sometimes), it would be nice to just be able to spack install any fpm package.

To do that, fpm should be able to take any package and produce a working Spack package out of it, that can then be submitted to Spack.

The generated Spack package would probably call fpm underneath to do the build.

@awvwgk
Copy link
Member

awvwgk commented Feb 3, 2021

I haven't used spack yet, but was always tempted to try it (the somewhat second-class support for my favorite build system, meson, hold me back so far). From what I got so far about spack it seems similar to homebrew, in the way that package files are not written in a configuration language or DSL, but in Python (like formulas in homebrew are written in Ruby) and the main packages are stored inside the package manager's monolithic repository.

How can we actually create a package for spack with fpm? First, this would require to have fpm as spack package first, wouldn't it? It might be easier to follow #69 and just use spack's support for CMake to build any fpm project instead.

@certik
Copy link
Member Author

certik commented Feb 4, 2021

@awvwgk there are multiple ways this can be achieved, I don't know yet the best way forward. I think our requirements are:

  • Work with upstream fpm packages (say stdlib, f-toml, etc.) with their upstream sources (whether git or tarball) without the need to host a separate spack specific tarball
  • We submit the package to Spack, so there will be a Python formula for it, just like other Spack packages

It looks like we have at least two paths forward:

Option 1

The Spack formula calls fpm to build the package ---- Spack itself handles downloading of the tarball (or git) and unpacking it, as well as building all dependencies. But fpm could be used from the Spack formula, we would have to probably implement some command line options to tell it where spack put all the dependencies (presumably also built with fpm underneath), then fpm would build the current package and hand it over to Spack.

Option 2

The Spack formula would call fpm to generate a CMake based build system, and then it would just call cmake. The issues how to find dependencies would be similar (if not identical) to Option 1.


As such, we just have to get started and get it figured out one way or another, and if some extra arguments for fpm have to be implemented, then we can do it.

@awvwgk
Copy link
Member

awvwgk commented Sep 5, 2021

Will take a stab at writing a spack package for fpm. Once we have this it should be easy to package any fpm project in spack without extra effort in fpm.

@awvwgk
Copy link
Member

awvwgk commented Sep 6, 2021

Fpm is now available in spack develop branch: spack/spack#25799

@certik
Copy link
Member Author

certik commented Sep 6, 2021

Note that to fix this issue, I am imagining something like fpm --create-spack-package and it will take the current fpm package in the current directory, and spit out the spack Python file that can be used with Spack to build it.

@awvwgk
Copy link
Member

awvwgk commented May 19, 2022

I think rather than writing a spack package from fpm as first step, we should enable fpm to work as build system for spack by

@certik
Copy link
Member Author

certik commented May 19, 2022

@awvwgk I agree, that is higher priority.

@wyphan
Copy link
Contributor

wyphan commented May 19, 2022

Like I mentioned on Fortran Discourse forum, I recently patched the fpm package in Spack with spack/spack#30158 and spack/spack#30342 . Would love to see Option 1 happen!

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

No branches or pull requests

3 participants