From c24265fe7eca682dd1057e02cb6bfd95b985a28f Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 26 Jun 2024 15:34:20 +0200 Subject: opennurbs: multiple build systems (#44871) --- .../repos/builtin/packages/opennurbs/package.py | 30 ++++++++++------------ 1 file 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) -- cgit v1.2.3-70-g09d2