forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re2c: rework package to use multiple build systems (spack#46748)
Signed-off-by: Massimiliano Culpo <[email protected]>
- Loading branch information
Showing
8 changed files
with
36 additions
and
51 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
lib/spack/spack/bootstrap/prototypes/clingo-darwin-aarch64.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
lib/spack/spack/bootstrap/prototypes/clingo-windows-x86_64.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,11 @@ | |
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
import sys | ||
|
||
from spack.build_systems import autotools, cmake | ||
from spack.package import * | ||
|
||
|
||
class Re2c(Package): | ||
class Re2c(AutotoolsPackage, CMakePackage): | ||
"""re2c: a free and open-source lexer generator for C and C++""" | ||
|
||
homepage = "https://re2c.org/index.html" | ||
|
@@ -17,63 +15,50 @@ class Re2c(Package): | |
|
||
license("Public-Domain") | ||
|
||
# Python 3.7 is required for [email protected], but the clingo bootstrap on OpenSUSE Leap uses | ||
# the system Python 3.6 such that the bootstrap fails with an UnsatisfiableVersionSpecError | ||
# version("3.1", sha256="0ac299ad359e3f512b06a99397d025cfff81d3be34464ded0656f8a96676c029") | ||
version("3.1", sha256="0ac299ad359e3f512b06a99397d025cfff81d3be34464ded0656f8a96676c029") | ||
version("3.0", sha256="b3babbbb1461e13fe22c630a40c43885efcfbbbb585830c6f4c0d791cf82ba0b") | ||
version("2.2", sha256="0fc45e4130a8a555d68e230d1795de0216dfe99096b61b28e67c86dfd7d86bda") | ||
version("2.1.1", sha256="036ee264fafd5423141ebd628890775aa9447a4c4068a6307385d7366fe711f8") | ||
version("2.1", sha256="8cba0d95c246c670de8f97f57def83a9c0f2113eaa6f7e4867a941f48f633540") | ||
version("2.0.3", sha256="b2bc1eb8aaaa21ff2fcd26507b7e6e72c5e3d887e58aa515c2155fb17d744278") | ||
version("2.0.2", sha256="6cddbb558dbfd697a729cb4fd3f095524480283b89911ca5221835d8a67ae5e0") | ||
version("2.0.1", sha256="aef8b50bb75905b2d55a7236380c0efdc756fa077fe16d808aaacbb10fb53531") | ||
version("2.0", sha256="89a9d7ee14be10e3779ea7b2c8ea4a964afce6e76b8dbcd5479940681db46d20") | ||
version("1.3", sha256="f37f25ff760e90088e7d03d1232002c2c2672646d5844fdf8e0d51a5cd75a503") | ||
version("1.2.1", sha256="1a4cd706b5b966aeffd78e3cf8b24239470ded30551e813610f9cd1a4e01b817") | ||
|
||
depends_on("c", type="build") # generated | ||
depends_on("cxx", type="build") # generated | ||
with default_args(deprecated=True): | ||
version("2.0.3", sha256="b2bc1eb8aaaa21ff2fcd26507b7e6e72c5e3d887e58aa515c2155fb17d744278") | ||
version("2.0.2", sha256="6cddbb558dbfd697a729cb4fd3f095524480283b89911ca5221835d8a67ae5e0") | ||
version("2.0.1", sha256="aef8b50bb75905b2d55a7236380c0efdc756fa077fe16d808aaacbb10fb53531") | ||
version("2.0", sha256="89a9d7ee14be10e3779ea7b2c8ea4a964afce6e76b8dbcd5479940681db46d20") | ||
version("1.3", sha256="f37f25ff760e90088e7d03d1232002c2c2672646d5844fdf8e0d51a5cd75a503") | ||
version("1.2.1", sha256="1a4cd706b5b966aeffd78e3cf8b24239470ded30551e813610f9cd1a4e01b817") | ||
|
||
phases = ["configure", "build", "install"] | ||
build_system(conditional("cmake", when="@2.2:"), "autotools", default="autotools") | ||
|
||
depends_on("cmake", when="platform=windows") | ||
depends_on("gmake", when="platform=linux") | ||
depends_on("gmake", when="platform=darwin") | ||
depends_on("gmake", when="platform=freebsd") | ||
# depends_on("python@3:", when="@3.1:", type="build") | ||
depends_on("c", type="build") | ||
depends_on("cxx", type="build") | ||
depends_on("[email protected]:", when="@3.1", type="build") | ||
|
||
@property | ||
def make_tool(self): | ||
if sys.platform == "win32": | ||
return ninja | ||
else: | ||
return make | ||
with when("build_system=cmake"): | ||
depends_on("[email protected]:", type="build") | ||
|
||
|
||
class AutotoolsBuilder(autotools.AutotoolsBuilder): | ||
def configure_args(self): | ||
return [ | ||
"--disable-benchmarks", | ||
"--disable-debug", | ||
"--disable-dependency-tracking", | ||
"--disable-docs", | ||
"--disable-lexers", # requires existing system re2c | ||
"--disable-libs", # experimental | ||
"--enable-libs", | ||
"--enable-golang", | ||
] | ||
|
||
def configure(self, spec, prefix): | ||
with working_dir(self.stage.source_path, create=True): | ||
configure("--prefix=" + prefix, *self.configure_args()) | ||
|
||
@when("platform=windows") | ||
def configure(self, spec, prefix): | ||
with working_dir(self.stage.source_path, create=True): | ||
args = ["-G", "Ninja", "-DCMAKE_INSTALL_PREFIX=%s" % prefix] | ||
cmake(*args) | ||
|
||
def build(self, spec, prefix): | ||
with working_dir(self.stage.source_path): | ||
self.make_tool() | ||
|
||
def install(self, spec, prefix): | ||
with working_dir(self.stage.source_path): | ||
self.make_tool("install") | ||
class CMakeBuilder(cmake.CMakeBuilder): | ||
def cmake_args(self): | ||
return [ | ||
self.define("RE2C_BUILD_LIBS", True), | ||
self.define("RE2C_REBUILD_DOCS", False), | ||
self.define("RE2C_REBUILD_LEXERS", False), | ||
self.define("RE2C_REBUILD_PARSERS", False), | ||
self.define("RE2C_BUILD_RE2RUST", False), | ||
self.define("RE2C_BUILD_RE2GO", False), | ||
] |