From 674990499795b93fc280e28081dfa7ac4c37c93f Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 1 Nov 2023 20:35:43 -0500 Subject: [PATCH 1/2] adding gcc-runtime package --- packages/gcc-runtime/package.py | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/gcc-runtime/package.py diff --git a/packages/gcc-runtime/package.py b/packages/gcc-runtime/package.py new file mode 100644 index 00000000..4a8dcfae --- /dev/null +++ b/packages/gcc-runtime/package.py @@ -0,0 +1,48 @@ +# Copyright 2013-2023 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.package import * +import os + + +class GccRuntime(Package): + """FIXME: Put a proper description of your package here.""" + + homepage = "https://github.com/FNALssi/" + url = "file:///dev/null" + + maintainers("marcmengel") + + version("see_compiler", sha256="364fd6d448b2398150a4d8aa3a3d3564a373aeb7dfb3a477f56685a356c88159") + + def url_for_version(self, version): + + if not os.access("/tmp/empty.tar",os.R_OK): + tdir = "/tmp/empty" + str(os.getpid()) + os.mkdir(tdir) + tar=which("tar") + with working_dir(tdir): + # --mtime=@0 gives consistent tarfile checksum... + tar("cf", "/tmp/empty.tar", ".", "--mtime=@0") + os.rmdir(tdir) + + url = 'file:///tmp/empty.tar' + return url + + + def install(self, spec, prefix): + libdir='' + cdir = os.path.dirname(os.path.dirname(self.compiler.cxx)) + for path, dirnames, filenames in os.walk(cdir): + if 'libstdc++.so' in filenames: + libdir = path + break + if libdir: + os.makedirs(prefix.lib) + install_tree(libdir, prefix.lib) + + def setup_dependent_runtime_environment(self, env): + env.append_flags("LDFLAGS", "-L"+self.prefix.lib) From b109d21cbb4bbb2c544ad6a417d425bfd9900339 Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Tue, 7 Nov 2023 13:44:10 -0600 Subject: [PATCH 2/2] find shortest path with libstdc++, finds libc_s, etc. that way --- packages/gcc-runtime/package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/gcc-runtime/package.py b/packages/gcc-runtime/package.py index 4a8dcfae..5f5c46a6 100644 --- a/packages/gcc-runtime/package.py +++ b/packages/gcc-runtime/package.py @@ -36,10 +36,11 @@ def url_for_version(self, version): def install(self, spec, prefix): libdir='' cdir = os.path.dirname(os.path.dirname(self.compiler.cxx)) + # find shortest pathname in cdir that has libstdc++.so in it... for path, dirnames, filenames in os.walk(cdir): if 'libstdc++.so' in filenames: - libdir = path - break + if not libdir or len(path) < len(libdir): + libdir = path if libdir: os.makedirs(prefix.lib) install_tree(libdir, prefix.lib)