Chapel 2.4 (#49662)

* limit some patches by chapel version

* fix short output version if building main

* update patches, remove unneeded 'self' refs

* fix spack style

* update patches with changes from PR

* change py-protobuf to just protobuf dep

* add PR numbers for patches

* fix spack style

* update 2.4 sha256
This commit is contained in:
arezaii 2025-03-25 10:01:58 -06:00 committed by GitHub
parent 20ddb85020
commit 9ac6ecd5ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 165 additions and 82 deletions

View File

@ -1,46 +1,87 @@
diff --git a/util/chplenv/chpl_home_utils.py b/util/chplenv/chpl_home_utils.py
index 5d85153835..b08fc2fc93 100644
--- a/util/chplenv/chpl_home_utils.py
+++ b/util/chplenv/chpl_home_utils.py
@@ -54,6 +54,45 @@ install_path_regex = re.compile(
os.path.sep,
os.path.sep))
+@memoize
+def get_chpl_configured_install_lib_prefix():
+ # gets the path to the lib directory for a prefix install, or None if not
+ # a prefix install
+ chpl_home = str(os.getenv("CHPL_HOME"))
+ if os.path.exists(os.path.join(chpl_home, "configured-prefix")):
+ with open(os.path.join(chpl_home, "CMakeLists.txt"), "r") as f:
+ # read CMakeLists.txt to get the CHPL_MAJOR_VERSION and
+ # CHPL_MINOR_VERSION and then construct the path from that
+ chpl_major_version = None
+ chpl_minor_version = None
+ for line in f:
+ if "set(CHPL_MAJOR_VERSION" in line:
+ chpl_major_version = line.split()[1].strip(")")
+ if "set(CHPL_MINOR_VERSION" in line:
+ chpl_minor_version = line.split()[1].strip(")")
+ if (
+ chpl_major_version is not None
+ and chpl_minor_version is not None
+ ):
+ break
+ assert chpl_major_version is not None and chpl_minor_version is not None
+ chpl_version_string = "{}.{}".format(
+ chpl_major_version,
+ chpl_minor_version,
+ )
+ chpl_prefix = None
+ with open(os.path.join(chpl_home, "configured-prefix"), "r") as f:
+ chpl_prefix = f.read().strip()
+ assert chpl_prefix != "" and chpl_prefix is not None
+ return os.path.join(
+ chpl_prefix,
+ "lib",
+ "chapel",
+ chpl_version_string,
+ "compiler",
+ )
+ return None
+
@memoize
def get_chpl_version_from_install():
if get_prefix_install_prefix():
@@ -189,6 +228,8 @@ def _main():
)
parser.add_option('--using-module', action='store_const',
dest='func', const=using_chapel_module)
+ parser.add_option('--configured-install-lib-prefix', action='store_const',
+ dest='func', const=get_chpl_configured_install_lib_prefix)
(options, args) = parser.parse_args()
if options.func:
diff --git a/tools/chapel-py/setup.py b/tools/chapel-py/setup.py diff --git a/tools/chapel-py/setup.py b/tools/chapel-py/setup.py
index bee452790c..58ec46d7e6 100644 index 0f3dd9fea0..9be2a48cff 100644
--- a/tools/chapel-py/setup.py --- a/tools/chapel-py/setup.py
+++ b/tools/chapel-py/setup.py +++ b/tools/chapel-py/setup.py
@@ -46,7 +46,37 @@ host_cc = str(chpl_variables.get("CHPL_HOST_CC")) @@ -47,6 +47,18 @@ host_cxx = str(chpl_variables.get("CHPL_HOST_CXX"))
host_cxx = str(chpl_variables.get("CHPL_HOST_CXX"))
host_bin_subdir = str(chpl_variables.get("CHPL_HOST_BIN_SUBDIR")) host_bin_subdir = str(chpl_variables.get("CHPL_HOST_BIN_SUBDIR"))
+
+# construct the chpl_lib_path from chpl_home, or use the configured-prefix if it exists
+
chpl_lib_path = os.path.join(chpl_home, "lib", "compiler", host_bin_subdir) chpl_lib_path = os.path.join(chpl_home, "lib", "compiler", host_bin_subdir)
+chpl_install_lib_path = None +# For installations using --prefix, the build and final lib paths are going to
+if os.path.exists(os.path.join(chpl_home, "configured-prefix")): +# differ. figure out the install location now and write it to the rpath
+ with open(os.path.join(chpl_home, "CMakeLists.txt"), "r") as f: +chpl_home_utils = os.path.join(
+ # read CMakeLists.txt to get the CHPL_MAJOR_VERSION and CHPL_MINOR_VERSION + chpl_home, "util", "chplenv", "chpl_home_utils.py"
+ # and then construct the path from that +)
+ chpl_major_version = None +chpl_install_lib_path = (
+ chpl_minor_version = None + subprocess.check_output(
+ for line in f: + ["python", chpl_home_utils, "--configured-install-lib-prefix"],
+ if "set(CHPL_MAJOR_VERSION" in line: + )
+ chpl_major_version = line.split()[1].strip(')') + .decode(sys.stdout.encoding)
+ if "set(CHPL_MINOR_VERSION" in line: + .strip()
+ chpl_minor_version = line.split()[1].strip(')') +)
+ if chpl_major_version is not None and chpl_minor_version is not None:
+ break
+ assert(chpl_major_version is not None and chpl_minor_version is not None)
+ chpl_version_string = "{}.{}".format(chpl_major_version, chpl_minor_version)
+ chpl_prefix = None
+ with open(os.path.join(chpl_home, "configured-prefix"), "r") as f:
+ chpl_prefix = f.read().strip()
+ assert(chpl_prefix is not None)
+ chpl_install_lib_path = os.path.join(
+ chpl_prefix,
+ "lib",
+ "chapel",
+ chpl_version_string,
+ "compiler"
+ )
CXXFLAGS = [] CXXFLAGS = []
if have_llvm and have_llvm != "none": if have_llvm and have_llvm != "none":
@@ -64,10 +94,14 @@ CXXFLAGS += ["-std=c++17", "-I{}/frontend/include".format(chpl_home)] @@ -64,11 +76,16 @@ CXXFLAGS += ["-std=c++17", "-I{}/frontend/include".format(chpl_home)]
LDFLAGS = [] LDFLAGS = []
LDFLAGS += [ LDFLAGS += [
"-L{}".format(chpl_lib_path), "-L{}".format(chpl_lib_path),
@ -49,11 +90,13 @@ index bee452790c..58ec46d7e6 100644
- "-Wl,-rpath", - "-Wl,-rpath",
- chpl_lib_path, - chpl_lib_path,
] ]
+if chpl_install_lib_path is not None:
+if chpl_install_lib_path != "None":
+ LDFLAGS += [ + LDFLAGS += [
+ "-L{}".format(chpl_install_lib_path), + "-L{}".format(chpl_install_lib_path),
+ "-Wl,-rpath,{}".format(chpl_install_lib_path), + "-Wl,-rpath,{}".format(chpl_install_lib_path),
+ ] + ]
+
if str(chpl_variables.get("CHPL_SANITIZE")) == "address": os.environ["CC"] = host_cc
if str(chpl_variables.get("CHPL_HOST_PLATFORM")) == "darwin": os.environ["CXX"] = host_cxx
setup(

View File

@ -1,49 +1,31 @@
diff --git a/tools/chapel-py/setup.py b/tools/chapel-py/setup.py diff --git a/tools/chapel-py/setup.py b/tools/chapel-py/setup.py
index 30c2708724..3921143def 100644 index 30c2708724..0cf576ab25 100644
--- a/tools/chapel-py/setup.py --- a/tools/chapel-py/setup.py
+++ b/tools/chapel-py/setup.py +++ b/tools/chapel-py/setup.py
@@ -47,6 +47,36 @@ host_cxx = str(chpl_variables.get("CHPL_HOST_CXX")) @@ -47,6 +47,18 @@ host_cxx = str(chpl_variables.get("CHPL_HOST_CXX"))
host_bin_subdir = str(chpl_variables.get("CHPL_HOST_BIN_SUBDIR")) host_bin_subdir = str(chpl_variables.get("CHPL_HOST_BIN_SUBDIR"))
chpl_lib_path = os.path.join(chpl_home, "lib", "compiler", host_bin_subdir) chpl_lib_path = os.path.join(chpl_home, "lib", "compiler", host_bin_subdir)
+# For installations using --prefix, the lib final lib path is going to be different +# For installations using --prefix, the build and final lib paths are going to
+# figure it out now and write it to the rpath +# differ figure out the install location now and write it to the rpath
+chpl_install_lib_path = None +chpl_home_utils = os.path.join(
+if os.path.exists(os.path.join(chpl_home, "configured-prefix")): + chpl_home, "util", "chplenv", "chpl_home_utils.py"
+ with open(os.path.join(chpl_home, "CMakeLists.txt"), "r") as f: +)
+ # read CMakeLists.txt to get the CHPL_MAJOR_VERSION and CHPL_MINOR_VERSION +chpl_install_lib_path = (
+ # and then construct the path from that + subprocess.check_output(
+ chpl_major_version = None + ["python", chpl_home_utils, "--configured-install-lib-prefix"],
+ chpl_minor_version = None + )
+ for line in f: + .decode(sys.stdout.encoding)
+ if "set(CHPL_MAJOR_VERSION" in line: + .strip()
+ chpl_major_version = line.split()[1].strip(')') +)
+ if "set(CHPL_MINOR_VERSION" in line:
+ chpl_minor_version = line.split()[1].strip(')')
+ if chpl_major_version is not None and chpl_minor_version is not None:
+ break
+ assert(chpl_major_version is not None and chpl_minor_version is not None)
+ chpl_version_string = "{}.{}".format(chpl_major_version, chpl_minor_version)
+ chpl_prefix = None
+ with open(os.path.join(chpl_home, "configured-prefix"), "r") as f:
+ chpl_prefix = f.read().strip()
+ assert(chpl_prefix is not None)
+ chpl_install_lib_path = os.path.join(
+ chpl_prefix,
+ "lib",
+ "chapel",
+ chpl_version_string,
+ "compiler"
+ )
+
CXXFLAGS = [] CXXFLAGS = []
if have_llvm and have_llvm != "none": if have_llvm and have_llvm != "none":
@@ -68,6 +98,12 @@ LDFLAGS += [ @@ -68,6 +80,12 @@ LDFLAGS += [
"-lChplFrontendShared", "-lChplFrontendShared",
] ]
+if chpl_install_lib_path is not None: +if chpl_install_lib_path != "None":
+ LDFLAGS += [ + LDFLAGS += [
+ "-L{}".format(chpl_install_lib_path), + "-L{}".format(chpl_install_lib_path),
+ "-Wl,-rpath,{}".format(chpl_install_lib_path), + "-Wl,-rpath,{}".format(chpl_install_lib_path),
@ -52,3 +34,63 @@ index 30c2708724..3921143def 100644
if str(chpl_variables.get("CHPL_SANITIZE")) == "address": if str(chpl_variables.get("CHPL_SANITIZE")) == "address":
if str(chpl_variables.get("CHPL_HOST_PLATFORM")) == "darwin": if str(chpl_variables.get("CHPL_HOST_PLATFORM")) == "darwin":
sys.exit( sys.exit(
diff --git a/util/chplenv/chpl_home_utils.py b/util/chplenv/chpl_home_utils.py
index 5f09ffed15..4b93849acd 100644
--- a/util/chplenv/chpl_home_utils.py
+++ b/util/chplenv/chpl_home_utils.py
@@ -54,6 +54,46 @@ install_path_regex = re.compile(
os.path.sep,
os.path.sep))
+@memoize
+def get_chpl_configured_install_lib_prefix():
+ # gets the path to the lib directory for a prefix install, or None if not
+ # a prefix install
+ chpl_home = str(os.getenv("CHPL_HOME"))
+ if os.path.exists(os.path.join(chpl_home, "configured-prefix")):
+ with open(os.path.join(chpl_home, "CMakeLists.txt"), "r") as f:
+ # read CMakeLists.txt to get the CHPL_MAJOR_VERSION and
+ # CHPL_MINOR_VERSION and then construct the path from that
+ chpl_major_version = None
+ chpl_minor_version = None
+ for line in f:
+ if "set(CHPL_MAJOR_VERSION" in line:
+ chpl_major_version = line.split()[1].strip(")")
+ if "set(CHPL_MINOR_VERSION" in line:
+ chpl_minor_version = line.split()[1].strip(")")
+ if (
+ chpl_major_version is not None
+ and chpl_minor_version is not None
+ ):
+ break
+ assert chpl_major_version is not None and chpl_minor_version is not None
+ chpl_version_string = "{}.{}".format(
+ chpl_major_version,
+ chpl_minor_version,
+ )
+ chpl_prefix = None
+ with open(os.path.join(chpl_home, "configured-prefix"), "r") as f:
+ chpl_prefix = f.read().strip()
+ # Problems with the configured-prefix file - maybe empty
+ assert chpl_prefix != "" and chpl_prefix is not None
+ return os.path.join(
+ chpl_prefix,
+ "lib",
+ "chapel",
+ chpl_version_string,
+ "compiler",
+ )
+ return None
+
@memoize
def get_chpl_version_from_install():
if get_prefix_install_prefix():
@@ -189,6 +229,8 @@ def _main():
)
parser.add_option('--using-module', action='store_const',
dest='func', const=using_chapel_module)
+ parser.add_option('--configured-install-lib-prefix', action='store_const',
+ dest='func', const=get_chpl_configured_install_lib_prefix)
(options, args) = parser.parse_args()
if options.func:

View File

@ -58,6 +58,7 @@ class Chapel(AutotoolsPackage, CudaPackage, ROCmPackage):
version("main", branch="main") version("main", branch="main")
version("2.4.0", sha256="a51a472488290df12d1657db2e7118ab519743094f33650f910d92b54c56f315")
version("2.3.0", sha256="0185970388aef1f1fae2a031edf060d5eac4eb6e6b1089e7e3b15a130edd8a31") version("2.3.0", sha256="0185970388aef1f1fae2a031edf060d5eac4eb6e6b1089e7e3b15a130edd8a31")
version("2.2.0", sha256="bb16952a87127028031fd2b56781bea01ab4de7c3466f7b6a378c4d8895754b6") version("2.2.0", sha256="bb16952a87127028031fd2b56781bea01ab4de7c3466f7b6a378c4d8895754b6")
version("2.1.0", sha256="72593c037505dd76e8b5989358b7580a3fdb213051a406adb26a487d26c68c60") version("2.1.0", sha256="72593c037505dd76e8b5989358b7580a3fdb213051a406adb26a487d26c68c60")
@ -71,9 +72,9 @@ class Chapel(AutotoolsPackage, CudaPackage, ROCmPackage):
depends_on("cxx", type="build") # generated depends_on("cxx", type="build") # generated
patch("fix_spack_cc_wrapper_in_cray_prgenv.patch", when="@2.0.0:") patch("fix_spack_cc_wrapper_in_cray_prgenv.patch", when="@2.0.0:")
patch("fix_chpl_shared_lib_path.patch", when="@2.1:2.2 +python-bindings") patch("fix_chpl_shared_lib_path.patch", when="@2.1.1:2.2 +python-bindings") # PR 26388
patch("fix_chpl_shared_lib_path_2.3.patch", when="@2.2.1: +python-bindings") patch("fix_chpl_shared_lib_path_2.3.patch", when="@2.2.1:2.3 +python-bindings") # PR 26388
patch("fix_chpl_line_length.patch") patch("fix_chpl_line_length.patch", when="@:2.3.0") # PRs 26357, 26381, 26491
patch("fix_checkChplInstall.patch", when="@:2.3.0") # PR 26317 patch("fix_checkChplInstall.patch", when="@:2.3.0") # PR 26317
patch("fix_llvm_include_path_2.3.patch", when="@=2.3.0 llvm=bundled") # PR 26402 patch("fix_llvm_include_path_2.3.patch", when="@=2.3.0 llvm=bundled") # PR 26402
@ -142,7 +143,7 @@ class Chapel(AutotoolsPackage, CudaPackage, ROCmPackage):
"curl": "curl", "curl": "curl",
"hdf5": "hdf5+hl~mpi", "hdf5": "hdf5+hl~mpi",
"libevent": "libevent", "libevent": "libevent",
"protobuf": "py-protobuf", "protobuf": "protobuf",
"ssl": "openssl", "ssl": "openssl",
"yaml": "libyaml@0.1", "yaml": "libyaml@0.1",
"zmq": "libzmq", "zmq": "libzmq",
@ -608,12 +609,9 @@ def install(self, spec, prefix):
# if working from a non-versioned release/branch (such as main) # if working from a non-versioned release/branch (such as main)
if not self.is_versioned_release(): if not self.is_versioned_release():
install("CMakeLists.txt", join_path(prefix.share, "chapel")) install("CMakeLists.txt", join_path(prefix.share, "chapel"))
install_tree("doc", join_path(prefix.share, "chapel", self._output_version_short, "doc"))
install_tree( install_tree(
"doc", join_path(self.prefix.share, "chapel", self._output_version_short, "doc") "examples", join_path(prefix.share, "chapel", self._output_version_short, "examples")
)
install_tree(
"examples",
join_path(self.prefix.share, "chapel", self._output_version_short, "examples"),
) )
def setup_chpl_platform(self, env): def setup_chpl_platform(self, env):
@ -839,7 +837,7 @@ def _output_version_long(self) -> str:
@llnl.util.lang.memoized @llnl.util.lang.memoized
def _output_version_short(self) -> str: def _output_version_short(self) -> str:
if not self.is_versioned_release(): if not self.is_versioned_release():
return self.get_chpl_version_from_cmakelists()[-2] return ".".join(self.get_chpl_version_from_cmakelists().split(".")[:-1])
spec_vers_str = str(self.spec.version.up_to(2)) spec_vers_str = str(self.spec.version.up_to(2))
return spec_vers_str return spec_vers_str