summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-06-26 15:34:20 +0200
committerGitHub <noreply@github.com>2024-06-26 15:34:20 +0200
commitc24265fe7eca682dd1057e02cb6bfd95b985a28f (patch)
tree15cd44277b8d4c1b904293dae3aa00e0629584a0
parent9d0102ac89ec009301437d27e0a6d40c8d3eb98c (diff)
downloadspack-c24265fe7eca682dd1057e02cb6bfd95b985a28f.tar.gz
spack-c24265fe7eca682dd1057e02cb6bfd95b985a28f.tar.bz2
spack-c24265fe7eca682dd1057e02cb6bfd95b985a28f.tar.xz
spack-c24265fe7eca682dd1057e02cb6bfd95b985a28f.zip
opennurbs: multiple build systems (#44871)
-rw-r--r--var/spack/repos/builtin/packages/opennurbs/package.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/var/spack/repos/builtin/packages/opennurbs/package.py b/var/spack/repos/builtin/packages/opennurbs/package.py
index cd583f0f88..68e0ec1b3a 100644
--- a/var/spack/repos/builtin/packages/opennurbs/package.py
+++ b/var/spack/repos/builtin/packages/opennurbs/package.py
@@ -4,10 +4,11 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+from spack.build_systems import cmake, makefile
from spack.package import *
-class Opennurbs(Package):
+class Opennurbs(CMakePackage, MakefilePackage):
"""OpenNURBS is an open-source NURBS-based geometric modeling library
and toolset, with meshing and display / output functions.
"""
@@ -20,34 +21,31 @@ class Opennurbs(Package):
license("Zlib")
version("develop", branch="develop")
-
version(
"percept",
sha256="d12a8f14f0b27d286fb7a75ab3c4e300f77d1fbb028326d1c8d28e4641605538",
url="https://github.com/PerceptTools/percept/raw/master/build-cmake/opennurbs-percept.tar.gz",
)
+ build_system(
+ conditional("cmake", when="@1:"), conditional("makefile", when="@:0"), default="cmake"
+ )
+
variant("shared", default=True, description="Build shared libraries")
- # CMake installation method
- def install(self, spec, prefix):
- cmake_args = [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
- cmake_args.extend(std_cmake_args)
+class CMakeBuilder(cmake.CMakeBuilder):
+ def cmake_args(self):
+ return [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
+
- with working_dir("spack-build", create=True):
- cmake("..", *cmake_args)
- make()
- make("install")
+class MakefileBuilder(makefile.MakefileBuilder):
- # Pre-cmake installation method
- @when("@percept")
- def install(self, spec, prefix):
- make(parallel=False)
+ def build(self, pkg, spec, prefix):
+ make("RM=rm -f", "AR=ar cr", f"CC={spack_cc}", f"CCC={spack_cxx}", parallel=False)
- # Install manually
+ def install(self, pkg, spec, prefix):
mkdir(prefix.lib)
mkdir(prefix.include)
install("libopenNURBS.a", prefix.lib)
- install_tree("zlib", join_path(prefix.include, "zlib"))
install("*.h", prefix.include)