File indexing completed on 2026-03-30 07:48:31
0001
0002
0003
0004
0005
0006 from spack.package import *
0007 from spack_repo.builtin.build_systems.makefile import MakefilePackage
0008 import os
0009
0010
0011 class Dawncut(MakefilePackage):
0012 """DAWNCUT is a tool to generate a 3D scene data clipped with an arbitrary plane.
0013 It reads a source DAWN-format file and outputs a new DAWN-format data,
0014 describing a plane-clipped 3D scene. The output DAWN-format data can be
0015 visualized with Fukui Renderer DAWN.
0016 """
0017
0018
0019 homepage = "https://geant4.kek.jp/~tanaka"
0020 url = "http://geant4.kek.jp/~tanaka/src/dawncut_1_54a.taz"
0021 maintainers = ["sly2j"]
0022
0023 version(
0024 "1_54a",
0025 url="http://geant4.kek.jp/~tanaka/src/dawncut_1_54a.taz",
0026 sha256="531e1f0e2ed35de3e2b1803108c0efb732d83a0c676f14083bd41a71346b4fa9",
0027 expand=False,
0028 )
0029
0030 depends_on("c", type="build")
0031 depends_on("cxx", type="build")
0032
0033 phases = ["unpack", "repatch", "edit", "build", "install"]
0034
0035 def unpack(self, spec, prefix):
0036
0037 def members(tf, tld):
0038 l = len(tld)
0039 for member in tf.getmembers():
0040 if member.path.startswith(tld):
0041 member.path = member.path[l:]
0042 yield member
0043
0044 with working_dir(self.stage.source_path):
0045 import tarfile
0046
0047 install_tar = tarfile.open("dawncut_1_54a.taz")
0048 install_tar.extractall(members=members(install_tar, "dawncut_1_54a/"))
0049
0050 def repatch(self, spec, prefix):
0051
0052 src = self.stage.source_path
0053 patches = self.package_dir
0054 which("patch")("-N", "-l", "-p1", "-i", join_path(patches, "install.patch"))
0055
0056 def edit(self, spec, prefix):
0057 makefile = FileFilter("Makefile")
0058 makefile.filter("CC= .*", "CC = " + env["CC"])
0059 makefile.filter("CXX = .*", "CXX = " + env["CXX"])
0060 os.environ["INSTALL_DIR"] = "{}/bin".format(prefix)