From beff29176cc98c4d414151c110d39e2656fd1efb Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Mon, 6 Sep 2021 13:12:53 +0200 Subject: fpm: new package (#25799) --- var/spack/repos/builtin/packages/fpm/package.py | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 var/spack/repos/builtin/packages/fpm/package.py diff --git a/var/spack/repos/builtin/packages/fpm/package.py b/var/spack/repos/builtin/packages/fpm/package.py new file mode 100644 index 0000000000..9401bf636c --- /dev/null +++ b/var/spack/repos/builtin/packages/fpm/package.py @@ -0,0 +1,56 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Fpm(Package): + """ + Fortran Package Manager (fpm) is a package manager and build system for Fortran. + Its key goal is to improve the user experience of Fortran programmers. + It does so by making it easier to build your Fortran program or library, run the + executables, tests, and examples, and distribute it as a dependency to other + Fortran projects. + """ + + homepage = "https://github.com/fortran-lang/fpm" + url = "https://github.com/fortran-lang/fpm/releases/download/v0.4.0/fpm-0.4.0.zip" + + maintainers = ["awvwgk"] + phases = ["install"] + + version("0.4.0", "cd9b80b7f40d9cf357ca8d5d4fe289fd32dfccb729bad7d2a68f245e4cdd0045") + version("0.3.0", "3368d1b17e2d1368559174c796ce0e184cb6bf79c939938c6d166fbd15959fa3") + + variant("openmp", default=True, description="Use OpenMP parallelisation") + + depends_on("curl", type="build") + + def setup_build_environment(self, env): + if "@0.4.0" in self.spec: + env.set("FPM_C_COMPILER", self.compiler.cc) + + fflags = "-O3" + if "+openmp" in self.spec: + fflags += " " + self.compiler.openmp_flag + env.set("FFLAGS", fflags) + + def install(self, spec, prefix): + """ + A three step bootstrapping procedure to get the fpm binary: + + 1. acquire single file source version of fpm (using curl) + 2. build bootstrap version from single file source version (using $FC) + 3. build full fpm version using bootstrap version + + This functionality is provided by the ``install.sh`` script. + """ + + script = Executable("./install.sh") + script(*self.install_args()) + + def install_args(self): + args = ["--prefix={0}".format(self.prefix)] + return args -- cgit v1.2.3-60-g2f50