diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 776c643f8602bfa50f2e82fc0f2082f77a6f46df..8a72b92a03fe8a118a1ad82c8e02ad9cc8cb52b9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,8 +4,8 @@ stages:
 variables:
   BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/tc/ebrains-spack-build-env/okd:okd_23.06
   GITLAB_BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/tc/ebrains-spack-build-env/gitlab_runners_nfs:gitlab_runners_nfs_23.06
-  SPACK_VERSION: v0.19.2
-  SPACK_PATH_GITLAB: /mnt/spack_v0.19.2
+  SPACK_VERSION: v0.20.0
+  SPACK_PATH_GITLAB: /mnt/spack_v0.20.0
   SYSTEMNAME: ebrainslab
 
 # start an OpenShift Job that will build the Spack environment
@@ -54,10 +54,10 @@ deploy-int-release-dev-cscs:
     OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_DEV_TOKEN
     OC_PROJECT: jupyterhub-int
     LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/int
-    INSTALLATION_ROOT: /srv/test-build-2305
+    INSTALLATION_ROOT: /srv/test-build-2309
     SPACK_ENV: test
     RELEASE_NAME: EBRAINS-test
-  resource_group: shared-NFS-mount-dev-cscs
+  resource_group: shared-NFS-mount-dev-cscs-spack20
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_NAMESPACE =~ /technical-coordination/
 
@@ -71,7 +71,7 @@ deploy-prod-release-prod-cscs:
     OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_PROD_TOKEN
     OC_PROJECT: jupyterhub
     LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
-    INSTALLATION_ROOT: /srv/main-spack-instance-2305
+    INSTALLATION_ROOT: /srv/main-spack-instance-2309
     SPACK_ENV: ebrains-23-09
     RELEASE_NAME: EBRAINS-23.09
   resource_group: shared-NFS-mount-prod-cscs
@@ -89,7 +89,7 @@ deploy-prod-release-prod-jsc:
     OPENSHIFT_TOKEN: $JSC_OPENSHIFT_PROD_TOKEN
     OC_PROJECT: jupyterhub
     LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
-    INSTALLATION_ROOT: /srv/main-spack-instance-2305
+    INSTALLATION_ROOT: /srv/main-spack-instance-2309
     SPACK_ENV: ebrains-23-09
     RELEASE_NAME: EBRAINS-23.09
   resource_group: shared-NFS-mount-prod-jsc
@@ -109,10 +109,10 @@ deploy-exp-release-dev-cscs:
     OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_DEV_TOKEN
     OC_PROJECT: jupyterhub-int
     LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/int
-    INSTALLATION_ROOT: /srv/test-build-2305
+    INSTALLATION_ROOT: /srv/test-build-2309
     SPACK_ENV: experimental
     RELEASE_NAME: EBRAINS-experimental
-  resource_group: shared-NFS-mount-dev-cscs
+  resource_group: shared-NFS-mount-dev-cscs-spack20
   only:
     refs:
       - schedules
@@ -131,7 +131,7 @@ deploy-exp-release-prod-cscs:
     OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_PROD_TOKEN
     OC_PROJECT: jupyterhub
     LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
-    INSTALLATION_ROOT: /srv/main-spack-instance-2305
+    INSTALLATION_ROOT: /srv/main-spack-instance-2309
     SPACK_ENV: experimental
     RELEASE_NAME: EBRAINS-experimental
   resource_group: shared-NFS-mount-prod-cscs
@@ -156,7 +156,7 @@ deploy-exp-release-prod-jsc:
     OPENSHIFT_TOKEN: $JSC_OPENSHIFT_PROD_TOKEN
     OC_PROJECT: jupyterhub
     LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
-    INSTALLATION_ROOT: /srv/main-spack-instance-2305
+    INSTALLATION_ROOT: /srv/main-spack-instance-2309
     SPACK_ENV: experimental
     RELEASE_NAME: EBRAINS-experimental
   resource_group: shared-NFS-mount-prod-jsc
diff --git a/README.md b/README.md
index 99081c6db3821be15f1a01d5cade46511862af70..6d29458edfb866466f94acfd4b3584f094db91e0 100644
--- a/README.md
+++ b/README.md
@@ -38,9 +38,9 @@ Clone this repository. You can use the `ebrains-yy-mm` branches to install the E
 git clone --branch {branch-name} https://gitlab.ebrains.eu/technical-coordination/project-internal/devops/platform/ebrains-spack-builds.git
 ```
 
-Clone Spack. We currently use version v0.19.2:
+Clone Spack. We currently use version v0.20.0:
 ```
-git clone --depth 1 -c advice.detachedHead=false -c feature.manyFiles=true --branch v0.19.2 https://github.com/spack/spack
+git clone --depth 1 -c advice.detachedHead=false -c feature.manyFiles=true --branch v0.20.0 https://github.com/spack/spack
 ```
 
 Activate Spack:
diff --git a/packages/bazel/add-include-limits-0.25.patch b/packages/bazel/add-include-limits-0.25.patch
deleted file mode 100644
index 643bde5facc17c7530257e0f4c1ddecc7aaf1a8c..0000000000000000000000000000000000000000
--- a/packages/bazel/add-include-limits-0.25.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -pur third_party/ijar/mapped_file_unix.cc third_party/ijar/mapped_file_unix.cc
---- third_party/ijar/mapped_file_unix.cc	2021-10-05 15:24:37.243946507 +0200
-+++ third_party/ijar/mapped_file_unix.cc	2021-10-05 15:24:28.707823401 +0200
-@@ -19,6 +19,7 @@
- #include <sys/mman.h>
- 
- #include <algorithm>
-+#include <limits>
- 
- #include "third_party/ijar/mapped_file.h"
- 
diff --git a/packages/bazel/add-include-limits-zlib_client.patch b/packages/bazel/add-include-limits-zlib_client.patch
deleted file mode 100644
index bb64145dbb519fcbba9cad9584272e44121df5f7..0000000000000000000000000000000000000000
--- a/packages/bazel/add-include-limits-zlib_client.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -pur third_party/ijar/zlib_client.h third_party/ijar/zlib_client.h
---- third_party/ijar/zlib_client.h	2021-10-07 09:32:57.087301302 +0200
-+++ third_party/ijar/zlib_client.h	1980-01-01 00:00:00.000000000 +0100
-@@ -16,6 +16,7 @@
- #define THIRD_PARTY_IJAR_ZLIB_CLIENT_H_
- 
- #include <limits.h>
-+#include <limits>
- 
- #include "third_party/ijar/common.h"
- 
diff --git a/packages/bazel/cc_env.patch b/packages/bazel/cc_env.patch
deleted file mode 100644
index 034fb77c9dd26a0d3663aaaaf853668bde1217e9..0000000000000000000000000000000000000000
--- a/packages/bazel/cc_env.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/compile.sh b/compile.sh
-index ed506d2..a5474ac 100755
---- a/compile.sh
-+++ b/compile.sh
-@@ -92,7 +92,7 @@ display "."
- log "Building output/bazel"
- # We set host and target platform directly since the defaults in @bazel_tools
- # have not yet been generated.
--bazel_build "src:bazel_nojdk${EXE_EXT}" \
-+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel_nojdk${EXE_EXT}" \
-   --host_platform=@bazel_tools//platforms:host_platform \
-   --platforms=@bazel_tools//platforms:target_platform \
-   || fail "Could not build Bazel"
diff --git a/packages/bazel/disabledepcheck.patch b/packages/bazel/disabledepcheck.patch
deleted file mode 100644
index c15d3bf64a180050bbdd00e59620f40b0fb2d168..0000000000000000000000000000000000000000
--- a/packages/bazel/disabledepcheck.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java.orig  2020-03-25 08:54:37.914186251 -0400
-+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java       2020-03-25 08:55:01.356250657 -0400
-@@ -148,7 +148,7 @@
-         if (execPath.startsWith(execRoot)) {
-           execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
-         } else {
--          problems.add(execPathFragment.getPathString());
-+          //          problems.add(execPathFragment.getPathString());
-           continue;
-         }
-       }
diff --git a/packages/bazel/disabledepcheck_old.patch b/packages/bazel/disabledepcheck_old.patch
deleted file mode 100644
index dd23972d9925de9b9631361ad5d7759e985f6d66..0000000000000000000000000000000000000000
--- a/packages/bazel/disabledepcheck_old.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java.orig    2020-06-08 13:42:14.035342560 -0400
-+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java 2020-06-08 13:42:25.149375458 -0400
-@@ -963,7 +963,7 @@
-           // are, it's probably due to a non-hermetic #include, & we should stop
-           // the build with an error.
-           if (execPath.startsWith(execRoot)) {
--            execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
-+             //  execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
-           } else {
-             problems.add(execPathFragment.getPathString());
-             continue;
diff --git a/packages/bazel/linux_ppc-0.29.1.patch b/packages/bazel/linux_ppc-0.29.1.patch
deleted file mode 100644
index c3ed9ab254b253066ce37f9b0eb497ebb1e589d4..0000000000000000000000000000000000000000
--- a/packages/bazel/linux_ppc-0.29.1.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 9c9d27561780bc56d9f0867e325c7421a94ee1cb Mon Sep 17 00:00:00 2001
-From: Harsh Bhatia <bhatia4@llnl.gov>
-Date: Tue, 15 Dec 2020 15:56:10 -0800
-Subject: [PATCH] https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0 
-
----
- src/conditions/BUILD | 6 ++++++
- third_party/BUILD    | 8 ++++++--
- 2 files changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/src/conditions/BUILD b/src/conditions/BUILD
-index 2b28e28057..faa41a439d 100644
---- a/src/conditions/BUILD
-+++ b/src/conditions/BUILD
-@@ -10,6 +10,12 @@ filegroup(
-     visibility = ["//src:__pkg__"],
- )
- 
-+config_setting(
-+    name = "linux_ppc",
-+    values = {"cpu": "ppc"},
-+    visibility = ["//visibility:public"],
-+)
-+
- config_setting(
-     name = "linux_x86_64",
-     values = {"cpu": "k8"},
-diff --git a/third_party/BUILD b/third_party/BUILD
-index 159006d741..4fcae54c00 100644
---- a/third_party/BUILD
-+++ b/third_party/BUILD
-@@ -523,12 +523,13 @@ UNNECESSARY_DYNAMIC_LIBRARIES = select({
-     "//src/conditions:darwin": "*.so *.dll",
-     "//src/conditions:darwin_x86_64": "*.so *.dll",
-     "//src/conditions:linux_x86_64": "*.jnilib *.dll",
-+    "//src/conditions:linux_ppc": "*.so *.jnilib *.dll",
-     # The .so file is an x86 one, so we can just remove it if the CPU is not x86
-     "//src/conditions:arm": "*.so *.jnilib *.dll",
-     "//src/conditions:linux_aarch64": "*.so *.jnilib *.dll",
-     # Play it safe -- better have a big binary than a slow binary
-     # zip -d does require an argument. Supply something bogus.
--    "//conditions:default": "*.bogusextension",
-+    "//conditions:default": "",
- })
- 
- # Remove native libraries that are for a platform different from the one we are
-@@ -537,7 +538,10 @@ genrule(
-     name = "filter_netty_dynamic_libs",
-     srcs = ["netty_tcnative/netty-tcnative-boringssl-static-2.0.24.Final.jar"],
-     outs = ["netty_tcnative/netty-tcnative-filtered.jar"],
--    cmd = "cp $< $@ && zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES,
-+    cmd = "cp $< $@ && " +
-+      # End successfully if there is nothing to be deleted from the archive
-+      "if [ -n '" + UNNECESSARY_DYNAMIC_LIBRARIES + "' ]; then " +
-+      "zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES + "; fi",
- )
- 
- java_import(
--- 
-2.21.0 (Apple Git-122.2)
-
diff --git a/packages/bazel/patch_for_fcc.patch b/packages/bazel/patch_for_fcc.patch
deleted file mode 100644
index d90448b0bae90cd963ea533f6e3b05a6f02b98cd..0000000000000000000000000000000000000000
--- a/packages/bazel/patch_for_fcc.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-diff --git a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc
-index 87ba899180..1c967ee818 100644
---- a/src/main/cpp/blaze_util_posix.cc
-+++ b/src/main/cpp/blaze_util_posix.cc
-@@ -565,7 +565,8 @@ static int setlk(int fd, struct flock *lock) {
-   // Prefer OFD locks if available.  POSIX locks can be lost "accidentally"
-   // due to any close() on the lock file, and are not reliably preserved
-   // across execve() on Linux, which we need for --batch mode.
--  if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
-+  //if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
-+  if (fcntl(fd, F_SETLK, lock) == 0) return 0;
-   if (errno != EINVAL) {
-     if (errno != EACCES && errno != EAGAIN) {
-       BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
-diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
-index ccb18a431a..0c5c8fd6f0 100644
---- a/tools/cpp/unix_cc_configure.bzl
-+++ b/tools/cpp/unix_cc_configure.bzl
-@@ -379,7 +379,8 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
-         "",
-         False,
-     ), ":")
--    gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
-+    #gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
-+    gold_linker_path = None
-     cc_path = repository_ctx.path(cc)
-     if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
-         # cc is outside the repository, set -B
-@@ -468,7 +469,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
-                     # Security hardening requires optimization.
-                     # We need to undef it as some distributions now have it enabled by default.
-                     "-U_FORTIFY_SOURCE",
--                    "-fstack-protector",
-+                    #"-fstack-protector",
-                     # All warnings are enabled. Maybe enable -Werror as well?
-                     "-Wall",
-                     # Enable a few more warnings that aren't part of -Wall.
diff --git a/packages/bazel/patch_for_fcc2.patch b/packages/bazel/patch_for_fcc2.patch
deleted file mode 100644
index 709e5ee0202c07e6bc5b6202d654dbe2b97168a7..0000000000000000000000000000000000000000
--- a/packages/bazel/patch_for_fcc2.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
-+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
-@@ -185,7 +185,7 @@ public class BazelRuleClassProvider {
- 
-         Map<String, String> spackEnv = System.getenv();
-         for (String envName : spackEnv.keySet()) {
--          if (envName.startsWith("SPACK_")) {
-+          if ((envName.startsWith("SPACK_")) || (envName.equals("fcc_ENV")) || (envName.equals("FCC_ENV"))) {
-             env.put(envName, spackEnv.get(envName));
-           }
-         }
diff --git a/packages/bazel/rename-gettid-functions-0.25.patch b/packages/bazel/rename-gettid-functions-0.25.patch
deleted file mode 100644
index fe06a6fc1825c9d70c5e84c8572d6b59c1511db6..0000000000000000000000000000000000000000
--- a/packages/bazel/rename-gettid-functions-0.25.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-From d1d017390b799c59d6fdf7b8afa6136d218bdd61 Mon Sep 17 00:00:00 2001
-From: Benjamin Peterson <benjamin@dropbox.com>
-Date: Fri, 3 May 2019 08:11:00 -0700
-Subject: [PATCH] Rename gettid() functions.
-
-glibc 2.30 will declare its own gettid; see https://sourceware.org/git/?p=glibc.git;a=commit;h=1d0fc213824eaa2a8f8c4385daaa698ee8fb7c92. Rename the grpc versions to avoid naming conflicts.
----
- src/core/lib/gpr/log_linux.cc          | 4 ++--
- src/core/lib/gpr/log_posix.cc          | 4 ++--
- src/core/lib/iomgr/ev_epollex_linux.cc | 4 ++--
- 3 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git third_party/grpc/src/core/lib/gpr/log_linux.cc.orig src/core/lib/gpr/log_linux.cc
-index 561276f0c20..8b597b4cf2f 100644
---- third_party/grpc/src/core/lib/gpr/log_linux.cc.orig	2019-06-21 10:42:13.235611417 -0400
-+++ third_party/grpc/src/core/lib/gpr/log_linux.cc	2019-06-21 10:42:16.686608855 -0400
-@@ -40,7 +40,7 @@
- #include <time.h>
- #include <unistd.h>
- 
--static long gettid(void) { return syscall(__NR_gettid); }
-+static long sys_gettid(void) { return syscall(__NR_gettid); }
- 
- void gpr_log(const char* file, int line, gpr_log_severity severity,
-              const char* format, ...) {
-@@ -70,7 +70,7 @@ void gpr_default_log(gpr_log_func_args*
-   gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
-   struct tm tm;
-   static __thread long tid = 0;
--  if (tid == 0) tid = gettid();
-+  if (tid == 0) tid = sys_gettid();
- 
-   timer = static_cast<time_t>(now.tv_sec);
-   final_slash = strrchr(args->file, '/');
-diff --git third_party/grpc/src/core/lib/gpr/log_posix.cc.orig src/core/lib/gpr/log_posix.cc
-index b6edc14ab6b..2f7c6ce3760 100644
---- third_party/grpc/src/core/lib/gpr/log_posix.cc.orig	2019-06-21 10:42:13.242611412 -0400
-+++ third_party/grpc/src/core/lib/gpr/log_posix.cc	2019-06-21 10:42:22.794604319 -0400
-@@ -30,7 +30,7 @@
- #include <string.h>
- #include <time.h>
- 
--static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
-+static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); }
- 
- void gpr_log(const char* file, int line, gpr_log_severity severity,
-              const char* format, ...) {
-@@ -85,7 +85,7 @@ void gpr_default_log(gpr_log_func_args*
-   char* prefix;
-   gpr_asprintf(&prefix, "%s%s.%09d %7tu %s:%d]",
-                gpr_log_severity_string(args->severity), time_buffer,
--               (int)(now.tv_nsec), gettid(), display_file, args->line);
-+               (int)(now.tv_nsec), sys_gettid(), display_file, args->line);
- 
-   fprintf(stderr, "%-70s %s\n", prefix, args->message);
-   gpr_free(prefix);
-diff --git third_party/grpc/src/core/lib/iomgr/ev_epollex_linux.cc.orig src/core/lib/iomgr/ev_epollex_linux.cc
-index 08116b3ab53..76f59844312 100644
---- third_party/grpc/src/core/lib/iomgr/ev_epollex_linux.cc.orig	2019-06-21 10:42:13.247611408 -0400
-+++ third_party/grpc/src/core/lib/iomgr/ev_epollex_linux.cc	2019-06-21 10:42:29.767599141 -0400
-@@ -1150,7 +1150,7 @@ static void end_worker(grpc_pollset* pol
- }
- 
- #ifndef NDEBUG
--static long gettid(void) { return syscall(__NR_gettid); }
-+static long sys_gettid(void) { return syscall(__NR_gettid); }
- #endif
- 
- /* pollset->mu lock must be held by the caller before calling this.
-@@ -1170,7 +1170,7 @@ static grpc_error* pollset_work(grpc_pol
- #define WORKER_PTR (&worker)
- #endif
- #ifndef NDEBUG
--  WORKER_PTR->originator = gettid();
-+  WORKER_PTR->originator = sys_gettid();
- #endif
-   if (grpc_polling_trace.enabled()) {
-     gpr_log(GPR_INFO,
diff --git a/packages/gcc/darwin/apfs.patch b/packages/gcc/darwin/apfs.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d1f9d56667dd9cf95e855ec71e38899ef9b6562a
--- /dev/null
+++ b/packages/gcc/darwin/apfs.patch
@@ -0,0 +1,12 @@
+diff -uNr gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in gcc-7.2.0/libstdc++-v3/include/Makefile.in
+--- gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in     2017-07-25 14:05:07.000000000 -0400
++++ gcc-7.2.0/libstdc++-v3/include/Makefile.in  2017-09-02 12:22:08.000000000 -0400
+@@ -1764,6 +1764,8 @@
+ @GLIBCXX_HOSTED_TRUE@install-data-local: install-headers
+ @GLIBCXX_HOSTED_FALSE@install-data-local: install-freestanding-headers
+ 
++.NOTPARALLEL: install-headers
++
+ # This is a subset of the full install-headers rule.  We only need <ciso646>,
+ # <cstddef>, <cfloat>, <limits>, <climits>, <cstdint>, <cstdlib>, <new>,
+ # <typeinfo>, <exception>, <initializer_list>, <cstdalign>, <cstdarg>,
diff --git a/packages/gcc/darwin/clang13.patch b/packages/gcc/darwin/clang13.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ac3bfcbe244c08e0672ad73fa9e10f067f6b78a7
--- /dev/null
+++ b/packages/gcc/darwin/clang13.patch
@@ -0,0 +1,32 @@
+--- a/gcc/genconditions.c	2019-01-01 12:37:19.064943662 +0100
++++ b/gcc/genconditions.c	2019-10-11 10:57:11.464595789 +0200
+@@ -57,8 +57,9 @@ write_header (void)
+ \n\
+ /* It is necessary, but not entirely safe, to include the headers below\n\
+    in a generator program.  As a defensive measure, don't do so when the\n\
+-   table isn't going to have anything in it.  */\n\
+-#if GCC_VERSION >= 3001\n\
++   table isn't going to have anything in it.\n\
++   Clang 9 is buggy and doesn't handle __builtin_constant_p correctly.  */\n\
++#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\
+ \n\
+ /* Do not allow checking to confuse the issue.  */\n\
+ #undef CHECKING_P\n\
+@@ -170,7 +171,7 @@ struct c_test\n\
+    vary at run time.  It works in 3.0.1 and later; 3.0 only when not\n\
+    optimizing.  */\n\
+ \n\
+-#if GCC_VERSION >= 3001\n\
++#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\
+ static const struct c_test insn_conditions[] = {\n");
+ 
+   traverse_c_tests (write_one_condition, 0);
+@@ -191,7 +192,7 @@ write_writer (void)
+ 	"  unsigned int i;\n"
+         "  const char *p;\n"
+         "  puts (\"(define_conditions [\");\n"
+-	"#if GCC_VERSION >= 3001\n"
++	"#if GCC_VERSION >= 3001 && __clang_major__ < 9\n"
+ 	"  for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
+ 	"    {\n"
+ 	"      printf (\"  (%d \\\"\", insn_conditions[i].value);\n"
diff --git a/packages/gcc/darwin/gcc-4.9.patch1 b/packages/gcc/darwin/gcc-4.9.patch1
new file mode 100644
index 0000000000000000000000000000000000000000..444e292786df41346a3a1cc6267bba587408a007
--- /dev/null
+++ b/packages/gcc/darwin/gcc-4.9.patch1
@@ -0,0 +1,42 @@
+diff --git a/gcc/configure b/gcc/configure
+index 9523773..52b0bf7 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -24884,7 +24884,7 @@ if test "${gcc_cv_as_ix86_filds+set}" = set; then :
+ else
+   gcc_cv_as_ix86_filds=no
+   if test x$gcc_cv_as != x; then
+-    $as_echo 'filds mem; fists mem' > conftest.s
++    $as_echo 'filds (%ebp); fists (%ebp)' > conftest.s
+     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+@@ -24915,7 +24915,7 @@ if test "${gcc_cv_as_ix86_fildq+set}" = set; then :
+ else
+   gcc_cv_as_ix86_fildq=no
+   if test x$gcc_cv_as != x; then
+-    $as_echo 'fildq mem; fistpq mem' > conftest.s
++    $as_echo 'fildq (%ebp); fistpq (%ebp)' > conftest.s
+     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 68b0ee8..bd53978 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -3869,13 +3869,13 @@ foo:	nop
+ 
+     gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
+        gcc_cv_as_ix86_filds,,,
+-       [filds mem; fists mem],,
++       [filds (%ebp); fists (%ebp)],,
+        [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
+          [Define if your assembler uses filds and fists mnemonics.])])
+ 
+     gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
+        gcc_cv_as_ix86_fildq,,,
+-       [fildq mem; fistpq mem],,
++       [fildq (%ebp); fistpq (%ebp)],,
+        [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
+          [Define if your assembler uses fildq and fistq mnemonics.])])
+ 
diff --git a/packages/gcc/darwin/gcc-4.9.patch2 b/packages/gcc/darwin/gcc-4.9.patch2
new file mode 100644
index 0000000000000000000000000000000000000000..b065997f453926e20d285f8a5e6555d9cd2e8f96
--- /dev/null
+++ b/packages/gcc/darwin/gcc-4.9.patch2
@@ -0,0 +1,28 @@
+From 82f81877458ea372176eabb5de36329431dce99b Mon Sep 17 00:00:00 2001
+From: Iain Sandoe <iain@codesourcery.com>
+Date: Sat, 21 Dec 2013 00:30:18 +0000
+Subject: [PATCH] don't try to mark local symbols as no-dead-strip
+
+---
+ gcc/config/darwin.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
+index 40804b8..0080299 100644
+--- a/gcc/config/darwin.c
++++ b/gcc/config/darwin.c
+@@ -1259,6 +1259,11 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
+ void
+ darwin_mark_decl_preserved (const char *name)
+ {
++  /* Actually we shouldn't mark any local symbol this way, but for now
++     this only happens with ObjC meta-data.  */
++  if (darwin_label_is_anonymous_local_objc_name (name))
++    return;
++
+   fprintf (asm_out_file, "\t.no_dead_strip ");
+   assemble_name (asm_out_file, name);
+   fputc ('\n', asm_out_file);
+-- 
+2.2.1
+
diff --git a/packages/gcc/darwin/gcc-6.1.0-jit.patch b/packages/gcc/darwin/gcc-6.1.0-jit.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8cc4405de49458db88df59ad28b41c14aec74954
--- /dev/null
+++ b/packages/gcc/darwin/gcc-6.1.0-jit.patch
@@ -0,0 +1,21 @@
+# Fix for libgccjit.so linkage on Darwin
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089
+# https://github.com/Homebrew/homebrew-core/issues/1872#issuecomment-225625332
+# https://github.com/Homebrew/homebrew-core/issues/1872#issuecomment-225626490
+
+# Stolen from Homebrew:
+# https://raw.githubusercontent.com/Homebrew/formula-patches/e9e0ee09389a54cc4c8fe1c24ebca3cd765ed0ba/gcc/6.1.0-jit.patch
+diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
+index 44d0750..4df2a9c 100644
+--- a/gcc/jit/Make-lang.in
++++ b/gcc/jit/Make-lang.in
+@@ -85,8 +85,7 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
+	     $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
+	     $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
+	     $(EXTRA_GCC_OBJS) \
+-	     -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
+-	     -Wl,-soname,$(LIBGCCJIT_SONAME)
++	     -Wl,-install_name,$(LIBGCCJIT_SONAME)
+
+ $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
+	ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
diff --git a/packages/gcc/darwin/gcc-7.1.0-headerpad.patch b/packages/gcc/darwin/gcc-7.1.0-headerpad.patch
new file mode 100644
index 0000000000000000000000000000000000000000..11ca2d0e4d711ac45a5773a815caf43c8ab82a92
--- /dev/null
+++ b/packages/gcc/darwin/gcc-7.1.0-headerpad.patch
@@ -0,0 +1,19 @@
+# Use -headerpad_max_install_names in the build,
+# otherwise lto1 load commands cannot be edited on El Capitan
+
+# Stolen from Homebrew:
+# https://raw.githubusercontent.com/Homebrew/formula-patches/32cf103/gcc/7.1.0-headerpad.patch
+
+diff --git a/config/mh-darwin b/config/mh-darwin
+index 148b730..c2318b5 100644
+--- a/config/mh-darwin
++++ b/config/mh-darwin
+@@ -16,7 +16,7 @@ DARWIN_GCC_MDYNAMIC_NO_PIC := \
+ DARWIN_NO_PIE := `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
+ 
+ BOOT_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
+-BOOT_LDFLAGS += $(DARWIN_NO_PIE)
++BOOT_LDFLAGS += $(DARWIN_NO_PIE) -Wl,-headerpad_max_install_names
+ 
+ # Similarly, for cross-compilation.
+ STAGE1_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
diff --git a/packages/gcc/darwin/headers-10.13-fix.patch b/packages/gcc/darwin/headers-10.13-fix.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3dbfde0255aa38833f6c162dd22cb30231c4bd58
--- /dev/null
+++ b/packages/gcc/darwin/headers-10.13-fix.patch
@@ -0,0 +1,127 @@
+diff -pur fixincludes/fixincl.x gcc-5.5.0/fixincludes/fixincl.x
+--- a/fixincludes/fixincl.x	2017-01-30 17:08:42.000000000 +0100
++++ b/fixincludes/fixincl.x	2017-12-21 14:34:35.000000000 +0100
+@@ -1,12 +1,12 @@
+ /*  -*- buffer-read-only: t -*- vi: set ro:
+- * 
++ *
+  * DO NOT EDIT THIS FILE   (fixincl.x)
+- * 
+- * It has been AutoGen-ed  January  5, 2017 at 06:05:06 PM by AutoGen 5.16.2
++ *
++ * It has been AutoGen-ed  December 21, 2017 at 02:34:35 PM by AutoGen 5.18.7
+  * From the definitions    inclhack.def
+  * and the template file   fixincl
+  */
+-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan  5 18:05:06 CET 2017
++/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Dec 21 14:34:35 CET 2017
+  *
+  * You must regenerate it.  Use the ./genfixes script.
+  *
+@@ -15,7 +15,7 @@
+  * certain ANSI-incompatible system header files which are fixed to work
+  * correctly with ANSI C and placed in a directory that GNU C will search.
+  *
+- * This file contains 240 fixup descriptions.
++ * This file contains 241 fixup descriptions.
+  *
+  * See README for more information.
+  *
+@@ -2579,6 +2579,43 @@ extern \"C\" {\n\
+ 
+ /* * * * * * * * * * * * * * * * * * * * * * * * * *
+  *
++ *  Description of Darwin_Osavailability fix
++ */
++tSCC zDarwin_OsavailabilityName[] =
++     "darwin_osavailability";
++
++/*
++ *  File name selection pattern
++ */
++tSCC zDarwin_OsavailabilityList[] =
++  "os/availability.h\0";
++/*
++ *  Machine/OS name selection pattern
++ */
++tSCC* apzDarwin_OsavailabilityMachs[] = {
++        "*-*-darwin*",
++        (const char*)NULL };
++
++/*
++ *  content selection pattern - do fix if pattern found
++ */
++tSCC zDarwin_OsavailabilitySelect0[] =
++       "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)";
++
++#define    DARWIN_OSAVAILABILITY_TEST_CT  1
++static tTestDesc aDarwin_OsavailabilityTests[] = {
++  { TT_EGREP,    zDarwin_OsavailabilitySelect0, (regex_t*)NULL }, };
++
++/*
++ *  Fix Command Arguments for Darwin_Osavailability
++ */
++static const char* apzDarwin_OsavailabilityPatch[] = {
++    "format",
++    "#define %1(...)",
++    (char*)NULL };
++
++/* * * * * * * * * * * * * * * * * * * * * * * * * *
++ *
+  *  Description of Darwin_9_Long_Double_Funcs_2 fix
+  */
+ tSCC zDarwin_9_Long_Double_Funcs_2Name[] =
+@@ -9818,9 +9855,9 @@ static const char* apzX11_SprintfPatch[]
+  *
+  *  List of all fixes
+  */
+-#define REGEX_COUNT          276
++#define REGEX_COUNT          277
+ #define MACH_LIST_SIZE_LIMIT 187
+-#define FIX_COUNT            240
++#define FIX_COUNT            241
+ 
+ /*
+  *  Enumerate the fixes
+@@ -9885,6 +9922,7 @@ typedef enum {
+     CTRL_QUOTES_DEF_FIXIDX,
+     CTRL_QUOTES_USE_FIXIDX,
+     CXX_UNREADY_FIXIDX,
++    DARWIN_OSAVAILABILITY_FIXIDX,
+     DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX,
+     DARWIN_EXTERNC_FIXIDX,
+     DARWIN_GCC4_BREAKAGE_FIXIDX,
+@@ -10364,6 +10402,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
+      CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+      aCxx_UnreadyTests,   apzCxx_UnreadyPatch, 0 },
+ 
++  {  zDarwin_OsavailabilityName,    zDarwin_OsavailabilityList,
++     apzDarwin_OsavailabilityMachs,
++     DARWIN_OSAVAILABILITY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
++     aDarwin_OsavailabilityTests,   apzDarwin_OsavailabilityPatch, 0 },
++
+   {  zDarwin_9_Long_Double_Funcs_2Name,    zDarwin_9_Long_Double_Funcs_2List,
+      apzDarwin_9_Long_Double_Funcs_2Machs,
+      DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+diff -pur fixincludes/inclhack.def gcc-5.5.0/fixincludes/inclhack.def
+--- a/fixincludes/inclhack.def	2017-01-30 17:08:42.000000000 +0100
++++ b/fixincludes/inclhack.def	2017-12-21 14:34:28.000000000 +0100
+@@ -1337,6 +1337,18 @@ fix = {
+     test_text = "extern void* malloc( size_t );";
+ };
+ 
++fix = {
++    hackname  = darwin_osavailability;
++    mach      = "*-*-darwin*";
++    files     = os/availability.h;
++    select    = "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)";
++    c_fix     = format;
++    c_fix_arg = "#define %1(...)";
++
++    test_text = "#define __API_AVAILABLE(...)\n"
++		"#define API_AVAILABLE(...)\n";
++};
++
+ /*
+  *  For the AAB_darwin7_9_long_double_funcs fix to be useful,
+  *  you have to not use "" includes.
diff --git a/packages/gcc/gcc-backport.patch b/packages/gcc/gcc-backport.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f9fab68f23700bfe48f5a7948bb64ec2d0fb1ff7
--- /dev/null
+++ b/packages/gcc/gcc-backport.patch
@@ -0,0 +1,138 @@
+2016-02-20  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	Backported from mainline
+	2016-02-19  Jakub Jelinek  <jakub@redhat.com>
+		    Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+	* Make-lang.in: Invoke gperf with -L C++.
+ 	* cfns.gperf: Remove prototypes for hash and libc_name_p
+ 	inlines.
+ 	* cfns.h: Regenerated.
+	* except.c (nothrow_libfn_p): Adjust.
+
+Index: gcc/cp/Make-lang.in
+===================================================================
+--- a/gcc/cp/Make-lang.in	(revision 233574)
++++ b/gcc/cp/Make-lang.in	(working copy)
+@@ -111,7 +111,7 @@ else
+ # deleting the $(srcdir)/cp/cfns.h file.
+ $(srcdir)/cp/cfns.h:
+ endif
+-	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
++	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
+ 		$(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
+ 
+ #
+Index: gcc/cp/cfns.gperf
+===================================================================
+--- a/gcc/cp/cfns.gperf	(revision 233574)
++++ b/gcc/cp/cfns.gperf	(working copy)
+@@ -1,3 +1,5 @@
++%language=C++
++%define class-name libc_name
+ %{
+ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ 
+@@ -16,14 +18,6 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ %}
+ %%
+ # The standard C library functions, for feeding to gperf; the result is used
+Index: gcc/cp/cfns.h
+===================================================================
+--- a/gcc/cp/cfns.h	(revision 233574)
++++ b/gcc/cp/cfns.h	(working copy)
+@@ -1,5 +1,5 @@
+-/* ANSI-C code produced by gperf version 3.0.3 */
+-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf  */
++/* C++ code produced by gperf version 3.0.4 */
++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf  */
+ 
+ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+@@ -28,7 +28,7 @@
+ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+ #endif
+ 
+-#line 1 "cfns.gperf"
++#line 3 "cfns.gperf"
+ 
+ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ 
+@@ -47,26 +47,19 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+ 
+-#ifdef __GNUC__
+-__inline
+-#else
+-#ifdef __cplusplus
+-inline
+-#endif
+-#endif
+-static unsigned int
+-hash (register const char *str, register unsigned int len)
++class libc_name
+ {
++private:
++  static inline unsigned int hash (const char *str, unsigned int len);
++public:
++  static const char *libc_name_p (const char *str, unsigned int len);
++};
++
++inline unsigned int
++libc_name::hash (register const char *str, register unsigned int len)
++{
+   static const unsigned short asso_values[] =
+     {
+       400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+@@ -122,14 +115,8 @@ along with GCC; see the file COPYING3.  If not see
+   return hval + asso_values[(unsigned char)str[len - 1]];
+ }
+ 
+-#ifdef __GNUC__
+-__inline
+-#ifdef __GNUC_STDC_INLINE__
+-__attribute__ ((__gnu_inline__))
+-#endif
+-#endif
+ const char *
+-libc_name_p (register const char *str, register unsigned int len)
++libc_name::libc_name_p (register const char *str, register unsigned int len)
+ {
+   enum
+     {
+Index: gcc/cp/except.c
+===================================================================
+--- a/gcc/cp/except.c	(revision 233574)
++++ b/gcc/cp/except.c	(working copy)
+@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
+      unless the system headers are playing rename tricks, and if
+      they are, we don't want to be confused by them.  */
+   id = DECL_NAME (fn);
+-  return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
++  return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
++				   IDENTIFIER_LENGTH (id));
+ }
+ 
+ /* Returns nonzero if an exception of type FROM will be caught by a
diff --git a/packages/gcc/glibc-2.31-libsanitizer-1-gcc-6.patch b/packages/gcc/glibc-2.31-libsanitizer-1-gcc-6.patch
new file mode 100644
index 0000000000000000000000000000000000000000..4187b812d5d3ea41a60dd1de4faf0c55e6ac850d
--- /dev/null
+++ b/packages/gcc/glibc-2.31-libsanitizer-1-gcc-6.patch
@@ -0,0 +1,39 @@
+From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 8 Nov 2019 19:53:18 +0100
+Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
+ bootstrap due to libsanitizer)
+
+	Backported from mainline
+	2019-10-22  Tamar Christina  <tamar.christina@arm.com>
+	Backported for version 5.3.0 <= gcc <= 6.5.0
+	2020-06-05  John L. Jolly  <john.jolly@gmail.com>
+
+	PR sanitizer/92154
+	* sanitizer_common/sanitizer_platform_limits_posix.cc:
+	Cherry-pick compiler-rt revision r375220.
+
+From-SVN: r277981
+---
+ libsanitizer/ChangeLog                                   | 9 +++++++++
+ .../sanitizer_common/sanitizer_platform_limits_posix.cc  | 6 +++++-
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 6cd4a5bac8b0..06a605ff4670 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1130,8 +1130,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ #ifndef __GLIBC_PREREQ
+ #define __GLIBC_PREREQ(x, y) 0
+ #endif
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
++#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
++    !defined(__arm__)
+ /* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++/* On Arm glibc 2.31 and later provide a different mode field, this field is
++   never used by libsanitizer so we can simply ignore this assert for all glibc
++   versions.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
diff --git a/packages/gcc/glibc-2.31-libsanitizer-1.patch b/packages/gcc/glibc-2.31-libsanitizer-1.patch
new file mode 100644
index 0000000000000000000000000000000000000000..96037707d3cf11c993010fde0e689d91e6aa8848
--- /dev/null
+++ b/packages/gcc/glibc-2.31-libsanitizer-1.patch
@@ -0,0 +1,37 @@
+From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 8 Nov 2019 19:53:18 +0100
+Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
+ bootstrap due to libsanitizer)
+
+	Backported from mainline
+	2019-10-22  Tamar Christina  <tamar.christina@arm.com>
+
+	PR sanitizer/92154
+	* sanitizer_common/sanitizer_platform_limits_posix.cc:
+	Cherry-pick compiler-rt revision r375220.
+
+From-SVN: r277981
+---
+ libsanitizer/ChangeLog                                   | 9 +++++++++
+ .../sanitizer_common/sanitizer_platform_limits_posix.cc  | 6 +++++-
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 6cd4a5bac8b0..06a605ff4670 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1156,8 +1156,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
++#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
++    !defined(__arm__)
+ /* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
++/* On Arm glibc 2.31 and later provide a different mode field, this field is
++   never used by libsanitizer so we can simply ignore this assert for all glibc
++   versions.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
diff --git a/packages/gcc/glibc-2.31-libsanitizer-2-gcc-6.patch b/packages/gcc/glibc-2.31-libsanitizer-2-gcc-6.patch
new file mode 100644
index 0000000000000000000000000000000000000000..755db173ffba61ade4c3fd5d8c6a5990ded63eaa
--- /dev/null
+++ b/packages/gcc/glibc-2.31-libsanitizer-2-gcc-6.patch
@@ -0,0 +1,69 @@
+From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 20 Dec 2019 17:58:35 +0100
+Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
+ bootstrap due to libsanitizer)
+
+	Backported from mainline
+	2019-11-26  Jakub Jelinek  <jakub@redhat.com>
+	Backported for version 5.3.0 <= gcc <= 6.5.0
+	2020-06-05  John L. Jolly  <john.jolly@gmail.com>
+
+	PR sanitizer/92154
+	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
+	llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
+	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
+
+From-SVN: r279653
+---
+ libsanitizer/ChangeLog                            | 10 ++++++++++
+ .../sanitizer_platform_limits_posix.cc            |  9 +++------
+ .../sanitizer_platform_limits_posix.h             | 15 +--------------
+ 3 files changed, 14 insertions(+), 20 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 06a605ff4670..d823a12190c0 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1130,12 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ #ifndef __GLIBC_PREREQ
+ #define __GLIBC_PREREQ(x, y) 0
+ #endif
+-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+-    !defined(__arm__)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+-/* On Arm glibc 2.31 and later provide a different mode field, this field is
+-   never used by libsanitizer so we can simply ignore this assert for all glibc
+-   versions.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 73af92af1e8f..6a673a7c9959 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -211,20 +211,13 @@ namespace __sanitizer {
+     unsigned long __unused1;
+     unsigned long __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-# else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-# endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/packages/gcc/glibc-2.31-libsanitizer-2-gcc-7.patch b/packages/gcc/glibc-2.31-libsanitizer-2-gcc-7.patch
new file mode 100644
index 0000000000000000000000000000000000000000..07cbb3fdb4960cdf7212746c376b2a9e0cbdfbd8
--- /dev/null
+++ b/packages/gcc/glibc-2.31-libsanitizer-2-gcc-7.patch
@@ -0,0 +1,69 @@
+From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 20 Dec 2019 17:58:35 +0100
+Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
+ bootstrap due to libsanitizer)
+
+	Backported from mainline
+	2019-11-26  Jakub Jelinek  <jakub@redhat.com>
+	Backported for version 7.1.0 <= gcc <= 7.4.0
+	2020-06-05  John L. Jolly  <john.jolly@gmail.com>
+
+	PR sanitizer/92154
+	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
+	llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
+	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
+
+From-SVN: r279653
+---
+ libsanitizer/ChangeLog                            | 10 ++++++++++
+ .../sanitizer_platform_limits_posix.cc            |  9 +++------
+ .../sanitizer_platform_limits_posix.h             | 15 +--------------
+ 3 files changed, 14 insertions(+), 20 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 06a605ff4670..d823a12190c0 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+-    !defined(__arm__)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+-/* On Arm glibc 2.31 and later provide a different mode field, this field is
+-   never used by libsanitizer so we can simply ignore this assert for all glibc
+-   versions.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 73af92af1e8f..6a673a7c9959 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -211,20 +211,13 @@ namespace __sanitizer {
+     unsigned long __unused1;
+     unsigned long __unused2;
+ #elif defined(__sparc__)
+-# if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-# else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-# endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/packages/gcc/glibc-2.31-libsanitizer-2.patch b/packages/gcc/glibc-2.31-libsanitizer-2.patch
new file mode 100644
index 0000000000000000000000000000000000000000..75234436e8e8d250fbbe266c8fa5c240715f0181
--- /dev/null
+++ b/packages/gcc/glibc-2.31-libsanitizer-2.patch
@@ -0,0 +1,73 @@
+From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Fri, 20 Dec 2019 17:58:35 +0100
+Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
+ bootstrap due to libsanitizer)
+
+	Backported from mainline
+	2019-11-26  Jakub Jelinek  <jakub@redhat.com>
+
+	PR sanitizer/92154
+	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
+	llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
+	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
+
+From-SVN: r279653
+---
+ libsanitizer/ChangeLog                            | 10 ++++++++++
+ .../sanitizer_platform_limits_posix.cc            |  9 +++------
+ .../sanitizer_platform_limits_posix.h             | 15 +--------------
+ 3 files changed, 14 insertions(+), 20 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 06a605ff4670..d823a12190c0 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
+ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
+-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+-    !defined(__arm__)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+-/* On Arm glibc 2.31 and later provide a different mode field, this field is
+-   never used by libsanitizer so we can simply ignore this assert for all glibc
+-   versions.  */
++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
++   on many architectures.  */
+ CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
+ #endif
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 73af92af1e8f..6a673a7c9959 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -211,26 +211,13 @@ namespace __sanitizer {
+     u64 __unused1;
+     u64 __unused2;
+ #elif defined(__sparc__)
+-#if defined(__arch64__)
+     unsigned mode;
+-    unsigned short __pad1;
+-#else
+-    unsigned short __pad1;
+-    unsigned short mode;
+     unsigned short __pad2;
+-#endif
+     unsigned short __seq;
+     unsigned long long __unused1;
+     unsigned long long __unused2;
+-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
+-    unsigned int mode;
+-    unsigned short __seq;
+-    unsigned short __pad1;
+-    unsigned long __unused1;
+-    unsigned long __unused2;
+ #else
+-    unsigned short mode;
+-    unsigned short __pad1;
++    unsigned int mode;
+     unsigned short __seq;
+     unsigned short __pad2;
+ #if defined(__x86_64__) && !defined(_LP64)
diff --git a/packages/gcc/glibc-2.31-libsanitizer-3-gcc-5.patch b/packages/gcc/glibc-2.31-libsanitizer-3-gcc-5.patch
new file mode 100644
index 0000000000000000000000000000000000000000..e1df265aa392963d8828df5747938e51545faeca
--- /dev/null
+++ b/packages/gcc/glibc-2.31-libsanitizer-3-gcc-5.patch
@@ -0,0 +1,81 @@
+diff -ru a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc	2014-09-23 17:59:53.000000000 +0000
++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc	2021-10-30 19:48:38.690007561 +0000
+@@ -358,15 +358,6 @@
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
+-  _(CYGETDEFTHRESH, WRITE, sizeof(int));
+-  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
+-  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
+-  _(CYGETTHRESH, WRITE, sizeof(int));
+-  _(CYGETTIMEOUT, WRITE, sizeof(int));
+-  _(CYSETDEFTHRESH, NONE, 0);
+-  _(CYSETDEFTIMEOUT, NONE, 0);
+-  _(CYSETTHRESH, NONE, 0);
+-  _(CYSETTIMEOUT, NONE, 0);
+   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
+   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
+   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
+diff -ru a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2021-10-30 19:40:51.805824323 +0000
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2021-10-30 19:51:13.640403192 +0000
+@@ -143,7 +143,6 @@
+ #include <sys/statvfs.h>
+ #include <sys/timex.h>
+ #include <sys/user.h>
+-#include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+ #include <linux/lp.h>
+@@ -392,7 +391,6 @@
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
+-  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
+ #if EV_VERSION > (0x010000)
+   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
+ #else
+@@ -759,15 +757,6 @@
+ #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
+-  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
+-  unsigned IOCTL_CYGETMON = CYGETMON;
+-  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
+-  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
+-  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
+-  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
+-  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
+-  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
+   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
+   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
+   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
+diff -ru a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2021-10-30 19:40:51.698824053 +0000
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2021-10-30 19:51:39.680469814 +0000
+@@ -875,7 +875,6 @@
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   extern unsigned struct_ax25_parms_struct_sz;
+-  extern unsigned struct_cyclades_monitor_sz;
+   extern unsigned struct_input_keymap_entry_sz;
+   extern unsigned struct_ipx_config_data_sz;
+   extern unsigned struct_kbdiacrs_sz;
+@@ -1220,15 +1219,6 @@
+ #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  extern unsigned IOCTL_CYGETDEFTHRESH;
+-  extern unsigned IOCTL_CYGETDEFTIMEOUT;
+-  extern unsigned IOCTL_CYGETMON;
+-  extern unsigned IOCTL_CYGETTHRESH;
+-  extern unsigned IOCTL_CYGETTIMEOUT;
+-  extern unsigned IOCTL_CYSETDEFTHRESH;
+-  extern unsigned IOCTL_CYSETDEFTIMEOUT;
+-  extern unsigned IOCTL_CYSETTHRESH;
+-  extern unsigned IOCTL_CYSETTIMEOUT;
+   extern unsigned IOCTL_EQL_EMANCIPATE;
+   extern unsigned IOCTL_EQL_ENSLAVE;
+   extern unsigned IOCTL_EQL_GETMASTRCFG;
diff --git a/packages/gcc/glibc-2.36-libsanitizer-gcc-10-12.patch b/packages/gcc/glibc-2.36-libsanitizer-gcc-10-12.patch
new file mode 100644
index 0000000000000000000000000000000000000000..90df6b048612978c62947ed57ac8c7a40508ba73
--- /dev/null
+++ b/packages/gcc/glibc-2.36-libsanitizer-gcc-10-12.patch
@@ -0,0 +1,27 @@
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+index badf6a401cc..b43733033a6 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -72,7 +72,6 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+-#include <linux/fs.h>
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -822,10 +821,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
diff --git a/packages/gcc/glibc-2.36-libsanitizer-gcc-5-9.patch b/packages/gcc/glibc-2.36-libsanitizer-gcc-5-9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2cd2bc4e5b393398bd935121e06f390b36551957
--- /dev/null
+++ b/packages/gcc/glibc-2.36-libsanitizer-gcc-5-9.patch
@@ -0,0 +1,27 @@
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index e8fce8a02..5122baa46 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -65,7 +65,6 @@
+ #include <sys/vt.h>
+ #include <linux/cdrom.h>
+ #include <linux/fd.h>
+-#include <linux/fs.h>
+ #include <linux/hdreg.h>
+ #include <linux/input.h>
+ #include <linux/ioctl.h>
+@@ -846,10 +845,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
+   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
+ #endif
+-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
+-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
+-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
+-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
++  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
++  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
++  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
++  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
+   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
+   unsigned IOCTL_GIO_FONT = GIO_FONT;
+   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
diff --git a/packages/gcc/package.py b/packages/gcc/package.py
new file mode 100644
index 0000000000000000000000000000000000000000..f572a133bd47a412aebcc627bb3e422385c95f5f
--- /dev/null
+++ b/packages/gcc/package.py
@@ -0,0 +1,1091 @@
+# 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)
+import glob
+import itertools
+import os
+import re
+import sys
+
+from archspec.cpu import UnsupportedMicroarchitecture
+
+import llnl.util.tty as tty
+from llnl.util.lang import classproperty
+
+import spack.platforms
+import spack.util.executable
+from spack.build_environment import dso_suffix
+from spack.operating_systems.mac_os import macos_sdk_path, macos_version
+from spack.package import *
+
+
+class Gcc(AutotoolsPackage, GNUMirrorPackage):
+    """The GNU Compiler Collection includes front ends for C, C++, Objective-C,
+    Fortran, Ada, and Go, as well as libraries for these languages."""
+
+    homepage = "https://gcc.gnu.org"
+    gnu_mirror_path = "gcc/gcc-9.2.0/gcc-9.2.0.tar.xz"
+    git = "git://gcc.gnu.org/git/gcc.git"
+    list_url = "https://ftp.gnu.org/gnu/gcc/"
+    list_depth = 1
+    keep_werror = "all"
+
+    maintainers("michaelkuhn", "alalazo")
+
+    version("master", branch="master")
+
+    version("13.1.0", sha256="61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86")
+
+    version("12.3.0", sha256="949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b")
+    version("12.2.0", sha256="e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff")
+    version("12.1.0", sha256="62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b")
+
+    version("11.3.0", sha256="b47cf2818691f5b1e21df2bb38c795fac2cfbd640ede2d0a5e1c89e338a3ac39")
+    version("11.2.0", sha256="d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b")
+    version("11.1.0", sha256="4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf")
+
+    version("10.4.0", sha256="c9297d5bcd7cb43f3dfc2fed5389e948c9312fd962ef6a4ce455cff963ebe4f1")
+    version("10.3.0", sha256="64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344")
+    version("10.2.0", sha256="b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c")
+    version("10.1.0", sha256="b6898a23844b656f1b68691c5c012036c2e694ac4b53a8918d4712ad876e7ea2")
+
+    version("9.5.0", sha256="27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f")
+    version("9.4.0", sha256="c95da32f440378d7751dd95533186f7fc05ceb4fb65eb5b85234e6299eb9838e")
+    version("9.3.0", sha256="71e197867611f6054aa1119b13a0c0abac12834765fe2d81f35ac57f84f742d1")
+    version("9.2.0", sha256="ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206")
+    version("9.1.0", sha256="79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0")
+
+    version("8.5.0", sha256="d308841a511bb830a6100397b0042db24ce11f642dab6ea6ee44842e5325ed50")
+    version("8.4.0", sha256="e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4")
+    version("8.3.0", sha256="64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c")
+    version("8.2.0", sha256="196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080")
+    version("8.1.0", sha256="1d1866f992626e61349a1ccd0b8d5253816222cdc13390dcfaa74b093aa2b153")
+
+    version("7.5.0", sha256="b81946e7f01f90528a1f7352ab08cc602b9ccc05d4e44da4bd501c5a189ee661")
+    version("7.4.0", sha256="eddde28d04f334aec1604456e536416549e9b1aa137fc69204e65eb0c009fe51")
+    version("7.3.0", sha256="832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c")
+    version("7.2.0", sha256="1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a")
+    version("7.1.0", sha256="8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17")
+
+    version("6.5.0", sha256="7ef1796ce497e89479183702635b14bb7a46b53249209a5e0f999bebf4740945")
+    version("6.4.0", sha256="850bf21eafdfe5cd5f6827148184c08c4a0852a37ccf36ce69855334d2c914d4")
+    version("6.3.0", sha256="f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f")
+    version("6.2.0", sha256="9944589fc722d3e66308c0ce5257788ebd7872982a718aa2516123940671b7c5")
+    version("6.1.0", sha256="09c4c85cabebb971b1de732a0219609f93fc0af5f86f6e437fd8d7f832f1a351")
+
+    version("5.5.0", sha256="530cea139d82fe542b358961130c69cfde8b3d14556370b65823d2f91f0ced87")
+    version("5.4.0", sha256="608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a")
+    version("5.3.0", sha256="b84f5592e9218b73dbae612b5253035a7b34a9a1f7688d2e1bfaaf7267d5c4db")
+    version("5.2.0", sha256="5f835b04b5f7dd4f4d2dc96190ec1621b8d89f2dc6f638f9f8bc1b1014ba8cad")
+    version("5.1.0", sha256="b7dafdf89cbb0e20333dbf5b5349319ae06e3d1a30bf3515b5488f7e89dca5ad")
+
+    version("4.9.4", sha256="6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092")
+    version("4.9.3", sha256="2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e")
+    version("4.9.2", sha256="2020c98295856aa13fda0f2f3a4794490757fc24bcca918d52cc8b4917b972dd")
+    version("4.9.1", sha256="d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e")
+    version("4.8.5", sha256="22fb1e7e0f68a63cee631d85b20461d1ea6bda162f03096350e38c8d427ecf23")
+    version("4.8.4", sha256="4a80aa23798b8e9b5793494b8c976b39b8d9aa2e53cd5ed5534aff662a7f8695")
+    version("4.7.4", sha256="92e61c6dc3a0a449e62d72a38185fda550168a86702dea07125ebd3ec3996282")
+    version("4.6.4", sha256="35af16afa0b67af9b8eb15cafb76d2bc5f568540552522f5dc2c88dd45d977e8")
+    version("4.5.4", sha256="eef3f0456db8c3d992cbb51d5d32558190bc14f3bc19383dd93acc27acc6befc")
+
+    # We specifically do not add 'all' variant here because:
+    # (i) Ada, D, Go, Jit, and Objective-C++ are not default languages.
+    # In that respect, the name 'all' is rather misleading.
+    # (ii) Languages other than c,c++,fortran are prone to configure bug in GCC
+    # For example, 'java' appears to ignore custom location of zlib
+    # (iii) meaning of 'all' changes with GCC version, i.e. 'java' is not part
+    # of gcc7. Correctly specifying conflicts() and depends_on() in such a
+    # case is a PITA.
+    #
+    # Also note that some languages get enabled by the configure scripts even if not listed in the
+    # arguments. For example, c++ is enabled when the bootstrapping is enabled and lto is enabled
+    # when the link time optimization support is enabled.
+    variant(
+        "languages",
+        default="c,c++,fortran",
+        values=(
+            "ada",
+            "brig",
+            "c",
+            "c++",
+            "d",
+            "fortran",
+            "go",
+            "java",
+            "jit",
+            "lto",
+            "objc",
+            "obj-c++",
+        ),
+        multi=True,
+        description="Compilers and runtime libraries to build",
+    )
+    variant("binutils", default=False, description="Build via binutils")
+    variant(
+        "piclibs", default=False, description="Build PIC versions of libgfortran.a and libstdc++.a"
+    )
+    variant("strip", default=False, description="Strip executables to reduce installation size")
+    variant("nvptx", default=False, description="Target nvptx offloading to NVIDIA GPUs")
+    variant("bootstrap", default=True, description="Enable 3-stage bootstrap")
+    variant(
+        "graphite", default=False, description="Enable Graphite loop optimizations (requires ISL)"
+    )
+    variant(
+        "build_type",
+        default="RelWithDebInfo",
+        values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
+        description="CMake-like build type. "
+        "Debug: -O0 -g; Release: -O3; "
+        "RelWithDebInfo: -O2 -g; MinSizeRel: -Os",
+    )
+    variant(
+        "profiled",
+        default=False,
+        description="Use Profile Guided Optimization",
+        when="+bootstrap %gcc",
+    )
+
+    depends_on("flex", type="build", when="@master")
+
+    # https://gcc.gnu.org/install/prerequisites.html
+    depends_on("gmp@4.3.2:")
+    # mawk is not sufficient for go support
+    depends_on("gawk@3.1.5:", type="build")
+    depends_on("texinfo@4.7:", type="build")
+    depends_on("libtool", type="build")
+    # dependencies required for git versions
+    depends_on("m4@1.4.6:", when="@master", type="build")
+    depends_on("automake@1.15.1:", when="@master", type="build")
+    depends_on("autoconf@2.69:", when="@master", type="build")
+
+    depends_on("gmake@3.80:", type="build")
+    depends_on("perl@5", type="build")
+
+    # GCC 7.3 does not compile with newer releases on some platforms, see
+    #   https://github.com/spack/spack/issues/6902#issuecomment-433030376
+    depends_on("mpfr@2.4.2:3.1.6", when="@:9.9")
+    depends_on("mpfr@3.1.0:", when="@10:")
+    depends_on("mpc@1.0.1:", when="@4.5:")
+    # Already released GCC versions do not support any newer version of ISL
+    #   GCC 5.4 https://github.com/spack/spack/issues/6902#issuecomment-433072097
+    #   GCC 7.3 https://github.com/spack/spack/issues/6902#issuecomment-433030376
+    #   GCC 9+  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724
+    with when("+graphite"):
+        depends_on("isl@0.14", when="@5.0:5.2")
+        depends_on("isl@0.15", when="@5.3:5.9")
+        depends_on("isl@0.15:0.18", when="@6:8.9")
+        depends_on("isl@0.15:0.20", when="@9:9.9")
+        depends_on("isl@0.15:", when="@10:")
+
+    depends_on("zlib", when="@6:")
+    depends_on("zstd", when="@10:")
+    depends_on("diffutils", type="build")
+    depends_on("iconv", when="platform=darwin")
+    depends_on("gnat", when="languages=ada")
+    depends_on(
+        "binutils+gas+ld+plugins~libiberty", when="+binutils", type=("build", "link", "run")
+    )
+    depends_on("zip", type="build", when="languages=java")
+
+    # The server is sometimes a bit slow to respond
+    timeout = {"timeout": 60}
+
+    # TODO: integrate these libraries.
+    # depends_on('ppl')
+    # depends_on('cloog')
+
+    # https://gcc.gnu.org/install/test.html
+    depends_on("dejagnu@1.4.4", type="test")
+    depends_on("expect", type="test")
+    depends_on("tcl", type="test")
+    depends_on("autogen@5.5.4:", type="test")
+    depends_on("guile@1.4.1:", type="test")
+
+    # See https://go.dev/doc/install/gccgo#Releases
+    with when("languages=go"):
+        provides("go-or-gccgo-bootstrap@:1.0", when="@4.7.1:")
+        provides("go-or-gccgo-bootstrap@:1.2", when="@4.9:")
+        provides("go-or-gccgo-bootstrap@:1.4", when="@5:")
+        provides("go-or-gccgo-bootstrap@:1.6.1", when="@6:")
+        provides("go-or-gccgo-bootstrap@:1.8.1", when="@7:")
+        provides("go-or-gccgo-bootstrap@:1.10.1", when="@8:")
+        provides("go-or-gccgo-bootstrap@:1.12.2", when="@9:")
+        provides("go-or-gccgo-bootstrap@:1.14.6", when="@10:")
+        provides("go-or-gccgo-bootstrap@1.16.3:1.16.5", when="@11:")
+
+        provides("golang@:1.0", when="@4.7.1:")
+        provides("golang@:1.2", when="@4.9:")
+        provides("golang@:1.4", when="@5:")
+        provides("golang@:1.6.1", when="@6:")
+        provides("golang@:1.8.1", when="@7:")
+        provides("golang@:1.10.1", when="@8:")
+        provides("golang@:1.12.2", when="@9:")
+        provides("golang@:1.14.6", when="@10:")
+        provides("golang@1.16.3:1.16.5", when="@11:")
+
+        # GCC 4.7.1 added full support for the Go 1.x programming language.
+        conflicts("@:4.7.0")
+
+        # Go is not supported on macOS
+        conflicts("platform=darwin", msg="GCC cannot build Go support on MacOS")
+
+    # For a list of valid languages for a specific release,
+    # run the following command in the GCC source directory:
+    #    $ grep ^language= gcc/*/config-lang.in
+    # See https://gcc.gnu.org/install/configure.html
+
+    # Support for processing BRIG 1.0 files was added in GCC 7
+    # BRIG is a binary format for HSAIL:
+    # (Heterogeneous System Architecture Intermediate Language).
+    # See https://gcc.gnu.org/gcc-7/changes.html
+    conflicts("languages=brig", when="@:6")
+
+    # BRIG does not seem to be supported on macOS
+    conflicts("languages=brig", when="platform=darwin")
+
+    # GCC 4.8 added a 'c' language. I'm sure C was always built,
+    # but this is the first version that accepts 'c' as a valid language.
+    conflicts("languages=c", when="@:4.7")
+
+    # The GCC Java frontend and associated libjava runtime library
+    # have been removed from GCC as of GCC 7.
+    # See https://gcc.gnu.org/gcc-7/changes.html
+    conflicts("languages=java", when="@7:")
+
+    # GCC 5 added the ability to build GCC as a Just-In-Time compiler.
+    # See https://gcc.gnu.org/gcc-5/changes.html
+    conflicts("languages=jit", when="@:4")
+
+    with when("languages=d"):
+        # The very first version of GDC that became part of GCC already supported version 2.076 of
+        # the language and runtime.
+        # See https://wiki.dlang.org/GDC#Status
+        provides("D@2")
+
+        # Support for the D programming language has been added to GCC 9.
+        # See https://gcc.gnu.org/gcc-9/changes.html#d
+        conflicts("@:8", msg="support for D has been added in GCC 9.1")
+
+        # Versions of GDC prior to 12 can be built with an ISO C++11 compiler. Starting version 12,
+        # the D frontend requires a working GDC. Moreover, it is strongly recommended to use an
+        # older version of GDC to build GDC.
+        # See https://gcc.gnu.org/install/prerequisites.html#GDC-prerequisite
+        with when("@12:"):
+            # All versions starting 12 have to be built GCC:
+            requires("%gcc")
+
+            # And it has to be GCC older than the version we build:
+            vv = ["11", "12.1.0", "12.2.0"]
+            for prev_v, curr_v in zip(vv, vv[1:]):
+                conflicts(
+                    "%gcc@{0}:".format(curr_v),
+                    when="@{0}".format(curr_v),
+                    msg="'gcc@{0} languages=d' requires '%gcc@:{1}' "
+                    "with the D language support".format(curr_v, prev_v),
+                )
+
+            # In principle, it is possible to have GDC even with GCC 5.
+            # See https://github.com/D-Programming-GDC/gdc
+            # We, however, require at least the oldest version that officially supports GDC. It is
+            # also a good opportunity to tell the users that they need a working GDC:
+            conflicts(
+                "%gcc@:8",
+                msg="'gcc@12: languages=d' requires '%gcc@9:' with the D language support",
+            )
+
+    with when("+nvptx"):
+        depends_on("cuda")
+        resource(
+            name="newlib",
+            url="ftp://sourceware.org/pub/newlib/newlib-3.0.0.20180831.tar.gz",
+            sha256="3ad3664f227357df15ff34e954bfd9f501009a647667cd307bf0658aefd6eb5b",
+            destination="newlibsource",
+            fetch_options=timeout,
+        )
+        # nvptx-tools does not seem to work as a dependency,
+        # but does fine when the source is inside the gcc build directory
+        # nvptx-tools doesn't have any releases, so grabbing the last commit
+        resource(
+            name="nvptx-tools",
+            git="https://github.com/MentorEmbedded/nvptx-tools",
+            commit="d0524fbdc86dfca068db5a21cc78ac255b335be5",
+        )
+        # NVPTX offloading supported in 7 and later by limited languages
+        conflicts("@:6", msg="NVPTX only supported in gcc 7 and above")
+        conflicts("languages=ada")
+        conflicts("languages=brig")
+        conflicts("languages=go")
+        conflicts("languages=java")
+        conflicts("languages=jit")
+        conflicts("languages=objc")
+        conflicts("languages=obj-c++")
+        conflicts("languages=d")
+        # NVPTX build disables bootstrap
+        conflicts("+bootstrap")
+
+    # Binutils can't build ld on macOS
+    conflicts("+binutils", when="platform=darwin")
+
+    # Bootstrap comparison failure:
+    #   see https://github.com/spack/spack/issues/23296
+    #   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100340
+    #   on XCode 12.5
+    conflicts("+bootstrap", when="@:11.1 %apple-clang@12.0.5")
+
+    # aarch64/M1 is supported in GCC 11.3-12.2
+    conflicts(
+        "@:11.2,12.3:",
+        when="target=aarch64: platform=darwin",
+        msg="Only GCC 11.3-12.2 support macOS M1 (aarch64)",
+    )
+
+    # Newer binutils than RHEL's is required to run `as` on some instructions
+    # generated by new GCC (see https://github.com/spack/spack/issues/12235)
+    conflicts("~binutils", when="@7: os=rhel6", msg="New GCC cannot use system assembler on RHEL6")
+    # Ditto for RHEL7/8: OpenBLAS uses flags which the RHEL system-binutils don't have:
+    # https://github.com/xianyi/OpenBLAS/issues/3805#issuecomment-1319878852
+    conflicts(
+        "~binutils", when="@10: os=rhel7", msg="gcc: Add +binutils - preinstalled as might be old"
+    )
+    conflicts(
+        "~binutils", when="@10: os=rhel8", msg="gcc: Add +binutils - preinstalled as might be old"
+    )
+
+    # GCC 11 requires GCC 4.8 or later (https://gcc.gnu.org/gcc-11/changes.html)
+    conflicts("%gcc@:4.7", when="@11:")
+
+    # https://github.com/iains/gcc-12-branch/issues/6
+    conflicts("@:12", when="%apple-clang@14:14.0")
+
+    if sys.platform == "darwin":
+        # Fix parallel build on APFS filesystem
+        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797
+        if macos_version() >= Version("10.13"):
+            patch("darwin/apfs.patch", when="@5.5.0,6.1:6.4,7.1:7.3")
+            # from homebrew via macports
+            # https://trac.macports.org/ticket/56502#no1
+            # see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83531
+            patch("darwin/headers-10.13-fix.patch", when="@5.5.0")
+        if macos_version() >= Version("10.14"):
+            # Fix system headers for Mojave SDK:
+            # https://github.com/Homebrew/homebrew-core/pull/39041
+            patch(
+                "https://raw.githubusercontent.com/Homebrew/formula-patches/b8b8e65e/gcc/8.3.0-xcode-bug-_Atomic-fix.patch",
+                sha256="33ee92bf678586357ee8ab9d2faddf807e671ad37b97afdd102d5d153d03ca84",
+                when="@6:8.3",
+            )
+        if macos_version() >= Version("10.15"):
+            # Fix system headers for Catalina SDK
+            # (otherwise __OSX_AVAILABLE_STARTING ends up undefined)
+            patch(
+                "https://raw.githubusercontent.com/Homebrew/formula-patches/b8b8e65e/gcc/9.2.0-catalina.patch",
+                sha256="0b8d14a7f3c6a2f0d2498526e86e088926671b5da50a554ffa6b7f73ac4f132b",
+                when="@9.2.0",
+            )
+
+            # See https://raw.githubusercontent.com/Homebrew/homebrew-core/3b7db4457ac64a31e3bbffc54b04c4bd824a4a4a/Formula/gcc.rb
+            patch(
+                "https://github.com/iains/gcc-darwin-arm64/commit/20f61faaed3b335d792e38892d826054d2ac9f15.patch?full_index=1",
+                sha256="c0605179a856ca046d093c13cea4d2e024809ec2ad4bf3708543fc3d2e60504b",
+                when="@11.2.0",
+            )
+
+        # Apple M1 support, created from branch of Darwin maintainer for GCC:
+        # https://github.com/iains/gcc-11-branch
+        patch(
+            "https://raw.githubusercontent.com/Homebrew/formula-patches/22dec3fc/gcc/gcc-11.3.0-arm.diff",
+            sha256="e02006b7ec917cc1390645d95735a6a866caed0dfe506d5bef742f7862cab218",
+            when="@11.3.0 target=aarch64:",
+        )
+        # https://github.com/iains/gcc-12-branch
+        patch(
+            "https://raw.githubusercontent.com/Homebrew/formula-patches/76677f2b/gcc/gcc-12.1.0-arm.diff",
+            sha256="a000f1d9cb1dd98c7c4ef00df31435cd5d712d2f9d037ddc044f8bf82a16cf35",
+            when="@12.1.0 target=aarch64:",
+        )
+        patch(
+            "https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff",
+            sha256="a7843b5c6bf1401e40c20c72af69c8f6fc9754ae980bb4a5f0540220b3dcb62d",
+            when="@12.2.0 target=aarch64:",
+        )
+        conflicts("+bootstrap", when="@11.3.0 target=aarch64:")
+
+        # Use -headerpad_max_install_names in the build,
+        # otherwise updated load commands won't fit in the Mach-O header.
+        # This is needed because `gcc` avoids the superenv shim.
+        patch("darwin/gcc-7.1.0-headerpad.patch", when="@5:11.2")
+        patch("darwin/gcc-6.1.0-jit.patch", when="@5:7")
+        patch("darwin/gcc-4.9.patch1", when="@4.9.0:4.9.3")
+        patch("darwin/gcc-4.9.patch2", when="@4.9.0:4.9.3")
+
+        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92061
+        patch("darwin/clang13.patch", when="@:11.1 %apple-clang@13")
+
+    patch("piclibs.patch", when="+piclibs")
+    patch("gcc-backport.patch", when="@4.7:4.9.3,5:5.3")
+
+    # Backport libsanitizer patch for glibc >= 2.31 and 5.3.0 <= gcc <= 9.2.0
+    # https://bugs.gentoo.org/708346
+    patch("glibc-2.31-libsanitizer-1.patch", when="@7.1.0:7.5.0,8.1.0:8.3.0,9.0.0:9.2.0")
+    patch("glibc-2.31-libsanitizer-1-gcc-6.patch", when="@5.3.0:5.5.0,6.1.0:6.5.0")
+    patch("glibc-2.31-libsanitizer-2.patch", when="@8.1.0:8.3.0,9.0.0:9.2.0")
+    patch("glibc-2.31-libsanitizer-2-gcc-6.patch", when="@5.3.0:5.5.0,6.1.0:6.5.0")
+    patch("glibc-2.31-libsanitizer-2-gcc-7.patch", when="@7.1.0:7.5.0")
+    patch(
+        "patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch",
+        when="@6.5.0,7.4.0:7.5.0,8.2.0:9.3.0",
+    )
+    patch("patch-745dae5923aba02982563481d75a21595df22ff8.patch", when="@10.1.0:10.3.0,11.1.0")
+
+    # Backport libsanitizer patch for glibc >= 2.36
+    # https://reviews.llvm.org/D129471
+    patch("glibc-2.36-libsanitizer-gcc-5-9.patch", when="@5.1:5.5,6.1:6.5,7.1:7.5,8.1:8.5,9.1:9.5")
+    patch("glibc-2.36-libsanitizer-gcc-10-12.patch", when="@10.1:10.4,11.1:11.3,12.1.0")
+
+    # Older versions do not compile with newer versions of glibc
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
+    patch("ucontext_t.patch", when="@4.9,5.1:5.4,6.1:6.4,7.1")
+    patch("ucontext_t-java.patch", when="@4.9,5.1:5.4,6.1:6.4 languages=java")
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81066
+    patch("stack_t-4.9.patch", when="@4.9")
+    patch("stack_t.patch", when="@5.1:5.4,6.1:6.4,7.1")
+    # https://bugs.busybox.net/show_bug.cgi?id=10061
+    patch("signal.patch", when="@4.9,5.1:5.4")
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85835
+    patch("sys_ustat.h.patch", when="@5.0:6.4,7.0:7.3,8.1")
+    patch("sys_ustat-4.9.patch", when="@4.9")
+
+    # this patch removes cylades support from gcc-5 and allows gcc-5 to be built
+    # with newer glibc versions.
+    patch("glibc-2.31-libsanitizer-3-gcc-5.patch", when="@5.3.0:5.5.0")
+
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005
+    patch("zstd.patch", when="@10")
+
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100102
+    patch("patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch", when="@10.1:10.3")
+    patch("patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch", when="@11.1")
+
+    # libstdc++: Fix inconsistent noexcept-specific for valarray begin/end
+    patch(
+        "https://github.com/gcc-mirror/gcc/commit/423cd47cfc9640ba3d6811b780e8a0b94b704dcb.patch?full_index=1",
+        sha256="0d136226eb07bc43f1b15284f48bd252e3748a0426b5d7ac9084ebc406e15490",
+        when="@9.5.0,10.4.0",
+    )
+
+    build_directory = "spack-build"
+
+    @classproperty
+    def executables(cls):
+        names = [r"gcc", r"[^\w]?g\+\+", r"gfortran", r"gdc", r"gccgo"]
+        suffixes = [r"", r"-mp-\d+\.\d", r"-\d+\.\d", r"-\d+", r"\d\d"]
+        return [r"".join(x) for x in itertools.product(names, suffixes)]
+
+    @classmethod
+    def filter_detected_exes(cls, prefix, exes_in_prefix):
+        result = []
+        for exe in exes_in_prefix:
+            # On systems like Ubuntu we might get multiple executables
+            # with the string "gcc" in them. See:
+            # https://helpmanual.io/packages/apt/gcc/
+            basename = os.path.basename(exe)
+            substring_to_be_filtered = [
+                "c99-gcc",
+                "c89-gcc",
+                "-nm",
+                "-ar",
+                "ranlib",
+                "clang",  # clang++ matches g++ -> clan[g++]
+            ]
+            if any(x in basename for x in substring_to_be_filtered):
+                continue
+            # Filter out links in favor of real executables on
+            # all systems but Cray
+            host_platform = str(spack.platforms.host())
+            if os.path.islink(exe) and host_platform != "cray":
+                continue
+
+            result.append(exe)
+
+        return result
+
+    @classmethod
+    def determine_version(cls, exe):
+        try:
+            output = spack.compiler.get_compiler_version_output(exe, "--version")
+        except Exception:
+            output = ""
+        # Apple's gcc is actually apple clang, so skip it.
+        # Users can add it manually to compilers.yaml at their own risk.
+        if "Apple" in output:
+            return None
+
+        version_regex = re.compile(r"([\d\.]+)")
+        for vargs in ("-dumpfullversion", "-dumpversion"):
+            try:
+                output = spack.compiler.get_compiler_version_output(exe, vargs)
+                match = version_regex.search(output)
+                if match:
+                    return match.group(1)
+            except spack.util.executable.ProcessError:
+                pass
+            except Exception as e:
+                tty.debug(e)
+
+        return None
+
+    @classmethod
+    def determine_variants(cls, exes, version_str):
+        languages, compilers = set(), {}
+        # There are often at least two copies (not symlinks) of each compiler executable in the
+        # same directory: one with a canonical name, e.g. "gfortran", and another one with the
+        # target prefix, e.g. "x86_64-pc-linux-gnu-gfortran". There also might be a copy of "gcc"
+        # with the version suffix, e.g. "x86_64-pc-linux-gnu-gcc-6.3.0". To ensure the consistency
+        # of values in the "compilers" dictionary (i.e. we prefer all of them to reference copies
+        # with canonical names if possible), we iterate over the executables in the reversed sorted
+        # order:
+        for exe in sorted(exes, reverse=True):
+            basename = os.path.basename(exe)
+            if "g++" in basename:
+                languages.add("c++")
+                compilers["cxx"] = exe
+            elif "gfortran" in basename:
+                languages.add("fortran")
+                compilers["fortran"] = exe
+            elif "gcc" in basename:
+                languages.add("c")
+                compilers["c"] = exe
+            elif "gccgo" in basename:
+                languages.add("go")
+                compilers["go"] = exe
+            elif "gdc" in basename:
+                languages.add("d")
+                compilers["d"] = exe
+        variant_str = "languages={0}".format(",".join(languages))
+        return variant_str, {"compilers": compilers}
+
+    @classmethod
+    def validate_detected_spec(cls, spec, extra_attributes):
+        # For GCC 'compilers' is a mandatory attribute
+        msg = 'the extra attribute "compilers" must be set for ' 'the detected spec "{0}"'.format(
+            spec
+        )
+        assert "compilers" in extra_attributes, msg
+
+        compilers = extra_attributes["compilers"]
+        for constraint, key in {
+            "languages=c": "c",
+            "languages=c++": "cxx",
+            "languages=d": "d",
+            "languages=fortran": "fortran",
+        }.items():
+            if spec.satisfies(constraint):
+                msg = "{0} not in {1}"
+                assert key in compilers, msg.format(key, spec)
+
+    @property
+    def cc(self):
+        msg = "cannot retrieve C compiler [spec is not concrete]"
+        assert self.spec.concrete, msg
+        if self.spec.external:
+            return self.spec.extra_attributes["compilers"].get("c", None)
+        result = None
+        if "languages=c" in self.spec:
+            result = str(self.spec.prefix.bin.gcc)
+        return result
+
+    @property
+    def cxx(self):
+        msg = "cannot retrieve C++ compiler [spec is not concrete]"
+        assert self.spec.concrete, msg
+        if self.spec.external:
+            return self.spec.extra_attributes["compilers"].get("cxx", None)
+        result = None
+        if "languages=c++" in self.spec:
+            result = os.path.join(self.spec.prefix.bin, "g++")
+        return result
+
+    @property
+    def fortran(self):
+        msg = "cannot retrieve Fortran compiler [spec is not concrete]"
+        assert self.spec.concrete, msg
+        if self.spec.external:
+            return self.spec.extra_attributes["compilers"].get("fortran", None)
+        result = None
+        if "languages=fortran" in self.spec:
+            result = str(self.spec.prefix.bin.gfortran)
+        return result
+
+    def url_for_version(self, version):
+        # This function will be called when trying to fetch from url, before
+        # mirrors are tried. It takes care of modifying the suffix of gnu
+        # mirror path so that Spack will also look for the correct file in
+        # the mirrors
+        if (version < Version("6.4.0") and version != Version("5.5.0")) or version == Version(
+            "7.1.0"
+        ):
+            self.gnu_mirror_path = self.gnu_mirror_path.replace("xz", "bz2")
+        return super(Gcc, self).url_for_version(version)
+
+    def patch(self):
+        spec = self.spec
+        prefix = self.spec.prefix
+
+        # Fix a standard header file for OS X Yosemite that
+        # is GCC incompatible by replacing non-GCC compliant macros
+        if "yosemite" in spec.architecture:
+            if os.path.isfile("/usr/include/dispatch/object.h"):
+                new_dispatch_dir = join_path(prefix, "include", "dispatch")
+                mkdirp(new_dispatch_dir)
+                new_header = join_path(new_dispatch_dir, "object.h")
+                install("/usr/include/dispatch/object.h", new_header)
+                filter_file(
+                    r"typedef void \(\^dispatch_block_t\)\(void\)",
+                    "typedef void* dispatch_block_t",
+                    new_header,
+                )
+
+        # Use installed libz
+        if self.version >= Version("6"):
+            filter_file("@zlibdir@", "-L{0}".format(spec["zlib"].prefix.lib), "gcc/Makefile.in")
+            filter_file(
+                "@zlibinc@", "-I{0}".format(spec["zlib"].prefix.include), "gcc/Makefile.in"
+            )
+
+        if spec.satisfies("+nvptx"):
+            # backport of 383400a6078d upstream to allow support of cuda@11:
+            filter_file(
+                '#define ASM_SPEC "%{misa=*:-m %*}"',
+                '#define ASM_SPEC "%{misa=*:-m %*; :-m sm_35}"',
+                "gcc/config/nvptx/nvptx.h",
+                string=True,
+            )
+            filter_file(
+                "Target RejectNegative ToLower Joined "
+                "Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM30)",
+                "Target RejectNegative ToLower Joined "
+                "Enum(ptx_isa) Var(ptx_isa_option) Init(PTX_ISA_SM35)",
+                "gcc/config/nvptx/nvptx.opt",
+                string=True,
+            )
+        self.build_optimization_config()
+
+    def get_common_target_flags(self, spec):
+        """Get the right (but pessimistic) architecture specific flags supported by
+        both host gcc and to-be-built gcc. For example: gcc@7 %gcc@12 target=znver3
+        should pick -march=znver1, since that's what gcc@7 supports."""
+        archs = [spec.target] + spec.target.ancestors
+        for arch in archs:
+            try:
+                return arch.optimization_flags("gcc", spec.version)
+            except UnsupportedMicroarchitecture:
+                pass
+        # no arch specific flags in common, unlikely to happen.
+        return ""
+
+    def build_optimization_config(self):
+        """Write a config/spack.mk file with sensible optimization flags, taking into
+        account bootstrapping subtleties."""
+        build_type_flags = {
+            "Debug": "-O0 -g",
+            "Release": "-O3",
+            "RelWithDebInfo": "-O2 -g",
+            "MinSizeRel": "-Os",
+        }
+
+        # Generic optimization flags.
+        flags = build_type_flags[self.spec.variants["build_type"].value]
+
+        # Pessimistic target specific flags. For example, when building
+        # gcc@11 %gcc@7 on znver3, Spack will fix the target to znver1 during
+        # concretization, so we'll stick to that. The other way around however can
+        # result in compilation errors, when gcc@7 is built with gcc@11, and znver3
+        # is taken as a the target, which gcc@7 doesn't support.
+        # Note we're not adding this for aarch64 because of
+        # https://github.com/spack/spack/issues/31184
+        if "+bootstrap %gcc" in self.spec and self.spec.target.family != "aarch64":
+            flags += " " + self.get_common_target_flags(self.spec)
+
+        if "+bootstrap" in self.spec:
+            variables = ["BOOT_CFLAGS", "CFLAGS_FOR_TARGET", "CXXFLAGS_FOR_TARGET"]
+        else:
+            variables = ["CFLAGS", "CXXFLAGS"]
+
+        # Redefine a few variables without losing other defaults:
+        # BOOT_CFLAGS = $(filter-out -O% -g%, $(BOOT_CFLAGS)) -O3
+        # This makes sure that build_type=Release is really -O3, not -O3 -g.
+        fmt_string = "{} := $(filter-out -O% -g%, $({})) {}\n"
+        with open("config/spack.mk", "w") as f:
+            for var in variables:
+                f.write(fmt_string.format(var, var, flags))
+            # Improve the build time for stage 2 a bit by enabling -O1 in stage 1.
+            # Note: this is ignored under ~bootstrap.
+            f.write("STAGE1_CFLAGS += -O1\n")
+
+    # https://gcc.gnu.org/install/configure.html
+    def configure_args(self):
+        spec = self.spec
+
+        # Generic options to compile GCC
+        options = [
+            # Distributor options
+            "--with-pkgversion=Spack GCC",
+            "--with-bugurl=https://github.com/spack/spack/issues",
+            # Xcode 10 dropped 32-bit support
+            "--disable-multilib",
+            "--enable-languages={0}".format(",".join(spec.variants["languages"].value)),
+            # Drop gettext dependency
+            "--disable-nls",
+        ]
+
+        # Avoid excessive realpath/stat calls for every system header
+        # by making -fno-canonical-system-headers the default.
+        if self.version >= Version("4.8.0"):
+            options.append("--disable-canonical-system-headers")
+
+        # Use installed libz
+        if self.version >= Version("6"):
+            options.append("--with-system-zlib")
+
+        if "zstd" in spec:
+            options.append("--with-zstd-include={0}".format(spec["zstd"].headers.directories[0]))
+            options.append("--with-zstd-lib={0}".format(spec["zstd"].libs.directories[0]))
+
+        # Enabling language "jit" requires --enable-host-shared.
+        if "languages=jit" in spec:
+            options.append("--enable-host-shared")
+
+        # Binutils
+        if spec.satisfies("+binutils"):
+            binutils = spec["binutils"].prefix.bin
+            options.extend(
+                [
+                    "--with-gnu-ld",
+                    "--with-ld=" + binutils.ld,
+                    "--with-gnu-as",
+                    "--with-as=" + binutils.join("as"),
+                ]
+            )
+
+        # enable_bootstrap
+        if spec.satisfies("+bootstrap"):
+            options.extend(["--enable-bootstrap"])
+        else:
+            options.extend(["--disable-bootstrap"])
+
+        # Configure include and lib directories explicitly for these
+        # dependencies since the short GCC option assumes that libraries
+        # are installed in "/lib" which might not be true on all OS
+        # (see #10842)
+        #
+        # More info at: https://gcc.gnu.org/install/configure.html
+        for dep_str in ("mpfr", "gmp", "mpc", "isl"):
+            if dep_str not in spec:
+                options.append("--without-{0}".format(dep_str))
+                continue
+
+            dep_spec = spec[dep_str]
+            include_dir = dep_spec.headers.directories[0]
+            lib_dir = dep_spec.libs.directories[0]
+            options.extend(
+                [
+                    "--with-{0}-include={1}".format(dep_str, include_dir),
+                    "--with-{0}-lib={1}".format(dep_str, lib_dir),
+                ]
+            )
+
+        # nvptx-none offloading for host compiler
+        if spec.satisfies("+nvptx"):
+            options.extend(
+                [
+                    "--enable-offload-targets=nvptx-none",
+                    "--with-cuda-driver-include={0}".format(spec["cuda"].prefix.include),
+                    "--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]),
+                    "--disable-bootstrap",
+                    "--disable-multilib",
+                ]
+            )
+
+        if sys.platform == "darwin":
+            options.extend(
+                [
+                    "--with-native-system-header-dir=/usr/include",
+                    "--with-sysroot={0}".format(macos_sdk_path()),
+                    "--with-libiconv-prefix={0}".format(spec["iconv"].prefix),
+                ]
+            )
+
+        # enable appropriate bootstrapping flags
+        stage1_ldflags = str(self.rpath_args)
+        boot_ldflags = stage1_ldflags + " -static-libstdc++ -static-libgcc"
+        options.append("--with-stage1-ldflags=" + stage1_ldflags)
+        options.append("--with-boot-ldflags=" + boot_ldflags)
+        options.append("--with-build-config=spack")
+
+        if "languages=d" in spec:
+            # Phobos is the standard library for the D Programming Language. The documentation says
+            # that on some targets, 'libphobos' is not enabled by default, but compiles and works
+            # if '--enable-libphobos' is used. Specifics are documented for affected targets.
+            # See https://gcc.gnu.org/install/prerequisites.html#GDC-prerequisite
+            # Unfortunately, it is unclear where exactly the aforementioned specifics are
+            # documented but GDC seems to be unusable without the library, therefore we enable it
+            # explicitly:
+            options.append("--enable-libphobos")
+            if spec.satisfies("@12:"):
+                options.append("GDC={0}".format(self.detect_gdc()))
+
+        return options
+
+    # run configure/make/make(install) for the nvptx-none target
+    # before running the host compiler phases
+    @run_before("configure")
+    def nvptx_install(self):
+        spec = self.spec
+        prefix = self.prefix
+
+        if not spec.satisfies("+nvptx"):
+            return
+
+        # config.guess returns the host triple, e.g. "x86_64-pc-linux-gnu"
+        guess = Executable("./config.guess")
+        targetguess = guess(output=str).rstrip("\n")
+
+        options = getattr(self, "configure_flag_args", [])
+        options += ["--prefix={0}".format(prefix)]
+
+        options += [
+            "--with-cuda-driver-include={0}".format(spec["cuda"].prefix.include),
+            "--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]),
+        ]
+
+        with working_dir("nvptx-tools"):
+            configure = Executable("./configure")
+            configure(*options)
+            make()
+            make("install")
+
+        pattern = join_path(self.stage.source_path, "newlibsource", "*")
+        files = glob.glob(pattern)
+
+        if files:
+            symlink(join_path(files[0], "newlib"), "newlib")
+
+        # self.build_directory = 'spack-build-nvptx'
+        with working_dir("spack-build-nvptx", create=True):
+            options = [
+                "--prefix={0}".format(prefix),
+                "--enable-languages={0}".format(",".join(spec.variants["languages"].value)),
+                "--with-mpfr={0}".format(spec["mpfr"].prefix),
+                "--with-gmp={0}".format(spec["gmp"].prefix),
+                "--target=nvptx-none",
+                "--with-build-time-tools={0}".format(join_path(prefix, "nvptx-none", "bin")),
+                "--enable-as-accelerator-for={0}".format(targetguess),
+                "--disable-sjlj-exceptions",
+                "--enable-newlib-io-long-long",
+            ]
+
+            configure = Executable("../configure")
+            configure(*options)
+            make()
+            make("install")
+
+    @property
+    def build_targets(self):
+        if "+profiled" in self.spec:
+            return ["profiledbootstrap"]
+        return []
+
+    @property
+    def install_targets(self):
+        if "+strip" in self.spec:
+            return ["install-strip"]
+        return ["install"]
+
+    @property
+    def spec_dir(self):
+        # e.g. lib/gcc/x86_64-unknown-linux-gnu/4.9.2
+        spec_dir = glob.glob("{0}/gcc/*/*".format(self.prefix.lib))
+        return spec_dir[0] if spec_dir else None
+
+    @run_after("install")
+    def write_rpath_specs(self):
+        """Generate a spec file so the linker adds a rpath to the libs
+        the compiler used to build the executable.
+
+        .. caution::
+
+           The custom spec file by default with *always* pass ``-Wl,-rpath
+           ...`` to the linker, which will cause the linker to *ignore* the
+           value of ``LD_RUN_PATH``, which otherwise would be saved to the
+           binary as the default rpath. See the mitigation below for how to
+           temporarily disable this behavior.
+
+        Structure the specs file so that users can define a custom spec file
+        to suppress the spack-linked rpaths to facilitate rpath adjustment
+        for relocatable binaries. The custom spec file
+        :file:`{norpath}.spec` will have a single
+        line followed by two blanks lines::
+
+            *link_libgcc_rpath:
+
+
+
+        It can be passed to the GCC linker using the argument
+        ``--specs=norpath.spec`` to disable the automatic rpath and restore
+        the behavior of ``LD_RUN_PATH``."""
+        if not self.spec_dir:
+            tty.warn(
+                "Could not install specs for {0}.".format(self.spec.format("{name}{@version}"))
+            )
+            return
+
+        gcc = self.spec["gcc"].command
+        lines = gcc("-dumpspecs", output=str).splitlines(True)
+        specs_file = join_path(self.spec_dir, "specs")
+
+        # Save a backup
+        with open(specs_file + ".orig", "w") as out:
+            out.writelines(lines)
+
+        # Find which directories have shared libraries
+        rpath_libdirs = []
+        for dir in ["lib", "lib64"]:
+            libdir = join_path(self.prefix, dir)
+            if glob.glob(join_path(libdir, "*." + dso_suffix)):
+                rpath_libdirs.append(libdir)
+
+        if not rpath_libdirs:
+            # No shared libraries
+            tty.warn("No dynamic libraries found in lib/lib64")
+            return
+
+        # Overwrite the specs file
+        with open(specs_file, "w") as out:
+            for line in lines:
+                out.write(line)
+                if line.startswith("*link_libgcc:"):
+                    # Insert at start of line following link_libgcc, which gets
+                    # inserted into every call to the linker
+                    out.write("%(link_libgcc_rpath) ")
+
+            # Add easily-overridable rpath string at the end
+            out.write("*link_libgcc_rpath:\n")
+            out.write(" ".join("-rpath " + lib for lib in rpath_libdirs))
+            out.write("\n")
+        set_install_permissions(specs_file)
+        tty.info("Wrote new spec file to {0}".format(specs_file))
+
+    def setup_run_environment(self, env):
+        # Search prefix directory for possibly modified compiler names
+        from spack.compilers.gcc import Gcc as Compiler
+
+        # Get the contents of the installed binary directory
+        bin_path = self.spec.prefix.bin
+
+        if not os.path.isdir(bin_path):
+            return
+
+        bin_contents = os.listdir(bin_path)
+
+        # Find the first non-symlink compiler binary present for each language
+        for lang in ["cc", "cxx", "fc", "f77"]:
+            for filename, regexp in itertools.product(bin_contents, Compiler.search_regexps(lang)):
+                if not regexp.match(filename):
+                    continue
+
+                abspath = os.path.join(bin_path, filename)
+                if os.path.islink(abspath):
+                    continue
+
+                # Set the proper environment variable
+                env.set(lang.upper(), abspath)
+                # Stop searching filename/regex combos for this language
+                break
+
+    def detect_gdc(self):
+        """Detect and return the path to GDC that belongs to the same instance of GCC that is used
+        by self.compiler.
+
+        If the path cannot be detected, raise InstallError with recommendations for the users on
+        how to circumvent the problem.
+
+        Should be use only if self.spec.satisfies("@12: languages=d")
+        """
+        # Detect GCC package in the directory of the GCC compiler
+        # or in the $PATH if self.compiler.cc is not an absolute path:
+        from spack.detection import by_executable
+
+        compiler_dir = os.path.dirname(self.compiler.cc)
+        detected_packages = by_executable(
+            [self.__class__], path_hints=([compiler_dir] if os.path.isdir(compiler_dir) else None)
+        )
+
+        # We consider only packages that satisfy the following constraint:
+        required_spec = Spec("languages=c,c++,d")
+        candidate_specs = [
+            p.spec
+            for p in filter(
+                lambda p: p.spec.satisfies(required_spec), detected_packages.get(self.name, ())
+            )
+        ]
+
+        if candidate_specs:
+            # We now need to filter specs that match the compiler version:
+            compiler_spec = Spec(repr(self.compiler.spec))
+
+            # First, try to filter specs that satisfy the compiler spec:
+            new_candidate_specs = list(
+                filter(lambda s: s.satisfies(compiler_spec), candidate_specs)
+            )
+
+            # The compiler version might be more specific than what we can detect. For example, the
+            # user might have "gcc@10.2.1-sys" as the compiler spec in compilers.yaml. In that
+            # case, we end up with an empty list of candidates. To circumvent the problem, we try
+            # to filter specs that are satisfied by the compiler spec:
+            if not new_candidate_specs:
+                new_candidate_specs = list(
+                    filter(lambda s: compiler_spec.satisfies(s), candidate_specs)
+                )
+
+            candidate_specs = new_candidate_specs
+
+        error_nl = "\n    "  # see SpackError.__str__()
+
+        if not candidate_specs:
+            raise InstallError(
+                "Cannot detect GDC",
+                long_msg="Starting version 12, the D frontend requires a working GDC."
+                "{0}You can install it with Spack by running:"
+                "{0}{0}spack install gcc@9:11 languages=c,c++,d"
+                "{0}{0}Once that has finished, you will need to add it to your compilers.yaml file"
+                "{0}and use it to install this spec (i.e. {1} ...).".format(
+                    error_nl, self.spec.format("{name}{@version} {variants.languages}")
+                ),
+            )
+        elif len(candidate_specs) == 0:
+            return candidate_specs[0].extra_attributes["compilers"]["d"]
+        else:
+            # It is rather unlikely to end up here but let us try to resolve the ambiguity:
+            candidate_gdc = candidate_specs[0].extra_attributes["compilers"]["d"]
+            if all(
+                candidate_gdc == s.extra_attributes["compilers"]["d"] for s in candidate_specs[1:]
+            ):
+                # It does not matter which one we take if they are all the same:
+                return candidate_gdc
+            else:
+                raise InstallError(
+                    "Cannot resolve ambiguity when detecting GDC that belongs to "
+                    "%{0}".format(self.compiler.spec),
+                    long_msg="The candidates are:{0}{0}{1}{0}".format(
+                        error_nl,
+                        error_nl.join(
+                            "{0} (cc: {1})".format(
+                                s.extra_attributes["compilers"]["d"],
+                                s.extra_attributes["compilers"]["c"],
+                            )
+                            for s in candidate_specs
+                        ),
+                    ),
+                )
diff --git a/packages/gcc/patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch b/packages/gcc/patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3d76c47b3c16e0a2ca2ea6d0d1093a84233843ce
--- /dev/null
+++ b/packages/gcc/patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch
@@ -0,0 +1,121 @@
+From 2b40941d23b1570cdd90083b58fa0f66aa58c86e Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 21 May 2021 12:16:56 +0100
+Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer
+
+The Linux kernel has removed the interface to cyclades from
+the latest kernel headers[1] due to them being orphaned for the
+past 13 years.
+
+libsanitizer uses this header when compiling against glibc, but
+glibcs itself doesn't seem to have any references to cyclades.
+
+Further more it seems that the driver is broken in the kernel and
+the firmware doesn't seem to be available anymore.
+
+As such since this is breaking the build of libsanitizer (and so the
+GCC bootstrap[2]) I propose to remove this.
+
+[1] https://lkml.org/lkml/2021/3/2/153
+[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379
+
+libsanitizer/ChangeLog:
+
+	PR sanitizer/100379
+	* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick
+	llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135.
+	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
+	* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.
+---
+ .../sanitizer_common_interceptors_ioctl.inc           |  9 ---------
+ .../sanitizer_platform_limits_posix.cc                | 11 -----------
+ .../sanitizer_platform_limits_posix.h                 | 10 ----------
+ 3 files changed, 30 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+index 5408ea17c59..7a9cd3f5968 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+@@ -365,15 +365,6 @@ static void ioctl_table_fill() {
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
+-  _(CYGETDEFTHRESH, WRITE, sizeof(int));
+-  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
+-  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
+-  _(CYGETTHRESH, WRITE, sizeof(int));
+-  _(CYGETTIMEOUT, WRITE, sizeof(int));
+-  _(CYSETDEFTHRESH, NONE, 0);
+-  _(CYSETDEFTIMEOUT, NONE, 0);
+-  _(CYSETTHRESH, NONE, 0);
+-  _(CYSETTIMEOUT, NONE, 0);
+   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
+   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
+   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index d823a12190c..e8fce8a0287 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ # include <sys/procfs.h>
+ #endif
+ #include <sys/user.h>
+-#include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+ #include <linux/lp.h>
+@@ -466,7 +465,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
+-  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
+ #if EV_VERSION > (0x010000)
+   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
+ #else
+@@ -833,15 +831,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
+-  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
+-  unsigned IOCTL_CYGETMON = CYGETMON;
+-  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
+-  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
+-  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
+-  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
+-  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
+-  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
+   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
+   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
+   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index 6a673a7c995..f921bf2b5b5 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -1040,7 +1040,6 @@ struct __sanitizer_cookie_io_functions_t {
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+   extern unsigned struct_ax25_parms_struct_sz;
+-  extern unsigned struct_cyclades_monitor_sz;
+   extern unsigned struct_input_keymap_entry_sz;
+   extern unsigned struct_ipx_config_data_sz;
+   extern unsigned struct_kbdiacrs_sz;
+@@ -1385,15 +1384,6 @@ struct __sanitizer_cookie_io_functions_t {
+ #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  extern unsigned IOCTL_CYGETDEFTHRESH;
+-  extern unsigned IOCTL_CYGETDEFTIMEOUT;
+-  extern unsigned IOCTL_CYGETMON;
+-  extern unsigned IOCTL_CYGETTHRESH;
+-  extern unsigned IOCTL_CYGETTIMEOUT;
+-  extern unsigned IOCTL_CYSETDEFTHRESH;
+-  extern unsigned IOCTL_CYSETDEFTIMEOUT;
+-  extern unsigned IOCTL_CYSETTHRESH;
+-  extern unsigned IOCTL_CYSETTIMEOUT;
+   extern unsigned IOCTL_EQL_EMANCIPATE;
+   extern unsigned IOCTL_EQL_ENSLAVE;
+   extern unsigned IOCTL_EQL_GETMASTRCFG;
+-- 
+2.31.1
+
diff --git a/packages/gcc/patch-745dae5923aba02982563481d75a21595df22ff8.patch b/packages/gcc/patch-745dae5923aba02982563481d75a21595df22ff8.patch
new file mode 100644
index 0000000000000000000000000000000000000000..57c51eb231123761590fe9a11bf478f6a357884b
--- /dev/null
+++ b/packages/gcc/patch-745dae5923aba02982563481d75a21595df22ff8.patch
@@ -0,0 +1,123 @@
+From 745dae5923aba02982563481d75a21595df22ff8 Mon Sep 17 00:00:00 2001
+From: Tamar Christina <tamar.christina@arm.com>
+Date: Fri, 21 May 2021 10:30:59 +0100
+Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer
+
+The Linux kernel has removed the interface to cyclades from
+the latest kernel headers[1] due to them being orphaned for the
+past 13 years.
+
+libsanitizer uses this header when compiling against glibc, but
+glibcs itself doesn't seem to have any references to cyclades.
+
+Further more it seems that the driver is broken in the kernel and
+the firmware doesn't seem to be available anymore.
+
+As such since this is breaking the build of libsanitizer (and so the
+GCC bootstrap[2]) I propose to remove this.
+
+[1] https://lkml.org/lkml/2021/3/2/153
+[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379
+
+(cherry picked from commit f7c5351552387bd43f6ca3631016d7f0dfe0f135)
+
+libsanitizer/ChangeLog:
+
+	PR sanitizer/100379
+	* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick
+	llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135.
+	* sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise.
+	* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.
+---
+ .../sanitizer_common_interceptors_ioctl.inc           |  9 ---------
+ .../sanitizer_platform_limits_posix.cpp               | 11 -----------
+ .../sanitizer_platform_limits_posix.h                 | 10 ----------
+ 3 files changed, 30 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+index 7f181258eab..b7da6598755 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+@@ -370,15 +370,6 @@ static void ioctl_table_fill() {
+ 
+ #if SANITIZER_GLIBC
+   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
+-  _(CYGETDEFTHRESH, WRITE, sizeof(int));
+-  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
+-  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
+-  _(CYGETTHRESH, WRITE, sizeof(int));
+-  _(CYGETTIMEOUT, WRITE, sizeof(int));
+-  _(CYSETDEFTHRESH, NONE, 0);
+-  _(CYSETDEFTIMEOUT, NONE, 0);
+-  _(CYSETTHRESH, NONE, 0);
+-  _(CYSETTIMEOUT, NONE, 0);
+   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
+   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
+   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+index 35a690cba5c..6e5c330b98e 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ # include <sys/procfs.h>
+ #endif
+ #include <sys/user.h>
+-#include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+ #include <linux/lp.h>
+@@ -460,7 +459,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+ 
+ #if SANITIZER_GLIBC
+   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
+-  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
+ #if EV_VERSION > (0x010000)
+   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
+ #else
+@@ -824,15 +822,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+ #endif // SANITIZER_LINUX
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
+-  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
+-  unsigned IOCTL_CYGETMON = CYGETMON;
+-  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
+-  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
+-  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
+-  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
+-  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
+-  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
+   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
+   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
+   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+index ad358eef8b7..cba41ba5494 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz;
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+ extern unsigned struct_ax25_parms_struct_sz;
+-extern unsigned struct_cyclades_monitor_sz;
+ extern unsigned struct_input_keymap_entry_sz;
+ extern unsigned struct_ipx_config_data_sz;
+ extern unsigned struct_kbdiacrs_sz;
+@@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE;
+ #endif  // SANITIZER_LINUX
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-extern unsigned IOCTL_CYGETDEFTHRESH;
+-extern unsigned IOCTL_CYGETDEFTIMEOUT;
+-extern unsigned IOCTL_CYGETMON;
+-extern unsigned IOCTL_CYGETTHRESH;
+-extern unsigned IOCTL_CYGETTIMEOUT;
+-extern unsigned IOCTL_CYSETDEFTHRESH;
+-extern unsigned IOCTL_CYSETDEFTIMEOUT;
+-extern unsigned IOCTL_CYSETTHRESH;
+-extern unsigned IOCTL_CYSETTIMEOUT;
+ extern unsigned IOCTL_EQL_EMANCIPATE;
+ extern unsigned IOCTL_EQL_ENSLAVE;
+ extern unsigned IOCTL_EQL_GETMASTRCFG;
+-- 
+2.31.1
+
diff --git a/packages/gcc/patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch b/packages/gcc/patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch
new file mode 100644
index 0000000000000000000000000000000000000000..2448be074828bbfc9b09dad4759b2c55d8168073
--- /dev/null
+++ b/packages/gcc/patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch
@@ -0,0 +1,133 @@
+From f1feb74046e0feb0596b93bbb822fae02940a90e Mon Sep 17 00:00:00 2001
+From: Patrick Palka <ppalka@redhat.com>
+Date: Fri, 4 Jun 2021 13:46:53 -0400
+Subject: [PATCH] c++: tsubst_function_decl and excess arg levels [PR100102]
+
+Here, when instantiating the dependent alias template
+duration::__is_harmonic with args={{T,U},{int}}, we find ourselves
+substituting the function decl _S_gcd.  Since we have more arg levels
+than _S_gcd has parm levels, an old special case in tsubst_function_decl
+causes us to unwantedly reduce args to its innermost level, yielding
+args={int}, which leads to a nonsensical substitution into the decl
+context and eventually a crash.
+
+The comment for this special case refers to three examples for which we
+ought to see more arg levels than parm levels here, but none of the
+examples actually demonstrate this.  In the first example, when
+defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and
+later when instantiating say S<int>::f<char> both depths are 2.  In the
+second example, when substituting the template friend declaration
+parms_depth is 2 and args_depth is 1, and later when instantiating f
+both depths are 1.  Finally, the third example is invalid since we can't
+specialize a member template of an unspecialized class template like
+that.
+
+Given that this reduction code seems no longer relevant for its
+documented purpose and that it causes problems as in the PR, this patch
+just removes it.  Note that as far as bootstrap/regtest is concerned,
+this code is dead; the below two tests would be the first to reach it.
+
+	PR c++/100102
+
+gcc/cp/ChangeLog:
+
+	* pt.c (tsubst_function_decl): Remove old code for reducing
+	args when it has excess levels.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/cpp0x/alias-decl-72.C: New test.
+	* g++.dg/cpp0x/alias-decl-72a.C: New test.
+
+(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f)
+---
+ gcc/cp/pt.c                                 | 39 ---------------------
+ gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C  |  9 +++++
+ gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C |  9 +++++
+ 3 files changed, 18 insertions(+), 39 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
+
+diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
+index 1434beb80f4..1761a902218 100644
+--- a/gcc/cp/pt.c
++++ b/gcc/cp/pt.c
+@@ -13954,45 +13954,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
+ 	  if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash))
+ 	    return spec;
+ 	}
+-
+-      /* We can see more levels of arguments than parameters if
+-	 there was a specialization of a member template, like
+-	 this:
+-
+-	 template <class T> struct S { template <class U> void f(); }
+-	 template <> template <class U> void S<int>::f(U);
+-
+-	 Here, we'll be substituting into the specialization,
+-	 because that's where we can find the code we actually
+-	 want to generate, but we'll have enough arguments for
+-	 the most general template.
+-
+-	 We also deal with the peculiar case:
+-
+-	 template <class T> struct S {
+-	   template <class U> friend void f();
+-	 };
+-	 template <class U> void f() {}
+-	 template S<int>;
+-	 template void f<double>();
+-
+-	 Here, the ARGS for the instantiation of will be {int,
+-	 double}.  But, we only need as many ARGS as there are
+-	 levels of template parameters in CODE_PATTERN.  We are
+-	 careful not to get fooled into reducing the ARGS in
+-	 situations like:
+-
+-	 template <class T> struct S { template <class U> void f(U); }
+-	 template <class T> template <> void S<T>::f(int) {}
+-
+-	 which we can spot because the pattern will be a
+-	 specialization in this case.  */
+-      int args_depth = TMPL_ARGS_DEPTH (args);
+-      int parms_depth =
+-	TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t)));
+-
+-      if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t))
+-	args = get_innermost_template_args (args, parms_depth);
+     }
+   else
+     {
+diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
+new file mode 100644
+index 00000000000..8009756dcba
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
+@@ -0,0 +1,9 @@
++// PR c++/100102
++// { dg-do compile { target c++11 } }
++
++template<int()> struct ratio;
++template<class T, class U> struct duration {
++  static constexpr int _S_gcd();
++  template<class> using __is_harmonic = ratio<_S_gcd>;
++  using type = __is_harmonic<int>;
++};
+diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
+new file mode 100644
+index 00000000000..a4443e18f9d
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
+@@ -0,0 +1,9 @@
++// PR c++/100102
++// { dg-do compile { target c++11 } }
++
++template<int> struct ratio;
++template<class T> struct duration {
++  static constexpr int _S_gcd();
++  template<class> using __is_harmonic = ratio<(duration::_S_gcd)()>;
++  using type = __is_harmonic<int>;
++};
+-- 
+2.31.1
+
diff --git a/packages/gcc/patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch b/packages/gcc/patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch
new file mode 100644
index 0000000000000000000000000000000000000000..27e5a2b5bf0f7268704ac920e1ee064673b9e3af
--- /dev/null
+++ b/packages/gcc/patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch
@@ -0,0 +1,133 @@
+From fc930b3010bd0de899a3da3209eab20664ddb703 Mon Sep 17 00:00:00 2001
+From: Patrick Palka <ppalka@redhat.com>
+Date: Fri, 4 Jun 2021 13:46:53 -0400
+Subject: [PATCH] c++: tsubst_function_decl and excess arg levels [PR100102]
+
+Here, when instantiating the dependent alias template
+duration::__is_harmonic with args={{T,U},{int}}, we find ourselves
+substituting the function decl _S_gcd.  Since we have more arg levels
+than _S_gcd has parm levels, an old special case in tsubst_function_decl
+causes us to unwantedly reduce args to its innermost level, yielding
+args={int}, which leads to a nonsensical substitution into the decl
+context and eventually a crash.
+
+The comment for this special case refers to three examples for which we
+ought to see more arg levels than parm levels here, but none of the
+examples actually demonstrate this.  In the first example, when
+defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and
+later when instantiating say S<int>::f<char> both depths are 2.  In the
+second example, when substituting the template friend declaration
+parms_depth is 2 and args_depth is 1, and later when instantiating f
+both depths are 1.  Finally, the third example is invalid since we can't
+specialize a member template of an unspecialized class template like
+that.
+
+Given that this reduction code seems no longer relevant for its
+documented purpose and that it causes problems as in the PR, this patch
+just removes it.  Note that as far as bootstrap/regtest is concerned,
+this code is dead; the below two tests would be the first to reach it.
+
+	PR c++/100102
+
+gcc/cp/ChangeLog:
+
+	* pt.c (tsubst_function_decl): Remove old code for reducing
+	args when it has excess levels.
+
+gcc/testsuite/ChangeLog:
+
+	* g++.dg/cpp0x/alias-decl-72.C: New test.
+	* g++.dg/cpp0x/alias-decl-72a.C: New test.
+
+(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f)
+---
+ gcc/cp/pt.c                                 | 39 ---------------------
+ gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C  |  9 +++++
+ gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C |  9 +++++
+ 3 files changed, 18 insertions(+), 39 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
+
+diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
+index 5a957141ba3..7ce9ac234f8 100644
+--- a/gcc/cp/pt.c
++++ b/gcc/cp/pt.c
+@@ -13811,45 +13811,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
+ 	  if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash))
+ 	    return spec;
+ 	}
+-
+-      /* We can see more levels of arguments than parameters if
+-	 there was a specialization of a member template, like
+-	 this:
+-
+-	 template <class T> struct S { template <class U> void f(); }
+-	 template <> template <class U> void S<int>::f(U);
+-
+-	 Here, we'll be substituting into the specialization,
+-	 because that's where we can find the code we actually
+-	 want to generate, but we'll have enough arguments for
+-	 the most general template.
+-
+-	 We also deal with the peculiar case:
+-
+-	 template <class T> struct S {
+-	   template <class U> friend void f();
+-	 };
+-	 template <class U> void f() {}
+-	 template S<int>;
+-	 template void f<double>();
+-
+-	 Here, the ARGS for the instantiation of will be {int,
+-	 double}.  But, we only need as many ARGS as there are
+-	 levels of template parameters in CODE_PATTERN.  We are
+-	 careful not to get fooled into reducing the ARGS in
+-	 situations like:
+-
+-	 template <class T> struct S { template <class U> void f(U); }
+-	 template <class T> template <> void S<T>::f(int) {}
+-
+-	 which we can spot because the pattern will be a
+-	 specialization in this case.  */
+-      int args_depth = TMPL_ARGS_DEPTH (args);
+-      int parms_depth =
+-	TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t)));
+-
+-      if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t))
+-	args = get_innermost_template_args (args, parms_depth);
+     }
+   else
+     {
+diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
+new file mode 100644
+index 00000000000..8009756dcba
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
+@@ -0,0 +1,9 @@
++// PR c++/100102
++// { dg-do compile { target c++11 } }
++
++template<int()> struct ratio;
++template<class T, class U> struct duration {
++  static constexpr int _S_gcd();
++  template<class> using __is_harmonic = ratio<_S_gcd>;
++  using type = __is_harmonic<int>;
++};
+diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
+new file mode 100644
+index 00000000000..a4443e18f9d
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
+@@ -0,0 +1,9 @@
++// PR c++/100102
++// { dg-do compile { target c++11 } }
++
++template<int> struct ratio;
++template<class T> struct duration {
++  static constexpr int _S_gcd();
++  template<class> using __is_harmonic = ratio<(duration::_S_gcd)()>;
++  using type = __is_harmonic<int>;
++};
+-- 
+2.31.1
+
diff --git a/packages/gcc/piclibs.patch b/packages/gcc/piclibs.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0ecb7930675230289be24cdd3b7b2ff9e9b311a2
--- /dev/null
+++ b/packages/gcc/piclibs.patch
@@ -0,0 +1,62 @@
+diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
+index 62b9f7a..7666fdb 100644
+--- a/libgfortran/Makefile.in
++++ b/libgfortran/Makefile.in
+@@ -357,11 +357,11 @@ AUTOMAKE = @AUTOMAKE@
+ AWK = @AWK@
+ CC = @CC@
+ CCDEPMODE = @CCDEPMODE@
+-CFLAGS = @CFLAGS@
++CFLAGS = @CFLAGS@ -fPIC
+ CPP = @CPP@
+-CPPFLAGS = @CPPFLAGS@
++CPPFLAGS = @CPPFLAGS@ -fPIC
+ CYGPATH_W = @CYGPATH_W@
+-DEFS = @DEFS@
++DEFS = @DEFS@ -fPIC
+ DEPDIR = @DEPDIR@
+ DSYMUTIL = @DSYMUTIL@
+ DUMPBIN = @DUMPBIN@
+@@ -371,7 +371,7 @@ ECHO_T = @ECHO_T@
+ EGREP = @EGREP@
+ EXEEXT = @EXEEXT@
+ FC = @FC@
+-FCFLAGS = @FCFLAGS@
++FCFLAGS = @FCFLAGS@ -fPIC
+ FGREP = @FGREP@
+ FPU_HOST_HEADER = @FPU_HOST_HEADER@
+ GREP = @GREP@
+diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
+index bede542..9b3e442 100644
+--- a/libstdc++-v3/Makefile.in
++++ b/libstdc++-v3/Makefile.in
+@@ -115,7 +115,7 @@ CC = @CC@
+ CCODECVT_CC = @CCODECVT_CC@
+ CCOLLATE_CC = @CCOLLATE_CC@
+ CCTYPE_CC = @CCTYPE_CC@
+-CFLAGS = @CFLAGS@
++CFLAGS = @CFLAGS@ -fPIC
+ CLOCALE_CC = @CLOCALE_CC@
+ CLOCALE_H = @CLOCALE_H@
+ CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
+@@ -124,7 +124,7 @@ CMESSAGES_H = @CMESSAGES_H@
+ CMONEY_CC = @CMONEY_CC@
+ CNUMERIC_CC = @CNUMERIC_CC@
+ CPP = @CPP@
+-CPPFLAGS = @CPPFLAGS@
++CPPFLAGS = @CPPFLAGS@ -fPIC
+ CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@
+ CPU_OPT_BITS_RANDOM = @CPU_OPT_BITS_RANDOM@
+ CPU_OPT_EXT_RANDOM = @CPU_OPT_EXT_RANDOM@
+@@ -139,7 +139,7 @@ CYGPATH_W = @CYGPATH_W@
+ C_INCLUDE_DIR = @C_INCLUDE_DIR@
+ DBLATEX = @DBLATEX@
+ DEBUG_FLAGS = @DEBUG_FLAGS@
+-DEFS = @DEFS@
++DEFS = @DEFS@ -fPIC
+ DOT = @DOT@
+ DOXYGEN = @DOXYGEN@
+ DSYMUTIL = @DSYMUTIL@
+-- 
+2.8.3
+
diff --git a/packages/gcc/signal.patch b/packages/gcc/signal.patch
new file mode 100644
index 0000000000000000000000000000000000000000..21bf9e030f44667534d7c9430646924cd467b2b1
--- /dev/null
+++ b/packages/gcc/signal.patch
@@ -0,0 +1,28 @@
+From 6c709b6262e8b6441b1e94526d6d65d4ce7a7dec Mon Sep 17 00:00:00 2001
+From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Thu, 7 Sep 2017 07:18:57 +0000
+Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>
+
+        * asan/asan_linux.cc: Include <signal.h>
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251830 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libsanitizer/asan/asan_linux.cc | 1 +
+ 2 files changed, 5 insertions(+)
+
+diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
+index c504168..59087b9 100644
+--- a/libsanitizer/asan/asan_linux.cc
++++ b/libsanitizer/asan/asan_linux.cc
+@@ -29,6 +29,7 @@
+ #include <dlfcn.h>
+ #include <fcntl.h>
+ #include <pthread.h>
++#include <signal.h>
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <unwind.h>
+-- 
+2.9.3
+
diff --git a/packages/gcc/stack_t-4.9.patch b/packages/gcc/stack_t-4.9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..b894557c8c58d496d5617ef6d928c3e95f04f173
--- /dev/null
+++ b/packages/gcc/stack_t-4.9.patch
@@ -0,0 +1,80 @@
+From 833e00c01e96f61e24cd7ec97b93fad212dc914b Mon Sep 17 00:00:00 2001
+From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Thu, 7 Sep 2017 07:17:17 +0000
+Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>
+
+        Backported from mainline
+        2017-07-14  Jakub Jelinek  <jakub@redhat.com>
+
+        PR sanitizer/81066
+        * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
+        * sanitizer_common/sanitizer_linux.cc: Likewise.
+        * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
+        * tsan/tsan_platform_linux.cc: Likewise.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251829 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libsanitizer/sanitizer_common/sanitizer_linux.cc              |  3 +--
+ libsanitizer/sanitizer_common/sanitizer_linux.h               |  4 +---
+ .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc  |  2 +-
+ libsanitizer/tsan/tsan_platform_linux.cc                      |  2 +-
+ 5 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
+index 9feb307..821b26d 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
+@@ -514,8 +514,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
+ }
+ #endif
+ 
+-uptr internal_sigaltstack(const struct sigaltstack *ss,
+-                         struct sigaltstack *oss) {
++uptr internal_sigaltstack(const void *ss, void *oss) {
+   return internal_syscall(__NR_sigaltstack, (uptr)ss, (uptr)oss);
+ }
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
+index 086834c..3a6f4cd 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_linux.h
++++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
+@@ -27,8 +26,7 @@ struct linux_dirent;
+ // Syscall wrappers.
+ uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
+ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5);
+-uptr internal_sigaltstack(const struct sigaltstack* ss,
+-                          struct sigaltstack* oss);
++uptr internal_sigaltstack(const void* ss, void* oss);
+ uptr internal_sigaction(int signum, const __sanitizer_kernel_sigaction_t *act,
+     __sanitizer_kernel_sigaction_t *oldact);
+ uptr internal_sigprocmask(int how, __sanitizer_kernel_sigset_t *set,
+diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+index 5881202..c54894d 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+@@ -234,7 +234,7 @@ static int TracerThread(void* argument) {
+ 
+   // Alternate stack for signal handling.
+   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
+-  struct sigaltstack handler_stack;
++  stack_t handler_stack;
+   internal_memset(&handler_stack, 0, sizeof(handler_stack));
+   handler_stack.ss_sp = handler_stack_memory.data();
+   handler_stack.ss_size = kHandlerStackSize;
+diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
+index 3259131..b8e9078 100644
+--- a/libsanitizer/tsan/tsan_platform_linux.cc
++++ b/libsanitizer/tsan/tsan_platform_linux.cc
+@@ -377,7 +377,7 @@ bool IsGlobalVar(uptr addr) {
+ int ExtractResolvFDs(void *state, int *fds, int nfd) {
+ #if SANITIZER_LINUX
+   int cnt = 0;
+-  __res_state *statp = (__res_state*)state;
++  struct __res_state *statp = (struct __res_state*)state;
+   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
+     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
+       fds[cnt++] = statp->_u._ext.nssocks[i];
+-- 
+2.9.3
+
diff --git a/packages/gcc/stack_t.patch b/packages/gcc/stack_t.patch
new file mode 100644
index 0000000000000000000000000000000000000000..48a5a47ade1980e4708b8d8cd42992d1d378584f
--- /dev/null
+++ b/packages/gcc/stack_t.patch
@@ -0,0 +1,88 @@
+From 833e00c01e96f61e24cd7ec97b93fad212dc914b Mon Sep 17 00:00:00 2001
+From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Thu, 7 Sep 2017 07:17:17 +0000
+Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>
+
+        Backported from mainline
+        2017-07-14  Jakub Jelinek  <jakub@redhat.com>
+
+        PR sanitizer/81066
+        * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
+        * sanitizer_common/sanitizer_linux.cc: Likewise.
+        * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
+        * tsan/tsan_platform_linux.cc: Likewise.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251829 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libsanitizer/sanitizer_common/sanitizer_linux.cc              |  3 +--
+ libsanitizer/sanitizer_common/sanitizer_linux.h               |  4 +---
+ .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc  |  2 +-
+ libsanitizer/tsan/tsan_platform_linux.cc                      |  2 +-
+ 5 files changed, 15 insertions(+), 7 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
+index 9feb307..821b26d 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
+@@ -514,8 +514,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
+ }
+ #endif
+ 
+-uptr internal_sigaltstack(const struct sigaltstack *ss,
+-                         struct sigaltstack *oss) {
++uptr internal_sigaltstack(const void *ss, void *oss) {
+   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
+ }
+ 
+diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
+index 086834c..3a6f4cd 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_linux.h
++++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
+@@ -18,7 +18,6 @@
+ #include "sanitizer_platform_limits_posix.h"
+ 
+ struct link_map;  // Opaque type returned by dlopen().
+-struct sigaltstack;
+ 
+ namespace __sanitizer {
+ // Dirent structure for getdents(). Note that this structure is different from
+@@ -27,8 +26,7 @@ struct linux_dirent;
+ 
+ // Syscall wrappers.
+ uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
+-uptr internal_sigaltstack(const struct sigaltstack* ss,
+-                          struct sigaltstack* oss);
++uptr internal_sigaltstack(const void* ss, void* oss);
+ uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
+     __sanitizer_sigset_t *oldset);
+ void internal_sigfillset(__sanitizer_sigset_t *set);
+diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+index 5881202..c54894d 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+@@ -234,7 +234,7 @@ static int TracerThread(void* argument) {
+ 
+   // Alternate stack for signal handling.
+   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
+-  struct sigaltstack handler_stack;
++  stack_t handler_stack;
+   internal_memset(&handler_stack, 0, sizeof(handler_stack));
+   handler_stack.ss_sp = handler_stack_memory.data();
+   handler_stack.ss_size = kHandlerStackSize;
+diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
+index 3259131..b8e9078 100644
+--- a/libsanitizer/tsan/tsan_platform_linux.cc
++++ b/libsanitizer/tsan/tsan_platform_linux.cc
+@@ -377,7 +377,7 @@ bool IsGlobalVar(uptr addr) {
+ int ExtractResolvFDs(void *state, int *fds, int nfd) {
+ #if SANITIZER_LINUX
+   int cnt = 0;
+-  __res_state *statp = (__res_state*)state;
++  struct __res_state *statp = (struct __res_state*)state;
+   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
+     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
+       fds[cnt++] = statp->_u._ext.nssocks[i];
+-- 
+2.9.3
+
diff --git a/packages/gcc/sys_ustat-4.9.patch b/packages/gcc/sys_ustat-4.9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..75453af3387e5e234bf33476f1b5d0a693a55c35
--- /dev/null
+++ b/packages/gcc/sys_ustat-4.9.patch
@@ -0,0 +1,34 @@
+The sys_ustat.h patch modified for gcc 4.9.x.
+
+diff -Naurb gcc-4.9.4.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+--- gcc-4.9.4.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2013-12-19 06:54:11.000000000 -0600
++++ gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2018-12-11 15:57:46.901800462 -0600
+@@ -81,7 +81,6 @@
+ #include <sys/statvfs.h>
+ #include <sys/timex.h>
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -163,7 +162,19 @@
+   unsigned struct_old_utsname_sz = sizeof(struct old_utsname);
+   unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname);
+   unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++  // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+ #endif // SANITIZER_LINUX
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
diff --git a/packages/gcc/sys_ustat.h.patch b/packages/gcc/sys_ustat.h.patch
new file mode 100644
index 0000000000000000000000000000000000000000..c65757b4eb12c39e03522435b56edc6b220604fd
--- /dev/null
+++ b/packages/gcc/sys_ustat.h.patch
@@ -0,0 +1,63 @@
+From 9569b61168b963a6cea7b782fd350dee489ad42c Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 21 May 2018 13:17:55 -0700
+Subject: [PATCH] libsanitizer: Use pre-computed size of struct ustat for Linux
+
+Cherry-pick compiler-rt revision 333213:
+
+<sys/ustat.h> has been removed from glibc 2.28 by:
+
+commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
+Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
+Date:   Sun Mar 18 11:28:59 2018 +0800
+
+    Deprecate ustat syscall interface
+
+This patch uses pre-computed size of struct ustat for Linux.
+
+	PR sanitizer/85835
+	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
+	include <sys/ustat.h> for Linux.
+	(SIZEOF_STRUCT_USTAT): New.
+	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.
+---
+ .../sanitizer_platform_limits_posix.cc            | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 858bb218450..de18e56d11c 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ # include <sys/procfs.h>
+ #endif
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -250,7 +249,19 @@ namespace __sanitizer {
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++  // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
+   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
+ #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
+-- 
+2.17.0
+
+
diff --git a/packages/gcc/ucontext_t-java.patch b/packages/gcc/ucontext_t-java.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a43e0b5aa24d09ca63b47c68038e255803c6bb02
--- /dev/null
+++ b/packages/gcc/ucontext_t-java.patch
@@ -0,0 +1,60 @@
+From 9b9287cde20ea57578cf07efb2a96ed4cc0da36f Mon Sep 17 00:00:00 2001
+From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Thu, 7 Sep 2017 07:22:07 +0000
+Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>
+
+        * include/x86_64-signal.h (HANDLE_DIVIDE_OVERFLOW): Replace
+        'struct ucontext' with ucontext_t.
+        * include/i386-signal.h (HANDLE_DIVIDE_OVERFLOW): Likewise.
+        * include/s390-signal.h (HANDLE_DIVIDE_OVERFLOW): Likewise.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251832 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libjava/include/i386-signal.h   | 2 +-
+ libjava/include/s390-signal.h   | 2 +-
+ libjava/include/x86_64-signal.h | 2 +-
+ 4 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h
+index c2409b0..ef77e7e 100644
+--- a/libjava/include/i386-signal.h
++++ b/libjava/include/i386-signal.h
+@@ -29,7 +29,7 @@ static void _Jv_##_name (int, siginfo_t *,			\
+ #define HANDLE_DIVIDE_OVERFLOW						\
+ do									\
+ {									\
+-  struct ucontext *_uc = (struct ucontext *)_p;				\
++  ucontext_t *_uc = (ucontext_t *)_p;					\
+   gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
+   unsigned char *_eip = (unsigned char *)_gregs[REG_EIP];		\
+ 									\
+diff --git a/libjava/include/s390-signal.h b/libjava/include/s390-signal.h
+index 4ca4c10..9261b52 100644
+--- a/libjava/include/s390-signal.h
++++ b/libjava/include/s390-signal.h
+@@ -51,7 +51,7 @@ do									\
+   struct                                                                \
+   {                                                                     \
+     unsigned long int uc_flags;                                         \
+-    struct ucontext *uc_link;                                           \
++    ucontext_t *uc_link;                                                \
+     stack_t uc_stack;                                                   \
+     mcontext_t uc_mcontext;                                             \
+     unsigned long sigmask[2];                                           \
+diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
+index 12383b5..e36c5a3 100644
+--- a/libjava/include/x86_64-signal.h
++++ b/libjava/include/x86_64-signal.h
+@@ -28,7 +28,7 @@ static void _Jv_##_name (int, siginfo_t *,			\
+ #define HANDLE_DIVIDE_OVERFLOW						\
+ do									\
+ {									\
+-  struct ucontext *_uc = (struct ucontext *)_p;				\
++  ucontext_t *_uc = (ucontext_t *)_p;					\
+   gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
+   unsigned char *_rip = (unsigned char *)_gregs[REG_RIP];		\
+ 									\
+-- 
+2.9.3
+
diff --git a/packages/gcc/ucontext_t.patch b/packages/gcc/ucontext_t.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a4f04b4715286bbe86ea141ccd257260d8320dd9
--- /dev/null
+++ b/packages/gcc/ucontext_t.patch
@@ -0,0 +1,189 @@
+From ecf0d1a107133c715763940c2b197aa814710e1b Mon Sep 17 00:00:00 2001
+From: jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 4 Jul 2017 10:25:10 +0000
+Subject: [PATCH] Use ucontext_t not struct ucontext in linux-unwind.h files.
+
+Current glibc no longer gives the ucontext_t type the tag struct
+ucontext, to conform with POSIX namespace rules.  This requires
+various linux-unwind.h files in libgcc, that were previously using
+struct ucontext, to be fixed to use ucontext_t instead.  This is
+similar to the removal of the struct siginfo tag from siginfo_t some
+years ago.
+
+This patch changes those files to use ucontext_t instead.  As the
+standard name that should be unconditionally safe, so this is not
+restricted to architectures supported by glibc, or conditioned on the
+glibc version.
+
+Tested compilation together with current glibc with glibc's
+build-many-glibcs.py.
+
+	* config/aarch64/linux-unwind.h (aarch64_fallback_frame_state),
+	config/alpha/linux-unwind.h (alpha_fallback_frame_state),
+	config/bfin/linux-unwind.h (bfin_fallback_frame_state),
+	config/i386/linux-unwind.h (x86_64_fallback_frame_state,
+	x86_fallback_frame_state), config/m68k/linux-unwind.h (struct
+	uw_ucontext), config/nios2/linux-unwind.h (struct nios2_ucontext),
+	config/pa/linux-unwind.h (pa32_fallback_frame_state),
+	config/sh/linux-unwind.h (sh_fallback_frame_state),
+	config/tilepro/linux-unwind.h (tile_fallback_frame_state),
+	config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Use
+	ucontext_t instead of struct ucontext.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@249958 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ libgcc/config/aarch64/linux-unwind.h |  2 +-
+ libgcc/config/alpha/linux-unwind.h   |  2 +-
+ libgcc/config/bfin/linux-unwind.h    |  2 +-
+ libgcc/config/i386/linux-unwind.h    |  4 ++--
+ libgcc/config/m68k/linux-unwind.h    |  2 +-
+ libgcc/config/nios2/linux-unwind.h   |  2 +-
+ libgcc/config/pa/linux-unwind.h      |  2 +-
+ libgcc/config/sh/linux-unwind.h      |  2 +-
+ libgcc/config/tilepro/linux-unwind.h |  2 +-
+ libgcc/config/xtensa/linux-unwind.h  |  2 +-
+ 11 files changed, 25 insertions(+), 11 deletions(-)
+
+diff --git a/libgcc/config/aarch64/linux-unwind.h b/libgcc/config/aarch64/linux-unwind.h
+index 86d17b1..909f68f 100644
+--- a/libgcc/config/aarch64/linux-unwind.h
++++ b/libgcc/config/aarch64/linux-unwind.h
+@@ -52,7 +52,7 @@ aarch64_fallback_frame_state (struct _Unwind_Context *context,
+   struct rt_sigframe
+   {
+     siginfo_t info;
+-    struct ucontext uc;
++    ucontext_t uc;
+   };
+ 
+   struct rt_sigframe *rt_;
+diff --git a/libgcc/config/alpha/linux-unwind.h b/libgcc/config/alpha/linux-unwind.h
+index d65474f..9a226b1 100644
+--- a/libgcc/config/alpha/linux-unwind.h
++++ b/libgcc/config/alpha/linux-unwind.h
+@@ -51,7 +51,7 @@ alpha_fallback_frame_state (struct _Unwind_Context *context,
+     {
+       struct rt_sigframe {
+ 	siginfo_t info;
+-	struct ucontext uc;
++	ucontext_t uc;
+       } *rt_ = context->cfa;
+       sc = &rt_->uc.uc_mcontext;
+     }
+diff --git a/libgcc/config/bfin/linux-unwind.h b/libgcc/config/bfin/linux-unwind.h
+index 0c270e4..7fa95d2 100644
+--- a/libgcc/config/bfin/linux-unwind.h
++++ b/libgcc/config/bfin/linux-unwind.h
+@@ -52,7 +52,7 @@ bfin_fallback_frame_state (struct _Unwind_Context *context,
+ 	void *puc;
+ 	char retcode[8];
+ 	siginfo_t info;
+-	struct ucontext uc;
++	ucontext_t uc;
+       } *rt_ = context->cfa;
+ 
+       /* The void * cast is necessary to avoid an aliasing warning.
+diff --git a/libgcc/config/i386/linux-unwind.h b/libgcc/config/i386/linux-unwind.h
+index e54bf73..d35fc45 100644
+--- a/libgcc/config/i386/linux-unwind.h
++++ b/libgcc/config/i386/linux-unwind.h
+@@ -58,7 +58,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context,
+   if (*(unsigned char *)(pc+0) == 0x48
+       && *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL)
+     {
+-      struct ucontext *uc_ = context->cfa;
++      ucontext_t *uc_ = context->cfa;
+       /* The void * cast is necessary to avoid an aliasing warning.
+          The aliasing warning is correct, but should not be a problem
+          because it does not alias anything.  */
+@@ -138,7 +138,7 @@ x86_fallback_frame_state (struct _Unwind_Context *context,
+ 	siginfo_t *pinfo;
+ 	void *puc;
+ 	siginfo_t info;
+-	struct ucontext uc;
++	ucontext_t uc;
+       } *rt_ = context->cfa;
+       /* The void * cast is necessary to avoid an aliasing warning.
+          The aliasing warning is correct, but should not be a problem
+diff --git a/libgcc/config/m68k/linux-unwind.h b/libgcc/config/m68k/linux-unwind.h
+index fb79a4d..b2f5ea4 100644
+--- a/libgcc/config/m68k/linux-unwind.h
++++ b/libgcc/config/m68k/linux-unwind.h
+@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ /* <sys/ucontext.h> is unfortunately broken right now.  */
+ struct uw_ucontext {
+ 	unsigned long	  uc_flags;
+-	struct ucontext  *uc_link;
++	ucontext_t	 *uc_link;
+ 	stack_t		  uc_stack;
+ 	mcontext_t	  uc_mcontext;
+ 	unsigned long	  uc_filler[80];
+diff --git a/libgcc/config/nios2/linux-unwind.h b/libgcc/config/nios2/linux-unwind.h
+index dff1c20..1d88afe 100644
+--- a/libgcc/config/nios2/linux-unwind.h
++++ b/libgcc/config/nios2/linux-unwind.h
+@@ -38,7 +38,7 @@ struct nios2_mcontext {
+ 
+ struct nios2_ucontext {
+   unsigned long uc_flags;
+-  struct ucontext *uc_link;
++  ucontext_t *uc_link;
+   stack_t uc_stack;
+   struct nios2_mcontext uc_mcontext;
+   sigset_t uc_sigmask;	/* mask last for extensibility */
+diff --git a/libgcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h
+index 0149468..9157535 100644
+--- a/libgcc/config/pa/linux-unwind.h
++++ b/libgcc/config/pa/linux-unwind.h
+@@ -80,7 +80,7 @@ pa32_fallback_frame_state (struct _Unwind_Context *context,
+   struct sigcontext *sc;
+   struct rt_sigframe {
+     siginfo_t info;
+-    struct ucontext uc;
++    ucontext_t uc;
+   } *frame;
+ 
+   /* rt_sigreturn trampoline:
+diff --git a/libgcc/config/sh/linux-unwind.h b/libgcc/config/sh/linux-unwind.h
+index e63091f..67033f0 100644
+--- a/libgcc/config/sh/linux-unwind.h
++++ b/libgcc/config/sh/linux-unwind.h
+@@ -180,7 +180,7 @@ sh_fallback_frame_state (struct _Unwind_Context *context,
+     {
+       struct rt_sigframe {
+ 	siginfo_t info;
+-	struct ucontext uc;
++	ucontext_t uc;
+       } *rt_ = context->cfa;
+       /* The void * cast is necessary to avoid an aliasing warning.
+          The aliasing warning is correct, but should not be a problem
+diff --git a/libgcc/config/tilepro/linux-unwind.h b/libgcc/config/tilepro/linux-unwind.h
+index fd83ba7..e3c9ef0 100644
+--- a/libgcc/config/tilepro/linux-unwind.h
++++ b/libgcc/config/tilepro/linux-unwind.h
+@@ -61,7 +61,7 @@ tile_fallback_frame_state (struct _Unwind_Context *context,
+   struct rt_sigframe {
+     unsigned char save_area[C_ABI_SAVE_AREA_SIZE];
+     siginfo_t info;
+-    struct ucontext uc;
++    ucontext_t uc;
+   } *rt_;
+ 
+   /* Return if this is not a signal handler.  */
+diff --git a/libgcc/config/xtensa/linux-unwind.h b/libgcc/config/xtensa/linux-unwind.h
+index 9a67b5d..98b7ea6 100644
+--- a/libgcc/config/xtensa/linux-unwind.h
++++ b/libgcc/config/xtensa/linux-unwind.h
+@@ -67,7 +67,7 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context,
+ 
+   struct rt_sigframe {
+     siginfo_t info;
+-    struct ucontext uc;
++    ucontext_t uc;
+   } *rt_;
+ 
+   /* movi a2, __NR_rt_sigreturn; syscall */
+-- 
+2.9.3
+
diff --git a/packages/gcc/zstd.patch b/packages/gcc/zstd.patch
new file mode 100644
index 0000000000000000000000000000000000000000..8fb7583a0c221d5beff8ad8fbcbf97468814848a
--- /dev/null
+++ b/packages/gcc/zstd.patch
@@ -0,0 +1,43 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -1075,7 +1075,8 @@ GNATMAKE = @GNATMAKE@
+ # Libs needed (at present) just for jcf-dump.
+ LDEXP_LIB = @LDEXP_LIB@
+ 
+-ZSTD_LIB = @ZSTD_LIB@
++ZSTD_INC = @ZSTD_CPPFLAGS@
++ZSTD_LIB = @ZSTD_LDFLAGS@ @ZSTD_LIB@
+ 
+ # Likewise, for use in the tools that must run on this machine
+ # even if we are cross-building GCC.
+@@ -2275,7 +2276,7 @@ CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
+ version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
+ 
+ # lto-compress.o needs $(ZLIBINC) added to the include flags.
+-CFLAGS-lto-compress.o += $(ZLIBINC)
++CFLAGS-lto-compress.o += $(ZLIBINC) $(ZSTD_INC)
+ 
+ CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\"
+ 
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -786,6 +786,8 @@ LTLIBICONV
+ LIBICONV
+ ZSTD_LIB
+ ZSTD_INCLUDE
++ZSTD_LDFLAGS
++ZSTD_CPPFLAGS
+ DL_LIB
+ LDEXP_LIB
+ EXTRA_GCC_LIBS
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -1339,6 +1339,8 @@ AC_SUBST(ZSTD_INCLUDE)
+ AC_SUBST(ZSTD_LIB)
+ ZSTD_CPPFLAGS=
+ ZSTD_LDFLAGS=
++AC_SUBST(ZSTD_CPPFLAGS)
++AC_SUBST(ZSTD_LDFLAGS)
+ AC_ARG_WITH(zstd,
+ 	[AS_HELP_STRING([--with-zstd=PATH],
+ 		[specify prefix directory for installed zstd library.
diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index 98ff7d7affba5d70e619c73beebd2ea1e076c95d..28aec2442e5cd0415be40a212bd0c247b2de7af6 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -181,7 +181,7 @@ class Hxtorch(WafPackage):
         return args
 
     def build_test(self):
-        self.waf('build', '--test-execall')
+        self.builder.waf('build', '--test-execall')
         copy_tree('build/test_results', join_path(self.prefix, '.build'))
 
     def install_args(self):
diff --git a/packages/llvm/package.py b/packages/llvm/package.py
index 1334179fc99b7d8d426a228b16aec5168b1cc342..9a692f8dbd6aa6e1363c2c0ec9ba1da5ef1e1af2 100644
--- a/packages/llvm/package.py
+++ b/packages/llvm/package.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
+# 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)
@@ -26,16 +26,21 @@ class Llvm(CMakePackage, CudaPackage):
     url = "https://github.com/llvm/llvm-project/archive/llvmorg-7.1.0.tar.gz"
     list_url = "https://releases.llvm.org/download.html"
     git = "https://github.com/llvm/llvm-project"
-    maintainers = ["trws", "haampie"]
+    maintainers("trws", "haampie")
 
     tags = ["e4s"]
 
-    generator = "Ninja"
+    generator("ninja")
 
     family = "compiler"  # Used by lmod
 
-    # fmt: off
     version("main", branch="main")
+    version("16.0.2", sha256="97c3c6aafb53c4bb0ed2781a18d6f05e75445e24bb1dc57a32b74f8d710ac19f")
+    version("16.0.1", sha256="b5a9ff1793b1e2d388a3819bf35797002b1d2e40bb35a10c65605e0ea1435271")
+    version("16.0.0", sha256="cba969a0782a3a398658d439f047b5e548ea04724f4fbfdbe17cfc946f4cd3ed")
+    version("15.0.7", sha256="42a0088f148edcf6c770dfc780a7273014a9a89b66f357c761b4ca7c8dfa10ba")
+    version("15.0.6", sha256="4d857d7a180918bdacd09a5910bf9743c9861a1e49cb065a85f7a990f812161d")
+    version("15.0.5", sha256="c47640269e0251e009ae18a25162df4e20e175885286e21d28c054b084b991a4")
     version("15.0.4", sha256="e24b4d3bf7821dcb1c901d1e09096c1f88fb00095c5a6ef893baab4836975e52")
     version("15.0.3", sha256="8ac8e4c0982bf236526d737d385db5e1e66543ab217a9355d54159659eae3774")
     version("15.0.2", sha256="dc11d35e60ab61792baa607dff080c993b39de23fb93b3d3369ba15b0601c307")
@@ -68,26 +73,13 @@ class Llvm(CMakePackage, CudaPackage):
     version("5.0.2", sha256="fe87aa11558c08856739bfd9bd971263a28657663cb0c3a0af01b94f03b0b795")
     version("5.0.1", sha256="84ca454abf262579814a2a2b846569f6e0cb3e16dc33ca3642b4f1dff6fbafd3")
     version("5.0.0", sha256="1f1843315657a4371d8ca37f01265fa9aae17dbcf46d2d0a95c1fdb3c6a4bab6")
-    version("4.0.1", sha256="cd664fb3eec3208c08fb61189c00c9118c290b3be5adb3215a97b24255618be5")
-    version("4.0.0", sha256="28ca4b2fc434cb1f558e8865386c233c2a6134437249b8b3765ae745ffa56a34")
-    version("3.9.1", sha256="f5b6922a5c65f9232f83d89831191f2c3ccf4f41fdd8c63e6645bbf578c4ab92")
-    version("3.9.0", sha256="9c6563a72c8b5b79941c773937d997dd2b1b5b3f640136d02719ec19f35e0333")
-    version("3.8.1", sha256="69360f0648fde0dc3d3c4b339624613f3bc2a89c4858933bc3871a250ad02826")
-    version("3.8.0", sha256="b5cc5974cc2fd4e9e49e1bbd0700f872501a8678bd9694fa2b36c65c026df1d1")
-    version("3.7.1", sha256="d2cb0eb9b8eb21e07605bfe5e7a5c6c5f5f8c2efdac01ec1da6ffacaabe4195a")
-    version("3.7.0", sha256="dc00bc230be2006fb87b84f6fe4800ca28bc98e6692811a98195da53c9cb28c6")
-    version("3.6.2", sha256="f75d703a388ba01d607f9cf96180863a5e4a106827ade17b221d43e6db20778a")
-    version("3.5.1", sha256="5d739684170d5b2b304e4fb521532d5c8281492f71e1a8568187bfa38eb5909d")
-    # fmt: on
 
     # NOTE: The debug version of LLVM is an order of magnitude larger than
     # the release version, and may take up 20-30 GB of space. If you want
     # to save space, build with `build_type=Release`.
 
     variant(
-        "clang",
-        default=True,
-        description="Build the LLVM C/C++/Objective-C compiler frontend",
+        "clang", default=True, description="Build the LLVM C/C++/Objective-C compiler frontend"
     )
     variant(
         "flang",
@@ -105,10 +97,7 @@ class Llvm(CMakePackage, CudaPackage):
     variant("lld", default=True, description="Build the LLVM linker")
     variant("mlir", default=False, when="@10:", description="Build with MLIR support")
     variant(
-        "internal_unwind",
-        default=True,
-        when="+clang",
-        description="Build the libcxxabi libunwind",
+        "internal_unwind", default=True, when="+clang", description="Build the libcxxabi libunwind"
     )
     variant(
         "polly",
@@ -116,10 +105,7 @@ class Llvm(CMakePackage, CudaPackage):
         description="Build the LLVM polyhedral optimization plugin, " "only builds for 3.7.0+",
     )
     variant(
-        "libcxx",
-        default=True,
-        when="+clang",
-        description="Build the LLVM C++ standard library",
+        "libcxx", default=True, when="+clang", description="Build the LLVM C++ standard library"
     )
     variant(
         "compiler-rt",
@@ -132,11 +118,7 @@ class Llvm(CMakePackage, CudaPackage):
         default=(sys.platform != "darwin"),
         description="Add support for LTO with the gold linker plugin",
     )
-    variant(
-        "split_dwarf",
-        default=False,
-        description="Build with split dwarf information",
-    )
+    variant("split_dwarf", default=False, description="Build with split dwarf information")
     variant(
         "llvm_dylib",
         default=True,
@@ -179,12 +161,6 @@ class Llvm(CMakePackage, CudaPackage):
         ),
         multi=True,
     )
-    variant(
-        "build_type",
-        default="Release",
-        description="CMake build type",
-        values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
-    )
     variant(
         "omp_tsan",
         default=False,
@@ -214,6 +190,12 @@ class Llvm(CMakePackage, CudaPackage):
     variant(
         "z3", default=False, when="+clang @8:", description="Use Z3 for the clang static analyzer"
     )
+    variant(
+        "zstd",
+        default=False,
+        when="@15:",
+        description="Enable zstd support for static analyzer / lld",
+    )
 
     provides("libllvm@14", when="@14.0.0:14")
     provides("libllvm@13", when="@13.0.0:13")
@@ -277,14 +259,12 @@ class Llvm(CMakePackage, CudaPackage):
     # Build dependency
     depends_on("cmake@3.4.3:", type="build")
     depends_on("cmake@3.13.4:", type="build", when="@12:")
-    depends_on("ninja", type="build")
-    depends_on("python@2.7:2.8", when="@:4 ~python", type="build")
-    depends_on("python", when="@5: ~python", type="build")
+    depends_on("cmake@3.20:", type="build", when="@16:")
+    depends_on("python", when="~python", type="build")
     depends_on("pkgconfig", type="build")
 
     # Universal dependency
-    depends_on("python@2.7:2.8", when="@:4+python")
-    depends_on("python", when="@5:+python")
+    depends_on("python", when="+python")
 
     # clang and clang-tools dependencies
     depends_on("z3@4.7.1:", when="+z3")
@@ -292,33 +272,36 @@ class Llvm(CMakePackage, CudaPackage):
     # openmp dependencies
     depends_on("perl-data-dumper", type=("build"))
     depends_on("hwloc")
-    depends_on("libelf", when="+cuda")  # libomptarget
+    depends_on("hwloc@2.0.1:", when="@9:")
+    depends_on("elf", when="+cuda")  # libomptarget
     depends_on("libffi", when="+cuda")  # libomptarget
 
     # llvm-config --system-libs libraries.
     depends_on("zlib")
 
+    # needs zstd cmake config file, which is not added when built with makefile.
+    depends_on("zstd build_system=cmake", when="+zstd")
+
     # lldb dependencies
     with when("+lldb +python"):
-        depends_on("swig")
+        # build fails with swig@4.1: https://github.com/llvm/llvm-project/issues/58018
+        depends_on("swig@:4.0")
         depends_on("swig@2:", when="@10:")
         depends_on("swig@3:", when="@12:")
     depends_on("libedit", when="+lldb")
     depends_on("ncurses", when="+lldb")
-    depends_on("py-six", when="@5.0.0: +lldb +python")
+    depends_on("py-six", when="+lldb+python")
 
     # gold support, required for some features
-    depends_on("binutils+gold+ld+plugins", when="+gold")
-
-    # polly plugin
-    depends_on("gmp", when="@:3.6 +polly")
-    depends_on("isl", when="@:3.6 +polly")
+    depends_on("binutils+gold+ld+plugins+headers", when="+gold")
 
     # Older LLVM do not build with newer compilers, and vice versa
+    with when("@16:"):
+        conflicts("%gcc@:7.0")
+        conflicts("%clang@:4")
+        conflicts("%apple-clang@:9")
     conflicts("%gcc@8:", when="@:5")
     conflicts("%gcc@:5.0", when="@8:")
-    # clang/lib: a lambda parameter cannot shadow an explicitly captured entity
-    conflicts("%clang@8:", when="@:4")
     # Internal compiler error on gcc 8.4 on aarch64 https://bugzilla.redhat.com/show_bug.cgi?id=1958295
     conflicts("%gcc@8.4:8.4.9", when="@12: target=aarch64:")
 
@@ -334,14 +317,6 @@ class Llvm(CMakePackage, CudaPackage):
     conflicts("%clang@:10", when="@13:+libcxx")
     conflicts("%apple-clang@:11", when="@13:+libcxx")
 
-    # libcxx-4 and compiler-rt-4 fail to build with "newer" clang and gcc versions:
-    conflicts("%gcc@7:", when="@:4+libcxx")
-    conflicts("%clang@6:", when="@:4+libcxx")
-    conflicts("%apple-clang@6:", when="@:4+libcxx")
-    conflicts("%gcc@7:", when="@:4+compiler-rt")
-    conflicts("%clang@6:", when="@:4+compiler-rt")
-    conflicts("%apple-clang@6:", when="@:4+compiler-rt")
-
     # cuda_arch value must be specified
     conflicts("cuda_arch=none", when="+cuda", msg="A value for cuda_arch must be specified.")
 
@@ -350,14 +325,10 @@ class Llvm(CMakePackage, CudaPackage):
     # Fixed in upstream versions of both
     conflicts("^cmake@3.19.0", when="@6:11.0.0")
 
-    # Github issue #4986
-    patch("llvm_gcc7.patch", when="@4.0.0:4.0.1+lldb %gcc@7.0:")
-
     # sys/ustat.h has been removed in favour of statfs from glibc-2.28. Use fixed sizes:
     patch("llvm5-sanitizer-ustat.patch", when="@4:6.0.0+compiler-rt")
 
     # Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463
-    patch("llvm4-lld-ELF-Symbols.patch", when="@4+lld%clang@6:")
     patch("llvm5-lld-ELF-Symbols.patch", when="@5+lld%clang@7:")
 
     # Fix missing std:size_t in 'llvm@4:5' when built with '%clang@7:'
@@ -386,8 +357,8 @@ class Llvm(CMakePackage, CudaPackage):
     patch("llvm_py37.patch", when="@4:6 ^python@3.7:")
 
     # https://github.com/spack/spack/issues/19625,
-    # merged in llvm-11.0.0_rc2, but not found in 11.0.1
-    patch("lldb_external_ncurses-10.patch", when="@10.0.0:11.0.1+lldb")
+    # merged in llvm-11.0.0_rc2, first available in 12.0.0
+    patch("lldb_external_ncurses-10.patch", when="@10.0.0:11+lldb")
 
     # https://github.com/spack/spack/issues/19908
     # merged in llvm main prior to 12.0.0
@@ -635,6 +606,7 @@ class Llvm(CMakePackage, CudaPackage):
             define("PYTHON_EXECUTABLE", python.command.path),
             define("LIBOMP_USE_HWLOC", True),
             define("LIBOMP_HWLOC_INSTALL_DIR", spec["hwloc"].prefix),
+            from_variant("LLVM_ENABLE_ZSTD", "zstd"),
         ]
 
         version_suffix = spec.variants["version_suffix"].value
@@ -672,9 +644,7 @@ class Llvm(CMakePackage, CudaPackage):
                     [
                         define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True),
                         # work around bad libelf detection in libomptarget
-                        define(
-                            "LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR", spec["libelf"].prefix.include
-                        ),
+                        define("LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR", spec["elf"].prefix.include),
                     ]
                 )
         else:
@@ -811,9 +781,7 @@ class Llvm(CMakePackage, CudaPackage):
                 cmake_args.extend(
                     [
                         define("LIBOMPTARGET_NVPTX_ENABLE_BCLIB", True),
-                        define(
-                            "LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR", spec["libelf"].prefix.include
-                        ),
+                        define("LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR", spec["elf"].prefix.include),
                         self.stage.source_path + "/openmp",
                     ]
                 )
diff --git a/packages/npm/package.py b/packages/npm/package.py
deleted file mode 100644
index 0d6480f210428b035fb54eff79d7e8416e2dd399..0000000000000000000000000000000000000000
--- a/packages/npm/package.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# 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)
-
-import os
-import shutil
-
-from spack.package import *
-
-
-class Npm(Package):
-    """npm: A package manager for javascript."""
-
-    homepage = "https://github.com/npm/cli"
-    # base https://www.npmjs.com/
-
-    git = "https://github.com/npm/cli.git"
-    url = "https://registry.npmjs.org/npm/-/npm-9.3.1.tgz"
-
-    version("9.3.1", sha256="41caa26a340b0562bc5429d28792049c980fe3e872b42b82cad94e8f70e37f40")
-    version("8.19.3", sha256="634bf4e0dc87be771ebf48a058629960e979a209c20a51ebdbc4897ca6a25260")
-    version("7.24.2", sha256="5b9eeea011f8bc3b76e55cc33339e87213800677f37e0756ad13ef0e9eaccd64")
-    version("6.14.18", sha256="c9b15f277e2a0b1b57e05bad04504296a27024555d56c2aa967f862e957ad2ed")
-
-    version(
-        "6.14.9",
-        sha256="1e0e880ce0d5adf0120fb3f92fc8e5ea5bac73681d37282615d074ff670f7703",
-        deprecated=True,
-    )
-    version(
-        "6.14.8",
-        sha256="fe8e873cb606c06f67f666b4725eb9122c8927f677c8c0baf1477f0ff81f5a2c",
-        deprecated=True,
-    )
-    version(
-        "6.13.7",
-        sha256="6adf71c198d61a5790cf0e057f4ab72c6ef6c345d72bed8bb7212cb9db969494",
-        deprecated=True,
-    )
-    version(
-        "6.13.4",
-        sha256="a063290bd5fa06a8753de14169b7b243750432f42d01213fbd699e6b85916de7",
-        deprecated=True,
-    )
-    version(
-        "3.10.9",
-        sha256="fb0871b1aebf4b74717a72289fade356aedca83ee54e7386e38cb51874501dd6",
-        deprecated=True,
-    )
-    version(
-        "3.10.5",
-        sha256="ff019769e186152098841c1fa6325e5a79f7903a45f13bd0046a4dc8e63f845f",
-        deprecated=True,
-    )
-
-    depends_on("node-js", type=("build", "run"))
-    depends_on("libvips")
-
-    # npm 6.13.4 ships with node-gyp 5.0.5, which contains several Python 3
-    # compatibility issues on macOS. Manually update to node-gyp 6.0.1 for
-    # full Python 3 support.
-    resource(
-        name="node-gyp",
-        destination="node-gyp",
-        url="https://registry.npmjs.org/node-gyp/-/node-gyp-6.0.1.tgz",
-        sha256="bbc0e137e17a63676efc97a0e3b1fcf101498a1c2c01c3341cd9491f248711b8",
-        when="@6",
-    )
-    resource(
-        name="env-paths",
-        destination="env-paths",
-        url="https://registry.npmjs.org/env-paths/-/env-paths-2.2.0.tgz",
-        sha256="168b394fbca60ea81dc84b1824466df96246b9eb4d671c2541f55f408a264b4c",
-        when="@6",
-    )
-
-    @when("@6")
-    def patch(self):
-        shutil.rmtree("node_modules/node-gyp")
-        install_tree("node-gyp/package", "node_modules/node-gyp")
-        filter_file(r'"node-gyp": "\^5\..*"', '"node-gyp": "^6.0.1"', "package.json")
-        install_tree("env-paths/package", "node_modules/env-paths")
-
-    @when("@:8")
-    def install(self, spec, prefix):
-        # `npm install .` doesn't work properly out of the box on npm up to 8, so we do
-        # what it would do manually. The only thing we seem to miss is docs. In
-        # particular, it will end up symlinking into the stage, which spack then
-        # deletes. You can avoid that with `npm install $(npm pack .)`, but `npm pack`
-        # also seems to fail when run from the tarball on macos. So we just copy manually.
-        to_install = [
-            "LICENSE",
-            "README.md",
-            "bin",
-            "docs",
-            "index.js",
-            "lib",
-            "node_modules",
-            "package.json",
-        ]
-
-        mkdirp(prefix.bin)
-        mkdirp(prefix.lib.node_modules.npm)
-
-        # manually install all the files above (if they exist for a particular node version)
-        for filename in to_install:
-            if os.path.exists(filename):
-                install_fn = install if os.path.isfile(filename) else install_tree
-                install_fn(filename, os.path.join(prefix.lib.node_modules.npm, filename))
-
-        # set up symlinks in bin
-        node_modules_bin = os.path.relpath(prefix.lib.node_modules.npm.bin, prefix.bin)
-        symlink(os.path.join(node_modules_bin, "npm-cli.js"), prefix.bin.npm)
-        symlink(os.path.join(node_modules_bin, "npx-cli.js"), prefix.bin.npx)
-
-    @when("@9:")
-    def install(self, spec, prefix):
-        # in npm 9, `npm install .` finally works within the repo, so we can just call it.
-        node = which("node", required=True)
-        node("bin/npm-cli.js", "install", "-ddd", "--global", f"--prefix={prefix}", ".")
-
-    def setup_dependent_build_environment(self, env, dependent_spec):
-        npm_config_cache_dir = "%s/npm-cache" % dependent_spec.prefix
-        if not os.path.isdir(npm_config_cache_dir):
-            mkdirp(npm_config_cache_dir)
-        env.set("npm_config_cache", npm_config_cache_dir)
-
-    def setup_dependent_run_environment(self, env, dependent_spec):
-        npm_config_cache_dir = "%s/npm-cache" % dependent_spec.prefix
-        env.set("npm_config_cache", npm_config_cache_dir)
diff --git a/packages/py-bluepymm/package.py b/packages/py-bluepymm/package.py
index fd67efcdf086f47d0ce1f1c2ca28151943cf89dd..9018c5765ef9796cd1c9c788cff480eb4691d2c0 100644
--- a/packages/py-bluepymm/package.py
+++ b/packages/py-bluepymm/package.py
@@ -21,7 +21,8 @@ class PyBluepymm(PythonPackage):
     depends_on("py-matplotlib", type="run")
     # The below dependency should disappear once
     # the matplotlib package is fixed
-    depends_on("py-backports-functools-lru-cache", type="run", when="^python@:3.3.99")
+    # not needed with EBRAINS python version:
+    # depends_on("py-backports-functools-lru-cache", type="run", when="^python@:3.3.99")
     depends_on("py-pandas", type="run")
     depends_on("py-numpy", type="run")
     depends_on("py-ipyparallel", type="run")
diff --git a/packages/py-deap/package.py b/packages/py-deap/package.py
deleted file mode 100644
index afafdcf7407bd2a2bf63c4a878a7e0d06638af2b..0000000000000000000000000000000000000000
--- a/packages/py-deap/package.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# this package was backported from the spack develop upstream to support newer setuptools
-
-# 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 *
-
-
-class PyDeap(PythonPackage):
-    """Distributed Evolutionary Algorithms in Python."""
-
-    homepage = "https://deap.readthedocs.org/"
-    pypi = "deap/deap-1.3.1.tar.gz"
-
-    version("1.3.3", sha256="8772f1b0fff042d5e516b0aebac2c706243045aa7d0de8e0b8658f380181cf31")
-    version("1.3.1", sha256="11f54493ceb54aae10dde676577ef59fc52d52f82729d5a12c90b0813c857a2f")
-
-    depends_on("py-setuptools", type="build")
-    # uses 2to3
-    depends_on("py-setuptools@:57", type="build", when="@1.3.1")
-    depends_on("py-numpy", type=("build", "run"))
diff --git a/packages/py-etils/package.py b/packages/py-etils/package.py
deleted file mode 100644
index 6fd0d1887ffbea0b3bf8ee690cf30a194e1b4d27..0000000000000000000000000000000000000000
--- a/packages/py-etils/package.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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 *
-
-
-class PyEtils(PythonPackage):
-    """etils (eclectic utils) is an open-source collection of utils
-    for python."""
-
-    homepage = "https://github.com/google/etils"
-    pypi = "etils/etils-0.9.0.tar.gz"
-
-    version("0.9.0", sha256="489103e9e499a566765c60458ee15d185cf0065f2060a4d16a68f8f46962ed0d")
-
-    variant("epath", default=False, description="with epath module")
-
-    depends_on("python@3.7:", type=("build", "run"))
-
-    depends_on("py-importlib-resources", type=("build", "run"), when="+epath")
-    depends_on("py-typing-extensions", type=("build", "run"), when="+epath")
-    depends_on("py-zipp", type=("build", "run"), when="+epath")
-
-    depends_on("py-flit-core@3.5:3", type="build")
diff --git a/packages/py-igor/package.py b/packages/py-igor/package.py
deleted file mode 100644
index 5377ce1f3c268bc501048a63ccf6ab34c3526d5f..0000000000000000000000000000000000000000
--- a/packages/py-igor/package.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# (backported from Spack v0.20.0)
-
-# 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 *
-
-
-class PyIgor(PythonPackage):
-    """igor: interface for reading binary IGOR files."""
-
-    homepage = "http://blog.tremily.us/posts/igor/"
-    pypi = "igor/igor-0.3.tar.gz"
-
-    version("0.3", sha256="b04ac38c68fb81cf3167a9981dc5a20379112d40268bb72c5a8514dc8051abba")
-
-    depends_on("py-setuptools", type="build")
-    depends_on("py-numpy", type=("build", "run"))
-    depends_on("py-matplotlib", type=("build", "run"))
\ No newline at end of file
diff --git a/packages/py-ipyparallel/package.py b/packages/py-ipyparallel/package.py
deleted file mode 100644
index 84537a0cd96ebf43b2fe0158920982890a9f6dcb..0000000000000000000000000000000000000000
--- a/packages/py-ipyparallel/package.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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 *
-
-
-class PyIpyparallel(PythonPackage):
-    """IPython's architecture for parallel and distributed computing."""
-
-    homepage = "https://github.com/ipython/ipyparallel"
-    pypi = "ipyparallel/ipyparallel-7.1.0.tar.gz"
-
-    version("8.4.1", sha256="670bbe05755381742e1ea01177dc428ff8f3e94af1f0d5642c9d19f37ca8289b")
-    version("8.0.0", sha256="95305a886f2c42e9603c034ea684e5c031d9d4222c66ed6d85eb3ae15d631e4b")
-    version("7.1.0", sha256="ea756df0d2485bac19cccb0dbf4cafbc855c922b9b5905b4906e6cfac8b3c648")
-    version("6.3.0", sha256="0a97b276c62db633e9e97a816282bdd166f9df74e28204f0c8fa54b71944cfdc")
-    version("6.2.5", sha256="33416179665f9c2f567011ab1a618232bc32c0845c0a3a5c388f6c71048bc053")
-    version("6.2.4", sha256="76c7b028962b0ba762e4e45b450ee3a4353e7221526a8af812e817d7ef6ac065")
-
-    depends_on("python@3.6:", type=("build", "run"), when="@7.1:")
-    depends_on("python@3.5:", type=("build", "run"), when="@6.3:")
-    depends_on("python@2.7,3.4:", type=("build", "run"))
-
-    depends_on("py-jupyterlab@3.0:3", type="build", when="@7.1:")
-    depends_on("py-packaging", type="build", when="@7.1:8.0.0")
-    depends_on("py-setuptools@40.8:", type="build", when="@7.1:8.2")
-    depends_on("py-setuptools@:60", type="build", when="@:8.2.0")
-    depends_on("py-hatchling@0.25:", type="build", when="@8.4:")
-
-    depends_on("py-ipython-genutils", type=("build", "run"), when="@:6.3")
-    depends_on("py-entrypoints", type=("build", "run"), when="@7.1:")
-    depends_on("py-decorator", type=("build", "run"))
-    depends_on("py-pyzmq@18:", type=("build", "run"), when="@7.1:")
-    depends_on("py-pyzmq@13:", type=("build", "run"))
-    depends_on("py-traitlets@4.3:", type=("build", "run"))
-    depends_on("py-ipython@4:", type=("build", "run"))
-    depends_on("py-jupyter-client", type=("build", "run"))
-    depends_on("py-ipykernel@4.4:", type=("build", "run"))
-    depends_on("py-tornado@5.1:", type=("build", "run"), when="@7.1:")
-    depends_on("py-tornado@4:", type=("build", "run"))
-    depends_on("py-psutil", type=("build", "run"), when="@7.1:")
-    depends_on("py-python-dateutil@2.1:", type=("build", "run"))
-    depends_on("py-tqdm", type=("build", "run"), when="@7.1:")
\ No newline at end of file
diff --git a/packages/py-jax/package.py b/packages/py-jax/package.py
deleted file mode 100644
index 279e4a00f7e309232d012c33a8a5d3dc9325360d..0000000000000000000000000000000000000000
--- a/packages/py-jax/package.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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 *
-
-
-class PyJax(PythonPackage):
-    """JAX is Autograd and XLA, brought together for high-performance
-    machine learning research. With its updated version of Autograd,
-    JAX can automatically differentiate native Python and NumPy
-    functions. It can differentiate through loops, branches,
-    recursion, and closures, and it can take derivatives of
-    derivatives of derivatives. It supports reverse-mode
-    differentiation (a.k.a. backpropagation) via grad as well as
-    forward-mode differentiation, and the two can be composed
-    arbitrarily to any order."""
-
-    homepage = "https://github.com/google/jax"
-    pypi = "jax/jax-0.2.25.tar.gz"
-
-    version("0.4.3", sha256="d43f08f940aa30eb339965cfb3d6bee2296537b0dc2f0c65ccae3009279529ae")
-    version("0.3.23", sha256="bff436e15552a82c0ebdef32737043b799e1e10124423c57a6ae6118c3a7b6cd")
-    version("0.2.25", sha256="822e8d1e06257eaa0fdc4c0a0686c4556e9f33647fa2a766755f984786ae7446")
-
-    depends_on("python@3.8:", when="@0.4:", type=("build", "run"))
-    depends_on("py-setuptools", type="build")
-    depends_on("py-numpy@1.20:", when="@0.3:", type=("build", "run"))
-    depends_on("py-numpy@1.18:", type=("build", "run"))
-    depends_on("py-opt-einsum", type=("build", "run"))
-    depends_on("py-scipy@1.5:", when="@0.3:", type=("build", "run"))
-    depends_on("py-scipy@1.2.1:", type=("build", "run"))
-
-    # See _minimum_jaxlib_version in jax/version.py
-    jax_to_jaxlib = {
-        "0.4.3": "0.4.2",
-        "0.3.23": "0.3.15",
-        "0.2.25": "0.1.69",
-    }
-
-    for jax, jaxlib in jax_to_jaxlib.items():
-        depends_on(f"py-jaxlib@{jaxlib}:", when=f"@{jax}", type=("build", "run"))
-
-    # Historical dependencies
-    depends_on("py-absl-py", when="@:0.3", type=("build", "run"))
-    depends_on("py-typing-extensions", when="@:0.3", type=("build", "run"))
-    depends_on("py-etils+epath", when="@0.3", type=("build", "run"))
diff --git a/packages/py-jaxlib/package.py b/packages/py-jaxlib/package.py
deleted file mode 100644
index 7d0c8b99dae31a7a0ac4343fbbc073d41f824f7d..0000000000000000000000000000000000000000
--- a/packages/py-jaxlib/package.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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)
-
-import tempfile
-
-from spack.package import *
-
-
-class PyJaxlib(PythonPackage, CudaPackage):
-    """XLA library for Jax"""
-
-    homepage = "https://github.com/google/jax"
-    url = "https://github.com/google/jax/archive/refs/tags/jaxlib-v0.1.74.tar.gz"
-
-    tmp_path = ""
-    buildtmp = ""
-
-    version("0.4.3", sha256="2104735dc22be2b105e5517bd5bc6ae97f40e8e9e54928cac1585c6112a3d910")
-    version("0.3.22", sha256="680a6f5265ba26d5515617a95ae47244005366f879a5c321782fde60f34e6d0d")
-    version("0.1.74", sha256="bbc78c7a4927012dcb1b7cd135c7521f782d7dad516a2401b56d3190f81afe35")
-
-    variant("cuda", default=True, description="Build with CUDA")
-
-    # jaxlib/setup.py
-    depends_on("python@3.8:", when="@0.4:", type=("build", "run"))
-    depends_on("py-setuptools", type="build")
-    depends_on("py-numpy@1.20:", when="@0.3:", type=("build", "run"))
-    depends_on("py-numpy@1.18:", type=("build", "run"))
-    depends_on("py-scipy@1.5:", type=("build", "run"))
-
-    # .bazelversion
-    depends_on("bazel@5.1.1:5.9", when="@0.3:", type="build")
-    # https://github.com/google/jax/issues/8440
-    depends_on("bazel@4.1:4", when="@0.1", type="build")
-
-    # README.md
-    depends_on("cuda@11.4:", when="@0.4:+cuda")
-    depends_on("cuda@11.1:", when="@0.3+cuda")
-    # https://github.com/google/jax/issues/12614
-    depends_on("cuda@11.1:11.7.0", when="@0.1+cuda")
-    depends_on("cudnn@8.2:", when="@0.4:+cuda")
-    depends_on("cudnn@8.0.5:", when="+cuda")
-
-    # Historical dependencies
-    depends_on("py-absl-py", when="@:0.3", type=("build", "run"))
-    depends_on("py-flatbuffers@1.12:2", when="@0.1", type=("build", "run"))
-
-    def patch(self):
-        self.tmp_path = tempfile.mkdtemp(prefix="spack")
-        self.buildtmp = tempfile.mkdtemp(prefix="spack")
-        filter_file(
-            'f"--output_path={output_path}",',
-            'f"--output_path={output_path}",'
-            f' "--sources_path={self.tmp_path}",'
-            ' "--nohome_rc",'
-            ' "--nosystem_rc",'
-            f' "--jobs={make_jobs}",',
-            "build/build.py",
-            string=True,
-        )
-        filter_file(
-            "args = parser.parse_args()",
-            "args, junk = parser.parse_known_args()",
-            "build/build_wheel.py",
-            string=True,
-        )
-
-    def install(self, spec, prefix):
-        args = []
-        args.append("build/build.py")
-        if "+cuda" in spec:
-            args.append("--enable_cuda")
-            args.append("--cuda_path={0}".format(self.spec["cuda"].prefix))
-            args.append("--cudnn_path={0}".format(self.spec["cudnn"].prefix))
-            capabilities = ",".join(
-                "{0:.1f}".format(float(i) / 10.0) for i in spec.variants["cuda_arch"].value
-            )
-            args.append("--cuda_compute_capabilities={0}".format(capabilities))
-        args.append(
-            "--bazel_startup_options="
-            "--output_user_root={0}".format(self.wrapped_package_object.buildtmp)
-        )
-        python(*args)
-        with working_dir(self.wrapped_package_object.tmp_path):
-            args = std_pip_args + ["--prefix=" + self.prefix, "."]
-            pip(*args)
-        remove_linked_tree(self.wrapped_package_object.tmp_path)
-        remove_linked_tree(self.wrapped_package_object.buildtmp)
diff --git a/packages/py-nilearn/package.py b/packages/py-nilearn/package.py
deleted file mode 100644
index 0bbc024662fcfedad0ff31f4a38063cde22aecb6..0000000000000000000000000000000000000000
--- a/packages/py-nilearn/package.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# this package was added from spack develop:
-# https://github.com/spack/spack/blob/c10b84f08d1febce6d1f64a5f8b9cbff73e461d9/var/spack/repos/builtin/packages/py-nilearn/package.py
-# to fix a typo in 0.19.2 version (https://github.com/spack/spack/pull/34284)
-
-# 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 *
-
-
-class PyNilearn(PythonPackage):
-    """Statistical learning for neuroimaging in Python."""
-
-    homepage = "https://nilearn.github.io/"
-    pypi = "nilearn/nilearn-0.7.1.tar.gz"
-    git = "https://github.com/nilearn/nilearn"
-
-    version("0.10.0", sha256="cc7f1068e038076527ead1bd363436f88f5e8d21e8bb57b323b30b926fc7553a")
-    version("0.9.2", sha256="8da8d3835d92cd7b8a6cc92455a489d7e7f5994cf64fc71bce653e362773b9e4")
-    version("0.9.0", sha256="f9c8e30adef51489910aec7724b5699de178427d3ae63873dad9b23dd321fe76")
-    version("0.8.1", sha256="a0489940855130f35bbc4cac0750479a6f82025215ea7b1d778faca064219298")
-    version("0.8.0", sha256="f2d3dc81005f829f3a183efa6c90d698ea6818c06264d2e3f03e805c4340febb")
-    version("0.7.1", sha256="8b1409a5e1f0f6d1a1f02555c2f11115a2364f45f1e57bcb5fb3c9ea11f346fa")
-    version("0.6.2", sha256="cfc6cfda59a6f4247189f8ccf92e364de450460a15c0ec21bdb857c420dd198c")
-    version("0.4.2", sha256="5049363eb6da2e7c35589477dfc79bf69929ca66de2d7ed2e9dc07acf78636f4")
-
-    depends_on("python@3.7:", when="@0.10:", type=("build", "run"))
-    depends_on("python@3.6:", when="@0.8:", type=("build", "run"))
-    depends_on("python@3.5:", when="@0.6:", type=("build", "run"))
-    depends_on("python@2.7:", type=("build", "run"))
-    depends_on("py-setuptools", type="build")
-
-    variant("plotting", default=False, description="Enable plotting functionalities")
-
-    depends_on("py-joblib@1:", when="@0.10:", type=("build", "run"))
-    depends_on("py-joblib@0.15:", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-joblib@0.12:", when="@0.7:", type=("build", "run"))
-    depends_on("py-joblib@0.11:", when="@0.6:", type=("build", "run"))
-    depends_on("py-lxml", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-nibabel@3.2:", when="@0.10:", type=("build", "run"))
-    depends_on("py-nibabel@3:", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-nibabel@2.5:", when="@0.8:", type=("build", "run"))
-    depends_on("py-nibabel@2.0.2:", type=("build", "run"))
-    depends_on("py-numpy@1.19:", when="@0.10:", type=("build", "run"))
-    depends_on("py-numpy@1.18:", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-numpy@1.16:", when="@0.8:", type=("build", "run"))
-    depends_on("py-numpy@1.11:", when="@0.5:", type=("build", "run"))
-    depends_on("py-numpy@1.6.1:", type=("build", "run"))
-    depends_on("py-pandas@1.1.5:", when="@0.10:", type=("build", "run"))
-    depends_on("py-pandas@1:", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-pandas@0.24.0:", when="@0.8:", type=("build", "run"))
-    depends_on("py-pandas@0.18.0:", when="@0.7:", type=("build", "run"))
-    depends_on("py-requests@2.25:", when="@0.10:", type=("build", "run"))
-    depends_on("py-requests@2:", when="@0.7:", type=("build", "run"))
-    depends_on("py-scikit-learn@1:", when="@0.10:", type=("build", "run"))
-    depends_on("py-scikit-learn@0.22:", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-scikit-learn@0.21:", when="@0.8:", type=("build", "run"))
-    depends_on("py-scikit-learn@0.19:", when="@0.7:", type=("build", "run"))
-    # sklearn.linear_model.base was deprecated in py-scikit.learn@0.24
-    depends_on("py-scikit-learn@0.19:0.23", when="@0.6.0:0.6", type=("build", "run"))
-    # older py-nilearn versions use import sklearn.external.joblib which was
-    # deprecated in py-scikit-learn@0.23:
-    depends_on("py-scikit-learn@0.15:0.22", when="@:0.5", type=("build", "run"))
-    depends_on("py-scipy@1.6:", when="@0.10:", type=("build", "run"))
-    depends_on("py-scipy@1.5:", when="@0.9.1:", type=("build", "run"))
-    depends_on("py-scipy@1.2:", when="@0.8:", type=("build", "run"))
-    depends_on("py-scipy@0.19:", when="@0.6:", type=("build", "run"))
-    depends_on("py-scipy@0.17:", when="@0.5:", type=("build", "run"))
-    depends_on("py-scipy@0.14:", type=("build", "run"))
-
-    depends_on("py-matplotlib@3.3:", when="@0.10: +plotting", type=("build", "run"))
-    depends_on("py-matplotlib@3:", when="@0.9.1: +plotting", type=("build", "run"))
-    depends_on("py-matplotlib@2:", when="@0.6: +plotting", type=("build", "run"))
-    # older py-nilearn versions use matplotlib.cm.revcmap which was deprecated
-    # in py-matplotlib@3.4:
-    depends_on("py-matplotlib@1.5.1:3.3", when="@:0.5 +plotting", type=("build", "run"))
-    depends_on("py-matplotlib@1.1.1:3.3", when="@0.4.2 +plotting", type=("build", "run"))
-
-    @property
-    def skip_modules(self):
-        modules = []
-
-        if self.spec.satisfies("~plotting"):
-            modules.append("nilearn.plotting")
-            if self.spec.satisfies("@0.7:"):
-                modules.append("nilearn.reporting")
-
-        return modules
diff --git a/packages/py-nptyping/package.py b/packages/py-nptyping/package.py
deleted file mode 100644
index f59291190d8090bf90875ad76a18fcc44a0f9358..0000000000000000000000000000000000000000
--- a/packages/py-nptyping/package.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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 *
-
-
-class PyNptyping(PythonPackage):
-    """Type hints for numpy"""
-
-    homepage = "https://github.com/ramonhagenaars/nptyping"
-    url = "https://github.com/ramonhagenaars/nptyping/archive/v2.4.1.tar.gz"
-    # avoid pypi for now: https://github.com/ramonhagenaars/nptyping/issues/98
-
-    version("2.4.1", sha256="1c1b2b08220d271f3e52dbf2bd9190e4dd15b3c04abfcf7a04ec533d3cc9fdab")
-    version("1.4.1", sha256="bbcedb967f8be1302dffdd999eb531b99712c6914078294b4411758d5899b3b6")
-    version("1.0.1", sha256="a00e672bfdaddc99aa6b25dd1ae89d7d58d2b76e8ad099bd69577bac2598589f")
-
-    depends_on("py-setuptools", type="build")
-    depends_on("py-typish@1.7.0:", type=("build", "run"))
-    depends_on("py-numpy@1.21.5", when="^python@:3.7", type=("build", "run"))
-    depends_on("py-numpy@1.20.0:1", when="^python@3.8:", type=("build", "run"))
-    depends_on("py-typing-extensions@4.0.0:4", when="^python@:3.9", type=("build", "run"))
diff --git a/packages/py-numpy/add_fj_compiler.patch b/packages/py-numpy/add_fj_compiler.patch
deleted file mode 100644
index 50df963581ff5bd876ea1e1d40d37fad2ff74f77..0000000000000000000000000000000000000000
--- a/packages/py-numpy/add_fj_compiler.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-diff -urN numpy-1.19.4.org/numpy/distutils/fcompiler/fujitsu.py numpy-1.19.4/numpy/distutils/fcompiler/fujitsu.py
---- numpy-1.19.4.org/numpy/distutils/fcompiler/fujitsu.py	1970-01-01 09:00:00.000000000 +0900
-+++ numpy-1.19.4/numpy/distutils/fcompiler/fujitsu.py	2020-11-10 17:21:43.324928283 +0900
-@@ -0,0 +1,40 @@
-+from numpy.distutils.fcompiler import FCompiler
-+
-+compilers = ['FujitsuFCompiler']
-+
-+class FujitsuFCompiler(FCompiler):
-+    compiler_type = 'fujitsu'
-+    description = 'Fujitsu Fortran Compiler'
-+
-+    possible_executables = ['frt']
-+    version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
-+    # $ frt --version
-+    # frt (FRT) x.x.x yyyymmdd
-+
-+    executables = {
-+        'version_cmd'  : ["<F77>", "--version"],
-+        'compiler_f77' : ["frt", "-Fixed"],
-+        'compiler_fix' : ["frt", "-Fixed"],
-+        'compiler_f90' : ["frt"],
-+        'linker_so'    : ["frt", "-shared"],
-+        'archiver'     : ["ar", "-cr"],
-+        'ranlib'       : ["ranlib"]
-+        }
-+    pic_flags = ['-KPIC']
-+    module_dir_switch = '-M'
-+    module_include_switch = '-I'
-+
-+    def get_flags_opt(self):
-+        return ['-O3']
-+    def get_flags_debug(self):
-+        return ['-g']
-+    def runtime_library_dir_option(self, dir):
-+        return f'-Wl,-rpath={dir}'
-+    def get_libraries(self):
-+        return ['fj90f', 'fj90i', 'fjsrcinfo']
-+
-+if __name__ == '__main__':
-+    from distutils import log
-+    from numpy.distutils import customized_fcompiler
-+    log.set_verbosity(2)
-+    print(customized_fcompiler('fujitsu').get_version())
-diff -urN numpy-1.19.4.org/numpy/distutils/fcompiler/__init__.py numpy-1.19.4/numpy/distutils/fcompiler/__init__.py
---- numpy-1.19.4.org/numpy/distutils/fcompiler/__init__.py	2020-11-09 10:51:35.693490207 +0900
-+++ numpy-1.19.4/numpy/distutils/fcompiler/__init__.py	2020-11-16 17:48:49.316744476 +0900
-@@ -746,7 +746,7 @@
-                'intelvem', 'intelem', 'flang')),
-     ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
-     ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'nv', 'absoft', 'nag', 'vast', 'compaq',
--                 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')),
-+                 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fujitsu')),
-     ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
-     ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
-     ('irix.*', ('mips', 'gnu', 'gnu95',)),
diff --git a/packages/py-numpy/add_fj_compiler2.patch b/packages/py-numpy/add_fj_compiler2.patch
deleted file mode 100644
index 4526ddeadb06468c1ae212953fa20ef681ea49fa..0000000000000000000000000000000000000000
--- a/packages/py-numpy/add_fj_compiler2.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-diff -urN spack-src.org/numpy/distutils/fcompiler/fujitsu.py spack-src/numpy/distutils/fcompiler/fujitsu.py
---- spack-src.org/numpy/distutils/fcompiler/fujitsu.py	1970-01-01 09:00:00.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/fujitsu.py	2020-11-16 17:55:57.608802456 +0900
-@@ -0,0 +1,40 @@
-+from numpy.distutils.fcompiler import FCompiler
-+
-+compilers = ['FujitsuFCompiler']
-+
-+class FujitsuFCompiler(FCompiler):
-+    compiler_type = 'fujitsu'
-+    description = 'Fujitsu Fortran Compiler'
-+
-+    possible_executables = ['frt']
-+    version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
-+    # $ frt --version
-+    # frt (FRT) x.x.x yyyymmdd
-+
-+    executables = {
-+        'version_cmd'  : ["<F77>", "--version"],
-+        'compiler_f77' : ["frt", "-Fixed"],
-+        'compiler_fix' : ["frt", "-Fixed"],
-+        'compiler_f90' : ["frt"],
-+        'linker_so'    : ["frt", "-shared"],
-+        'archiver'     : ["ar", "-cr"],
-+        'ranlib'       : ["ranlib"]
-+        }
-+    pic_flags = ['-KPIC']
-+    module_dir_switch = '-M'
-+    module_include_switch = '-I'
-+
-+    def get_flags_opt(self):
-+        return ['-O3']
-+    def get_flags_debug(self):
-+        return ['-g']
-+    def runtime_library_dir_option(self, dir):
-+        return f'-Wl,-rpath={dir}'
-+    def get_libraries(self):
-+        return ['fj90f', 'fj90i', 'fjsrcinfo']
-+
-+if __name__ == '__main__':
-+    from distutils import log
-+    from numpy.distutils import customized_fcompiler
-+    log.set_verbosity(2)
-+    print(customized_fcompiler('fujitsu').get_version())
-diff -urN spack-src.org/numpy/distutils/fcompiler/__init__.py spack-src/numpy/distutils/fcompiler/__init__.py
---- spack-src.org/numpy/distutils/fcompiler/__init__.py	2020-11-16 17:55:31.638677631 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2020-11-16 17:56:29.978957954 +0900
-@@ -746,7 +746,7 @@
-                'intelvem', 'intelem', 'flang')),
-     ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
-     ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq',
--                 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')),
-+                 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fujitsu')),
-     ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
-     ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
-     ('irix.*', ('mips', 'gnu', 'gnu95',)),
diff --git a/packages/py-numpy/add_fj_compiler3.patch b/packages/py-numpy/add_fj_compiler3.patch
deleted file mode 100644
index 034cac069b8625a60994bdadaecb6203105f0fbc..0000000000000000000000000000000000000000
--- a/packages/py-numpy/add_fj_compiler3.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-diff -urN spack-src.org/numpy/distutils/fcompiler/fujitsu.py spack-src/numpy/distutils/fcompiler/fujitsu.py
---- spack-src.org/numpy/distutils/fcompiler/fujitsu.py	1970-01-01 09:00:00.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/fujitsu.py	2020-11-16 18:30:06.698641953 +0900
-@@ -0,0 +1,40 @@
-+from numpy.distutils.fcompiler import FCompiler
-+
-+compilers = ['FujitsuFCompiler']
-+
-+class FujitsuFCompiler(FCompiler):
-+    compiler_type = 'fujitsu'
-+    description = 'Fujitsu Fortran Compiler'
-+
-+    possible_executables = ['frt']
-+    version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
-+    # $ frt --version
-+    # frt (FRT) x.x.x yyyymmdd
-+
-+    executables = {
-+        'version_cmd'  : ["<F77>", "--version"],
-+        'compiler_f77' : ["frt", "-Fixed"],
-+        'compiler_fix' : ["frt", "-Fixed"],
-+        'compiler_f90' : ["frt"],
-+        'linker_so'    : ["frt", "-shared"],
-+        'archiver'     : ["ar", "-cr"],
-+        'ranlib'       : ["ranlib"]
-+        }
-+    pic_flags = ['-KPIC']
-+    module_dir_switch = '-M'
-+    module_include_switch = '-I'
-+
-+    def get_flags_opt(self):
-+        return ['-O3']
-+    def get_flags_debug(self):
-+        return ['-g']
-+    def runtime_library_dir_option(self, dir):
-+        return '-Wl,-rpath=%s' %dir
-+    def get_libraries(self):
-+        return ['fj90f', 'fj90i', 'fjsrcinfo']
-+
-+if __name__ == '__main__':
-+    from distutils import log
-+    from numpy.distutils import customized_fcompiler
-+    log.set_verbosity(2)
-+    print(customized_fcompiler('fujitsu').get_version())
-diff -urN spack-src.org/numpy/distutils/fcompiler/__init__.py spack-src/numpy/distutils/fcompiler/__init__.py
---- spack-src.org/numpy/distutils/fcompiler/__init__.py	2020-11-16 18:25:26.087294181 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2020-11-16 18:26:19.987553070 +0900
-@@ -750,7 +750,7 @@
-                'intelvem', 'intelem', 'flang')),
-     ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
-     ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq',
--                 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')),
-+                 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fujitsu')),
-     ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
-     ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
-     ('irix.*', ('mips', 'gnu', 'gnu95',)),
diff --git a/packages/py-numpy/add_fj_compiler4.patch b/packages/py-numpy/add_fj_compiler4.patch
deleted file mode 100644
index 83f2be5d822ba06f70cf3db2e00372a9eef9da28..0000000000000000000000000000000000000000
--- a/packages/py-numpy/add_fj_compiler4.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-diff -urN spack-src.org/numpy/distutils/fcompiler/fujitsu.py spack-src/numpy/distutils/fcompiler/fujitsu.py
---- spack-src.org/numpy/distutils/fcompiler/fujitsu.py	1970-01-01 09:00:00.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/fujitsu.py	2020-11-16 18:42:47.672297372 +0900
-@@ -0,0 +1,40 @@
-+from numpy.distutils.fcompiler import FCompiler
-+
-+compilers = ['FujitsuFCompiler']
-+
-+class FujitsuFCompiler(FCompiler):
-+    compiler_type = 'fujitsu'
-+    description = 'Fujitsu Fortran Compiler'
-+
-+    possible_executables = ['frt']
-+    version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
-+    # $ frt --version
-+    # frt (FRT) x.x.x yyyymmdd
-+
-+    executables = {
-+        'version_cmd'  : ["<F77>", "--version"],
-+        'compiler_f77' : ["frt", "-Fixed"],
-+        'compiler_fix' : ["frt", "-Fixed"],
-+        'compiler_f90' : ["frt"],
-+        'linker_so'    : ["frt", "-shared"],
-+        'archiver'     : ["ar", "-cr"],
-+        'ranlib'       : ["ranlib"]
-+        }
-+    pic_flags = ['-KPIC']
-+    module_dir_switch = '-M'
-+    module_include_switch = '-I'
-+
-+    def get_flags_opt(self):
-+        return ['-O3']
-+    def get_flags_debug(self):
-+        return ['-g']
-+    def runtime_library_dir_option(self, dir):
-+        return '-Wl,-rpath=%s' %dir
-+    def get_libraries(self):
-+        return ['fj90f', 'fj90i', 'fjsrcinfo']
-+
-+if __name__ == '__main__':
-+    from distutils import log
-+    from numpy.distutils import customized_fcompiler
-+    log.set_verbosity(2)
-+    print(customized_fcompiler('fujitsu').get_version())
-diff -urN spack-src.org/numpy/distutils/fcompiler/__init__.py spack-src/numpy/distutils/fcompiler/__init__.py
---- spack-src.org/numpy/distutils/fcompiler/__init__.py	2020-11-16 18:43:18.112443626 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2020-11-16 18:44:54.062904636 +0900
-@@ -709,7 +709,7 @@
-                'intelvem', 'intelem')),
-     ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
-     ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq',
--                'intele', 'intelem', 'gnu', 'g95', 'pathf95')),
-+                'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'fujitsu')),
-     ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
-     ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
-     ('irix.*', ('mips', 'gnu', 'gnu95',)),
diff --git a/packages/py-numpy/blas-lapack-order.patch b/packages/py-numpy/blas-lapack-order.patch
deleted file mode 100644
index ac27d87dcdf81f18742b4ae7084ca78b9b108704..0000000000000000000000000000000000000000
--- a/packages/py-numpy/blas-lapack-order.patch
+++ /dev/null
@@ -1,347 +0,0 @@
-Allows you to specify order of BLAS/LAPACK preference
-https://github.com/numpy/numpy/pull/13132
-diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
-index 806f4f7d3..0480d7b5a 100644
---- a/numpy/distutils/system_info.py
-+++ b/numpy/distutils/system_info.py
-@@ -474,6 +474,13 @@ class LapackSrcNotFoundError(LapackNotFoundError):
-     the LAPACK_SRC environment variable."""
- 
- 
-+class BlasOptNotFoundError(NotFoundError):
-+    """
-+    Optimized (vendor) Blas libraries are not found.
-+    Falls back to netlib Blas library which has worse performance.
-+    A better performance should be easily gained by switching
-+    Blas library."""
-+
- class BlasNotFoundError(NotFoundError):
-     """
-     Blas (http://www.netlib.org/blas/) libraries not found.
-@@ -1541,139 +1548,219 @@ Make sure that -lgfortran is used for C++ extensions.
- class lapack_opt_info(system_info):
- 
-     notfounderror = LapackNotFoundError
-+    # Default order of LAPACK checks
-+    lapack_order = ['mkl', 'openblas', 'atlas', 'accelerate', 'lapack']
- 
--    def calc_info(self):
-+    def _calc_info_mkl(self):
-+        info = get_info('lapack_mkl')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        lapack_mkl_info = get_info('lapack_mkl')
--        if lapack_mkl_info:
--            self.set_info(**lapack_mkl_info)
--            return
-+    def _calc_info_openblas(self):
-+        info = get_info('openblas_lapack')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        info = get_info('openblas_clapack')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        openblas_info = get_info('openblas_lapack')
--        if openblas_info:
--            self.set_info(**openblas_info)
--            return
-+    def _calc_info_atlas(self):
-+        info = get_info('atlas_3_10_threads')
-+        if not info:
-+            info = get_info('atlas_3_10')
-+        if not info:
-+            info = get_info('atlas_threads')
-+        if not info:
-+            info = get_info('atlas')
-+        if info:
-+            # Figure out if ATLAS has lapack...
-+            # If not we need the lapack library, but not BLAS!
-+            l = info.get('define_macros', [])
-+            if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \
-+               or ('ATLAS_WITHOUT_LAPACK', None) in l:
-+                # Get LAPACK (with possible warnings)
-+                # If not found we don't accept anything
-+                # since we can't use ATLAS with LAPACK!
-+                lapack_info = self._get_info_lapack()
-+                if not lapack_info:
-+                    return False
-+                dict_append(info, **lapack_info)
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        openblas_info = get_info('openblas_clapack')
--        if openblas_info:
--            self.set_info(**openblas_info)
--            return
-+    def _calc_info_accelerate(self):
-+        info = get_info('accelerate')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        atlas_info = get_info('atlas_3_10_threads')
--        if not atlas_info:
--            atlas_info = get_info('atlas_3_10')
--        if not atlas_info:
--            atlas_info = get_info('atlas_threads')
--        if not atlas_info:
--            atlas_info = get_info('atlas')
--
--        accelerate_info = get_info('accelerate')
--        if accelerate_info and not atlas_info:
--            self.set_info(**accelerate_info)
--            return
-+    def _get_info_blas(self):
-+        # Default to get the optimized BLAS implementation
-+        info = get_info('blas_opt')
-+        if not info:
-+            warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=3)
-+            info_src = get_info('blas_src')
-+            if not info_src:
-+                warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=3)
-+                return {}
-+            dict_append(info, libraries=[('fblas_src', info_src)])
-+        return info
- 
--        need_lapack = 0
--        need_blas = 0
--        info = {}
--        if atlas_info:
--            l = atlas_info.get('define_macros', [])
--            if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \
--                   or ('ATLAS_WITHOUT_LAPACK', None) in l:
--                need_lapack = 1
--            info = atlas_info
-+    def _get_info_lapack(self):
-+        info = get_info('lapack')
-+        if not info:
-+            warnings.warn(LapackNotFoundError.__doc__ or '', stacklevel=3)
-+            info_src = get_info('lapack_src')
-+            if not info_src:
-+                warnings.warn(LapackSrcNotFoundError.__doc__ or '', stacklevel=3)
-+                return {}
-+            dict_append(info, libraries=[('flapack_src', info_src)])
-+        return info
- 
--        else:
--            warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2)
--            need_blas = 1
--            need_lapack = 1
-+    def _calc_info_lapack(self):
-+        info = self._get_info_lapack()
-+        if info:
-+            info_blas = self._get_info_blas()
-+            dict_append(info, **info_blas)
-             dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        if need_lapack:
--            lapack_info = get_info('lapack')
--            #lapack_info = {} ## uncomment for testing
--            if lapack_info:
--                dict_append(info, **lapack_info)
--            else:
--                warnings.warn(LapackNotFoundError.__doc__, stacklevel=2)
--                lapack_src_info = get_info('lapack_src')
--                if not lapack_src_info:
--                    warnings.warn(LapackSrcNotFoundError.__doc__, stacklevel=2)
--                    return
--                dict_append(info, libraries=[('flapack_src', lapack_src_info)])
--
--        if need_blas:
--            blas_info = get_info('blas')
--            if blas_info:
--                dict_append(info, **blas_info)
--            else:
--                warnings.warn(BlasNotFoundError.__doc__, stacklevel=2)
--                blas_src_info = get_info('blas_src')
--                if not blas_src_info:
--                    warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2)
--                    return
--                dict_append(info, libraries=[('fblas_src', blas_src_info)])
-+    def calc_info(self):
-+        user_order = os.environ.get('NPY_LAPACK_ORDER', None)
-+        if user_order is None:
-+            lapack_order = self.lapack_order
-+        else:
-+            # the user has requested the order of the
-+            # check they are all in the available list, a COMMA SEPARATED list
-+            user_order = user_order.lower().split(',')
-+            non_existing = []
-+            lapack_order = []
-+            for order in user_order:
-+                if order in self.lapack_order:
-+                    lapack_order.append(order)
-+                elif len(order) > 0:
-+                    non_existing.append(order)
-+            if len(non_existing) > 0:
-+                raise ValueError("lapack_opt_info user defined "
-+                                 "LAPACK order has unacceptable "
-+                                 "values: {}".format(non_existing))
-+
-+        for lapack in lapack_order:
-+            if getattr(self, '_calc_info_{}'.format(lapack))():
-+                return
- 
--        self.set_info(**info)
--        return
-+        if 'lapack' not in lapack_order:
-+            # Since the user may request *not* to use any library, we still need
-+            # to raise warnings to signal missing packages!
-+            warnings.warn(LapackNotFoundError.__doc__ or '', stacklevel=2)
-+            warnings.warn(LapackSrcNotFoundError.__doc__ or '', stacklevel=2)
- 
- 
- class blas_opt_info(system_info):
- 
-     notfounderror = BlasNotFoundError
-+    # Default order of BLAS checks
-+    blas_order = ['mkl', 'blis', 'openblas', 'atlas', 'accelerate', 'blas']
- 
--    def calc_info(self):
-+    def _calc_info_mkl(self):
-+        info = get_info('blas_mkl')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        blas_mkl_info = get_info('blas_mkl')
--        if blas_mkl_info:
--            self.set_info(**blas_mkl_info)
--            return
-+    def _calc_info_blis(self):
-+        info = get_info('blis')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        blis_info = get_info('blis')
--        if blis_info:
--            self.set_info(**blis_info)
--            return
-+    def _calc_info_openblas(self):
-+        info = get_info('openblas')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        openblas_info = get_info('openblas')
--        if openblas_info:
--            self.set_info(**openblas_info)
--            return
-+    def _calc_info_atlas(self):
-+        info = get_info('atlas_3_10_blas_threads')
-+        if not info:
-+            info = get_info('atlas_3_10_blas')
-+        if not info:
-+            info = get_info('atlas_blas_threads')
-+        if not info:
-+            info = get_info('atlas_blas')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        atlas_info = get_info('atlas_3_10_blas_threads')
--        if not atlas_info:
--            atlas_info = get_info('atlas_3_10_blas')
--        if not atlas_info:
--            atlas_info = get_info('atlas_blas_threads')
--        if not atlas_info:
--            atlas_info = get_info('atlas_blas')
--
--        accelerate_info = get_info('accelerate')
--        if accelerate_info and not atlas_info:
--            self.set_info(**accelerate_info)
--            return
-+    def _calc_info_accelerate(self):
-+        info = get_info('accelerate')
-+        if info:
-+            self.set_info(**info)
-+            return True
-+        return False
- 
--        need_blas = 0
-+    def _calc_info_blas(self):
-+        # Warn about a non-optimized BLAS library
-+        warnings.warn(BlasOptNotFoundError.__doc__ or '', stacklevel=3)
-         info = {}
--        if atlas_info:
--            info = atlas_info
-+        dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])
-+
-+        blas = get_info('blas')
-+        if blas:
-+            dict_append(info, **blas)
-         else:
--            warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2)
--            need_blas = 1
--            dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])
-+            # Not even BLAS was found!
-+            warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=3)
- 
--        if need_blas:
--            blas_info = get_info('blas')
--            if blas_info:
--                dict_append(info, **blas_info)
--            else:
--                warnings.warn(BlasNotFoundError.__doc__, stacklevel=2)
--                blas_src_info = get_info('blas_src')
--                if not blas_src_info:
--                    warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2)
--                    return
--                dict_append(info, libraries=[('fblas_src', blas_src_info)])
-+            blas_src = get_info('blas_src')
-+            if not blas_src:
-+                warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=3)
-+                return False
-+            dict_append(info, libraries=[('fblas_src', blas_src)])
- 
-         self.set_info(**info)
--        return
-+        return True
-+
-+    def calc_info(self):
-+        user_order = os.environ.get('NPY_BLAS_ORDER', None)
-+        if user_order is None:
-+            blas_order = self.blas_order
-+        else:
-+            # the user has requested the order of the
-+            # check they are all in the available list
-+            user_order = user_order.lower().split(',')
-+            non_existing = []
-+            blas_order = []
-+            for order in user_order:
-+                if order in self.blas_order:
-+                    blas_order.append(order)
-+                elif len(order) > 0:
-+                    non_existing.append(order)
-+            if len(non_existing) > 0:
-+                raise ValueError("blas_opt_info user defined BLAS order has unacceptable values: {}".format(non_existing))
-+
-+        for blas in blas_order:
-+            if getattr(self, '_calc_info_{}'.format(blas))():
-+                return
-+
-+        if 'blas' not in blas_order:
-+            # Since the user may request *not* to use any library, we still need
-+            # to raise warnings to signal missing packages!
-+            warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=2)
-+            warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=2)
- 
- 
- class blas_info(system_info):
diff --git a/packages/py-numpy/check_executables.patch b/packages/py-numpy/check_executables.patch
deleted file mode 100644
index ee4ac1b45ee1b238ee55929fd40f1c4ab35ff2f9..0000000000000000000000000000000000000000
--- a/packages/py-numpy/check_executables.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- numpy-1.20.0/numpy/distutils/fcompiler/__init__.py.org	2021-02-04 17:38:42.000000000 +0900
-+++ numpy-1.20.0/numpy/distutils/fcompiler/__init__.py	2021-02-04 18:29:21.000000000 +0900
-@@ -314,7 +314,12 @@
-             if not exe_from_environ:
-                 possibles = [f90, f77] + self.possible_executables
-             else:
--                possibles = [exe_from_environ] + self.possible_executables
-+                matching_executables = []
-+                for e in exe_from_environ:
-+                    for p in self.possible_executables:
-+                        if p in e:
-+                            matching_executables.append(e)
-+                possibles = [matching_executables] + self.possible_executables
-
-             seen = set()
-             unique_possibles = []
diff --git a/packages/py-numpy/check_executables2.patch b/packages/py-numpy/check_executables2.patch
deleted file mode 100644
index 0d0b78f647f00627bf18de18c1a041d33bd27150..0000000000000000000000000000000000000000
--- a/packages/py-numpy/check_executables2.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- spack-src/numpy/distutils/fcompiler/__init__.py.orig	2021-01-04 15:16:38.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2021-02-12 17:20:07.327563118 +0900
-@@ -316,7 +316,12 @@
-             if not exe_from_environ:
-                 possibles = [f90, f77] + self.possible_executables
-             else:
--                possibles = [exe_from_environ] + self.possible_executables
-+                matching_executables = []
-+                for e in exe_from_environ:
-+                    for p in self.possible_executables:
-+                        if p in e:
-+                            matching_executables.append(e)
-+                possibles = [matching_executables] + self.possible_executables
- 
-             seen = set()
-             unique_possibles = []
diff --git a/packages/py-numpy/check_executables3.patch b/packages/py-numpy/check_executables3.patch
deleted file mode 100644
index 078211e3379cd19bf2c5bd6f20dfe084427065b4..0000000000000000000000000000000000000000
--- a/packages/py-numpy/check_executables3.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- spack-src/numpy/distutils/fcompiler/__init__.py.orig	2020-06-02 17:24:58.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2021-02-12 17:33:11.483728471 +0900
-@@ -320,7 +320,12 @@
-             if not exe_from_environ:
-                 possibles = [f90, f77] + self.possible_executables
-             else:
--                possibles = [exe_from_environ] + self.possible_executables
-+                matching_executables = []
-+                for e in exe_from_environ:
-+                    for p in self.possible_executables:
-+                        if p in e:
-+                            matching_executables.append(e)
-+                possibles = [matching_executables] + self.possible_executables
- 
-             seen = set()
-             unique_possibles = []
diff --git a/packages/py-numpy/check_executables4.patch b/packages/py-numpy/check_executables4.patch
deleted file mode 100644
index b553acb46f921810a844460fb329c77b827e0696..0000000000000000000000000000000000000000
--- a/packages/py-numpy/check_executables4.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- spack-src/numpy/distutils/fcompiler/__init__.py.orig	2018-11-03 10:49:58.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2021-02-12 17:57:50.632263931 +0900
-@@ -318,7 +318,12 @@
-             if not exe_from_environ:
-                 possibles = [f90, f77] + self.possible_executables
-             else:
--                possibles = [exe_from_environ] + self.possible_executables
-+                matching_executables = []
-+                for e in exe_from_environ:
-+                    for p in self.possible_executables:
-+                        if p in e:
-+                            matching_executables.append(e)
-+                possibles = [matching_executables] + self.possible_executables
- 
-             seen = set()
-             unique_possibles = []
diff --git a/packages/py-numpy/check_executables5.patch b/packages/py-numpy/check_executables5.patch
deleted file mode 100644
index 4ae9fe4009761e91cf138cc088be2887b92d7bf9..0000000000000000000000000000000000000000
--- a/packages/py-numpy/check_executables5.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- spack-src/numpy/distutils/fcompiler/__init__.py.orig	2017-09-29 13:31:46.000000000 +0900
-+++ spack-src/numpy/distutils/fcompiler/__init__.py	2021-02-12 18:06:12.001479417 +0900
-@@ -322,7 +322,12 @@
-             if not exe_from_environ:
-                 possibles = [f90, f77] + self.possible_executables
-             else:
--                possibles = [exe_from_environ] + self.possible_executables
-+                matching_executables = []
-+                for e in exe_from_environ:
-+                    for p in self.possible_executables:
-+                        if p in e:
-+                            matching_executables.append(e)
-+                possibles = [matching_executables] + self.possible_executables
- 
-             seen = set()
-             unique_possibles = []
diff --git a/packages/py-numpy/package.py b/packages/py-numpy/package.py
deleted file mode 100644
index 2cabb57311367d3b1c7fb97bb188e90cef3ccb39..0000000000000000000000000000000000000000
--- a/packages/py-numpy/package.py
+++ /dev/null
@@ -1,384 +0,0 @@
-# Copyright 2013-2022 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)
-
-import platform
-import subprocess
-
-from spack.package import *
-
-
-class PyNumpy(PythonPackage):
-    """NumPy is the fundamental package for scientific computing with Python.
-    It contains among other things: a powerful N-dimensional array object,
-    sophisticated (broadcasting) functions, tools for integrating C/C++ and
-    Fortran code, and useful linear algebra, Fourier transform, and random
-    number capabilities"""
-
-    homepage = "https://numpy.org/"
-    pypi = "numpy/numpy-1.23.0.tar.gz"
-    git = "https://github.com/numpy/numpy.git"
-
-    maintainers = ["adamjstewart", "rgommers"]
-
-    version("main", branch="main")
-    version("1.23.4", sha256="ed2cc92af0efad20198638c69bb0fc2870a58dabfba6eb722c933b48556c686c")
-    version("1.23.3", sha256="51bf49c0cd1d52be0a240aa66f3458afc4b95d8993d2d04f0d91fa60c10af6cd")
-    version("1.23.2", sha256="b78d00e48261fbbd04aa0d7427cf78d18401ee0abd89c7559bbf422e5b1c7d01")
-    version("1.23.1", sha256="d748ef349bfef2e1194b59da37ed5a29c19ea8d7e6342019921ba2ba4fd8b624")
-    version("1.23.0", sha256="bd3fa4fe2e38533d5336e1272fc4e765cabbbde144309ccee8675509d5cd7b05")
-    version("1.22.4", sha256="425b390e4619f58d8526b3dcf656dde069133ae5c240229821f01b5f44ea07af")
-    version("1.22.3", sha256="dbc7601a3b7472d559dc7b933b18b4b66f9aa7452c120e87dfb33d02008c8a18")
-    version("1.22.2", sha256="076aee5a3763d41da6bef9565fdf3cb987606f567cd8b104aded2b38b7b47abf")
-    version("1.22.1", sha256="e348ccf5bc5235fc405ab19d53bec215bb373300e5523c7b476cc0da8a5e9973")
-    version("1.22.0", sha256="a955e4128ac36797aaffd49ab44ec74a71c11d6938df83b1285492d277db5397")
-    version("1.21.6", sha256="ecb55251139706669fdec2ff073c98ef8e9a84473e51e716211b41aa0f18e656")
-    version("1.21.5", sha256="6a5928bc6241264dce5ed509e66f33676fc97f464e7a919edc672fb5532221ee")
-    version("1.21.4", sha256="e6c76a87633aa3fa16614b61ccedfae45b91df2767cf097aa9c933932a7ed1e0")
-    version("1.21.3", sha256="63571bb7897a584ca3249c86dd01c10bcb5fe4296e3568b2e9c1a55356b6410e")
-    version("1.21.2", sha256="423216d8afc5923b15df86037c6053bf030d15cc9e3224206ef868c2d63dd6dc")
-    version("1.21.1", sha256="dff4af63638afcc57a3dfb9e4b26d434a7a602d225b42d746ea7fe2edf1342fd")
-    version("1.21.0", sha256="e80fe25cba41c124d04c662f33f6364909b985f2eb5998aaa5ae4b9587242cce")
-    version("1.20.3", sha256="e55185e51b18d788e49fe8305fd73ef4470596b33fc2c1ceb304566b99c71a69")
-    version("1.20.2", sha256="878922bf5ad7550aa044aa9301d417e2d3ae50f0f577de92051d739ac6096cee")
-    version("1.20.1", sha256="3bc63486a870294683980d76ec1e3efc786295ae00128f9ea38e2c6e74d5a60a")
-    version("1.20.0", sha256="3d8233c03f116d068d5365fed4477f2947c7229582dad81e5953088989294cec")
-    version("1.19.5", sha256="a76f502430dd98d7546e1ea2250a7360c065a5fdea52b2dffe8ae7180909b6f4")
-    version("1.19.4", sha256="141ec3a3300ab89c7f2b0775289954d193cc8edb621ea05f99db9cb181530512")
-    version("1.19.3", sha256="35bf5316af8dc7c7db1ad45bec603e5fb28671beb98ebd1d65e8059efcfd3b72")
-    version("1.19.2", sha256="0d310730e1e793527065ad7dde736197b705d0e4c9999775f212b03c44a8484c")
-    version("1.19.1", sha256="b8456987b637232602ceb4d663cb34106f7eb780e247d51a260b84760fd8f491")
-    version("1.19.0", sha256="76766cc80d6128750075378d3bb7812cf146415bd29b588616f72c943c00d598")
-    version("1.18.5", sha256="34e96e9dae65c4839bd80012023aadd6ee2ccb73ce7fdf3074c62f301e63120b")
-    version("1.18.4", sha256="bbcc85aaf4cd84ba057decaead058f43191cc0e30d6bc5d44fe336dc3d3f4509")
-    version("1.18.3", sha256="e46e2384209c91996d5ec16744234d1c906ab79a701ce1a26155c9ec890b8dc8")
-    version("1.18.2", sha256="e7894793e6e8540dbeac77c87b489e331947813511108ae097f1715c018b8f3d")
-    version("1.18.1", sha256="b6ff59cee96b454516e47e7721098e6ceebef435e3e21ac2d6c3b8b02628eb77")
-    version("1.18.0", sha256="a9d72d9abaf65628f0f31bbb573b7d9304e43b1e6bbae43149c17737a42764c4")
-    version("1.17.5", sha256="16507ba6617f62ae3c6ab1725ae6f550331025d4d9a369b83f6d5a470446c342")
-    version("1.17.4", sha256="f58913e9227400f1395c7b800503ebfdb0772f1c33ff8cb4d6451c06cabdf316")
-    version("1.17.3", sha256="a0678793096205a4d784bd99f32803ba8100f639cf3b932dc63b21621390ea7e")
-    version("1.17.2", sha256="73615d3edc84dd7c4aeb212fa3748fb83217e00d201875a47327f55363cef2df")
-    version("1.17.1", sha256="f11331530f0eff69a758d62c2461cd98cdc2eae0147279d8fc86e0464eb7e8ca")
-    version("1.17.0", sha256="951fefe2fb73f84c620bec4e001e80a80ddaa1b84dce244ded7f1e0cbe0ed34a")
-    version("1.16.6", sha256="e5cf3fdf13401885e8eea8170624ec96225e2174eb0c611c6f26dd33b489e3ff")
-    version("1.16.5", sha256="8bb452d94e964b312205b0de1238dd7209da452343653ab214b5d681780e7a0c")
-    version("1.16.4", sha256="7242be12a58fec245ee9734e625964b97cf7e3f2f7d016603f9e56660ce479c7")
-    version("1.16.3", sha256="78a6f89da87eeb48014ec652a65c4ffde370c036d780a995edaeb121d3625621")
-    version("1.16.2", sha256="6c692e3879dde0b67a9dc78f9bfb6f61c666b4562fd8619632d7043fb5b691b0")
-    version("1.16.1", sha256="31d3fe5b673e99d33d70cfee2ea8fe8dccd60f265c3ed990873a88647e3dd288")
-    version("1.16.0", sha256="cb189bd98b2e7ac02df389b6212846ab20661f4bafe16b5a70a6f1728c1cc7cb")
-    version("1.15.4", sha256="3d734559db35aa3697dadcea492a423118c5c55d176da2f3be9c98d4803fc2a7")
-    version("1.15.3", sha256="1c0c80e74759fa4942298044274f2c11b08c86230b25b8b819e55e644f5ff2b6")
-    version("1.15.2", sha256="27a0d018f608a3fe34ac5e2b876f4c23c47e38295c47dd0775cc294cd2614bc1")
-    version("1.15.2", sha256="27a0d018f608a3fe34ac5e2b876f4c23c47e38295c47dd0775cc294cd2614bc1")
-    version("1.15.1", sha256="7b9e37f194f8bcdca8e9e6af92e2cbad79e360542effc2dd6b98d63955d8d8a3")
-    version("1.15.0", sha256="f28e73cf18d37a413f7d5de35d024e6b98f14566a10d82100f9dc491a7d449f9")
-    version("1.14.6", sha256="1250edf6f6c43e1d7823f0967416bc18258bb271dc536298eb0ea00a9e45b80a")
-    version("1.14.5", sha256="a4a433b3a264dbc9aa9c7c241e87c0358a503ea6394f8737df1683c7c9a102ac")
-    version("1.14.4", sha256="2185a0f31ecaa0792264fa968c8e0ba6d96acf144b26e2e1d1cd5b77fc11a691")
-    version("1.14.3", sha256="9016692c7d390f9d378fc88b7a799dc9caa7eb938163dda5276d3f3d6f75debf")
-    version("1.14.2", sha256="facc6f925c3099ac01a1f03758100772560a0b020fb9d70f210404be08006bcb")
-    version("1.14.1", sha256="fa0944650d5d3fb95869eaacd8eedbd2d83610c85e271bd9d3495ffa9bc4dc9c")
-    version("1.14.0", sha256="3de643935b212307b420248018323a44ec51987a336d1d747c1322afc3c099fb")
-    version("1.13.3", sha256="36ee86d5adbabc4fa2643a073f93d5504bdfed37a149a3a49f4dde259f35a750")
-    version("1.13.1", sha256="c9b0283776085cb2804efff73e9955ca279ba4edafd58d3ead70b61d209c4fbb")
-    version("1.13.0", sha256="dcff367b725586830ff0e20b805c7654c876c2d4585c0834a6049502b9d6cf7e")
-    version("1.12.1", sha256="a65266a4ad6ec8936a1bc85ce51f8600634a31a258b722c9274a80ff189d9542")
-    version("1.12.0", sha256="ff320ecfe41c6581c8981dce892fe6d7e69806459a899e294e4bf8229737b154")
-    version("1.11.3", sha256="2e0fc5248246a64628656fe14fcab0a959741a2820e003bd15538226501b82f7")
-    version("1.11.2", sha256="c1ed4d1d2a795409c7df1eb4bfee65c0e3326cfc7c57875fa39e5c7414116d9a")
-    version("1.11.1", sha256="4e9c289b9d764d10353a224a5286dda3e0425b13b112719bdc3e9864ae648d79")
-    version("1.11.0", sha256="9109f260850627e4b83a3c4bcef4f2f99357eb4a5eaae75dec51c32f3c197aa3")
-    version("1.10.4", sha256="8ce443dc79656a9fc97a7837f1444d324aef2c9b53f31f83441f57ad1f1f3659")
-    version("1.9.3", sha256="baa074bb1c7f9c822122fb81459b7caa5fc49267ca94cca69465c8dcfd63ac79")
-    version("1.9.2", sha256="e37805754f4ebb575c434d134f6bebb8b857d9843c393f6943c7be71ef57311c")
-    version("1.9.1", sha256="2a545c0d096d86035b12160fcba5e4c0a08dcabbf902b4f867eb64deb31a2b7a")
-
-    variant("blas", default=True, description="Build with BLAS support")
-    variant("lapack", default=True, description="Build with LAPACK support")
-
-    depends_on("python@2.7:2.8,3.4:3.6", type=("build", "link", "run"), when="@:1.13")
-    depends_on("python@2.7:2.8,3.4:3.8", type=("build", "link", "run"), when="@1.14:1.15")
-    depends_on("python@2.7:2.8,3.5:3.9", type=("build", "link", "run"), when="@1.16")
-    depends_on("python@3.5:3.9", type=("build", "link", "run"), when="@1.17:1.18")
-    depends_on("python@3.6:3.10", type=("build", "link", "run"), when="@1.19")
-    depends_on("python@3.7:3.10", type=("build", "link", "run"), when="@1.20:1.21")
-    depends_on("python@3.8:", type=("build", "link", "run"), when="@1.22:")
-    # https://github.com/spack/spack/pull/32078
-    # https://github.com/spack/spack/pull/34475#discussion_r1046146311
-    depends_on("py-setuptools@:63", type=("build", "run"))
-    depends_on("py-setuptools@:59", when="@:1.22.1", type=("build", "run"))
-    # Check pyproject.toml for updates to the required cython version
-    depends_on("py-cython@0.29.13:2", when="@1.18.0:", type="build")
-    depends_on("py-cython@0.29.14:2", when="@1.18.1:", type="build")
-    depends_on("py-cython@0.29.21:2", when="@1.19.1:", type="build")
-    depends_on("py-cython@0.29.24:2", when="@1.21.2:", type="build")
-    depends_on("py-cython@0.29.30:2", when="@1.22.4:", type="build")
-    depends_on("blas", when="+blas")
-    depends_on("lapack", when="+lapack")
-
-    depends_on("py-nose@1.0.0:", when="@:1.14", type="test")
-    depends_on("py-pytest", when="@1.15:", type="test")
-    depends_on("py-hypothesis", when="@1.19:", type="test")
-    depends_on("py-typing-extensions@4.2:", when="@1.23:", type="test")
-
-    # Allows you to specify order of BLAS/LAPACK preference
-    # https://github.com/numpy/numpy/pull/13132
-    patch("blas-lapack-order.patch", when="@1.15:1.16")
-
-    # Add Fujitsu Fortran compiler
-    patch("add_fj_compiler.patch", when="@1.19.3:1.19.5%fj")
-    patch("add_fj_compiler2.patch", when="@1.19.0:1.19.2%fj")
-    patch("add_fj_compiler3.patch", when="@1.14.0:1.18.5%fj")
-    patch("add_fj_compiler4.patch", when="@:1.13.3%fj")
-
-    patch("check_executables.patch", when="@1.20.0:")
-    patch("check_executables2.patch", when="@1.19.0:1.19.5")
-    patch("check_executables3.patch", when="@1.16.0:1.18.5")
-    patch("check_executables4.patch", when="@1.14.0:1.15.4")
-    patch("check_executables5.patch", when="@:1.13.3")
-
-    # Backport bug fix for f2py's define for threading when building with Mingw
-    patch(
-        "https://github.com/numpy/numpy/pull/20881.patch?full_index=1",
-        sha256="802970a9034d40a8a8f49a03f489d5361d5eabf69249621e6757651448910f1a",
-        when="@1.20.3:1.22.1",
-    )
-    # Patch to update compiler flags.
-    # See https://github.com/spack/spack/issues/30373
-    patch(
-        "https://github.com/numpy/numpy/pull/21448.patch?full_index=1",
-        sha256="e9508c3b3a1e1a24669014a0c1b9f3b009a149ea3886cf711eaef2a32b247fdb",
-        when="@1.22.0:1.22.3",
-    )
-
-    # version 1.21.0 runs into an infinit loop during printing
-    # (e.g. print(numpy.ones(1000)) when compiled with gcc 11
-    conflicts("%gcc@11:", when="@1.21.0")
-
-    # GCC 4.8 is the minimum version that works
-    conflicts("%gcc@:4.7", msg="GCC 4.8+ required")
-
-    # NVHPC support added in https://github.com/numpy/numpy/pull/17344
-    conflicts("%nvhpc", when="@:1.19")
-
-    # Newer versions will not build with Intel https://github.com/numpy/numpy/issues/22011
-    conflicts("%intel", when="@1.23.0:")
-    conflicts("%oneapi", when="@1.23.0:")
-
-    def url_for_version(self, version):
-        url = "https://files.pythonhosted.org/packages/source/n/numpy/numpy-{}.{}"
-        if version >= Version("1.23"):
-            ext = "tar.gz"
-        else:
-            ext = "zip"
-        return url.format(version, ext)
-
-    def flag_handler(self, name, flags):
-        # -std=c99 at least required, old versions of GCC default to -std=c90
-        if self.spec.satisfies("%gcc@:5.1") and name == "cflags":
-            flags.append(self.compiler.c99_flag)
-        # Check gcc version in use by intel compiler
-        # This will essentially check the system gcc compiler unless a gcc
-        # module is already loaded.
-        if self.spec.satisfies("%intel") and name == "cflags":
-            p1 = subprocess.Popen([self.compiler.cc, "-v"], stderr=subprocess.PIPE)
-            p2 = subprocess.Popen(
-                ["grep", "compatibility"], stdin=p1.stderr, stdout=subprocess.PIPE
-            )
-            p1.stderr.close()
-            out, err = p2.communicate()
-            gcc_version = Version(out.split()[5].decode("utf-8"))
-            if gcc_version < Version("4.8"):
-                raise InstallError(
-                    "The GCC version that the Intel compiler "
-                    "uses must be >= 4.8. The GCC in use is "
-                    "{0}".format(gcc_version)
-                )
-            if gcc_version <= Version("5.1"):
-                flags.append(self.compiler.c99_flag)
-
-        return (flags, None, None)
-
-    @run_before("install")
-    def set_blas_lapack(self):
-        # https://numpy.org/devdocs/user/building.html
-        # https://github.com/numpy/numpy/blob/master/site.cfg.example
-
-        # Skip if no BLAS/LAPACK requested
-        spec = self.spec
-        if "+blas" not in spec and "+lapack" not in spec:
-            return
-
-        def write_library_dirs(f, dirs):
-            f.write("library_dirs = {0}\n".format(dirs))
-            if not (
-                (platform.system() == "Darwin")
-                and (Version(platform.mac_ver()[0]).up_to(2) == Version("10.12"))
-            ):
-                f.write("rpath = {0}\n".format(dirs))
-
-        blas_libs = LibraryList([])
-        blas_headers = HeaderList([])
-        if "+blas" in spec:
-            blas_libs = spec["blas"].libs
-            blas_headers = spec["blas"].headers
-
-        lapack_libs = LibraryList([])
-        lapack_headers = HeaderList([])
-        if "+lapack" in spec:
-            lapack_libs = spec["lapack"].libs
-            lapack_headers = spec["lapack"].headers
-
-        lapackblas_libs = lapack_libs + blas_libs
-        lapackblas_headers = lapack_headers + blas_headers
-
-        blas_lib_names = ",".join(blas_libs.names)
-        blas_lib_dirs = ":".join(blas_libs.directories)
-        blas_header_dirs = ":".join(blas_headers.directories)
-
-        lapack_lib_names = ",".join(lapack_libs.names)
-        lapack_lib_dirs = ":".join(lapack_libs.directories)
-        lapack_header_dirs = ":".join(lapack_headers.directories)
-
-        lapackblas_lib_names = ",".join(lapackblas_libs.names)
-        lapackblas_lib_dirs = ":".join(lapackblas_libs.directories)
-        lapackblas_header_dirs = ":".join(lapackblas_headers.directories)
-
-        # Tell numpy where to find BLAS/LAPACK libraries
-        with open("site.cfg", "w") as f:
-            if (
-                "^intel-mkl" in spec
-                or "^intel-parallel-studio+mkl" in spec
-                or "^intel-oneapi-mkl" in spec
-            ):
-                f.write("[mkl]\n")
-                # FIXME: as of @1.11.2, numpy does not work with separately
-                # specified threading and interface layers. A workaround is a
-                # terribly bad idea to use mkl_rt. In this case Spack will no
-                # longer be able to guarantee that one and the same variant of
-                # Blas/Lapack (32/64bit, threaded/serial) is used within the
-                # DAG. This may lead to a lot of hard-to-debug segmentation
-                # faults on user's side. Users may also break working
-                # installation by (unconsciously) setting environment variable
-                # to switch between different interface and threading layers
-                # dynamically. From this perspective it is no different from
-                # throwing away RPATH's and using LD_LIBRARY_PATH throughout
-                # Spack.
-                f.write("libraries = {0}\n".format("mkl_rt"))
-                write_library_dirs(f, lapackblas_lib_dirs)
-                f.write("include_dirs = {0}\n".format(lapackblas_header_dirs))
-
-            if "^blis" in spec or "^amdblis" in spec:
-                f.write("[blis]\n")
-                f.write("libraries = {0}\n".format(blas_lib_names))
-                write_library_dirs(f, blas_lib_dirs)
-                f.write("include_dirs = {0}\n".format(blas_header_dirs))
-
-            if "^openblas" in spec:
-                f.write("[openblas]\n")
-                f.write("libraries = {0}\n".format(lapackblas_lib_names))
-                write_library_dirs(f, lapackblas_lib_dirs)
-                f.write("include_dirs = {0}\n".format(lapackblas_header_dirs))
-
-            if "^libflame" in spec or "^amdlibflame" in spec:
-                f.write("[flame]\n")
-                f.write("libraries = {0}\n".format(lapack_lib_names))
-                write_library_dirs(f, lapack_lib_dirs)
-                f.write("include_dirs = {0}\n".format(lapack_header_dirs))
-
-            if "^atlas" in spec:
-                f.write("[atlas]\n")
-                f.write("libraries = {0}\n".format(lapackblas_lib_names))
-                write_library_dirs(f, lapackblas_lib_dirs)
-                f.write("include_dirs = {0}\n".format(lapackblas_header_dirs))
-
-            if "^veclibfort" in spec:
-                f.write("[accelerate]\n")
-                f.write("libraries = {0}\n".format(lapackblas_lib_names))
-                write_library_dirs(f, lapackblas_lib_dirs)
-
-            if "^netlib-lapack" in spec or "^cray-libsci" in spec:
-                # netlib and Cray require blas and lapack listed
-                # separately so that scipy can find them
-                if spec.satisfies("+blas"):
-                    f.write("[blas]\n")
-                    f.write("libraries = {0}\n".format(blas_lib_names))
-                    write_library_dirs(f, blas_lib_dirs)
-                    f.write("include_dirs = {0}\n".format(blas_header_dirs))
-                if spec.satisfies("+lapack"):
-                    f.write("[lapack]\n")
-                    f.write("libraries = {0}\n".format(lapack_lib_names))
-                    write_library_dirs(f, lapack_lib_dirs)
-                    f.write("include_dirs = {0}\n".format(lapack_header_dirs))
-
-            if "^fujitsu-ssl2" in spec:
-                if spec.satisfies("+blas"):
-                    f.write("[blas]\n")
-                    f.write("libraries = {0}\n".format(spec["blas"].libs.names[0]))
-                    write_library_dirs(f, blas_lib_dirs)
-                    f.write("include_dirs = {0}\n".format(blas_header_dirs))
-                    f.write("extra_link_args = {0}\n".format(self.spec["blas"].libs.ld_flags))
-                if spec.satisfies("+lapack"):
-                    f.write("[lapack]\n")
-                    f.write("libraries = {0}\n".format(spec["lapack"].libs.names[0]))
-                    write_library_dirs(f, lapack_lib_dirs)
-                    f.write("include_dirs = {0}\n".format(lapack_header_dirs))
-                    f.write("extra_link_args = {0}\n".format(self.spec["lapack"].libs.ld_flags))
-
-    def setup_build_environment(self, env):
-        # Tell numpy which BLAS/LAPACK libraries we want to use.
-        # https://github.com/numpy/numpy/pull/13132
-        # https://numpy.org/devdocs/user/building.html#accelerated-blas-lapack-libraries
-        spec = self.spec
-        # https://numpy.org/devdocs/user/building.html#blas
-        if "blas" not in spec:
-            blas = ""
-        elif (
-            spec["blas"].name == "intel-mkl"
-            or spec["blas"].name == "intel-parallel-studio"
-            or spec["blas"].name == "intel-oneapi-mkl"
-        ):
-            blas = "mkl"
-        elif spec["blas"].name == "blis" or spec["blas"].name == "amdblis":
-            blas = "blis"
-        elif spec["blas"].name == "openblas":
-            blas = "openblas"
-        elif spec["blas"].name == "atlas":
-            blas = "atlas"
-        elif spec["blas"].name == "veclibfort":
-            blas = "accelerate"
-        else:
-            blas = "blas"
-
-        env.set("NPY_BLAS_ORDER", blas)
-
-        # https://numpy.org/devdocs/user/building.html#lapack
-        if "lapack" not in spec:
-            lapack = ""
-        elif (
-            spec["lapack"].name == "intel-mkl"
-            or spec["lapack"].name == "intel-parallel-studio"
-            or spec["lapack"].name == "intel-oneapi-mkl"
-        ):
-            lapack = "mkl"
-        elif spec["lapack"].name == "openblas":
-            lapack = "openblas"
-        elif spec["lapack"].name == "libflame" or spec["lapack"].name == "amdlibflame":
-            lapack = "flame"
-        elif spec["lapack"].name == "atlas":
-            lapack = "atlas"
-        elif spec["lapack"].name == "veclibfort":
-            lapack = "accelerate"
-        else:
-            lapack = "lapack"
-
-        env.set("NPY_LAPACK_ORDER", lapack)
-
-    @run_after("install")
-    @on_package_attributes(run_tests=True)
-    def install_test(self):
-        with working_dir("spack-test", create=True):
-            python("-c", 'import numpy; numpy.test("full", verbose=2)')
diff --git a/packages/py-pebble/package.py b/packages/py-pebble/package.py
deleted file mode 100644
index 5e17a06cec5be189527ab05b47a7572df3df0db3..0000000000000000000000000000000000000000
--- a/packages/py-pebble/package.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# (this package was adapted from the spack develop upstream as a dependency of py-bluepyopt)
-
-# 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 import *
-
-
-class PyPebble(PythonPackage):
-    """Threading and multiprocessing eye-candy."""
-
-    homepage = "https://github.com/noxdafox/pebble"
-    pypi = "Pebble/Pebble-5.0.3.tar.gz"
-
-    maintainers = ["hjorth", "elmath"]
-    
-    version("5.0.3", sha256="bdcfd9ea7e0aedb895b204177c19e6d6543d9962f4e3402ebab2175004863da8")
-
-    depends_on("python@3.6:",   type=("build", "run"))
-    depends_on("py-setuptools", type=("build"))
diff --git a/packages/py-python-jose/package.py b/packages/py-python-jose/package.py
deleted file mode 100644
index 3c8ceb8e00828c3479a75f31d52ff03c9ebb3072..0000000000000000000000000000000000000000
--- a/packages/py-python-jose/package.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2013-2022 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 import *
-
-class PyPythonJose(PythonPackage):
-    """JOSE implementation in Python"""
-
-    homepage = "http://github.com/mpdavis/python-jose"
-    pypi = "python-jose/python-jose-3.3.0.tar.gz"
-
-    version("3.3.0", sha256="55779b5e6ad599c6336191246e95eb2293a9ddebd555f796a65f838f07e5d78a")
-
-    depends_on("python@3.6:", type=("build", "run"))
-    depends_on("py-setuptools", type="build")
-
-    depends_on("py-rsa", type=("build", "run"))
-    depends_on("py-ecdsa@:0.14.1,0.16.0:", type=("build", "run"))
-    depends_on("py-pyasn1", type=("build", "run"))
diff --git a/packages/py-ray/package.py b/packages/py-ray/package.py
index c687d7eef4d8bc9379de9f63218967b1db4118f8..55bdd87d1f47c4ab893346d4f71e05687717b390 100644
--- a/packages/py-ray/package.py
+++ b/packages/py-ray/package.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
+# 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)
@@ -29,7 +29,6 @@ class PyRay(PythonPackage):
     depends_on("py-attrs", when="@2.0.1", type=("build", "run"))
     depends_on("py-click@7:8.0.4", when="@2.0.1", type=("build", "run"))
     depends_on("py-click@7.0:", when="@0.8.7", type=("build", "run"))
-    depends_on("py-dataclasses", when="@2.0.1 ^python@:3.6", type=("build", "run"))
     depends_on("py-filelock", type=("build", "run"))
     depends_on("py-grpcio@1.32:1.43.0", when="@2.0.1 ^python@:3.9", type=("build", "run"))
     depends_on("py-grpcio@1.42:1.43.0", when="@2.0.1 ^python@3.10:", type=("build", "run"))
@@ -50,7 +49,7 @@ class PyRay(PythonPackage):
     depends_on("py-setproctitle", type=("build", "run"))
     depends_on("py-colorama", type=("build", "run"))
     depends_on("py-psutil", type=("build", "run"))
-
+    
     with when("+default"):
         depends_on("py-aiohttp@3.7:", type=("build", "run"))
         depends_on("py-aiohttp-cors", type=("build", "run"))
@@ -84,6 +83,14 @@ class PyRay(PythonPackage):
 
     build_directory = "python"
 
+    def patch(self):
+        filter_file(
+            'bazel_flags = ["--verbose_failures"]',
+            f'bazel_flags = ["--verbose_failures", "--jobs={make_jobs}"]',
+            join_path("python", "setup.py"),
+            string=True,
+        )
+
     def setup_build_environment(self, env):
         env.set("SKIP_THIRDPARTY_INSTALL", "1")
 
@@ -93,4 +100,4 @@ class PyRay(PythonPackage):
         with working_dir(join_path("python", "ray", "dashboard", "client")):
             npm = which("npm")
             npm("ci")
-            npm("run", "build")
+            npm("run", "build")
\ No newline at end of file
diff --git a/packages/py-scipy/package.py b/packages/py-scipy/package.py
deleted file mode 100644
index d47a3896e9f96abdcf1eae61b523c46902b7156d..0000000000000000000000000000000000000000
--- a/packages/py-scipy/package.py
+++ /dev/null
@@ -1,161 +0,0 @@
-# this package was slightly adapted from the spack v0.19.2 upstream because with py-pybind11@2.10.1
-# available, the concretizer selected py-scipy@1.5:1.6.1
-#     depends_on("py-pybind11@2.4.3:2.8", when="@1.8:", type=("build", "link"))
-# was changed to
-#     depends_on("py-pybind11@2.4.3:", when="@1.8:", type=("build", "link"))
-
-# Copyright 2013-2022 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 *
-
-
-class PyScipy(PythonPackage):
-    """SciPy (pronounced "Sigh Pie") is a Scientific Library for Python.
-    It provides many user-friendly and efficient numerical routines such
-    as routines for numerical integration and optimization."""
-
-    homepage = "https://www.scipy.org/"
-    pypi = "scipy/scipy-1.5.4.tar.gz"
-    git = "https://github.com/scipy/scipy.git"
-
-    maintainers = ["adamjstewart", "rgommers"]
-
-    version("master", branch="master")
-    version("1.8.1", sha256="9e3fb1b0e896f14a85aa9a28d5f755daaeeb54c897b746df7a55ccb02b340f33")
-    version("1.8.0", sha256="31d4f2d6b724bc9a98e527b5849b8a7e589bf1ea630c33aa563eda912c9ff0bd")
-    version("1.7.3", sha256="ab5875facfdef77e0a47d5fd39ea178b58e60e454a4c85aa1e52fcb80db7babf")
-    version("1.7.2", sha256="fa2dbabaaecdb502641b0b3c00dec05fb475ae48655c66da16c9ed24eda1e711")
-    version("1.7.1", sha256="6b47d5fa7ea651054362561a28b1ccc8da9368a39514c1bbf6c0977a1c376764")
-    version("1.7.0", sha256="998c5e6ea649489302de2c0bc026ed34284f531df89d2bdc8df3a0d44d165739")
-    version("1.6.3", sha256="a75b014d3294fce26852a9d04ea27b5671d86736beb34acdfc05859246260707")
-    version("1.6.2", sha256="e9da33e21c9bc1b92c20b5328adb13e5f193b924c9b969cd700c8908f315aa59")
-    version("1.6.1", sha256="c4fceb864890b6168e79b0e714c585dbe2fd4222768ee90bc1aa0f8218691b11")
-    version("1.6.0", sha256="cb6dc9f82dfd95f6b9032a8d7ea70efeeb15d5b5fd6ed4e8537bb3c673580566")
-    version("1.5.4", sha256="4a453d5e5689de62e5d38edf40af3f17560bfd63c9c5bd228c18c1f99afa155b")
-    version("1.5.3", sha256="ddae76784574cc4c172f3d5edd7308be16078dd3b977e8746860c76c195fa707")
-    version("1.5.2", sha256="066c513d90eb3fd7567a9e150828d39111ebd88d3e924cdfc9f8ce19ab6f90c9")
-    version("1.5.1", sha256="039572f0ca9578a466683558c5bf1e65d442860ec6e13307d528749cfe6d07b8")
-    version("1.5.0", sha256="4ff72877d19b295ee7f7727615ea8238f2d59159df0bdd98f91754be4a2767f0")
-    version("1.4.1", sha256="dee1bbf3a6c8f73b6b218cb28eed8dd13347ea2f87d572ce19b289d6fd3fbc59")
-    version("1.4.0", sha256="31f7cfa93b01507c935c12b535e24812594002a02a56803d7cd063e9920d25e8")
-    version("1.3.3", sha256="64bf4e8ae0db2d42b58477817f648d81e77f0b381d0ea4427385bba3f959380a")
-    version("1.3.2", sha256="a03939b431994289f39373c57bbe452974a7da724ae7f9620a1beee575434da4")
-    version("1.3.1", sha256="2643cfb46d97b7797d1dbdb6f3c23fe3402904e3c90e6facfe6a9b98d808c1b5")
-    version("1.3.0", sha256="c3bb4bd2aca82fb498247deeac12265921fe231502a6bc6edea3ee7fe6c40a7a")
-    version("1.2.3", sha256="ecbe6413ca90b8e19f8475bfa303ac001e81b04ec600d17fa7f816271f7cca57")
-    version("1.2.2", sha256="a4331e0b8dab1ff75d2c67b5158a8bb9a83c799d7140094dda936d876c7cfbb1")
-    version("1.2.1", sha256="e085d1babcb419bbe58e2e805ac61924dac4ca45a07c9fa081144739e500aa3c")
-    version("1.1.0", sha256="878352408424dffaa695ffedf2f9f92844e116686923ed9aa8626fc30d32cfd1")
-    version("1.0.0", sha256="87ea1f11a0e9ec08c264dc64551d501fa307289460705f6fccd84cbfc7926d10")
-    version("0.19.1", sha256="a19a2ca7a7336495ec180adeaa0dfdcf41e96dbbee90d51c3ed828ba570884e6")
-    version("0.18.1", sha256="8ab6e9c808bf2fb3e8576cd8cf07226d9cdc18b012c06d9708429a821ac6634e")
-    version("0.17.0", sha256="f600b755fb69437d0f70361f9e560ab4d304b1b66987ed5a28bdd9dd7793e089")
-    version("0.15.1", sha256="a212cbc3b79e9a563aa45fc5c517b3499198bd7eb7e7be1e047568a5f48c259a")
-    version("0.15.0", sha256="0c74e31e08acc8bf9b6ceb9bced73df2ae0cc76003e0366350bc7b26292bf8b1")
-
-    # pyproject.toml
-    depends_on("py-wheel@:0.37", type="build")
-    depends_on("py-setuptools", type="build")
-    depends_on("py-setuptools@:51.0.0", when="@1.6", type="build")
-    depends_on("py-setuptools@:57", when="@1.7", type="build")
-    depends_on("py-setuptools@:63", when="@1.8:", type="build")
-    depends_on("py-cython@0.29.18:2", when="@1.7:", type="build")
-    depends_on("py-pybind11@2.2.4:", when="@1.4.0", type=("build", "link"))
-    depends_on("py-pybind11@2.4.0:", when="@1.4.1:1.4", type=("build", "link"))
-    depends_on("py-pybind11@2.4.3:", when="@1.5:1.6.1", type=("build", "link"))
-    depends_on("py-pybind11@2.4.3:2.6", when="@1.6.2:1.7.1", type=("build", "link"))
-    depends_on("py-pybind11@2.4.3:2.7", when="@1.7.2:1.7", type=("build", "link"))
-    depends_on("py-pybind11@2.4.3:", when="@1.8:", type=("build", "link"))
-    depends_on("py-pythran@0.9.11", when="@1.7.0:1.7.1", type=("build", "link"))
-    depends_on("py-pythran@0.9.12:0.9", when="@1.7.2:1.7", type=("build", "link"))
-    depends_on("py-pythran@0.10:", when="@1.8:", type=("build", "link"))
-    # setup.py
-    depends_on("py-numpy@1.5.1:+blas+lapack", when="@:0.15", type=("build", "link", "run"))
-    depends_on("py-numpy@1.6.2:+blas+lapack", when="@0.16:0.17", type=("build", "link", "run"))
-    depends_on("py-numpy@1.7.1:+blas+lapack", when="@0.18.0:0.18", type=("build", "link", "run"))
-    depends_on("py-numpy@1.8.2:+blas+lapack", when="@0.19:1.2", type=("build", "link", "run"))
-    depends_on("py-numpy@1.13.3:+blas+lapack", when="@1.3:1.4", type=("build", "link", "run"))
-    depends_on("py-numpy@1.14.5:+blas+lapack", when="@1.5.0:1.5", type=("build", "link", "run"))
-    depends_on("py-numpy@1.16.5:+blas+lapack", when="@1.6:1.6.1", type=("build", "link", "run"))
-    depends_on(
-        "py-numpy@1.16.5:1.22+blas+lapack", when="@1.6.2:1.7", type=("build", "link", "run")
-    )
-    depends_on("py-numpy@1.17.3:1.24+blas+lapack", when="@1.8:", type=("build", "link", "run"))
-    depends_on("python@2.6:2.8,3.2:", when="@:0.17", type=("build", "link", "run"))
-    depends_on("python@2.7:2.8,3.4:", when="@0.18:1.2", type=("build", "link", "run"))
-    depends_on("python@3.5:", when="@1.3:1.4", type=("build", "link", "run"))
-    depends_on("python@3.6:", when="@1.5.0:1.5", type=("build", "link", "run"))
-    depends_on("python@3.7:", when="@1.6:1.6.1", type=("build", "link", "run"))
-    depends_on("python@3.7:3.9", when="@1.6.2:1.7.1", type=("build", "link", "run"))
-    depends_on("python@3.7:3.10", when="@1.7.2:1.7", type=("build", "link", "run"))
-    depends_on("python@3.8:3.10", when="@1.8:", type=("build", "link", "run"))
-    depends_on("py-pytest", type="test")
-
-    # NOTE: scipy should use the same Blas/Lapack as numpy
-    # This is achieved by calling the set_blas_lapack() and setup_build_environment()
-    # from numpy in the scipy spec
-    depends_on("blas")
-    depends_on("lapack")
-    # https://github.com/scipy/scipy/wiki/Dropping-support-for-Accelerate
-    depends_on("lapack@3.4.1:", when="@1.2:")
-
-    # https://github.com/scipy/scipy/pull/11324
-    conflicts("@1.4.0:1.4.1", when="target=ppc64le:")
-
-    # https://github.com/scipy/scipy/issues/12860
-    patch(
-        "https://git.sagemath.org/sage.git/plain/build/pkgs/scipy/patches/extern_decls.patch?id=711fe05025795e44b84233e065d240859ccae5bd",
-        sha256="5433f60831cb554101520a8f8871ac5a32c95f7a971ccd68b69049535b106780",
-        when="@1.2:1.5.3",
-    )
-
-    patch("scipy-clang.patch", when="@1.5.0:1.6.3 %clang")
-
-    @run_before("install")
-    def set_blas_lapack(self):
-        # Pick up Blas/Lapack from numpy
-        self.spec["py-numpy"].package.set_blas_lapack()
-
-    @run_before("install")
-    def set_fortran_compiler(self):
-        if self.spec.satisfies("%fj"):
-            with open("setup.cfg", "w") as f:
-                f.write("[config_fc]\n")
-                f.write("fcompiler = fujitsu\n")
-        elif self.spec.satisfies("%intel") or self.spec.satisfies("%oneapi"):
-            if self.spec.satisfies("target=x86:"):
-                with open("setup.cfg", "w") as f:
-                    f.write("[config_fc]\n")
-                    f.write("fcompiler = intel\n")
-            elif self.spec.satisfies("target=x86_64:"):
-                with open("setup.cfg", "w") as f:
-                    f.write("[config_fc]\n")
-                    f.write("fcompiler = intelem\n")
-
-    def setup_build_environment(self, env):
-        # https://github.com/scipy/scipy/issues/9080
-        env.set("F90", spack_fc)
-
-        # https://github.com/scipy/scipy/issues/11611
-        if self.spec.satisfies("@:1.4 %gcc@10:"):
-            env.set("FFLAGS", "-fallow-argument-mismatch")
-            if self.spec.satisfies("^py-numpy@1.16:1.17"):
-                env.set("NPY_DISTUTILS_APPEND_FLAGS", "1")
-
-        # https://github.com/scipy/scipy/issues/14935
-        if self.spec.satisfies("%intel ^py-pythran") or self.spec.satisfies("%oneapi ^py-pythran"):
-            if self.spec["py-pythran"].version < Version("0.12"):
-                env.set("SCIPY_USE_PYTHRAN", "0")
-
-        # Pick up Blas/Lapack from numpy
-        self.spec["py-numpy"].package.setup_build_environment(env)
-
-    @run_after("install")
-    @on_package_attributes(run_tests=True)
-    def install_test(self):
-        with working_dir("spack-test", create=True):
-            python("-c", 'import scipy; scipy.test("full", verbose=2)')
diff --git a/packages/py-scipy/scipy-clang.patch b/packages/py-scipy/scipy-clang.patch
deleted file mode 100644
index 5dc19faeab93a31ea0162ea89d4d9093e64339cd..0000000000000000000000000000000000000000
--- a/packages/py-scipy/scipy-clang.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/scipy/special/_faddeeva.cxx b/scipy/special/_faddeeva.cxx
-index 9134516..159122c 100644
---- a/scipy/special/_faddeeva.cxx
-+++ b/scipy/special/_faddeeva.cxx
-@@ -130,7 +130,7 @@ double faddeeva_voigt_profile(double x, double sigma, double gamma)
- 
-     if(sigma == 0){
-         if (gamma == 0){
--            if (isnan(x))
-+            if (std::isnan(x))
-                 return x;
-             if (x == 0)
-                 return NPY_INFINITY;
-
diff --git a/packages/py-tensorboard/package.py b/packages/py-tensorboard/package.py
deleted file mode 100644
index cccf282409699dff834090537fd3b5e86716c690..0000000000000000000000000000000000000000
--- a/packages/py-tensorboard/package.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# Copyright 2013-2022 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 *
-
-
-class PyTensorboard(PythonPackage):
-    """TensorBoard is a suite of web applications for
-    inspecting and understanding your TensorFlow runs and
-    graphs."""
-
-    homepage = "https://github.com/tensorflow/tensorboard"
-    url = "https://files.pythonhosted.org/packages/py3/t/tensorboard/tensorboard-2.9.1-py3-none-any.whl"
-    list_url = "https://pypi.org/simple/tensorboard/"
-
-    maintainers = ["aweits"]
-
-    version(
-        "2.11.0",
-        sha256="a0e592ee87962e17af3f0dce7faae3fbbd239030159e9e625cce810b7e35c53d",
-        expand=False,
-    )
-    version(
-        "2.10.0",
-        sha256="76c91a5e8959cd2208cc32cb17a0cb002badabb66a06ac2af02a7810f49a59e3",
-        expand=False,
-    )
-    version(
-        "2.9.1",
-        sha256="baa727f791776f9e5841d347127720ceed4bbd59c36b40604b95fb2ae6029276",
-        expand=False,
-    )
-    version(
-        "2.9.0",
-        sha256="bd78211076dca5efa27260afacfaa96cd05c7db12a6c09cc76a1d6b2987ca621",
-        expand=False,
-    )
-    version(
-        "2.8.0",
-        sha256="65a338e4424e9079f2604923bdbe301792adce2ace1be68da6b3ddf005170def",
-        expand=False,
-    )
-    version(
-        "2.7.0",
-        sha256="239f78a4a8dff200ce585a030c787773a8c1184d5c159252f5f85bac4e3c3b38",
-        expand=False,
-    )
-    version(
-        "2.6.0",
-        sha256="f7dac4cdfb52d14c9e3f74585ce2aaf8e6203620a864e51faf84988b09f7bbdb",
-        expand=False,
-    )
-    version(
-        "2.5.0",
-        sha256="e167460085b6528956b33bab1c970c989cdce47a6616273880733f5e7bde452e",
-        expand=False,
-    )
-    version(
-        "2.4.1",
-        sha256="7b8c53c396069b618f6f276ec94fc45d17e3282d668979216e5d30be472115e4",
-        expand=False,
-    )
-    version(
-        "2.4.0",
-        sha256="cde0c663a85609441cb4d624e7255fd8e2b6b1d679645095aac8a234a2812738",
-        expand=False,
-    )
-    version(
-        "2.3.0",
-        sha256="d34609ed83ff01dd5b49ef81031cfc9c166bba0dabd60197024f14df5e8eae5e",
-        expand=False,
-    )
-    version(
-        "2.2.0",
-        sha256="bb6bbc75ad2d8511ba6cbd49e4417276979f49866e11841e83da8298727dbaed",
-        expand=False,
-    )
-
-    depends_on("python@2.7:2.8,3.2:", type=("build", "run"), when="@:2.5")
-    depends_on("python@3.6:", type=("build", "run"), when="@2.6:")
-    depends_on("py-absl-py@0.4:", type=("build", "run"))
-    depends_on("py-grpcio@1.24.3:", type=("build", "run"), when="@2.3:")
-    depends_on("py-grpcio@1.23.3:", type=("build", "run"), when="@2.2")
-    depends_on("py-google-auth@1.6.3:1", type=("build", "run"), when="@:2.6")
-    depends_on("py-google-auth@1.6.3:2", type=("build", "run"), when="@2.7:")
-    depends_on("py-google-auth-oauthlib@0.4.1:0.4", type=("build", "run"))
-    depends_on("py-markdown@2.6.8:", type=("build", "run"))
-    depends_on("py-numpy@1.12.0:", type=("build", "run"))
-    depends_on("py-protobuf@3.6.0:3.19", type=("build", "run"), when="@:2.8")
-    depends_on("py-protobuf@3.9.2:3.19", type=("build", "run"), when="@2.9:")
-    depends_on("py-requests@2.21.0:2", type=("build", "run"))
-    depends_on("py-setuptools@41.0.0:", type=("build", "run"))
-    depends_on("py-tensorboard-data-server@0.6", type=("build", "run"), when="@2.5:")
-    depends_on("py-tensorboard-plugin-wit@1.6.0:", type=("build", "run"))
-    depends_on("py-werkzeug@0.11.15:", type=("build", "run"))
-    depends_on("py-werkzeug@1.0.1:", type=("build", "run"), when="@2.9:")
-    depends_on("py-wheel@0.26:", type="build")
-    depends_on("py-six@1.10.0:", type=("build", "run"), when="@:2.4")
diff --git a/packages/py-torch/cusparseGetErrorString.patch b/packages/py-torch/cusparseGetErrorString.patch
deleted file mode 100644
index 9cb136b3f88faee0631eaac14c2915664e30dc6c..0000000000000000000000000000000000000000
--- a/packages/py-torch/cusparseGetErrorString.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-diff --git a/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu b/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu
-index 1cee04c200..f46003d9a9 100644
---- a/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu
-+++ b/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu
-@@ -10,48 +10,6 @@
- namespace at { namespace native { namespace sparse { namespace cuda {
- 
- 
--std::string cusparseGetErrorString(cusparseStatus_t status) {
--  switch(status)
--  {
--    case CUSPARSE_STATUS_SUCCESS:
--      return "success";
--
--    case CUSPARSE_STATUS_NOT_INITIALIZED:
--      return "library not initialized";
--
--    case CUSPARSE_STATUS_ALLOC_FAILED:
--      return "resource allocation failed";
--
--    case CUSPARSE_STATUS_INVALID_VALUE:
--      return "an invalid numeric value was used as an argument";
--
--    case CUSPARSE_STATUS_ARCH_MISMATCH:
--      return "an absent device architectural feature is required";
--
--    case CUSPARSE_STATUS_MAPPING_ERROR:
--      return "an access to GPU memory space failed";
--
--    case CUSPARSE_STATUS_EXECUTION_FAILED:
--      return "the GPU program failed to execute";
--
--    case CUSPARSE_STATUS_INTERNAL_ERROR:
--      return "an internal operation failed";
--
--    case CUSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED:
--      return "the matrix type is not supported by this function";
--
--    case CUSPARSE_STATUS_ZERO_PIVOT:
--      return "an entry of the matrix is either structural zero or numerical zero (singular block)";
--
--    default:
--      {
--        std::ostringstream oss;
--        oss << "unknown error " << static_cast<int64_t>(status);
--        return oss.str();
--      }
--  }
--}
--
- inline void CUSPARSE_CHECK(cusparseStatus_t status)
- {
-   if (status != CUSPARSE_STATUS_SUCCESS) {
diff --git a/packages/py-torch/detect_omp_of_fujitsu_compiler.patch b/packages/py-torch/detect_omp_of_fujitsu_compiler.patch
deleted file mode 100644
index 519d66869d578ea4a59c4e7f626569baade6837a..0000000000000000000000000000000000000000
--- a/packages/py-torch/detect_omp_of_fujitsu_compiler.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- pytorch/cmake/Modules/FindOpenMP.cmake.org	2020-05-26 17:43:53.000000000 +0900
-+++ pytorch/cmake/Modules/FindOpenMP.cmake	2020-05-26 17:46:37.000000000 +0900
-@@ -84,7 +84,7 @@
-     unset(OpenMP_FLAG_CANDIDATES)
- 
-     set(OMP_FLAG_GNU "-fopenmp")
--    set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp")
-+    set(OMP_FLAG_Clang "-fopenmp" "-fopenmp=libomp" "-fopenmp=libiomp5")
- 
-     # AppleClang may need a header file, search for omp.h with hints to brew
-     # default include dir
-@@ -245,7 +245,7 @@
-         set(OpenMP_libomp_LIBRARY "${MKL_OPENMP_LIBRARY}" CACHE STRING "libomp location for OpenMP")
-       else()
-         find_library(OpenMP_libomp_LIBRARY
--          NAMES omp gomp iomp5
-+          NAMES fjomp omp gomp iomp5
-           HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
-           DOC "libomp location for OpenMP"
-         )
diff --git a/packages/py-torch/fj-ssl2_1.10.patch b/packages/py-torch/fj-ssl2_1.10.patch
deleted file mode 100644
index bcd2c37804c1ba1ee62d70907c8705a23607a5aa..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.10.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index ca560288a4..f5a29ecf43 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -130,7 +130,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
-+set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -185,6 +185,20 @@ elseif(BLAS STREQUAL "vecLib")
-   set(BLAS_INFO "veclib")
-   set(BLAS_FOUND 1)
-   set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- elseif(BLAS STREQUAL "Generic")
-   # On Debian family, the CBLAS ABIs have been merged into libblas.so
-   find_library(BLAS_LIBRARIES blas)
-@@ -201,7 +215,7 @@ if(NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_ENABLED 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
-+  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if(NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index 47c80b45f6..efd4a87d06 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -276,6 +276,28 @@ if((NOT BLAS_LIBRARIES)
-   endif()
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.11.patch b/packages/py-torch/fj-ssl2_1.11.patch
deleted file mode 100644
index af41e5bb93931ca3c0f12a55733407a52fb4af31..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.11.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index 557ab649a4..56d1699736 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -174,7 +174,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
-+set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -229,6 +229,20 @@ elseif(BLAS STREQUAL "vecLib")
-   set(BLAS_INFO "veclib")
-   set(BLAS_FOUND 1)
-   set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- elseif(BLAS STREQUAL "FlexiBLAS")
-   find_package(FlexiBLAS REQUIRED)
-   include_directories(SYSTEM ${FlexiBLAS_INCLUDE_DIR})
-@@ -250,7 +264,7 @@ if(NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_SEQUENTIAL 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
-+  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if(NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index 94942d520f..ae5b8db963 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -289,6 +289,28 @@ if((NOT BLAS_LIBRARIES)
-   endif()
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.2.patch b/packages/py-torch/fj-ssl2_1.2.patch
deleted file mode 100644
index 826c5c2b078de0c152d22d73cd8208ee992fa76b..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.2.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index 00dcabd131..bddd3716ca 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -107,7 +107,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib")
-+set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -147,6 +147,20 @@ elseif(BLAS STREQUAL "vecLib")
-   find_package(vecLib REQUIRED)
-   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
-   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- else()
-   message(FATAL_ERROR "Unrecognized BLAS option: " ${BLAS})
- endif()
-@@ -156,7 +170,7 @@ if (NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_ENABLED 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND))
-+  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if (NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index d6c0346739..72f4e18da2 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -225,6 +225,28 @@ if((NOT BLAS_LIBRARIES)
-   endif (BLAS_LIBRARIES)
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.3-1.5.patch b/packages/py-torch/fj-ssl2_1.3-1.5.patch
deleted file mode 100644
index 0ea87500b0a60e35450c90315c5466d5f6488073..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.3-1.5.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index a8e9769536..f0f91304c2 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -107,7 +107,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME")
-+set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -147,6 +147,20 @@ elseif(BLAS STREQUAL "vecLib")
-   find_package(vecLib REQUIRED)
-   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
-   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- else()
-   message(FATAL_ERROR "Unrecognized BLAS option: " ${BLAS})
- endif()
-@@ -156,7 +170,7 @@ if (NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_ENABLED 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND))
-+  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if (NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index e93e98a609..d43a6c40bd 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -239,6 +239,28 @@ if((NOT BLAS_LIBRARIES)
-   endif (BLAS_LIBRARIES)
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.6-1.7.patch b/packages/py-torch/fj-ssl2_1.6-1.7.patch
deleted file mode 100644
index 423af3f21299395696d27703e531c504c19b50f4..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.6-1.7.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index 36e1ab7682..0f02f51c47 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -114,7 +114,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME;Generic")
-+set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME;Generic")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -154,6 +154,20 @@ elseif(BLAS STREQUAL "vecLib")
-   find_package(vecLib REQUIRED)
-   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
-   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- elseif(BLAS STREQUAL "Generic")
-   # On Debian family, the CBLAS ABIs have been merged into libblas.so
-   find_library(BLAS_LIBRARIES blas)
-@@ -168,7 +182,7 @@ if(NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_ENABLED 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR GENERIC_BLAS_FOUND))
-+  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND OR GENERIC_BLAS_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if(NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index e93e98a609..d43a6c40bd 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -239,6 +239,28 @@ if((NOT BLAS_LIBRARIES)
-   endif (BLAS_LIBRARIES)
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.8.patch b/packages/py-torch/fj-ssl2_1.8.patch
deleted file mode 100644
index 461c1a2976b7a118173182452075e809f7f52858..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.8.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index 06464e799a..7f50bd8fa0 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -118,7 +118,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME;Generic")
-+set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME;Generic")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -157,6 +157,20 @@ elseif(BLAS STREQUAL "vecLib")
-   find_package(vecLib REQUIRED)
-   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
-   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- elseif(BLAS STREQUAL "Generic")
-   # On Debian family, the CBLAS ABIs have been merged into libblas.so
-   find_library(BLAS_LIBRARIES blas)
-@@ -171,7 +185,7 @@ if(NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_ENABLED 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR GENERIC_BLAS_FOUND))
-+  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND OR GENERIC_BLAS_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if(NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index e8f5d7c950..29219e057f 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -257,6 +257,28 @@ if((NOT BLAS_LIBRARIES)
-   endif()
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.9.patch b/packages/py-torch/fj-ssl2_1.9.patch
deleted file mode 100644
index 0febb57586fc1297ac21c1707e1c9cfc93da819d..0000000000000000000000000000000000000000
--- a/packages/py-torch/fj-ssl2_1.9.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
-index 5d57b9ca78..a74fe73b9f 100644
---- a/cmake/Dependencies.cmake
-+++ b/cmake/Dependencies.cmake
-@@ -118,7 +118,7 @@ else()
-   set(AT_MKLDNN_ENABLED 0)
-   set(AT_MKL_ENABLED 0)
- endif()
--set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
-+set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
- message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
- 
- if(BLAS STREQUAL "Eigen")
-@@ -161,6 +161,20 @@ elseif(BLAS STREQUAL "vecLib")
-   find_package(vecLib REQUIRED)
-   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
-   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
-+elseif(BLAS STREQUAL "SSL2")
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    message(STATUS "SSL2 Selected BLAS library")
-+    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
-+    set(SSL2_FOUND ON)
-+    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
-+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    set(WITH_BLAS "ssl2")
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
- elseif(BLAS STREQUAL "Generic")
-   # On Debian family, the CBLAS ABIs have been merged into libblas.so
-   find_library(BLAS_LIBRARIES blas)
-@@ -175,7 +189,7 @@ if(NOT INTERN_BUILD_MOBILE)
-   set(AT_MKL_ENABLED 0)
-   set(AT_MKL_MT 0)
-   set(USE_BLAS 1)
--  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
-+  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND))
-     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
-     find_package(BLAS)
-     if(NOT BLAS_FOUND)
-diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
-index eefd6d475a..92ad75d32e 100644
---- a/cmake/Modules/FindBLAS.cmake
-+++ b/cmake/Modules/FindBLAS.cmake
-@@ -276,6 +276,28 @@ if((NOT BLAS_LIBRARIES)
-   endif()
- endif()
- 
-+# BLAS in SSL2 library?
-+if((NOT BLAS_LIBRARIES)
-+    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
-+  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
-+      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
-+    check_fortran_libraries(
-+    BLAS_LIBRARIES
-+    BLAS
-+    sgemm
-+    "-SSL2;--linkfortran"
-+    "fjlapackexsve")
-+    if (BLAS_LIBRARIES)
-+      set(BLAS_INFO "ssl2")
-+      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
-+    endif (BLAS_LIBRARIES)
-+  else()
-+    message(STATUS "Not built using fcc and FCC.")
-+    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
-+    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
-+  endif()
-+endif()
-+
- # Generic BLAS library?
- if((NOT BLAS_LIBRARIES)
-     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/package.py b/packages/py-torch/package.py
deleted file mode 100644
index 641955a02a44d39916335af196e40c28e85fcdea..0000000000000000000000000000000000000000
--- a/packages/py-torch/package.py
+++ /dev/null
@@ -1,554 +0,0 @@
-# Copyright 2013-2022 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)
-
-import os
-import sys
-
-from spack.operating_systems.mac_os import macos_version
-from spack.package import *
-
-
-class PyTorch(PythonPackage, CudaPackage, ROCmPackage):
-    """Tensors and Dynamic neural networks in Python
-    with strong GPU acceleration."""
-
-    homepage = "https://pytorch.org/"
-    git = "https://github.com/pytorch/pytorch.git"
-
-    maintainers = ["adamjstewart"]
-
-    # Exact set of modules is version- and variant-specific, just attempt to import the
-    # core libraries to ensure that the package was successfully installed.
-    import_modules = ["torch", "torch.autograd", "torch.nn", "torch.utils"]
-
-    version("master", branch="master", submodules=True)
-    version("1.13.0", tag="v1.13.0", submodules=True)
-    version("1.12.1", tag="v1.12.1", submodules=True)
-    version("1.12.0", tag="v1.12.0", submodules=True)
-    version("1.11.0", tag="v1.11.0", submodules=True)
-    version("1.10.2", tag="v1.10.2", submodules=True)
-    version("1.10.1", tag="v1.10.1", submodules=True)
-    version("1.10.0", tag="v1.10.0", submodules=True)
-    version("1.9.1", tag="v1.9.1", submodules=True)
-    version("1.9.0", tag="v1.9.0", submodules=True)
-    version("1.8.2", tag="v1.8.2", submodules=True)
-    version("1.8.1", tag="v1.8.1", submodules=True)
-    version("1.8.0", tag="v1.8.0", submodules=True)
-    version("1.7.1", tag="v1.7.1", submodules=True)
-    version("1.7.0", tag="v1.7.0", submodules=True)
-    version("1.6.0", tag="v1.6.0", submodules=True)
-    version("1.5.1", tag="v1.5.1", submodules=True)
-    version("1.5.0", tag="v1.5.0", submodules=True)
-    version("1.4.1", tag="v1.4.1", submodules=True)
-    version("1.3.1", tag="v1.3.1", submodules=True)
-    version("1.3.0", tag="v1.3.0", submodules=True)
-    version("1.2.0", tag="v1.2.0", submodules=True)
-    version("1.1.0", tag="v1.1.0", submodules=True)
-    version("1.0.1", tag="v1.0.1", submodules=True)
-    version("1.0.0", tag="v1.0.0", submodules=True)
-
-    is_darwin = sys.platform == "darwin"
-
-    # All options are defined in CMakeLists.txt.
-    # Some are listed in setup.py, but not all.
-    variant("debug", default=False, description="Build with debugging support")
-    variant("caffe2", default=False, description="Build Caffe2", when="@1.7:")
-    variant("test", default=False, description="Build C++ test binaries")
-    variant("cuda", default=not is_darwin, description="Use CUDA")
-    variant("rocm", default=False, description="Use ROCm")
-    variant("cudnn", default=not is_darwin, description="Use cuDNN", when="+cuda")
-    variant("fbgemm", default=True, description="Use FBGEMM (quantized 8-bit server operators)")
-    variant("kineto", default=True, description="Use Kineto profiling library", when="@1.8:")
-    variant("magma", default=not is_darwin, description="Use MAGMA", when="+cuda")
-    variant("metal", default=is_darwin, description="Use Metal for Caffe2 iOS build")
-    variant(
-        "mps",
-        default=is_darwin and macos_version() >= Version("12.3"),
-        description="Use MPS for macOS build",
-        when="@1.12: platform=darwin",
-    )
-    variant("nccl", default=True, description="Use NCCL", when="+cuda platform=linux")
-    variant("nccl", default=True, description="Use NCCL", when="+cuda platform=cray")
-    variant("nccl", default=True, description="Use NCCL", when="+rocm platform=linux")
-    variant("nccl", default=True, description="Use NCCL", when="+rocm platform=cray")
-    variant("nnpack", default=True, description="Use NNPACK")
-    variant("numa", default=True, description="Use NUMA", when="platform=linux")
-    variant("numa", default=True, description="Use NUMA", when="platform=cray")
-    variant("numpy", default=True, description="Use NumPy")
-    variant("openmp", default=True, description="Use OpenMP for parallel code")
-    variant("qnnpack", default=True, description="Use QNNPACK (quantized 8-bit operators)")
-    variant("valgrind", default=True, description="Use Valgrind", when="@1.8: platform=linux")
-    variant("valgrind", default=True, description="Use Valgrind", when="@1.8: platform=cray")
-    variant("xnnpack", default=True, description="Use XNNPACK", when="@1.5:")
-    variant("mkldnn", default=True, description="Use MKLDNN")
-    variant("distributed", default=not is_darwin, description="Use distributed")
-    variant("mpi", default=not is_darwin, description="Use MPI for Caffe2", when="+distributed")
-    variant("gloo", default=not is_darwin, description="Use Gloo", when="+distributed")
-    variant(
-        "tensorpipe",
-        default=not is_darwin,
-        description="Use TensorPipe",
-        when="@1.6: +distributed",
-    )
-    variant("onnx_ml", default=True, description="Enable traditional ONNX ML API", when="@1.5:")
-    variant(
-        "breakpad",
-        default=True,
-        description="Enable breakpad crash dump library",
-        when="@1.9:1.11",
-    )
-
-    conflicts("+cuda+rocm")
-    conflicts("+tensorpipe", when="+rocm", msg="TensorPipe doesn't yet support ROCm")
-    conflicts("+breakpad", when="target=ppc64:")
-    conflicts("+breakpad", when="target=ppc64le:")
-
-    # https://github.com/pytorch/pytorch/issues/77811
-    conflicts("+qnnpack", when="platform=darwin target=aarch64:")
-
-    conflicts(
-        "cuda_arch=none",
-        when="+cuda",
-        msg="Must specify CUDA compute capabilities of your GPU, see "
-        "https://developer.nvidia.com/cuda-gpus",
-    )
-
-    # Required dependencies
-    # See python_min_version in setup.py
-    depends_on("python@3.7:", when="@1.11:", type=("build", "link", "run"))
-    depends_on("python@3.6.2:", when="@1.7.1:", type=("build", "link", "run"))
-    depends_on("python@3.6.1:", when="@1.6:1.7.0", type=("build", "link", "run"))
-    depends_on("python@3.5:", when="@1.5", type=("build", "link", "run"))
-    depends_on("python@2.7:2,3.5:", when="@1.4", type=("build", "link", "run"))
-    depends_on("python@2.7:2,3.5:3.7", when="@:1.3", type=("build", "link", "run"))
-
-    # pyproject.toml
-    depends_on("py-setuptools", type=("build", "run"))
-    depends_on("py-astunparse", when="@1.13:", type=("build", "run"))
-    depends_on("py-numpy@1.16.6:", type=("build", "run"))
-    depends_on("ninja@1.5:", when="@1.1:", type="build")
-    depends_on("py-pyyaml", type=("build", "run"))
-    depends_on("cmake@3.13:", when="@1.11:", type="build")
-    depends_on("cmake@3.10:", when="@1.10:", type="build")
-    depends_on("cmake@3.5:", type="build")
-    depends_on("py-cffi", type=("build", "run"))
-    depends_on("py-typing-extensions@3.6.2.1:", when="@1.7:", type=("build", "run"))
-    depends_on("py-future", when="@1.5:", type=("build", "run"))
-    depends_on("py-future", when="@1.1: ^python@:2", type=("build", "run"))
-    depends_on("py-six", when="@1.13:", type=("build", "run"))
-    depends_on("py-requests", when="@1.13:", type=("build", "run"))
-    depends_on("py-dataclasses", when="@1.7: ^python@3.6", type=("build", "run"))
-
-    # Undocumented dependencies
-    depends_on("py-typing", when="^python@:3.4", type=("build", "run"))
-    depends_on("py-tqdm", type="run")
-    depends_on("blas")
-    depends_on("lapack")
-
-    # third_party
-    depends_on("py-pybind11@2.10.0:", when="@1.13:", type=("build", "link", "run"))
-    depends_on("py-pybind11@2.6.2", when="@1.8:1.12", type=("build", "link", "run"))
-    depends_on("py-pybind11@2.3.0", when="@1.1:1.7", type=("build", "link", "run"))
-    depends_on("py-pybind11@2.2.4", when="@:1.0", type=("build", "link", "run"))
-    depends_on("py-protobuf@3.12.2:", when="@1.10:", type=("build", "run"))
-    depends_on("py-protobuf@:3.14", when="@:1.9", type=("build", "run"))
-    depends_on("protobuf@3.12.2:", when="@1.10:")
-    depends_on("protobuf@:3.14", when="@:1.9")
-    # https://github.com/protocolbuffers/protobuf/issues/10051
-    # https://github.com/pytorch/pytorch/issues/78362
-    depends_on("py-protobuf@:3", type=("build", "run"))
-    depends_on("protobuf@:3", type=("build", "run"))
-    depends_on("eigen")
-    # https://github.com/pytorch/pytorch/issues/60329
-    # depends_on("cpuinfo@2022-08-19", when="@1.13:")
-    # depends_on("cpuinfo@2020-12-17", when="@1.8:1.12")
-    # depends_on("cpuinfo@2020-06-11", when="@1.6:1.7")
-    # https://github.com/shibatch/sleef/issues/427
-    # depends_on("sleef@3.5.1_2020-12-22", when="@1.8:")
-    # https://github.com/pytorch/pytorch/issues/60334
-    # depends_on("sleef@3.4.0_2019-07-30", when="@1.6:1.7")
-    # https://github.com/Maratyszcza/FP16/issues/18
-    # depends_on("fp16@2020-05-14", when="@1.6:")
-    depends_on("pthreadpool@2021-04-13", when="@1.9:")
-    depends_on("pthreadpool@2020-10-05", when="@1.8")
-    depends_on("pthreadpool@2020-06-15", when="@1.6:1.7")
-    depends_on("psimd@2020-05-17", when="@1.6:")
-    depends_on("fxdiv@2020-04-17", when="@1.6:")
-    depends_on("benchmark", when="@1.6:+test")
-
-    # Optional dependencies
-    # https://discuss.pytorch.org/t/compiling-1-10-1-from-source-with-gcc-11-and-cuda-11-5/140971
-    depends_on("cuda@9.2:", when="@1.11:+cuda", type=("build", "link", "run"))
-    depends_on("cuda@9.2:11.4", when="@1.6:1.10+cuda", type=("build", "link", "run"))
-    depends_on("cuda@9:11.4", when="@1.1:1.5+cuda", type=("build", "link", "run"))
-    depends_on("cuda@7.5:11.4", when="@:1.0+cuda", type=("build", "link", "run"))
-    depends_on("cudnn@6:7", when="@:1.0+cudnn")
-    depends_on("cudnn@7.0:7", when="@1.1:1.5+cudnn")
-    depends_on("cudnn@7:", when="@1.6:+cudnn")
-    depends_on("magma+cuda", when="+magma+cuda")
-    depends_on("magma+rocm", when="+magma+rocm")
-    depends_on("nccl", when="+nccl+cuda")
-    depends_on("numactl", when="+numa")
-    depends_on("llvm-openmp", when="%apple-clang +openmp")
-    depends_on("valgrind", when="+valgrind")
-    with when("+rocm"):
-        depends_on("hsa-rocr-dev")
-        depends_on("hip")
-        depends_on("rccl", when="+nccl")
-        depends_on("rocprim")
-        depends_on("hipcub")
-        depends_on("rocthrust")
-        depends_on("roctracer-dev")
-        depends_on("rocrand")
-        depends_on("hipsparse")
-        depends_on("hipfft")
-        depends_on("rocfft")
-        depends_on("rocblas")
-        depends_on("miopen-hip")
-        depends_on("rocminfo")
-    # https://github.com/pytorch/pytorch/issues/60332
-    # depends_on("xnnpack@2022-02-16", when="@1.12:+xnnpack")
-    # depends_on("xnnpack@2021-06-21", when="@1.10:1.11+xnnpack")
-    # depends_on("xnnpack@2021-02-22", when="@1.8:1.9+xnnpack")
-    # depends_on("xnnpack@2020-03-23", when="@1.6:1.7+xnnpack")
-    depends_on("mpi", when="+mpi")
-    # https://github.com/pytorch/pytorch/issues/60270
-    # depends_on("gloo@2022-05-18", when="@1.13:+gloo")
-    # depends_on("gloo@2021-05-21", when="@1.10:1.12+gloo")
-    # depends_on("gloo@2021-05-04", when="@1.9+gloo")
-    # depends_on("gloo@2020-09-18", when="@1.7:1.8+gloo")
-    # depends_on("gloo@2020-03-17", when="@1.6+gloo")
-    # https://github.com/pytorch/pytorch/issues/60331
-    # depends_on("onnx!1.12.0", when="@1.13:+onnx_ml")
-    # depends_on("onnx@1.11.0", when="@1.12+onnx_ml")
-    # depends_on("onnx@1.10.1_2021-10-08", when="@1.11+onnx_ml")
-    # depends_on("onnx@1.10.1", when="@1.10+onnx_ml")
-    # depends_on("onnx@1.8.0_2020-11-03", when="@1.8:1.9+onnx_ml")
-    # depends_on("onnx@1.7.0_2020-05-31", when="@1.6:1.7+onnx_ml")
-    depends_on("mkl", when="+mkldnn")
-
-    # Test dependencies
-    depends_on("py-hypothesis", type="test")
-    depends_on("py-six", type="test")
-    depends_on("py-psutil", type="test")
-
-    # Fix BLAS being overridden by MKL
-    # https://github.com/pytorch/pytorch/issues/60328
-    patch(
-        "https://github.com/pytorch/pytorch/pull/59220.patch?full_index=1",
-        sha256="6d5717267f901e8ee493dfacd08734d9bcc48ad29a76ca9ef702368e96bee675",
-        when="@1.2:1.11",
-    )
-
-    # Fixes build on older systems with glibc <2.12
-    patch(
-        "https://github.com/pytorch/pytorch/pull/55063.patch?full_index=1",
-        sha256="2229bcbf20fbe88aa9f7318f89c126ec7f527875ffe689a763c78abfa127a65c",
-        when="@1.1:1.8.1",
-    )
-
-    # Fixes CMake configuration error when XNNPACK is disabled
-    # https://github.com/pytorch/pytorch/pull/35607
-    # https://github.com/pytorch/pytorch/pull/37865
-    patch("xnnpack.patch", when="@1.5")
-
-    # Fixes build error when ROCm is enabled for pytorch-1.5 release
-    patch("rocm.patch", when="@1.5+rocm")
-
-    # Fixes fatal error: sleef.h: No such file or directory
-    # https://github.com/pytorch/pytorch/pull/35359
-    # https://github.com/pytorch/pytorch/issues/26555
-    # patch("sleef.patch", when="@:1.5")
-
-    # Fixes compilation with Clang 9.0.0 and Apple Clang 11.0.3
-    # https://github.com/pytorch/pytorch/pull/37086
-    patch(
-        "https://github.com/pytorch/pytorch/commit/e921cd222a8fbeabf5a3e74e83e0d8dfb01aa8b5.patch?full_index=1",
-        sha256="0f3ad037a95af9d34b1d085050c1e7771fd00f0b89e5b3a276097b7c9f4fabf8",
-        when="@1.1:1.5",
-    )
-
-    # Removes duplicate definition of getCusparseErrorString
-    # https://github.com/pytorch/pytorch/issues/32083
-    patch("cusparseGetErrorString.patch", when="@:1.0^cuda@10.1.243:")
-
-    # Fixes 'FindOpenMP.cmake'
-    # to detect openmp settings used by Fujitsu compiler.
-    patch("detect_omp_of_fujitsu_compiler.patch", when="%fj")
-
-    # Fixes to build with fujitsu-ssl2
-    patch("fj-ssl2_1.11.patch", when="@1.11:^fujitsu-ssl2")
-    patch("fj-ssl2_1.10.patch", when="@1.10^fujitsu-ssl2")
-    patch("fj-ssl2_1.9.patch", when="@1.9^fujitsu-ssl2")
-    patch("fj-ssl2_1.8.patch", when="@1.8^fujitsu-ssl2")
-    patch("fj-ssl2_1.6-1.7.patch", when="@1.6:1.7^fujitsu-ssl2")
-    patch("fj-ssl2_1.3-1.5.patch", when="@1.3:1.5^fujitsu-ssl2")
-    patch("fj-ssl2_1.2.patch", when="@1.2^fujitsu-ssl2")
-
-    # Fix compilation of +distributed~tensorpipe
-    # https://github.com/pytorch/pytorch/issues/68002
-    patch(
-        "https://github.com/pytorch/pytorch/commit/c075f0f633fa0136e68f0a455b5b74d7b500865c.patch?full_index=1",
-        sha256="41271e494a3a60a65a8dd45ac053d1a6e4e4d5b42c2dac589ac67524f61ac41e",
-        when="@1.10.0+distributed~tensorpipe",
-    )
-
-    # Use patches from IBM's Open CE to enable building on Power systems
-    # 03xx - patch temporary to fix a problem that when fixed upstream can be removed
-    patch(
-        "https://github.com/open-ce/pytorch-feedstock/raw/0a145060ca8523314ec3893af935c3b140e2d0b0/pytorch-1.10/recipe/0302-cpp-extension.patch",
-        sha256="ecb3973fa7d0f4c8f8ae40433f3ca5622d730a7b16f6cb63325d1e95baff8aa2",
-        when="@1.10:1.11 arch=ppc64le:",
-    )
-
-    patch(
-        "https://github.com/open-ce/pytorch-feedstock/raw/0a145060ca8523314ec3893af935c3b140e2d0b0/pytorch-1.10/recipe/0311-PR66085-Remove-unused-dump-method-from-VSX-vec256-methods.patch",
-        sha256="f05db59f3def4c4215db7142d81029c73fe330c660492159b66d65ca5001f4d1",
-        when="@1.10:1.11 arch=ppc64le:",
-    )
-
-    patch(
-        "https://github.com/open-ce/pytorch-feedstock/raw/0a145060ca8523314ec3893af935c3b140e2d0b0/pytorch-1.10/recipe/0312-PR67331-Dummpy-VSX-bfloat16-implementation.patch",
-        sha256="860b64afa85f5e6647ebc3c91d5a0bb258784770900c9302c3599c98d5cff1ee",
-        when="@1.10:1.11 arch=ppc64le:",
-    )
-
-    patch(
-        "https://github.com/open-ce/pytorch-feedstock/raw/0a145060ca8523314ec3893af935c3b140e2d0b0/pytorch-1.10/recipe/0313-add-missing-vsx-dispatch.patch",
-        sha256="7393c2bc0b6d41ecc813c829a1e517bee864686652e91f174cb7bcdfb10ba451",
-        when="@1.10:1.11 arch=ppc64le:",
-    )
-
-    patch(
-        "https://github.com/open-ce/pytorch-feedstock/raw/0a145060ca8523314ec3893af935c3b140e2d0b0/pytorch-1.12/recipe/0302-cpp-extension.patch",
-        sha256="2fac519cca8997f074c263505657ff867e7ba2d6637fc8bda99c70a99be0442a",
-        when="@1.12: arch=ppc64le:",
-    )
-
-    # Cherry-pick a patch to allow earlier versions of PyTorch to work with CUDA 11.4
-    patch(
-        "https://github.com/pytorch/pytorch/commit/c74c0c571880df886474be297c556562e95c00e0.patch?full_index=1",
-        sha256="8ff7d285e52e4718bad1ca01ceb3bb6471d7828329036bb94222717fcaa237da",
-        when="@:1.9.1 ^cuda@11.4.100:",
-    )
-
-    @when("@1.5.0:")
-    def patch(self):
-        # https://github.com/pytorch/pytorch/issues/52208
-        filter_file(
-            "torch_global_deps PROPERTIES LINKER_LANGUAGE C",
-            "torch_global_deps PROPERTIES LINKER_LANGUAGE CXX",
-            "caffe2/CMakeLists.txt",
-        )
-
-    def setup_build_environment(self, env):
-        """Set environment variables used to control the build.
-
-        PyTorch's ``setup.py`` is a thin wrapper around ``cmake``.
-        In ``tools/setup_helpers/cmake.py``, you can see that all
-        environment variables that start with ``BUILD_``, ``USE_``,
-        or ``CMAKE_``, plus a few more explicitly specified variable
-        names, are passed directly to the ``cmake`` call. Therefore,
-        most flags defined in ``CMakeLists.txt`` can be specified as
-        environment variables.
-        """
-
-        def enable_or_disable(variant, keyword="USE", var=None, newer=False):
-            """Set environment variable to enable or disable support for a
-            particular variant.
-
-            Parameters:
-                variant (str): the variant to check
-                keyword (str): the prefix to use for enabling/disabling
-                var (str): CMake variable to set. Defaults to variant.upper()
-                newer (bool): newer variants that never used NO_*
-            """
-            if var is None:
-                var = variant.upper()
-
-            # Version 1.1.0 switched from NO_* to USE_* or BUILD_*
-            # But some newer variants have always used USE_* or BUILD_*
-            if self.spec.satisfies("@1.1:") or newer:
-                if "+" + variant in self.spec:
-                    env.set(keyword + "_" + var, "ON")
-                elif "~" + variant in self.spec:
-                    env.set(keyword + "_" + var, "OFF")
-            else:
-                if "+" + variant in self.spec:
-                    env.unset("NO_" + var)
-                elif "~" + variant in self.spec:
-                    env.set("NO_" + var, "ON")
-
-        # Build in parallel to speed up build times
-        env.set("MAX_JOBS", make_jobs)
-
-        # Spack logs have trouble handling colored output
-        env.set("COLORIZE_OUTPUT", "OFF")
-
-        enable_or_disable("test", keyword="BUILD")
-        enable_or_disable("caffe2", keyword="BUILD")
-
-        enable_or_disable("cuda")
-        if "+cuda" in self.spec:
-            # cmake/public/cuda.cmake
-            # cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake
-            env.unset("CUDA_ROOT")
-            torch_cuda_arch = ";".join(
-                "{0:.1f}".format(float(i) / 10.0) for i in self.spec.variants["cuda_arch"].value
-            )
-            env.set("TORCH_CUDA_ARCH_LIST", torch_cuda_arch)
-            if self.spec.satisfies("%clang"):
-                for flag in self.spec.compiler_flags["cxxflags"]:
-                    if "gcc-toolchain" in flag:
-                        env.set("CMAKE_CUDA_FLAGS", "=-Xcompiler={0}".format(flag))
-
-        enable_or_disable("rocm")
-        if "+rocm" in self.spec:
-            env.set("PYTORCH_ROCM_ARCH", ";".join(self.spec.variants["amdgpu_target"].value))
-            env.set("HSA_PATH", self.spec["hsa-rocr-dev"].prefix)
-            env.set("ROCBLAS_PATH", self.spec["rocblas"].prefix)
-            env.set("ROCFFT_PATH", self.spec["rocfft"].prefix)
-            env.set("HIPFFT_PATH", self.spec["hipfft"].prefix)
-            env.set("HIPSPARSE_PATH", self.spec["hipsparse"].prefix)
-            env.set("HIP_PATH", self.spec["hip"].prefix)
-            env.set("HIPRAND_PATH", self.spec["rocrand"].prefix)
-            env.set("ROCRAND_PATH", self.spec["rocrand"].prefix)
-            env.set("MIOPEN_PATH", self.spec["miopen-hip"].prefix)
-            if "+nccl" in self.spec:
-                env.set("RCCL_PATH", self.spec["rccl"].prefix)
-            env.set("ROCPRIM_PATH", self.spec["rocprim"].prefix)
-            env.set("HIPCUB_PATH", self.spec["hipcub"].prefix)
-            env.set("ROCTHRUST_PATH", self.spec["rocthrust"].prefix)
-            env.set("ROCTRACER_PATH", self.spec["roctracer-dev"].prefix)
-            if self.spec.satisfies("^hip@5.2.0:"):
-                env.set("CMAKE_MODULE_PATH", self.spec["hip"].prefix.lib.cmake.hip)
-
-        enable_or_disable("cudnn")
-        if "+cudnn" in self.spec:
-            # cmake/Modules_CUDA_fix/FindCUDNN.cmake
-            env.set("CUDNN_INCLUDE_DIR", self.spec["cudnn"].prefix.include)
-            env.set("CUDNN_LIBRARY", self.spec["cudnn"].libs[0])
-
-        enable_or_disable("fbgemm")
-        enable_or_disable("kineto")
-        enable_or_disable("magma")
-        enable_or_disable("metal")
-        enable_or_disable("mps")
-        enable_or_disable("breakpad")
-
-        enable_or_disable("nccl")
-        if "+cuda+nccl" in self.spec:
-            env.set("NCCL_LIB_DIR", self.spec["nccl"].libs.directories[0])
-            env.set("NCCL_INCLUDE_DIR", self.spec["nccl"].prefix.include)
-
-        # cmake/External/nnpack.cmake
-        enable_or_disable("nnpack")
-
-        enable_or_disable("numa")
-        if "+numa" in self.spec:
-            # cmake/Modules/FindNuma.cmake
-            env.set("NUMA_ROOT_DIR", self.spec["numactl"].prefix)
-
-        # cmake/Modules/FindNumPy.cmake
-        enable_or_disable("numpy")
-        # cmake/Modules/FindOpenMP.cmake
-        enable_or_disable("openmp", newer=True)
-        enable_or_disable("qnnpack")
-        enable_or_disable("qnnpack", var="PYTORCH_QNNPACK")
-        enable_or_disable("valgrind")
-        enable_or_disable("xnnpack")
-        enable_or_disable("mkldnn")
-        enable_or_disable("distributed")
-        enable_or_disable("mpi")
-        # cmake/Modules/FindGloo.cmake
-        enable_or_disable("gloo", newer=True)
-        enable_or_disable("tensorpipe")
-
-        if "+debug" in self.spec:
-            env.set("DEBUG", "ON")
-        else:
-            env.set("DEBUG", "OFF")
-
-        if "+onnx_ml" in self.spec:
-            env.set("ONNX_ML", "ON")
-        elif "~onnx_ml" in self.spec:
-            env.set("ONNX_ML", "OFF")
-
-        if not self.spec.satisfies("@master"):
-            env.set("PYTORCH_BUILD_VERSION", self.version)
-            env.set("PYTORCH_BUILD_NUMBER", 0)
-
-        # BLAS to be used by Caffe2
-        # Options defined in cmake/Dependencies.cmake and cmake/Modules/FindBLAS.cmake
-        if self.spec["blas"].name == "atlas":
-            env.set("BLAS", "ATLAS")
-            env.set("WITH_BLAS", "atlas")
-        elif self.spec["blas"].name in ["blis", "amdblis"]:
-            env.set("BLAS", "BLIS")
-            env.set("WITH_BLAS", "blis")
-        elif self.spec["blas"].name == "eigen":
-            env.set("BLAS", "Eigen")
-        elif self.spec["lapack"].name in ["libflame", "amdlibflame"]:
-            env.set("BLAS", "FLAME")
-            env.set("WITH_BLAS", "FLAME")
-        elif self.spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]:
-            env.set("BLAS", "MKL")
-            env.set("WITH_BLAS", "mkl")
-            # help find MKL
-            if self.spec["mkl"].name == "intel-oneapi-mkl":
-                env.set("INTEL_MKL_DIR", self.spec["mkl"].prefix.mkl.latest)
-            else:
-                env.set("INTEL_MKL_DIR", self.spec["mkl"].prefix.mkl)
-        elif self.spec["blas"].name == "openblas":
-            env.set("BLAS", "OpenBLAS")
-            env.set("WITH_BLAS", "open")
-        elif self.spec["blas"].name == "veclibfort":
-            env.set("BLAS", "vecLib")
-            env.set("WITH_BLAS", "veclib")
-        elif self.spec["blas"].name == "fujitsu-ssl2":
-            env.set("BLAS", "SSL2")
-            env.set("WITH_BLAS", "ssl2")
-        else:
-            env.set("BLAS", "Generic")
-            env.set("WITH_BLAS", "generic")
-
-        # Don't use vendored third-party libraries when possible
-        env.set("BUILD_CUSTOM_PROTOBUF", "OFF")
-        env.set("USE_SYSTEM_NCCL", "ON")
-        env.set("USE_SYSTEM_EIGEN_INSTALL", "ON")
-        env.set("pybind11_DIR", self.spec["py-pybind11"].prefix)
-        env.set("pybind11_INCLUDE_DIR", self.spec["py-pybind11"].prefix.include)
-        if self.spec.satisfies("@1.10:"):
-            env.set("USE_SYSTEM_PYBIND11", "ON")
-        # https://github.com/pytorch/pytorch/issues/60334
-        # if self.spec.satisfies("@1.8:"):
-        #     env.set("USE_SYSTEM_SLEEF", "ON")
-        if self.spec.satisfies("@1.6:"):
-            # env.set("USE_SYSTEM_LIBS", "ON")
-            # https://github.com/pytorch/pytorch/issues/60329
-            # env.set("USE_SYSTEM_CPUINFO", "ON")
-            # https://github.com/pytorch/pytorch/issues/60270
-            # env.set("USE_SYSTEM_GLOO", "ON")
-            # https://github.com/Maratyszcza/FP16/issues/18
-            # env.set("USE_SYSTEM_FP16", "ON")
-            env.set("USE_SYSTEM_PTHREADPOOL", "ON")
-            env.set("USE_SYSTEM_PSIMD", "ON")
-            env.set("USE_SYSTEM_FXDIV", "ON")
-            env.set("USE_SYSTEM_BENCHMARK", "ON")
-            # https://github.com/pytorch/pytorch/issues/60331
-            # env.set("USE_SYSTEM_ONNX", "ON")
-            # https://github.com/pytorch/pytorch/issues/60332
-            # env.set("USE_SYSTEM_XNNPACK", "ON")
-
-    @run_before("install")
-    def build_amd(self):
-        if "+rocm" in self.spec:
-            python(os.path.join("tools", "amd_build", "build_amd.py"))
-
-    @run_after("install")
-    @on_package_attributes(run_tests=True)
-    def install_test(self):
-        with working_dir("test"):
-            python("run_test.py")
diff --git a/packages/py-torch/rocm.patch b/packages/py-torch/rocm.patch
deleted file mode 100644
index b50cc7e1598a23f41e1e1a73e6672e6a4d132b6a..0000000000000000000000000000000000000000
--- a/packages/py-torch/rocm.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-diff --git a/aten/src/ATen/cuda/nvrtc_stub/ATenNVRTC.h b/aten/src/ATen/cuda/nvrtc_stub/ATenNVRTC.h
-index 9cd678dfb4cc7..4630465115c7c 100644
---- a/aten/src/ATen/cuda/nvrtc_stub/ATenNVRTC.h
-+++ b/aten/src/ATen/cuda/nvrtc_stub/ATenNVRTC.h
-@@ -67,6 +67,14 @@ namespace at { namespace cuda {
- //
- // HIP doesn't have
- //   cuGetErrorString  (maps to non-functional hipGetErrorString___)
-+//
-+// HIP from ROCm 3.5 on renamed hipOccupancyMaxActiveBlocksPerMultiprocessor
-+// to hipModuleOccupancyMaxActiveBlocksPerMultiprocessor.
-+#if HIP_VERSION < 305
-+#define HIPOCCUPANCYMAXACTIVEBLOCKSPERMULTIPROCESSOR hipOccupancyMaxActiveBlocksPerMultiprocessor
-+#else
-+#define HIPOCCUPANCYMAXACTIVEBLOCKSPERMULTIPROCESSOR cuOccupancyMaxActiveBlocksPerMultiprocessor
-+#endif
- 
- #define AT_FORALL_NVRTC(_)                       \
-   _(nvrtcVersion)                                \
-@@ -76,7 +84,7 @@ namespace at { namespace cuda {
-   _(nvrtcGetPTX)                                 \
-   _(cuModuleLoadData)                            \
-   _(cuModuleGetFunction)                         \
--  _(cuOccupancyMaxActiveBlocksPerMultiprocessor) \
-+  _(HIPOCCUPANCYMAXACTIVEBLOCKSPERMULTIPROCESSOR)\
-   _(nvrtcGetErrorString)                         \
-   _(nvrtcGetProgramLogSize)                      \
-   _(nvrtcGetProgramLog)                          \
-diff --git a/aten/src/ATen/native/cuda/SoftMax.cu b/aten/src/ATen/native/cuda/SoftMax.cu
-index da1995123ecfc..f935eb4ef3d0e 100644
---- a/aten/src/ATen/native/cuda/SoftMax.cu
-+++ b/aten/src/ATen/native/cuda/SoftMax.cu
-@@ -127,8 +127,8 @@ void SpatialSoftMax_getLaunchSizes(
-   uint32_t block_threads = block.x * block.y;
-   smem_size = block.x == 1 ? 0 : block_threads * sizeof(accscalar_t);
-   int max_active_blocks;
--#ifdef __HIP_PLATFORM_HCC__
--  // XXX HIP function signature is not compatible yet.
-+#if defined(__HIP_PLATFORM_HCC__) && HIP_VERSION < 305
-+  // HIP function signature is not compatible yet.
-   uint32_t max_blocks;
-   cudaOccupancyMaxActiveBlocksPerMultiprocessor(&max_blocks,
-                                                 k, block_threads, smem_size);
-diff --git a/torch/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp b/torch/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp
-index 5586e49919727..27315ee475277 100644
---- a/torch/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp
-+++ b/torch/csrc/jit/codegen/fuser/cuda/fused_kernel.cpp
-@@ -140,10 +140,10 @@ FusedKernelCUDA::FusedKernelCUDA(
-       nvrtc().cuModuleGetFunction(&function_, module_, name_.c_str()));
- 
-   // Computes max blocks
--#ifdef __HIP_PLATFORM_HCC__
--  // XXX HIP function signature is not compatible yet
-+#if defined(__HIP_PLATFORM_HCC__) && HIP_VERSION < 305
-+  // HIP function signature is not compatible yet
-   uint32_t max_blocks;
--  AT_CUDA_DRIVER_CHECK(nvrtc().cuOccupancyMaxActiveBlocksPerMultiprocessor(
-+  AT_CUDA_DRIVER_CHECK(nvrtc().hipOccupancyMaxActiveBlocksPerMultiprocessor(
-       &max_blocks, function_, 128, 0));
-   maxBlocks_ = max_blocks;
- #else
-diff --git a/torch/utils/hipify/cuda_to_hip_mappings.py b/torch/utils/hipify/cuda_to_hip_mappings.py
-index 7e21363cbe6af..26f269d92ae38 100644
---- a/torch/utils/hipify/cuda_to_hip_mappings.py
-+++ b/torch/utils/hipify/cuda_to_hip_mappings.py
-@@ -2890,7 +2890,7 @@
-         (
-             "cuOccupancyMaxActiveBlocksPerMultiprocessor",
-             (
--                "hipOccupancyMaxActiveBlocksPerMultiprocessor",
-+                "hipModuleOccupancyMaxActiveBlocksPerMultiprocessor",
-                 CONV_OCCUPANCY,
-                 API_DRIVER,
-             ),
-@@ -2898,7 +2898,7 @@
-         (
-             "cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags",
-             (
--                "hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags",
-+                "hipModuleOccupancyMaxActiveBlocksPerMultiprocessorWithFlags",
-                 CONV_OCCUPANCY,
-                 API_DRIVER,
-                 HIP_UNSUPPORTED,
-@@ -2906,12 +2906,12 @@
-         ),
-         (
-             "cuOccupancyMaxPotentialBlockSize",
--            ("hipOccupancyMaxPotentialBlockSize", CONV_OCCUPANCY, API_DRIVER),
-+            ("hipModuleOccupancyMaxPotentialBlockSize", CONV_OCCUPANCY, API_DRIVER),
-         ),
-         (
-             "cuOccupancyMaxPotentialBlockSizeWithFlags",
-             (
--                "hipOccupancyMaxPotentialBlockSizeWithFlags",
-+                "hipModuleOccupancyMaxPotentialBlockSizeWithFlags",
-                 CONV_OCCUPANCY,
-                 API_DRIVER,
-                 HIP_UNSUPPORTED,
diff --git a/packages/py-torch/sleef.patch b/packages/py-torch/sleef.patch
deleted file mode 100644
index 67f0234162d1a1af29aa5c538b0e585c3261a81e..0000000000000000000000000000000000000000
--- a/packages/py-torch/sleef.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
-index 8025a7de3c..2e5cdbb5c9 100644
---- a/caffe2/CMakeLists.txt
-+++ b/caffe2/CMakeLists.txt
-@@ -1232,6 +1232,7 @@ if (BUILD_TEST)
-     add_executable(${test_name} "${test_src}")
-     target_link_libraries(${test_name} ${Caffe2_MAIN_LIBS} gtest_main)
-     target_include_directories(${test_name} PRIVATE $<INSTALL_INTERFACE:include>)
-+    target_include_directories(${test_name} PRIVATE $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
-     target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE})
-     add_test(NAME ${test_name} COMMAND $<TARGET_FILE:${test_name}>)
-     if (INSTALL_TEST)
diff --git a/packages/py-torch/xnnpack.patch b/packages/py-torch/xnnpack.patch
deleted file mode 100644
index 154033081e7ff91867e9a043a93c46b888bfe8cb..0000000000000000000000000000000000000000
--- a/packages/py-torch/xnnpack.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
-index 8025a7de3c..0da37079d6 100644
---- a/caffe2/CMakeLists.txt
-+++ b/caffe2/CMakeLists.txt
-@@ -46,12 +46,19 @@ if (INTERN_BUILD_ATEN_OPS)
-   list(APPEND Caffe2_DEPENDENCY_INCLUDE ${ATen_THIRD_PARTY_INCLUDE})
- endif()
- 
-+# {Q/X,etc} NPACK support is enabled by default, if none of these options
-+# are selected, turn this flag ON to incidate the support is disabled
-+set(NNPACK_AND_FAMILY_DISABLED OFF)
-+if(NOT (USE_NNPACK OR USE_QNNPACK OR USE_PYTORCH_QNNPACK OR USE_XNNPACK))
-+  set(NNPACK_AND_FAMILY_DISABLED ON)
-+endif()
-+
- # ---[ Caffe2 build
- # Note: the folders that are being commented out have not been properly
- # addressed yet.
- 
- # For pthreadpool_new_if_impl. TODO: Remove when threadpools are unitied.
--if (NOT MSVC)
-+if (NOT MSVC AND NOT NNPACK_AND_FAMILY_DISABLED)
-   IF(NOT TARGET fxdiv)
-     SET(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
-     SET(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
-@@ -710,7 +717,7 @@ ELSEIF(USE_CUDA)
- ENDIF()
- 
- 
--if (NOT MSVC)
-+if (NOT MSVC AND NOT NNPACK_AND_FAMILY_DISABLED)
-   TARGET_LINK_LIBRARIES(torch_cpu PRIVATE fxdiv)
- endif()
- 
-diff --git a/caffe2/utils/CMakeLists.txt b/caffe2/utils/CMakeLists.txt
-index 27aabb1315..3c7845c67d 100644
---- a/caffe2/utils/CMakeLists.txt
-+++ b/caffe2/utils/CMakeLists.txt
-@@ -36,7 +36,7 @@ list(APPEND Caffe2_CPU_SRCS
- # ---[ threadpool/pthreadpool* is a local modification of the NNPACK
- # pthreadpool with a very similar interface. Neither NNPACK, nor this
- # thread pool supports Windows.
--if (NOT MSVC)
-+if (NOT MSVC AND NOT NNPACK_AND_FAMILY_DISABLED)
-   add_definitions(-DUSE_INTERNAL_THREADPOOL_IMPL)
-   set(Caffe2_CPU_SRCS ${Caffe2_CPU_SRCS}
-           utils/threadpool/pthreadpool.cc
diff --git a/packages/py-typish/package.py b/packages/py-typish/package.py
deleted file mode 100644
index 00ecb2ac3213b66deff9a1aca7de6edde77a77de..0000000000000000000000000000000000000000
--- a/packages/py-typish/package.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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 *
-
-
-class PyTypish(PythonPackage):
-    """Python library for type checking"""
-
-    homepage = "https://github.com/ramonhagenaars/typish"
-    url = "https://github.com/ramonhagenaars/typish/archive/v1.9.2.tar.gz"
-
-    version("1.9.3", sha256="16f8ff022b7009a91529e363d0484465be57797b9cc34a193ca7e3c4c597e4bc")
-    version("1.9.2", sha256="d0cd35aade6f974b2509771ac92aa1a5b4d9efe9c2c34127734539fd28e7145c")
-
-    depends_on("py-setuptools", type="build")
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index 7471678722e7b1ada421796d98616eeee94f25c8..60afda339e5708b68e663da167c6854e9834254b 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -158,7 +158,7 @@ class PynnBrainscales(WafPackage):
         return args
 
     def build_test(self):
-        self.waf('build', '--test-execall')
+        self.builder.waf('build', '--test-execall')
         copy_tree('build/test_results', join_path(self.prefix, '.build'))
 
     def install_args(self):
diff --git a/packages/r-irkernel/package.py b/packages/r-irkernel/package.py
deleted file mode 100644
index 145aeeee0dd4c80b1dc76aac17087c4fb1a79a0e..0000000000000000000000000000000000000000
--- a/packages/r-irkernel/package.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# this package was adapted from Spack upstream v0.19.2, to change the dependency on py-jupyter to py-jupyter-client
-
-# Copyright 2013-2022 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 *
-
-
-class RIrkernel(RPackage):
-    """Native R Kernel for the 'Jupyter Notebook'.
-
-    The R kernel for the 'Jupyter' environment executes R code which the
-    front-end ('Jupyter Notebook' or other front-ends) submits to the kernel
-    via the network."""
-
-    cran = "IRkernel"
-
-    version("1.3.1", sha256="3186e3a177c7246d45218af55f8b10836540e68a2d106858a0385f7d741b640c")
-    version("1.3", sha256="5a7fcbfd978dfb3cca6702a68a21c147551995fc400084ae8382ffcbbdae1903")
-    version("1.2", sha256="5fb4dbdb741d05043120a8be0eb73f054b607d9854f314bd79cfec08d219ff91")
-    version(
-        "0.7",
-        git="https://github.com/IRkernel/IRkernel.git",
-        commit="9cdd284e03eb42d03fab18544b81f486852d5fe0",
-        deprecated=True,
-    )
-
-    depends_on("r@3.2.0:", type=("build", "run"))
-    depends_on("r-repr@0.4.99:", type=("build", "run"))
-    depends_on("r-evaluate@0.10:", type=("build", "run"))
-    depends_on("r-irdisplay@0.3.0.9999:", type=("build", "run"))
-    depends_on("r-pbdzmq@0.2-1:", type=("build", "run"))
-    depends_on("r-crayon", type=("build", "run"))
-    depends_on("r-jsonlite@0.9.6:", type=("build", "run"))
-    depends_on("r-uuid", type=("build", "run"))
-    depends_on("r-digest", type=("build", "run"))
-    depends_on("py-jupyter-client", type="run")
-
-    depends_on("r-evaluate@0.5.4:", type=("build", "run"), when="@0.7")
-    depends_on("r-devtools", type=("build", "run"), when="@0.7")
diff --git a/packages/sbml/package.py b/packages/sbml/package.py
index f0112dfd6dcc461259d1b2aaa4b1ba3ec5f03cbe..25504b607647581f8b1efdf4a48185bb7239a62d 100644
--- a/packages/sbml/package.py
+++ b/packages/sbml/package.py
@@ -1,6 +1,6 @@
-# this package was adapted from Spack upstream v0.19.2, to fix some issues with finding existing libs/headers
+# this package was adapted from Spack upstream v0.20.0, to fix some issues with finding existing libs/headers
 
-# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
+# 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)
@@ -12,7 +12,7 @@ class Sbml(CMakePackage):
     """Library for the Systems Biology Markup Language"""
 
     homepage = "https://sbml.org"
-    maintainers = ["rblake-llnl"]
+    maintainers("rblake-llnl")
 
     version("5.19.0", sha256="a7f0e18be78ff0e064e4cdb1cd86634d08bc33be5250db4a1878bd81eeb8b547")
     version("5.18.0", sha256="6c01be2306ec0c9656b59cb082eb7b90176c39506dd0f912b02e08298a553360")
@@ -87,10 +87,7 @@ class Sbml(CMakePackage):
         args.append(self.define_from_variant("WITH_CPP_NAMESPACE", "cpp"))
         if "+python" in spec:
             args.extend(
-                [
-                    "-DWITH_PYTHON:BOOL=ON",
-                    "-DWITH_PYTHON_INCLUDE:PATH=%s" % spec["python"].prefix,
-                ]
+                ["-DWITH_PYTHON:BOOL=ON", "-DWITH_PYTHON_INCLUDE:PATH=%s" % spec["python"].prefix]
             )
         else:
             args.append("-DWITH_PYTHON:BOOL=OFF")
diff --git a/packages/suite-sparse/fix_cuda11.patch b/packages/suite-sparse/fix_cuda11.patch
deleted file mode 100644
index 4d9e0fc1e1f88cd85cee511cbde8edeeab9de66b..0000000000000000000000000000000000000000
--- a/packages/suite-sparse/fix_cuda11.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- spack-src.orig/SuiteSparse_config/SuiteSparse_config.mk	2021-03-03 22:04:33.000000000 +0000
-+++ spack-src/SuiteSparse_config/SuiteSparse_config.mk	2021-04-13 16:21:57.426166357 +0000
-@@ -259,7 +259,6 @@
-                 MAGMA_LIB     = -L/opt/magma-2.4.0/lib/ -lmagma
-         NVCC          = $(CUDA_PATH)/bin/nvcc
-         NVCCFLAGS     = -Xcompiler -fPIC -O3 \
--                            -gencode=arch=compute_30,code=sm_30 \
-                             -gencode=arch=compute_35,code=sm_35 \
-                             -gencode=arch=compute_50,code=sm_50 \
-                             -gencode=arch=compute_53,code=sm_53 \
diff --git a/packages/suite-sparse/graphblas_libm_dep.patch b/packages/suite-sparse/graphblas_libm_dep.patch
deleted file mode 100644
index 441b0eff8738dacaf877a34cf25109a54c440d9d..0000000000000000000000000000000000000000
--- a/packages/suite-sparse/graphblas_libm_dep.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/GraphBLAS/CMakeLists.txt
-+++ b/GraphBLAS/CMakeLists.txt
-@@ -87,6 +87,7 @@
-     C_STANDARD_REQUIRED 11
-     PUBLIC_HEADER "Include/GraphBLAS.h" )
- set_property ( TARGET graphblas PROPERTY C_STANDARD 11 )
-+target_link_libraries ( graphblas m )
-
- # create the static graphblas library.  Requires ANSI C11
- add_library ( graphblas_static STATIC ${GRAPHBLAS_SOURCES} )
diff --git a/packages/suite-sparse/package.py b/packages/suite-sparse/package.py
deleted file mode 100644
index 97278496f0124105c35d343df8b4db27ae94b7e0..0000000000000000000000000000000000000000
--- a/packages/suite-sparse/package.py
+++ /dev/null
@@ -1,253 +0,0 @@
-# this package was adapted from Spack upstream v0.18.1, to fix build with GPU targets
-# (see https://github.com/spack/spack/commit/e7238a0f2655cd1ffa19fe5ad21baf0acfb0a829)
-
-# Copyright 2013-2022 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 import *
-
-
-class SuiteSparse(Package):
-    """
-    SuiteSparse is a suite of sparse matrix algorithms
-    """
-    homepage = 'https://people.engr.tamu.edu/davis/suitesparse.html'
-    url      = 'https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v4.5.3.tar.gz'
-    git      = 'https://github.com/DrTimothyAldenDavis/SuiteSparse.git'
-
-    version('5.10.1', sha256='acb4d1045f48a237e70294b950153e48dce5b5f9ca8190e86c2b8c54ce00a7ee')
-    version('5.10.0', sha256='4bcc974901c0173acf80c41ee0fd779eb7dce2871d4afa24a5d15b1a468f93e5')
-    version('5.9.0', sha256='7bdd4811f1cf0767c5fdb5e435817fdadee50b0acdb598f4882ae7b8291a7f24')
-    version('5.8.1', sha256='06726e471fbaa55f792578f9b4ab282ea9d008cf39ddcc3b42b73400acddef40')
-    version('5.8.0', sha256='94a9b7134eb4dd82b97f1a22a6b464feb81e73af2dcdf683c6f252285191df1d')
-    version('5.7.2', sha256='fe3bc7c3bd1efdfa5cffffb5cebf021ff024c83b5daf0ab445429d3d741bd3ad')
-    version('5.7.1', sha256='5ba5add1663d51a1b6fb128b50fe869b497f3096765ff7f8212f0ede044b9557')
-    version('5.6.0', sha256='76d34d9f6dafc592b69af14f58c1dc59e24853dcd7c2e8f4c98ffa223f6a1adb')
-    version('5.5.0', sha256='63c73451734e2bab19d1915796c6776565ea6aea5da4063a9797ecec60da2e3d')
-    version('5.4.0', sha256='d9d62d539410d66550d0b795503a556830831f50087723cb191a030525eda770')
-    version('5.3.0', sha256='d8ef4bee4394d2f07299d4688b83bbd98e9d3a2ebbe1c1632144b6f7095ce165')
-    version('5.2.0', sha256='68c431aef3d9a0b02e97803eb61671c5ecb9d36fd292a807db87067dadb36e53')
-    version('5.1.2', sha256='97dc5fdc7f78ff5018e6a1fcc841e17a9af4e5a35cebd62df6922349bf12959e')
-    version('5.1.0', sha256='0b0e03c63e67b04529bb6248808d2a8c82259d40b30fc5a7599f4b6f7bdd4dc6')
-    version('5.0.0', sha256='2f8694d9978033659f10ceb8bdb19147d3c519a0251b8de84be6ba8824d30517')
-    version('4.5.6', sha256='1c7b7a265a1d6c606095eb8aa3cb8e27821f1b7f5bc04f28df6d62906e02f4e4')
-    version('4.5.5', sha256='80d1d9960a6ec70031fecfe9adfe5b1ccd8001a7420efb50d6fa7326ef14af91')
-    version('4.5.3', sha256='b6965f9198446a502cde48fb0e02236e75fa5700b94c7306fc36599d57b563f4')
-
-    variant('tbb',  default=False, description='Build with Intel TBB')
-    variant('pic',  default=True,  description='Build position independent code (required to link with shared libraries)')
-    variant('cuda', default=False, description='Build with CUDA')
-    variant('openmp', default=False, description='Build with OpenMP')
-    variant('graphblas', default=False, description='Build with GraphBLAS (takes a long time to compile)')
-
-    depends_on('mpfr@4.0.0:', type=('build', 'link'), when='@5.8.0:')
-    depends_on('gmp', type=('build', 'link'), when='@5.8.0:')
-    depends_on('blas')
-    depends_on('lapack')
-    depends_on('m4', type='build', when='@5.0.0:')
-    depends_on('cmake', when='+graphblas @5.2.0:', type='build')
-
-    depends_on('metis@5.1.0', when='@4.5.1:')
-    # in @4.5.1. TBB support in SPQR seems to be broken as TBB-related linkng
-    # flags does not seem to be used, which leads to linking errors on Linux.
-    depends_on('tbb', when='@4.5.3:+tbb')
-
-    depends_on('cuda', when='+cuda')
-
-    patch('tbb_453.patch', when='@4.5.3:4.5.5+tbb')
-
-    # This patch removes unsupported flags for pgi compiler
-    patch('pgi.patch', when='%pgi')
-    patch('pgi.patch', when='%nvhpc')
-
-    # This patch adds '-lm' when linking libgraphblas and when using clang.
-    # Fixes 'libgraphblas.so.2.0.1: undefined reference to `__fpclassify''
-    patch('graphblas_libm_dep.patch', when='+graphblas @5.2.0:5.2%clang')
-
-    # CUDA-11 dropped sm_30 code generation, remove hardcoded sm_30 from makefile
-    # open issue: https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/56
-    # Tested only with 5.9.0, previous versions probably work too
-    patch('fix_cuda11.patch', when='@5.9.0:5.10.0+cuda ^cuda@11:')
-
-    conflicts('%gcc@:4.8', when='@5.2.0:', msg='gcc version must be at least 4.9 for suite-sparse@5.2.0:')
-
-    # The @2021.x versions of tbb dropped the task_scheduler_init.h header and
-    # related stuff (which have long been deprecated).  This appears to be
-    # rather problematic for suite-sparse (see e.g.
-    # https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/master/SPQR/Source/spqr_parallel.cpp)
-    # Have Spack complain if +tbb and trying to use a 2021.x version of tbb
-    conflicts('+tbb', when='^intel-oneapi-tbb@2021:',
-              msg='suite-sparse needs task_scheduler_init.h dropped in '
-              'recent tbb libs')
-    conflicts('+tbb', when='^intel-tbb@2021:',
-              msg='suite-sparse needs task_scheduler_init.h dropped in '
-              'recent tbb libs')
-
-    def symbol_suffix_blas(self, spec, args):
-        """When using BLAS with a special symbol suffix we use defines to
-        replace blas symbols, e.g. dgemm_ becomes dgemm_64_ when
-        symbol_suffix=64_."""
-
-        # Currently only OpenBLAS does this.
-        if not spec.satisfies('^openblas'):
-            return
-
-        suffix = spec['openblas'].variants['symbol_suffix'].value
-        if suffix == 'none':
-            return
-
-        symbols = (
-            'dtrsv_', 'dgemv_', 'dtrsm_', 'dgemm_', 'dsyrk_', 'dger_', 'dscal_',
-            'dpotrf_', 'ztrsv_', 'zgemv_', 'ztrsm_', 'zgemm_', 'zherk_',
-            'zgeru_', 'zscal_', 'zpotrf_',
-            'dnrm2_', 'dlarf_', 'dlarfg_', 'dlarft_', 'dlarfb_', 'dznrm2_',
-            'zlarf_', 'zlarfg_', 'zlarft_', 'zlarfb_'
-        )
-
-        for symbol in symbols:
-            args.append('CFLAGS+=-D{0}={1}{2}'.format(symbol, symbol, suffix))
-
-    def install(self, spec, prefix):
-        # The build system of SuiteSparse is quite old-fashioned.
-        # It's basically a plain Makefile which include an header
-        # (SuiteSparse_config/SuiteSparse_config.mk)with a lot of convoluted
-        # logic in it. Any kind of customization will need to go through
-        # filtering of that file
-
-        cc_pic_flag  = self.compiler.cc_pic_flag  if '+pic' in spec else ''
-        f77_pic_flag = self.compiler.f77_pic_flag if '+pic' in spec else ''
-
-        make_args = [
-            # By default, the Makefile uses the Intel compilers if
-            # they are found. The AUTOCC flag disables this behavior,
-            # forcing it to use Spack's compiler wrappers.
-            'AUTOCC=no',
-            # CUDA=no does NOT disable cuda, it only disables internal search
-            # for CUDA_PATH. If in addition the latter is empty, then CUDA is
-            # completely disabled. See
-            # [SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk] for more.
-            'CUDA=no',
-            'CUDA_PATH=%s' % (spec['cuda'].prefix if '+cuda' in spec else ''),
-            'CFOPENMP=%s' % (self.compiler.openmp_flag
-                             if '+openmp' in spec else ''),
-            'CFLAGS=-O3 %s' % cc_pic_flag,
-            # Both FFLAGS and F77FLAGS are used in SuiteSparse makefiles;
-            # FFLAGS is used in CHOLMOD, F77FLAGS is used in AMD and UMFPACK.
-            'FFLAGS=%s' % f77_pic_flag,
-            'F77FLAGS=%s' % f77_pic_flag,
-            # use Spack's metis in CHOLMOD/Partition module,
-            # otherwise internal Metis will be compiled
-            'MY_METIS_LIB=%s' % spec['metis'].libs.ld_flags,
-            'MY_METIS_INC=%s' % spec['metis'].prefix.include,
-            # Make sure Spack's Blas/Lapack is used. Otherwise System's
-            # Blas/Lapack might be picked up. Need to add -lstdc++, following
-            # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk,
-            # even though this fix is ugly
-            'BLAS=%s' % (spec['blas'].libs.ld_flags + (
-                ' -lstdc++' if '@4.5.1' in spec else '')),
-            'LAPACK=%s' % spec['lapack'].libs.ld_flags,
-        ]
-
-        # Recent versions require c11 but some demos do not get the c11 from
-        # GraphBLAS/CMakeLists.txt, for example the file
-        # GraphBLAS/Demo/Program/wildtype_demo.c. For many compilers this is
-        # not an issue because c11 or newer is their default. However, for some
-        # compilers (e.g. xlc) the c11 flag is necessary.
-        if spec.satisfies('@5.4:5.7.1') and ('%xl' in spec or '%xl_r' in spec):
-            make_args += ['CFLAGS+=%s' % self.compiler.c11_flag]
-
-        # 64bit blas in UMFPACK:
-        if (spec.satisfies('^openblas+ilp64') or
-            spec.satisfies('^intel-mkl+ilp64') or
-            spec.satisfies('^intel-parallel-studio+mkl+ilp64')):
-            make_args.append('UMFPACK_CONFIG=-DLONGBLAS="long long"')
-
-        # Handle symbol suffix of some BLAS'es (e.g. 64_ or _64 for ilp64)
-        self.symbol_suffix_blas(spec, make_args)
-
-        # SuiteSparse defaults to using '-fno-common -fexceptions' in
-        # CFLAGS, but not all compilers use the same flags for these
-        # optimizations
-        if any([x in spec for x in
-                ('%apple-clang', '%clang', '%gcc', '%intel', '%fj')]):
-            make_args += ['CFLAGS+=-fno-common -fexceptions']
-        elif '%pgi' in spec:
-            make_args += ['CFLAGS+=--exceptions']
-
-        if spack_f77.endswith('xlf') or spack_f77.endswith('xlf_r'):
-            make_args += ['CFLAGS+=-DBLAS_NO_UNDERSCORE']
-
-        # Intel TBB in SuiteSparseQR
-        if '+tbb' in spec:
-            make_args += [
-                'SPQR_CONFIG=-DHAVE_TBB',
-                'TBB=%s' % spec['tbb'].libs.ld_flags,
-            ]
-
-        if '@5.3:' in spec:
-            # Without CMAKE_LIBRARY_PATH defined, the CMake file in the
-            # Mongoose directory finds libsuitesparseconfig.so in system
-            # directories like /usr/lib.
-            make_args += [
-                'CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX=%s' % prefix +
-                ' -DCMAKE_LIBRARY_PATH=%s' % prefix.lib]
-
-        make_args.append('INSTALL=%s' % prefix)
-
-        # Filter the targets we're interested in
-        targets = [
-            'SuiteSparse_config',
-            'AMD',
-            'BTF',
-            'CAMD',
-            'CCOLAMD',
-            'COLAMD',
-            'CHOLMOD',
-            'CXSparse',
-            'LDL',
-            'KLU',
-            'UMFPACK',
-            'RBio',
-        ]
-        if spec.satisfies('+cuda'):
-            targets.extend([
-                'SuiteSparse_GPURuntime',
-                'GPUQREngine'
-            ])
-        targets.extend([
-            'SPQR'
-        ])
-        if spec.satisfies('+graphblas'):
-            targets.append('GraphBLAS')
-        if spec.satisfies('@5.8.0:'):
-            targets.append('SLIP_LU')
-
-        # Finally make and install
-        make('-C', 'SuiteSparse_config', 'library', 'config')
-        for target in targets:
-            make('-C', target, 'library', *make_args)
-            make('-C', target, 'install', *make_args)
-
-    @run_after('install')
-    def fix_darwin_install(self):
-        # The shared libraries are not installed correctly on Darwin:
-        # See https://github.com/DrTimothyAldenDavis/SuiteSparse/issues/42
-        if '+pic platform=darwin' in self.spec:
-            fix_darwin_install_name(self.spec.prefix.lib)
-
-    @property
-    def libs(self):
-        """Export the libraries of SuiteSparse.
-        Sample usage: spec['suite-sparse'].libs.ld_flags
-                      spec['suite-sparse:klu,btf'].libs.ld_flags
-        """
-        # Component libraries, ordered by dependency. Any missing components?
-        all_comps = ['klu', 'btf', 'umfpack', 'cholmod', 'colamd', 'amd',
-                     'camd', 'ccolamd', 'cxsparse', 'ldl', 'rbio', 'spqr',
-                     'suitesparseconfig']
-        query_parameters = self.spec.last_query.extra_parameters
-        comps = all_comps if not query_parameters else query_parameters
-        return find_libraries(['lib' + c for c in comps], root=self.prefix.lib,
-                              shared=True, recursive=False)
diff --git a/packages/suite-sparse/pgi.patch b/packages/suite-sparse/pgi.patch
deleted file mode 100644
index f615a5767476418014894420289fd91d726b4498..0000000000000000000000000000000000000000
--- a/packages/suite-sparse/pgi.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/SuiteSparse_config/SuiteSparse_config.mk
-+++ b/SuiteSparse_config/SuiteSparse_config.mk
-@@ -89,7 +89,8 @@
- 
-     # The CF macro is used by SuiteSparse Makefiles as a combination of
-     # CFLAGS, CPPFLAGS, TARGET_ARCH, and system-dependent settings.
--    CF ?= $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OPTIMIZATION) -fexceptions -fPIC
-+    #CF ?= $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OPTIMIZATION) -fexceptions -fPIC
-+    CF ?= $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OPTIMIZATION) -fPIC
- 
-     #---------------------------------------------------------------------------
-     # OpenMP is used in CHOLMOD
diff --git a/packages/suite-sparse/tbb_453.patch b/packages/suite-sparse/tbb_453.patch
deleted file mode 100644
index 70241ed01745309cc82943db8c2c49261a590221..0000000000000000000000000000000000000000
--- a/packages/suite-sparse/tbb_453.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/SPQR/Lib/Makefile b/SPQR/Lib/Makefile
-index eaade58..d0de852 100644
---- a/SPQR/Lib/Makefile
-+++ b/SPQR/Lib/Makefile
-@@ -13,7 +13,7 @@ ccode: all
- include ../../SuiteSparse_config/SuiteSparse_config.mk
- 
- # SPQR depends on CHOLMOD, AMD, COLAMD, LAPACK, the BLAS and SuiteSparse_config
--LDLIBS += -lamd -lcolamd -lcholmod -lsuitesparseconfig $(LAPACK) $(BLAS)
-+LDLIBS += -lamd -lcolamd -lcholmod -lsuitesparseconfig $(TBB) $(LAPACK) $(BLAS)
- 
- # compile and install in SuiteSparse/lib
- library: