From 269ed55f62f5b15bda7050638eece0420e4be86c Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:17:42 +0000 Subject: [PATCH 001/104] libpng updates --- .../repos/builtin/packages/libpng/package.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/libpng/package.py b/var/spack/repos/builtin/packages/libpng/package.py index fcdceacbd86db0..0a7470735432c2 100644 --- a/var/spack/repos/builtin/packages/libpng/package.py +++ b/var/spack/repos/builtin/packages/libpng/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) @@ -13,6 +13,8 @@ class Libpng(AutotoolsPackage): url = "https://prdownloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz" git = "https://github.com/glennrp/libpng.git" + maintainers = ["AlexanderRichert-NOAA"] + version("1.6.37", sha256="505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca") # From http://www.libpng.org/pub/png/libpng.html (2019-04-15) # libpng versions 1.6.36 and earlier have a use-after-free bug in the @@ -26,7 +28,14 @@ class Libpng(AutotoolsPackage): depends_on("zlib@1.0.4:") # 1.2.5 or later recommended - variant("shared", default=True) + variant( + "libs", + default="shared,static", + values=("shared", "static"), + multi=True, + description="Build shared libs, static libs or both", + ) + variant("pic", default=False, description="PIC") def configure_args(self): args = [ @@ -36,7 +45,14 @@ def configure_args(self): f"CPPFLAGS={self.spec['zlib'].headers.include_flags}", f"LDFLAGS={self.spec['zlib'].libs.search_flags}", ] - if "~shared" in self.spec: args += ["--enable-static","--disable-shared"] + + args += self.enable_or_disable("libs") + + if self.spec.satisfies("+pic"): + args.append("CFLAGS=-fPIC") + args.append("FFLAGS=-fPIC") + args.append("--with-pic") + return args def check(self): From 0cd205213245df212fcfdd9de1d7deba86d19a4d Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:23:49 +0000 Subject: [PATCH 002/104] Update cdo to allow using static netcdf and eccodes --- .../repos/builtin/packages/cdo/package.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/cdo/package.py b/var/spack/repos/builtin/packages/cdo/package.py index 08c575cd6dcd6e..8cfe9e8a429f80 100644 --- a/var/spack/repos/builtin/packages/cdo/package.py +++ b/var/spack/repos/builtin/packages/cdo/package.py @@ -204,23 +204,33 @@ def yes_or_prefix(spec_name): # Note that the argument of --with-hdf5 is not passed to the # configure script of libcdi, therefore we have to provide # additional flags regardless of whether hdf5 support is enabled. - hdf5_spec = self.spec["hdf5"] - if not is_system_path(hdf5_spec.prefix): - flags["LDFLAGS"].append(self.spec["hdf5"].libs.search_flags) + netcdfc_spec = self.spec["netcdf-c"] + if not is_system_path(netcdfc_spec.prefix): + if netcdfc_spec.satisfies("+shared"): + flags["LDFLAGS"].append(netcdfc_spec.libs.search_flags) + flags["LIBS"].append(netcdfc_spec.libs.link_flags) + else: + ncconfig = which("nc-config") + flags["LDFLAGS"].append(ncconfig("--cflags", output=str).strip()) + flags["LIBS"].append(ncconfig("--libs", output=str).strip()) else: config_args.append("--without-netcdf") if self.spec.variants["grib2"].value == "eccodes": - if self.spec.satisfies("@1.9:"): + eccodes_spec = self.spec["eccodes"] + if self.spec.satisfies("@1.9:") and eccodes_spec.satisfies("+shared"): config_args.append("--with-eccodes=" + yes_or_prefix("eccodes")) config_args.append("--without-grib_api") else: config_args.append("--with-grib_api=yes") - eccodes_spec = self.spec["eccodes"] eccodes_libs = eccodes_spec.libs flags["LIBS"].append(eccodes_libs.link_flags) if not is_system_path(eccodes_spec.prefix): flags["LDFLAGS"].append(eccodes_libs.search_flags) + if eccodes_spec.satisfies("~shared"): + jpeglib = eccodes_spec.variants["jp2k"].value + flags["LIBS"].append(self.spec[jpeglib].libs.link_flags) + flags["LDFLAGS"].append(self.spec[jpeglib].libs.ld_flags) elif self.spec.variants["grib2"].value == "grib-api": config_args.append("--with-grib_api=" + yes_or_prefix("grib-api")) if self.spec.satisfies("@1.9:"): From b7bc275441b303e3a08bebf949c30582c5f56b27 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:34:10 +0000 Subject: [PATCH 003/104] met: add 11.0.1; allow static netcdf-c and python --- .../repos/builtin/packages/met/package.py | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/var/spack/repos/builtin/packages/met/package.py b/var/spack/repos/builtin/packages/met/package.py index a96b88463d2ea3..2da28765d7cf87 100644 --- a/var/spack/repos/builtin/packages/met/package.py +++ b/var/spack/repos/builtin/packages/met/package.py @@ -3,7 +3,9 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +import os + +from spack.package import * class Met(AutotoolsPackage): @@ -12,10 +14,11 @@ class Met(AutotoolsPackage): configurable methods to compute statistics and diagnostics""" homepage = "https://dtcenter.org/community-code/model-evaluation-tools-met" - url = "https://github.com/dtcenter/MET/releases/download/v10.1.0/met-10.1.0.20220314.tar.gz" + url = "https://github.com/dtcenter/MET/archive/refs/tags/v11.0.1.tar.gz" maintainers = ['kgerheiser'] + version('11.0.1', sha256='48d471ad4634f1b969d9358c51925ce36bf0a1cec5312a6755203a4794b81646') version('10.1.1', sha256='9827e65fbd1c64e776525bae072bc2d37d14465e85a952778dcc32a26d8b5c9e') version('10.1.0', sha256='8d4c1fb2311d8481ffd24e30e407a1b1bc72a6add9658d76b9c323f1733db336') version('10.0.1', sha256='8e965bb0eb8353229a730af511c5fa62bad9744606ab6a218d741d29eb5f3acd') @@ -63,8 +66,12 @@ def url_for_version(self, version): '10.0.0': '20210510', '9.1.3': '20210319' } - url = "https://github.com/dtcenter/MET/releases/download/v{0}/met-{0}.{1}.tar.gz" - return url.format(version, release_date[str(version)]) + if version in release_date.keys(): + url = "https://github.com/dtcenter/MET/releases/download/v{0}/met-{0}.{1}.tar.gz" + return url.format(version, release_date[str(version)]) + else: + url = "https://github.com/dtcenter/MET/archive/refs/tags/v{0}.tar.gz" + return url.format(version) def setup_build_environment(self, env): spec = self.spec @@ -75,20 +82,25 @@ def setup_build_environment(self, env): gsl = spec['gsl'] env.set('MET_GSL', gsl.prefix) - netcdfc = spec['netcdf-c'] netcdfcxx = spec['netcdf-cxx4'] - zlib = spec['zlib'] + cppflags.append(netcdfcxx.libs.search_flags) + ldflags.append(netcdfcxx.libs.ld_flags) + libs.append(netcdfcxx.libs.link_flags) - cppflags.append('-I' + netcdfc.prefix.include) - cppflags.append('-I' + netcdfcxx.prefix.include) - cppflags.append('-D__64BIT__') + netcdfc = spec['netcdf-c'] + if netcdfc.satisfies("+shared"): + cppflags.append('-I' + netcdfc.prefix.include) + ldflags.append('-L' + netcdfc.prefix.lib) + libs.append(netcdfc.libs.link_flags) + else: + nc_config = which(os.path.join(netcdfc.prefix.bin, "nc-config")) + cppflags.append(nc_config("--cflags", output=str).strip()) + ldflags.append(nc_config("--libs", "--static", output=str).strip()) + libs.append(nc_config("--libs", "--static", output=str).strip()) - ldflags.append('-L' + netcdfc.prefix.lib) - ldflags.append('-L' + netcdfcxx.prefix.lib) + zlib = spec['zlib'] + cppflags.append('-D__64BIT__') ldflags.append('-L' + zlib.prefix.lib) - - libs.append('-lnetcdf') - libs.append('-lnetcdf_c++4') libs.append('-lz') bufr = spec['bufr'] @@ -111,7 +123,13 @@ def setup_build_environment(self, env): python = spec['python'] env.set('MET_PYTHON', python.command.path) env.set('MET_PYTHON_CC', '-I' + python.headers.directories[0]) - env.set('MET_PYTHON_LD', python.libs.ld_flags) + py_ld = [python.libs.ld_flags] + if spec["python"].satisfies("~shared"): + py_ld.append(spec["gettext"].libs.ld_flags) + py_ld.append(spec["gettext"].libs.ld_flags) + py_ld.append(spec["libiconv"].libs.ld_flags) + py_ld.append("-lutil") + env.set('MET_PYTHON_LD', " ".join(py_ld)) if '+lidar2nc' in spec or '+modis' in spec: hdf = spec['hdf'] From 88a1fa11b786536b2e76ad9daff9418e953f5f7f Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:38:18 +0000 Subject: [PATCH 004/104] Add pic variant for libjpeg-turbo --- var/spack/repos/builtin/packages/libjpeg-turbo/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/libjpeg-turbo/package.py b/var/spack/repos/builtin/packages/libjpeg-turbo/package.py index cf99c742d64346..c754f65652c5b2 100644 --- a/var/spack/repos/builtin/packages/libjpeg-turbo/package.py +++ b/var/spack/repos/builtin/packages/libjpeg-turbo/package.py @@ -56,6 +56,7 @@ class LibjpegTurbo(CMakePackage, AutotoolsPackage): variant("shared", default=True, description="Build shared libs") variant("static", default=True, description="Build static libs") variant("jpeg8", default=False, description="Emulate libjpeg v8 API/ABI") + variant("pic", default=True, description="Enable position independent code") # Can use either of these. But in the current version of the package # only nasm is used. In order to use yasm an environmental variable @@ -87,6 +88,7 @@ def cmake_args(self): self.define_from_variant("ENABLE_SHARED", "shared"), self.define_from_variant("ENABLE_STATIC", "static"), self.define_from_variant("WITH_JPEG8", "jpeg8"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), ] return args From 31d113a967c4dc35f5beb993e0551493b570608a Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:42:21 +0000 Subject: [PATCH 005/104] Update freetype; add pic variant --- .../builtin/packages/freetype/package.py | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/freetype/package.py b/var/spack/repos/builtin/packages/freetype/package.py index 8fcd3de0a4160f..c61ff543e62795 100644 --- a/var/spack/repos/builtin/packages/freetype/package.py +++ b/var/spack/repos/builtin/packages/freetype/package.py @@ -1,12 +1,14 @@ -# 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) +from spack.build_systems.autotools import AutotoolsBuilder +from spack.build_systems.cmake import CMakeBuilder from spack.package import * -class Freetype(AutotoolsPackage): +class Freetype(AutotoolsPackage, CMakePackage): """FreeType is a freely available software library to render fonts. It is written in C, designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output (glyph images) @@ -15,7 +17,7 @@ class Freetype(AutotoolsPackage): homepage = "https://www.freetype.org/index.html" url = "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz" - maintainers = ["michaelkuhn"] + maintainers("michaelkuhn") version("2.11.1", sha256="f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b") version("2.11.0", sha256="a45c6b403413abd5706f3582f04c8339d26397c4304b78fa552f2215df64101f") @@ -28,9 +30,12 @@ class Freetype(AutotoolsPackage): version("2.7", sha256="7b657d5f872b0ab56461f3bd310bd1c5ec64619bd15f0d8e08282d494d9cfea4") version("2.5.3", sha256="41217f800d3f40d78ef4eb99d6a35fd85235b64f81bc56e4812d7672fca7b806") + build_system("cmake", "autotools", default="autotools") + depends_on("bzip2") depends_on("libpng") - depends_on("pkgconfig", type="build") + for plat in ["linux", "darwin", "cray"]: + depends_on("pkgconfig", type="build", when="platform=%s" % plat) conflicts( "%intel", @@ -39,6 +44,13 @@ class Freetype(AutotoolsPackage): "support __builtin_shuffle)", ) + variant( + "pic", + default=False, + description="Enable position-independent code (PIC)", + when="build_system=cmake", + ) + patch("windows.patch", when="@2.9.1") @property @@ -47,6 +59,7 @@ def headers(self): headers.directories = [self.prefix.include.freetype2] return headers +class AutotoolsBuilder(AutotoolsBuilder): def configure_args(self): args = [ "--with-brotli=no", @@ -58,3 +71,20 @@ def configure_args(self): if self.spec.satisfies("@2.9.1:"): args.append("--enable-freetype-config") return args + + def setup_build_environment(self, env): + if self.spec.satisfies("+pic"): + env.set("CFLAGS", "-fPIC") + env.set("FFLAGS", "-fPIC") + + +class CMakeBuilder(CMakeBuilder): + def cmake_args(self): + return [ + self.define("FT_DISABLE_ZLIB", True), + self.define("FT_DISABLE_BROTLI", True), + self.define("FT_DISABLE_HARFBUZZ", True), + self.define("FT_REQUIRE_PNG", True), + self.define("FT_REQUIRE_BZIP2", True), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + ] From 05695e1245b7cd42a944ad69594dd31fd0d7d7b5 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:44:07 +0000 Subject: [PATCH 006/104] Allow static freetype for mkfontscale --- .../repos/builtin/packages/mkfontscale/package.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/mkfontscale/package.py b/var/spack/repos/builtin/packages/mkfontscale/package.py index 95e6c8fcd6fb8a..1f162c481d8d61 100644 --- a/var/spack/repos/builtin/packages/mkfontscale/package.py +++ b/var/spack/repos/builtin/packages/mkfontscale/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) @@ -21,3 +21,14 @@ class Mkfontscale(AutotoolsPackage, XorgPackage): depends_on("xproto@7.0.25:") depends_on("pkgconfig", type="build") depends_on("util-macros", type="build") + + def configure_args(self): + args = [] + ldflags = [] + libs = [] + for lib in ["libpng", "bzip2"]: + ldflags.append(self.spec[lib].libs.ld_flags) + libs.append(self.spec[lib].libs.link_flags) + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) + return args From 53e8f6a80410720119a664b8e28a8139f7dd9127 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:47:45 +0000 Subject: [PATCH 007/104] fontconfig: add pic variant; allow static dependencies --- .../builtin/packages/fontconfig/package.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index 31dbfbbe5a350e..9ae5985c9d3bca 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/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) @@ -27,6 +27,8 @@ class Fontconfig(AutotoolsPackage): depends_on("uuid", when="@2.13.1:") depends_on("python@3:", type="build", when="@2.13.93:") + variant("pic", default=False, description="Enable position-independent code (PIC)") + def patch(self): """Make test/run-test.sh compatible with dash""" filter_file("SIGINT SIGTERM SIGABRT EXIT", "2 15 6 0", "test/run-test.sh") @@ -39,8 +41,20 @@ def _rm_offending_header(self): def configure_args(self): font_path = join_path(self.spec["font-util"].prefix, "share", "fonts") - - return ["--enable-libxml2", "--disable-docs", "--with-default-fonts={0}".format(font_path)] + args = ["--enable-libxml2", "--disable-docs", "--with-default-fonts={0}".format(font_path)] + ldflags = [] + libs = [] + for lib in ["libpng", "bzip2"]: + ldflags.append(self.spec[lib].libs.ld_flags) + libs.append(self.spec[lib].libs.link_flags) + args.append("LDFLAGS=-fPIC %s" % " ".join(ldflags)) + args.append("LIBS=-fPIC %s" % " ".join(libs)) + if self.spec.satisfies("+pic"): + args.append("CFLAGS=-fPIC") + args.append("FFLAGS=-fPIC") + args.append("--with-pic") + return args + @run_after("install") def system_fonts(self): From 073f4e93f8588539981faffcd5d3cc322b8383b4 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:50:37 +0000 Subject: [PATCH 008/104] Add pic variant for subversion --- var/spack/repos/builtin/packages/subversion/package.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/subversion/package.py b/var/spack/repos/builtin/packages/subversion/package.py index 229fc6fd8b90de..a79be68f99bc4d 100644 --- a/var/spack/repos/builtin/packages/subversion/package.py +++ b/var/spack/repos/builtin/packages/subversion/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) @@ -115,6 +115,10 @@ def configure_args(self): else: args.append("--disable-nls") + args.append("CFLAGS=-fPIC") + args.append("FFLAGS=-fPIC") + args.append("--with-pic") + return args def build(self, spec, prefix): From 12efe5ae5535f6591afe3eaf876f6cae83229a96 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:53:14 +0000 Subject: [PATCH 009/104] Add pic variant for lz4 --- var/spack/repos/builtin/packages/lz4/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/lz4/package.py b/var/spack/repos/builtin/packages/lz4/package.py index c2b34a5d2d6dc7..8aea22a9299c52 100644 --- a/var/spack/repos/builtin/packages/lz4/package.py +++ b/var/spack/repos/builtin/packages/lz4/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) @@ -35,6 +35,7 @@ class Lz4(MakefilePackage): multi=True, description="Build shared libs, static libs or both", ) + variant("pic", default=False, description="PIC") def url_for_version(self, version): url = "https://github.com/lz4/lz4/archive" @@ -44,6 +45,10 @@ def url_for_version(self, version): else: return "{0}/r{1}.tar.gz".format(url, version.joined) + def setup_build_environment(self, env): + if self.spec.satisfies("+pic"): + env.set("CFLAGS", "-fPIC") + def build(self, spec, prefix): par = True if spec.compiler.name == "nvhpc": From bf1f92cbdb90b0984323b2f15ab5524dfb237573 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:57:10 +0000 Subject: [PATCH 010/104] Allow static deps for harfbuzz --- .../builtin/packages/harfbuzz/package.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/harfbuzz/package.py b/var/spack/repos/builtin/packages/harfbuzz/package.py index e746ed6fbf7f1d..e29260d0f31cad 100644 --- a/var/spack/repos/builtin/packages/harfbuzz/package.py +++ b/var/spack/repos/builtin/packages/harfbuzz/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) @@ -14,11 +14,17 @@ class Harfbuzz(MesonPackage, AutotoolsPackage): url = "https://github.com/harfbuzz/harfbuzz/releases/download/2.9.1/harfbuzz-2.9.1.tar.xz" git = "https://github.com/harfbuzz/harfbuzz.git" - version("5.1.0", sha256="2edb95db668781aaa8d60959d21be2ff80085f31b12053cdd660d9a50ce84f05") build_system( conditional("autotools", when="@:2.9"), conditional("meson", when="@3:"), default="meson" ) + version("6.0.0", sha256="1d1010a1751d076d5291e433c138502a794d679a7498d1268ee21e2d4a140eb4") + version( + "5.3.1", + sha256="4a6ce097b75a8121facc4ba83b5b083bfec657f45b003cd5a3424f2ae6b4434d", + preferred=True, + ) + version("5.1.0", sha256="2edb95db668781aaa8d60959d21be2ff80085f31b12053cdd660d9a50ce84f05") version("4.2.1", sha256="bd17916513829aeff961359a5ccebba6de2f4bf37a91faee3ac29c120e3d7ee1") version("4.1.0", sha256="f7984ff4241d4d135f318a93aa902d910a170a8265b7eaf93b5d9a504eed40c8") version("4.0.1", sha256="98f68777272db6cd7a3d5152bac75083cd52a26176d87bc04c8b3929d33bce49") @@ -117,6 +123,18 @@ def setup_dependent_build_environment(self, env, dependent_spec): env.prepend_path("XDG_DATA_DIRS", self.prefix.share) env.prepend_path("GI_TYPELIB_PATH", join_path(self.prefix.lib, "girepository-1.0")) + def setup_build_environment(self, env): + ldflags = [] + libs = [] + ldflags.append(self.spec["bzip2"].libs.ld_flags) + ldflags.append(self.spec["zlib"].libs.ld_flags) + ldflags.append(self.spec["libpng"].libs.ld_flags) + libs.append(self.spec["bzip2"].libs.link_flags) + libs.append(self.spec["zlib"].libs.link_flags) + libs.append(self.spec["libpng"].libs.link_flags) + env.set("LDFLAGS", " ".join(ldflags)) + env.set("LIBS", " ".join(libs)) + class MesonBuilder(spack.build_systems.meson.MesonBuilder, SetupEnvironment): def meson_args(self): From 651241c7ed3d1e0849871f62acc2365227bb8fe2 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 15 Mar 2023 01:58:27 +0000 Subject: [PATCH 011/104] Rename fpic variant to pic for fms --- var/spack/repos/builtin/packages/fms/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/fms/package.py b/var/spack/repos/builtin/packages/fms/package.py index 28779f699bac7e..210f232f7887d2 100644 --- a/var/spack/repos/builtin/packages/fms/package.py +++ b/var/spack/repos/builtin/packages/fms/package.py @@ -82,7 +82,7 @@ class Fms(CMakePackage): when="@2022.02:", ) variant( - "fpic", default=False, description="Build with position independent code", when="@2022.02:" + "pic", default=False, description="Build with position independent code", when="@2022.02:" ) depends_on("netcdf-c") @@ -104,7 +104,7 @@ def cmake_args(self): self.define_from_variant("ENABLE_QUAD_PRECISION", "quad_precision"), self.define_from_variant("WITH_YAML", "yaml"), self.define_from_variant("CONSTANTS"), - self.define_from_variant("FPIC"), + self.define_from_variant("FPIC", "pic"), ] args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc)) From 25a201db1c78c3db8a04c240b0677cb6766283fe Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 17 Mar 2023 00:30:42 +0000 Subject: [PATCH 012/104] Allow git to compile against static curl --- var/spack/repos/builtin/packages/git/package.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py index 26637127523854..56fe61c8f63cae 100644 --- a/var/spack/repos/builtin/packages/git/package.py +++ b/var/spack/repos/builtin/packages/git/package.py @@ -411,6 +411,13 @@ def setup_build_environment(self, env): env.append_flags("EXTLIBS", "-L{0} -lintl".format(self.spec["gettext"].prefix.lib)) env.append_flags("CFLAGS", "-I{0}".format(self.spec["gettext"].prefix.include)) + if self.spec["curl"].satisfies("libs=static"): + curlconfig = which(os.path.join(self.spec["curl"].prefix.bin, "curl-config")) + # For configure step: + env.append_flags("LIBS", curlconfig("--static-libs", output=str).strip()) + # For build step: + env.append_flags("EXTLIBS", curlconfig("--static-libs", output=str).strip()) + if "~perl" in self.spec: env.append_flags("NO_PERL", "1") From eabcb64b0586f22d285e5d78ef53a887b8fa28bd Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 17 Mar 2023 16:45:18 +0000 Subject: [PATCH 013/104] Revise fontconfig to clean up flags --- var/spack/repos/builtin/packages/fontconfig/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index 9ae5985c9d3bca..89c417212a6b6e 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -47,8 +47,8 @@ def configure_args(self): for lib in ["libpng", "bzip2"]: ldflags.append(self.spec[lib].libs.ld_flags) libs.append(self.spec[lib].libs.link_flags) - args.append("LDFLAGS=-fPIC %s" % " ".join(ldflags)) - args.append("LIBS=-fPIC %s" % " ".join(libs)) + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) if self.spec.satisfies("+pic"): args.append("CFLAGS=-fPIC") args.append("FFLAGS=-fPIC") From 93dd24fab939a493080c28c5600f1dc916bb94cc Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 17 Mar 2023 16:49:02 +0000 Subject: [PATCH 014/104] Revise fontconfig to remove unnecessary flag --- var/spack/repos/builtin/packages/fontconfig/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index 89c417212a6b6e..f531cec0e3176a 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -52,7 +52,6 @@ def configure_args(self): if self.spec.satisfies("+pic"): args.append("CFLAGS=-fPIC") args.append("FFLAGS=-fPIC") - args.append("--with-pic") return args From f68ce85e742bfa136db4976325ce4926bf2164dc Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 17 Mar 2023 16:54:54 +0000 Subject: [PATCH 015/104] Revise freetype ('maintainers') --- var/spack/repos/builtin/packages/freetype/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/freetype/package.py b/var/spack/repos/builtin/packages/freetype/package.py index c61ff543e62795..b1384e7f7f1179 100644 --- a/var/spack/repos/builtin/packages/freetype/package.py +++ b/var/spack/repos/builtin/packages/freetype/package.py @@ -17,7 +17,7 @@ class Freetype(AutotoolsPackage, CMakePackage): homepage = "https://www.freetype.org/index.html" url = "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz" - maintainers("michaelkuhn") + maintainers = ["michaelkuhn"] version("2.11.1", sha256="f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b") version("2.11.0", sha256="a45c6b403413abd5706f3582f04c8339d26397c4304b78fa552f2215df64101f") From 21c786cebf45110d788d4a4c4e4304b6649937d6 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 17 Mar 2023 17:06:26 +0000 Subject: [PATCH 016/104] Revise libpng to remove unnecessary flag --- var/spack/repos/builtin/packages/libpng/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/libpng/package.py b/var/spack/repos/builtin/packages/libpng/package.py index 0a7470735432c2..46a2c64b5a47bb 100644 --- a/var/spack/repos/builtin/packages/libpng/package.py +++ b/var/spack/repos/builtin/packages/libpng/package.py @@ -51,7 +51,6 @@ def configure_args(self): if self.spec.satisfies("+pic"): args.append("CFLAGS=-fPIC") args.append("FFLAGS=-fPIC") - args.append("--with-pic") return args From 4856e941360efb9f587f127fcbc3c7529632c9b3 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 17 Mar 2023 17:18:13 +0000 Subject: [PATCH 017/104] Revise harfbuzz to only update LDFLAGS/LIBS if using static dependencies --- .../repos/builtin/packages/harfbuzz/package.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/harfbuzz/package.py b/var/spack/repos/builtin/packages/harfbuzz/package.py index e29260d0f31cad..af84643f682503 100644 --- a/var/spack/repos/builtin/packages/harfbuzz/package.py +++ b/var/spack/repos/builtin/packages/harfbuzz/package.py @@ -126,14 +126,16 @@ def setup_dependent_build_environment(self, env, dependent_spec): def setup_build_environment(self, env): ldflags = [] libs = [] - ldflags.append(self.spec["bzip2"].libs.ld_flags) - ldflags.append(self.spec["zlib"].libs.ld_flags) - ldflags.append(self.spec["libpng"].libs.ld_flags) - libs.append(self.spec["bzip2"].libs.link_flags) - libs.append(self.spec["zlib"].libs.link_flags) - libs.append(self.spec["libpng"].libs.link_flags) - env.set("LDFLAGS", " ".join(ldflags)) - env.set("LIBS", " ".join(libs)) + for lib in ["bzip2", "zlib", "libpng"]: + spec = self.spec[lib] + if spec.satisfies("~shared") or ( + spec.satisfies("libs=static") and not spec.satisfies("libs=shared") + ): + ldflags.append(spec.libs.ld_flags) + libs.append(spec.libs.link_flags) + if ldflags: + env.set("LDFLAGS", " ".join(ldflags)) + env.set("LIBS", " ".join(libs)) class MesonBuilder(spack.build_systems.meson.MesonBuilder, SetupEnvironment): From 90060687a056534ff57763f9178c0e5f6f9acadd Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:53 +0000 Subject: [PATCH 018/104] Add static-only option for cairo --- var/spack/repos/builtin/packages/cairo/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/cairo/package.py b/var/spack/repos/builtin/packages/cairo/package.py index a61ec15cf90e0f..4194e1d528df26 100644 --- a/var/spack/repos/builtin/packages/cairo/package.py +++ b/var/spack/repos/builtin/packages/cairo/package.py @@ -39,6 +39,7 @@ class Cairo(AutotoolsPackage): variant("fc", default=False, description="Enable cairo's Fontconfig font backend feature") variant("png", default=False, description="Enable cairo's PNG functions feature") variant("svg", default=False, description="Enable cairo's SVN functions feature") + variant("shared", default=True, description="Build shared libraries") depends_on("libx11", when="+X") depends_on("libxext", when="+X") @@ -83,6 +84,7 @@ def configure_args(self): args.extend(self.enable_or_disable("gobject")) args.extend(self.enable_or_disable("ft")) args.extend(self.enable_or_disable("fc")) + args.extend(self.enable_or_disable("shared")) return args From 519dba3a2cf72731157805b9b1a1fe4fe85567a7 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:53 +0000 Subject: [PATCH 019/104] Add static-only option for fftw --- var/spack/repos/builtin/packages/fftw/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 7ce50f5df9b742..6d32a6ee34b5f2 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -25,6 +25,7 @@ class FftwBase(AutotoolsPackage): ) variant("openmp", default=False, description="Enable OpenMP support.") variant("mpi", default=True, description="Activate MPI support") + variant("shared", default=True, description="Build shared libraries") depends_on("mpi", when="+mpi") depends_on("llvm-openmp", when="%apple-clang +openmp") @@ -98,7 +99,7 @@ def setup_build_environment(self, env): def configure(self, spec, prefix): # Base options - options = ["--prefix={0}".format(prefix), "--enable-shared", "--enable-threads"] + options = ["--prefix={0}".format(prefix), self.enable_or_disable("shared"), "--enable-threads"] if not self.compiler.f77 or not self.compiler.fc: options.append("--disable-fortran") if spec.satisfies("@:2"): From 9faff48abbf5c326a3b0c2cc9346895abe287793 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:53 +0000 Subject: [PATCH 020/104] Add static-only option for gdal --- var/spack/repos/builtin/packages/gdal/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index ce6f26ef3ae229..5ec8fc4322bd64 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -227,6 +227,8 @@ class Gdal(CMakePackage, AutotoolsPackage, PythonExtension): variant("perl", default=False, when="@:3.4", description="Build Perl bindings") variant("php", default=False, when="@:2.3", description="Build PHP bindings") + variant("shared", default=True, description="Build shared libraries") + # Build system build_system( conditional("cmake", when="@3.5:"), @@ -468,6 +470,7 @@ class CMakeBuilder(CMakeBuilder): def cmake_args(self): # https://gdal.org/build_hints.html args = [ + self.define_from_variant("BUILD_SHARED_LIBS", "shared") # Only use Spack-installed dependencies self.define("GDAL_USE_EXTERNAL_LIBS", False), self.define("GDAL_USE_INTERNAL_LIBS", False), @@ -595,6 +598,7 @@ def configure_args(self): # https://trac.osgeo.org/gdal/wiki/BuildHints args = [ "--prefix={}".format(self.prefix), + self.enable_or_disable("shared"), # Required dependencies "--with-geotiff={}".format(self.spec["libgeotiff"].prefix), "--with-libjson-c={}".format(self.spec["json-c"].prefix), From 5abc1d807ca53b95080741fbd37cf621953fee22 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:54 +0000 Subject: [PATCH 021/104] Add static-only option for geos --- var/spack/repos/builtin/packages/geos/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/geos/package.py b/var/spack/repos/builtin/packages/geos/package.py index 5509a11e5617da..313f5bb467f89d 100644 --- a/var/spack/repos/builtin/packages/geos/package.py +++ b/var/spack/repos/builtin/packages/geos/package.py @@ -55,6 +55,8 @@ class Geos(CMakePackage): depends_on("cmake@3.8:", type="build") depends_on("ninja", type="build") + variant("shared", default=True, description="Build shared library") + generator = "Ninja" patch( @@ -74,4 +76,6 @@ def cmake_args(self): if "%intel" in self.spec: args.append(self.define("BUILD_ASTYLE", False)) + args.extend(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + return args From aa96a33b4387e5806c47ee5ac3d70eb3ba30a78c Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:54 +0000 Subject: [PATCH 022/104] Add static-only option for libtiff --- var/spack/repos/builtin/packages/libtiff/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/libtiff/package.py b/var/spack/repos/builtin/packages/libtiff/package.py index 535a3145b60e5e..d22ea8c650470a 100644 --- a/var/spack/repos/builtin/packages/libtiff/package.py +++ b/var/spack/repos/builtin/packages/libtiff/package.py @@ -72,6 +72,8 @@ class Libtiff(CMakePackage, AutotoolsPackage): variant("zstd", default=False, description="use libzstd", when="@4.0.10:") variant("webp", default=False, description="use libwebp", when="@4.0.10:") + variant("shared", default=True, description="Build shared") + build_system( conditional("cmake", when="@4.0.5:"), "autotools", @@ -114,6 +116,7 @@ def patch(self): class CMakeBuilder(CMakeBuilder): def cmake_args(self): args = [self.define_from_variant(var) for var in VARIANTS] + args += [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] # Remove empty strings args = [arg for arg in args if arg] @@ -126,5 +129,6 @@ def configure_args(self): args = [] for var in VARIANTS: args.extend(self.enable_or_disable(var)) + args.extend(self.enable_or_disable("shared")) return args From 11caa03fb6d68dd6957992503dc85bd5a7a26610 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:54 +0000 Subject: [PATCH 023/104] Add static-only option for proj --- var/spack/repos/builtin/packages/proj/package.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/proj/package.py b/var/spack/repos/builtin/packages/proj/package.py index c9f6c485769a96..5addfae37b0157 100644 --- a/var/spack/repos/builtin/packages/proj/package.py +++ b/var/spack/repos/builtin/packages/proj/package.py @@ -47,6 +47,7 @@ class Proj(AutotoolsPackage): variant("tiff", default=True, description="Enable TIFF support") variant("curl", default=True, description="Enable curl support") + variant("shared", default=True, description="Enable shared libraries") # https://github.com/OSGeo/PROJ#distribution-files-and-format # https://github.com/OSGeo/PROJ-data @@ -96,16 +97,15 @@ def configure_args(self): args.append("--with-external-gtest") if self.spec.satisfies("@7:"): - if "+tiff" in self.spec: - args.append("--enable-tiff") - else: - args.append("--disable-tiff") + args.extend(self.enable_or_disable("tiff")) if "+curl" in self.spec: args.append("--with-curl=" + self.spec["curl"].prefix.bin.join("curl-config")) else: args.append("--without-curl") + args.extend(self.enable_or_disable("shared")) + return args def setup_run_environment(self, env): From 0e1f202c641c7ad6cb533757fb907f8e077029e9 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 03:13:54 +0000 Subject: [PATCH 024/104] Add static-only option for udunits --- var/spack/repos/builtin/packages/udunits/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/udunits/package.py b/var/spack/repos/builtin/packages/udunits/package.py index 16baa33c158ccd..9120e6fe25003c 100644 --- a/var/spack/repos/builtin/packages/udunits/package.py +++ b/var/spack/repos/builtin/packages/udunits/package.py @@ -34,6 +34,11 @@ class Udunits(AutotoolsPackage): depends_on("expat") + variant("shared", default=True, description="Build shared library") + @property def libs(self): return find_libraries(["libudunits2"], root=self.prefix, recursive=True, shared=True) + + def configure_args(self): + return self.enable_or_disable("shared") From 96ce39e7c188c9bc528f98e86320acaf2adce02a Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Sat, 18 Mar 2023 10:18:06 -0700 Subject: [PATCH 025/104] Update package.py --- var/spack/repos/builtin/packages/subversion/package.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/subversion/package.py b/var/spack/repos/builtin/packages/subversion/package.py index a79be68f99bc4d..b9f790adf2cac9 100644 --- a/var/spack/repos/builtin/packages/subversion/package.py +++ b/var/spack/repos/builtin/packages/subversion/package.py @@ -116,8 +116,6 @@ def configure_args(self): args.append("--disable-nls") args.append("CFLAGS=-fPIC") - args.append("FFLAGS=-fPIC") - args.append("--with-pic") return args From 95770a6b5687cc3d0b64d21b06c1c74d98df30a1 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Sat, 18 Mar 2023 10:18:45 -0700 Subject: [PATCH 026/104] Update package.py --- var/spack/repos/builtin/packages/gdal/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index 5ec8fc4322bd64..b3ed16f6bff4b9 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -470,7 +470,7 @@ class CMakeBuilder(CMakeBuilder): def cmake_args(self): # https://gdal.org/build_hints.html args = [ - self.define_from_variant("BUILD_SHARED_LIBS", "shared") + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), # Only use Spack-installed dependencies self.define("GDAL_USE_EXTERNAL_LIBS", False), self.define("GDAL_USE_INTERNAL_LIBS", False), From 159429b34185e20b12836cc4b0dae8d9d2a2a17b Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 17:28:43 +0000 Subject: [PATCH 027/104] Update harfbuzz --- var/spack/repos/builtin/packages/harfbuzz/package.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/harfbuzz/package.py b/var/spack/repos/builtin/packages/harfbuzz/package.py index af84643f682503..e67bba65a7e5ac 100644 --- a/var/spack/repos/builtin/packages/harfbuzz/package.py +++ b/var/spack/repos/builtin/packages/harfbuzz/package.py @@ -128,11 +128,10 @@ def setup_build_environment(self, env): libs = [] for lib in ["bzip2", "zlib", "libpng"]: spec = self.spec[lib] - if spec.satisfies("~shared") or ( - spec.satisfies("libs=static") and not spec.satisfies("libs=shared") - ): - ldflags.append(spec.libs.ld_flags) - libs.append(spec.libs.link_flags) + if spec.satisfies("+shared") or spec.satisfies("libs=shared"): + continue + ldflags.append(spec.libs.ld_flags) + libs.append(spec.libs.link_flags) if ldflags: env.set("LDFLAGS", " ".join(ldflags)) env.set("LIBS", " ".join(libs)) From 41f524ce7fcd4d1e2201795877e708dd388b71e4 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 17:28:51 +0000 Subject: [PATCH 028/104] Update git --- var/spack/repos/builtin/packages/git/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py index 56fe61c8f63cae..10981c5751d0f6 100644 --- a/var/spack/repos/builtin/packages/git/package.py +++ b/var/spack/repos/builtin/packages/git/package.py @@ -411,7 +411,7 @@ def setup_build_environment(self, env): env.append_flags("EXTLIBS", "-L{0} -lintl".format(self.spec["gettext"].prefix.lib)) env.append_flags("CFLAGS", "-I{0}".format(self.spec["gettext"].prefix.include)) - if self.spec["curl"].satisfies("libs=static"): + if not self.spec["curl"].satisfies("libs=shared"): curlconfig = which(os.path.join(self.spec["curl"].prefix.bin, "curl-config")) # For configure step: env.append_flags("LIBS", curlconfig("--static-libs", output=str).strip()) From 72ae2d96a8b0cdc33ba1219a5bf6f4849a20ae6e Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 17:29:04 +0000 Subject: [PATCH 029/104] Update fontconfig --- var/spack/repos/builtin/packages/fontconfig/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index f531cec0e3176a..d7d60cf345fa0e 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -45,6 +45,8 @@ def configure_args(self): ldflags = [] libs = [] for lib in ["libpng", "bzip2"]: + if self.spec[lib].satisfies("+shared") or self.spec[lib].satisfies("libs=shared"): + continue ldflags.append(self.spec[lib].libs.ld_flags) libs.append(self.spec[lib].libs.link_flags) args.append("LDFLAGS=%s" % " ".join(ldflags)) From 167140bf7ab25169f62fa8ad12737cc315109679 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 17:31:10 +0000 Subject: [PATCH 030/104] Update libpng --- var/spack/repos/builtin/packages/libpng/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/libpng/package.py b/var/spack/repos/builtin/packages/libpng/package.py index 46a2c64b5a47bb..eb0e4e30e24381 100644 --- a/var/spack/repos/builtin/packages/libpng/package.py +++ b/var/spack/repos/builtin/packages/libpng/package.py @@ -50,7 +50,6 @@ def configure_args(self): if self.spec.satisfies("+pic"): args.append("CFLAGS=-fPIC") - args.append("FFLAGS=-fPIC") return args From b6c4d30a43c297b4cbf44877e331d6d345577a18 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 17:31:20 +0000 Subject: [PATCH 031/104] Update mkfontscale --- var/spack/repos/builtin/packages/mkfontscale/package.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/mkfontscale/package.py b/var/spack/repos/builtin/packages/mkfontscale/package.py index 1f162c481d8d61..3b475b5888d0ab 100644 --- a/var/spack/repos/builtin/packages/mkfontscale/package.py +++ b/var/spack/repos/builtin/packages/mkfontscale/package.py @@ -27,8 +27,11 @@ def configure_args(self): ldflags = [] libs = [] for lib in ["libpng", "bzip2"]: + if self.spec[lib].satisfies("+shared") or self.spec[lib].satisfies("libs=shared"): + continue ldflags.append(self.spec[lib].libs.ld_flags) libs.append(self.spec[lib].libs.link_flags) - args.append("LDFLAGS=%s" % " ".join(ldflags)) - args.append("LIBS=%s" % " ".join(libs)) - return args + if ldflags: + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) + return args From 037763f829852e7d7fce6a8062c34f7cbb6e50f9 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 17:50:02 +0000 Subject: [PATCH 032/104] Enable static-only on linux --- .../repos/builtin/packages/openssl/package.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 62fdecbdc4de63..6c432ff4e078fc 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +#import glob import os import re @@ -322,9 +323,11 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package ), ) variant("docs", default=False, description="Install docs and manpages") - variant("shared", default=False, description="Build shared library version") + with when("platform=linux"): + variant("shared", default=True, description="Build shared library version") with when("platform=windows"): variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") + variant("shared", default=False, description="Build shared library version") depends_on("zlib") depends_on("perl@5.14.0:", type=("build", "test")) @@ -396,8 +399,6 @@ def install(self, spec, prefix): "VC-WIN64A", ] ) - if spec.satisfies("~shared"): - base_args.append("no-shared") else: base_args.extend( [ @@ -406,6 +407,10 @@ def install(self, spec, prefix): ] ) base_args.extend(options) + + if spec.satisfies("~shared"): + base_args.append("no-shared") + # On Windows, we use perl for configuration and build through MSVC # nmake. if spec.satisfies("platform=windows"): @@ -489,6 +494,12 @@ def copy_mozilla_certs(self): pkg_cert = join_path(pkg_dir, "cert.pem") install(mozilla_pem, pkg_cert) +# @run_after("install") +# @when("~shared") +# def static_only(self): +# for sharedlibpath in glob.glob(os.path.join(self.spec.prefix.lib, "*.so"): +# os.remove(sharedlibpath) + def patch(self): if self.spec.satisfies("%nvhpc"): # Remove incompatible preprocessor flags From c9fea329621b3bc2527e34a1adc030b12af08682 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 18:24:22 +0000 Subject: [PATCH 033/104] Add static-only option for libxml2 --- var/spack/repos/builtin/packages/libxml2/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/libxml2/package.py b/var/spack/repos/builtin/packages/libxml2/package.py index 8255bc5f10eacb..ee27509c28ce68 100644 --- a/var/spack/repos/builtin/packages/libxml2/package.py +++ b/var/spack/repos/builtin/packages/libxml2/package.py @@ -38,6 +38,7 @@ def url_for_version(self, version): version("2.7.8", sha256="cda23bc9ebd26474ca8f3d67e7d1c4a1f1e7106364b690d822e009fdc3c417ec") variant("python", default=False, description="Enable Python support") + variant("shared", default=True, description="Build shared library") depends_on("pkgconfig@0.9.0:", type="build") depends_on("iconv") @@ -105,6 +106,8 @@ def configure_args(self): else: args.append("--without-python") + args.extend(self.enable_or_disable("shared")) + return args def patch(self): From 2bda61bd0a9c9690c4b8ad72e6ef2a776662ffc9 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 18:24:39 +0000 Subject: [PATCH 034/104] Add static-only option for gettext --- var/spack/repos/builtin/packages/gettext/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/gettext/package.py b/var/spack/repos/builtin/packages/gettext/package.py index de077821f26cb8..25dd80b1d1b4ed 100644 --- a/var/spack/repos/builtin/packages/gettext/package.py +++ b/var/spack/repos/builtin/packages/gettext/package.py @@ -32,6 +32,7 @@ class Gettext(AutotoolsPackage, GNUMirrorPackage): variant("tar", default=True, description="Enable tar support") variant("bzip2", default=True, description="Enable bzip2 support") variant("xz", default=True, description="Enable xz support") + variant("shared", default=True, description="Build shared libraries") # Optional variants variant("libunistring", default=False, description="Use libunistring") @@ -87,6 +88,8 @@ def configure_args(self): "--without-cvs", ] + config_args.extend(self.enable_or_disable("shared")) + if "+curses" in spec: config_args.append("--with-ncurses-prefix={0}".format(spec["ncurses"].prefix)) else: From fb116e7deda81a525ae0fa52e5803a3d2c41239b Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 18 Mar 2023 18:39:28 +0000 Subject: [PATCH 035/104] add pic variant to subversion --- var/spack/repos/builtin/packages/subversion/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/subversion/package.py b/var/spack/repos/builtin/packages/subversion/package.py index b9f790adf2cac9..10ae29a1f5f83f 100644 --- a/var/spack/repos/builtin/packages/subversion/package.py +++ b/var/spack/repos/builtin/packages/subversion/package.py @@ -36,6 +36,7 @@ class Subversion(AutotoolsPackage): variant("perl", default=False, description="Build with Perl bindings") variant("apxs", default=True, description="Build with APXS") variant("nls", default=True, description="Enable Native Language Support") + variant("pic", default=False, description="Enable position-independent code") depends_on("apr") depends_on("apr-util") @@ -115,7 +116,8 @@ def configure_args(self): else: args.append("--disable-nls") - args.append("CFLAGS=-fPIC") + if spec.satisfies("+pic"): + args.append("CFLAGS=-fPIC") return args From e5cc7fd150c6a6e4ed511eeac8dcf967a947723e Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sun, 19 Mar 2023 16:53:37 +0000 Subject: [PATCH 036/104] Enable static openssl for krb5 --- var/spack/repos/builtin/packages/krb5/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/krb5/package.py b/var/spack/repos/builtin/packages/krb5/package.py index 65bc147c0c2152..8d43479fe3f933 100644 --- a/var/spack/repos/builtin/packages/krb5/package.py +++ b/var/spack/repos/builtin/packages/krb5/package.py @@ -78,6 +78,9 @@ def configure_args(self): if "%gcc@10:" in self.spec: args.append("CFLAGS=-fcommon") + if self.spec["openssl"].satisfies("~shared"): + args.append("LDFLAGS=-L%s -lz" % self.spec["zlib"].prefix.lib) + return args def setup_build_environment(self, env): From 11a6ca8e5f391c88dd93b3cc5a03b75b96c02117 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Mon, 20 Mar 2023 21:30:11 +0000 Subject: [PATCH 037/104] Allow python to use static gettext/iconv --- var/spack/repos/builtin/packages/python/package.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index aa7a6532969379..bcc2ddb4a339a4 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -537,6 +537,13 @@ def configure_args(self): if cflags: config_args.append("CFLAGS={0}".format(" ".join(cflags))) + if spec["gettext"].satisfies("~shared"): + config_args.append( + "LIBS=-L{0} -L{1} -lintl -liconv".format( + spec["gettext"].prefix.lib, spec["iconv"].prefix.lib + ) + ) + return config_args def configure(self, spec, prefix): From 0a3fa07f5847ee2087a0c26e33ac7537dc4d9fda Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Mon, 20 Mar 2023 21:31:31 +0000 Subject: [PATCH 038/104] Allow apr-util to use static openssl --- var/spack/repos/builtin/packages/apr-util/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/apr-util/package.py b/var/spack/repos/builtin/packages/apr-util/package.py index 5ef9ab7f854aa4..d88678a026de45 100644 --- a/var/spack/repos/builtin/packages/apr-util/package.py +++ b/var/spack/repos/builtin/packages/apr-util/package.py @@ -102,6 +102,10 @@ def configure_args(self): else: args.append("--without-odbc") + if "+crypto" in spec: + if spec["openssl"].satisfies("~shared"): + args.append("LIBS=-L%s -lz" % self.spec["zlib"].prefix.lib) + return args def check(self): From 992932e5cca4aea30b6e579754c54a4661a8000c Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:30:28 +0000 Subject: [PATCH 039/104] Update geos --- var/spack/repos/builtin/packages/geos/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/geos/package.py b/var/spack/repos/builtin/packages/geos/package.py index 313f5bb467f89d..365532d6ea9e3a 100644 --- a/var/spack/repos/builtin/packages/geos/package.py +++ b/var/spack/repos/builtin/packages/geos/package.py @@ -76,6 +76,6 @@ def cmake_args(self): if "%intel" in self.spec: args.append(self.define("BUILD_ASTYLE", False)) - args.extend(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) return args From 7a7085fa29f0340fa6bb68a36a5c85f63fe1b209 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:30:29 +0000 Subject: [PATCH 040/104] Update cmake --- var/spack/repos/builtin/packages/cmake/package.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py index a5fb14db91578b..0759fca48d89aa 100644 --- a/var/spack/repos/builtin/packages/cmake/package.py +++ b/var/spack/repos/builtin/packages/cmake/package.py @@ -380,6 +380,18 @@ def bootstrap_args(self): ] ) + if self.spec["openssl"].satisfies("~shared"): + args.append( + "-DOPENSSL_CRYPTO_LIBRARY={0};{1}".format( + find_libraries("libcrypto", self.spec["openssl"].prefix.lib, shared=False), + find_libraries( + "libz", + self.spec["zlib"].prefix.lib, + shared=self.spec["zlib"].satisfies("+shared"), + ) + ) + ) + return args def cmake_bootstrap(self): From c78bd042c1b9050d9e87132ca222e4f4d190a45c Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:30:29 +0000 Subject: [PATCH 041/104] Update gettext --- var/spack/repos/builtin/packages/gettext/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gettext/package.py b/var/spack/repos/builtin/packages/gettext/package.py index 25dd80b1d1b4ed..e31cfbb82b65d0 100644 --- a/var/spack/repos/builtin/packages/gettext/package.py +++ b/var/spack/repos/builtin/packages/gettext/package.py @@ -117,8 +117,10 @@ def configure_args(self): @property def libs(self): - return find_libraries( + libs = find_libraries( ["libasprintf", "libgettextlib", "libgettextpo", "libgettextsrc", "libintl"], root=self.prefix, recursive=True, + shared=self.spec.variants["shared"].value, ) + return libs From ee4b40068568a852164453dc983ff1c799465f01 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:30:29 +0000 Subject: [PATCH 042/104] Update xz --- var/spack/repos/builtin/packages/xz/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/xz/package.py b/var/spack/repos/builtin/packages/xz/package.py index 5db7713d8c3129..cecbc31d6a7eda 100644 --- a/var/spack/repos/builtin/packages/xz/package.py +++ b/var/spack/repos/builtin/packages/xz/package.py @@ -53,7 +53,12 @@ def flag_handler(self, name, flags): @property def libs(self): - return find_libraries(["liblzma"], root=self.prefix, recursive=True) + return find_libraries( + ["liblzma"], + root=self.prefix, + recursive=True, + shared=self.spec.satisfies("libs=shared") + ) @classmethod def determine_version(cls, exe): From 11ca95f84dedd86e1ca87a3083ec80d58f94e63e Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:31:17 +0000 Subject: [PATCH 043/104] Update fftw --- var/spack/repos/builtin/packages/fftw/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 6d32a6ee34b5f2..e6f78f5bb023ee 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -99,7 +99,9 @@ def setup_build_environment(self, env): def configure(self, spec, prefix): # Base options - options = ["--prefix={0}".format(prefix), self.enable_or_disable("shared"), "--enable-threads"] + options = ["--prefix={0}".format(prefix), "--enable-threads"] + options.extend(self.enable_or_disable("shared")) + if not self.compiler.f77 or not self.compiler.fc: options.append("--disable-fortran") if spec.satisfies("@:2"): From 24ed178158f39007cc8d6431f2c623954939ccf3 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:31:17 +0000 Subject: [PATCH 044/104] Update fontconfig --- .../repos/builtin/packages/fontconfig/package.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index d7d60cf345fa0e..3ba6851feccf3f 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -44,16 +44,22 @@ def configure_args(self): args = ["--enable-libxml2", "--disable-docs", "--with-default-fonts={0}".format(font_path)] ldflags = [] libs = [] - for lib in ["libpng", "bzip2"]: - if self.spec[lib].satisfies("+shared") or self.spec[lib].satisfies("libs=shared"): - continue - ldflags.append(self.spec[lib].libs.ld_flags) - libs.append(self.spec[lib].libs.link_flags) + deps = [] + if self.spec["python"].satisfies("~shared"): + deps += ["libpng", "bzip2"] + if self.spec["libxml2"].satisfies("~shared"): + deps += ["zlib", "xz", "iconv"] + if deps: + for lib in deps: + ldflags.append(self.spec[lib].libs.ld_flags) + libs.append(self.spec[lib].libs.link_flags) args.append("LDFLAGS=%s" % " ".join(ldflags)) args.append("LIBS=%s" % " ".join(libs)) + if self.spec.satisfies("+pic"): args.append("CFLAGS=-fPIC") args.append("FFLAGS=-fPIC") + return args From 35c2339171c46273880846fbf4f9e3eb6e150ecf Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:31:46 +0000 Subject: [PATCH 045/104] Update libxml2 --- var/spack/repos/builtin/packages/libxml2/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/libxml2/package.py b/var/spack/repos/builtin/packages/libxml2/package.py index ee27509c28ce68..f1b5d5c7eb8907 100644 --- a/var/spack/repos/builtin/packages/libxml2/package.py +++ b/var/spack/repos/builtin/packages/libxml2/package.py @@ -39,6 +39,7 @@ def url_for_version(self, version): variant("python", default=False, description="Enable Python support") variant("shared", default=True, description="Build shared library") + variant("pic", default=False, description="Enable position-independent code (PIC)") depends_on("pkgconfig@0.9.0:", type="build") depends_on("iconv") @@ -108,6 +109,10 @@ def configure_args(self): args.extend(self.enable_or_disable("shared")) + if spec.satisfies("+pic"): + args.append("CFLAGS=-fPIC") + args.append("FFLAGS=-fPIC") + return args def patch(self): From d10d5224b5dfaf63bdeae736dc9c81c14a9ef274 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 17:40:01 +0000 Subject: [PATCH 046/104] Update proj --- var/spack/repos/builtin/packages/proj/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/proj/package.py b/var/spack/repos/builtin/packages/proj/package.py index 5addfae37b0157..dd48c4a59d74a4 100644 --- a/var/spack/repos/builtin/packages/proj/package.py +++ b/var/spack/repos/builtin/packages/proj/package.py @@ -106,6 +106,10 @@ def configure_args(self): args.extend(self.enable_or_disable("shared")) + if self.spec["libtiff"].satisfies("+jpeg~shared"): + args.append("LDFLAGS=%s" % self.spec["jpeg"].libs.ld_flags) + args.append("LIBS=%s" % self.spec["jpeg"].libs.link_flags) + return args def setup_run_environment(self, env): From e706e823267dcb57b7acab45c3ab1a84be57079b Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 18:06:40 +0000 Subject: [PATCH 047/104] Update libxml2 --- var/spack/repos/builtin/packages/libxml2/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/libxml2/package.py b/var/spack/repos/builtin/packages/libxml2/package.py index f1b5d5c7eb8907..0057a2ac3d07e7 100644 --- a/var/spack/repos/builtin/packages/libxml2/package.py +++ b/var/spack/repos/builtin/packages/libxml2/package.py @@ -111,7 +111,6 @@ def configure_args(self): if spec.satisfies("+pic"): args.append("CFLAGS=-fPIC") - args.append("FFLAGS=-fPIC") return args From 637f290d44f1c55e07f3aa809dc298ecdc74742d Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 18:08:20 +0000 Subject: [PATCH 048/104] update freetype --- var/spack/repos/builtin/packages/freetype/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/freetype/package.py b/var/spack/repos/builtin/packages/freetype/package.py index b1384e7f7f1179..6dddf5946e9bfe 100644 --- a/var/spack/repos/builtin/packages/freetype/package.py +++ b/var/spack/repos/builtin/packages/freetype/package.py @@ -75,7 +75,6 @@ def configure_args(self): def setup_build_environment(self, env): if self.spec.satisfies("+pic"): env.set("CFLAGS", "-fPIC") - env.set("FFLAGS", "-fPIC") class CMakeBuilder(CMakeBuilder): From 4968b3f46f2fb7979f7c62cbbc49c4bfe5f720de Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 18:10:02 +0000 Subject: [PATCH 049/104] update fontconfig --- var/spack/repos/builtin/packages/fontconfig/package.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index 3ba6851feccf3f..ed6641c79d8e64 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -45,10 +45,12 @@ def configure_args(self): ldflags = [] libs = [] deps = [] - if self.spec["python"].satisfies("~shared"): - deps += ["libpng", "bzip2"] + if self.spec["bzip2"].satisfies("~shared"): + deps.append("bzip2") + if not self.spec["libpng"].satisfies("libs=shared"): + deps.append("libpng") if self.spec["libxml2"].satisfies("~shared"): - deps += ["zlib", "xz", "iconv"] + deps.extend(["zlib", "xz", "iconv"]) if deps: for lib in deps: ldflags.append(self.spec[lib].libs.ld_flags) From 2553a798912bca3608361468e5df4db25ed00576 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 18:10:49 +0000 Subject: [PATCH 050/104] update openssl --- var/spack/repos/builtin/packages/openssl/package.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 6c432ff4e078fc..a920648720b0d8 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -494,12 +494,6 @@ def copy_mozilla_certs(self): pkg_cert = join_path(pkg_dir, "cert.pem") install(mozilla_pem, pkg_cert) -# @run_after("install") -# @when("~shared") -# def static_only(self): -# for sharedlibpath in glob.glob(os.path.join(self.spec.prefix.lib, "*.so"): -# os.remove(sharedlibpath) - def patch(self): if self.spec.satisfies("%nvhpc"): # Remove incompatible preprocessor flags From 985c00cbc9d7d159d4b9e1f99d1cb2400a676952 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 18:16:57 +0000 Subject: [PATCH 051/104] update apr-util --- var/spack/repos/builtin/packages/apr-util/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/apr-util/package.py b/var/spack/repos/builtin/packages/apr-util/package.py index d88678a026de45..84e55881de2d51 100644 --- a/var/spack/repos/builtin/packages/apr-util/package.py +++ b/var/spack/repos/builtin/packages/apr-util/package.py @@ -104,7 +104,8 @@ def configure_args(self): if "+crypto" in spec: if spec["openssl"].satisfies("~shared"): - args.append("LIBS=-L%s -lz" % self.spec["zlib"].prefix.lib) + zlibs = self.spec["zlib"].libs + args.append("LIBS={0} {1}".format(zlibs.ld_flags, zlibs.link_flags)) return args From 924782ac4392f885c02d9c5dff0a62ad58fb468f Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 18:43:41 +0000 Subject: [PATCH 052/104] add pic to gettext --- var/spack/repos/builtin/packages/gettext/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/gettext/package.py b/var/spack/repos/builtin/packages/gettext/package.py index e31cfbb82b65d0..ccc35209c7cb79 100644 --- a/var/spack/repos/builtin/packages/gettext/package.py +++ b/var/spack/repos/builtin/packages/gettext/package.py @@ -33,6 +33,7 @@ class Gettext(AutotoolsPackage, GNUMirrorPackage): variant("bzip2", default=True, description="Enable bzip2 support") variant("xz", default=True, description="Enable xz support") variant("shared", default=True, description="Build shared libraries") + variant("pic", default=True, description="Enable position-independent code (PIC)") # Optional variants variant("libunistring", default=False, description="Use libunistring") @@ -113,6 +114,9 @@ def configure_args(self): else: config_args.append("--with-included-libunistring") + if spec.satisfies("+pic"): + config_args.append("CFLAGS=-fPIC") + return config_args @property From 6728d9bdbfffb22fff0d20e353bfa71b2ff86544 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 19:41:30 +0000 Subject: [PATCH 053/104] Update subversion --- .../builtin/packages/subversion/package.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/var/spack/repos/builtin/packages/subversion/package.py b/var/spack/repos/builtin/packages/subversion/package.py index 10ae29a1f5f83f..60185d2e8f57a6 100644 --- a/var/spack/repos/builtin/packages/subversion/package.py +++ b/var/spack/repos/builtin/packages/subversion/package.py @@ -103,16 +103,17 @@ def configure_args(self): args.append("APXS=no") if "+nls" in spec: - args.extend( - [ - "LDFLAGS={0}".format(spec["gettext"].libs.search_flags), - # Using .libs.link_flags is the canonical way to add these arguments, - # but since libintl is much smaller than the rest and also the only - # necessary one, we specify it by hand here. - "LIBS=-lintl", - "--enable-nls", - ] - ) + ldflags = [spec["gettext"].libs.search_flags] + # Using .libs.link_flags is the canonical way to add these arguments, + # but since libintl is much smaller than the rest and also the only + # necessary one, we specify it by hand here. + libs = ["-lintl"] + if spec["gettext"].satisfies("~shared"): + ldflags.append(spec["iconv"].libs.search_flags) + libs.append(spec["iconv"].libs.link_flags) + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) + args.append("--enable-nls") else: args.append("--disable-nls") From b81a175a56d306cc1873d3dd0b00f42edbcaa74a Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 21 Mar 2023 20:11:42 +0000 Subject: [PATCH 054/104] update libxkbcommon --- .../builtin/packages/libxkbcommon/package.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/libxkbcommon/package.py b/var/spack/repos/builtin/packages/libxkbcommon/package.py index 054f05e9bdcecf..c3233a4f74314a 100644 --- a/var/spack/repos/builtin/packages/libxkbcommon/package.py +++ b/var/spack/repos/builtin/packages/libxkbcommon/package.py @@ -49,20 +49,29 @@ class Libxkbcommon(MesonPackage, AutotoolsPackage): depends_on("wayland@1.2.0:", when="+wayland") depends_on("wayland-protocols@1.7:", when="+wayland") - class MesonBuilder(spack.build_systems.meson.MesonBuilder): def meson_args(self): - return [ + args = [ "-Dxkb-config-root={0}".format(self.spec["xkbdata"].prefix), "-Denable-docs=false", "-Denable-wayland=" + str(self.spec.satisfies("+wayland")), ] + return args + + def setup_build_environment(self, env): + if self.spec["libxml2"].satisfies("~shared"): + deps = ["zlib", "xz", "iconv"] + ldflags = [self.spec[lib].libs.search_flags for lib in deps] + libs = [self.spec[lib].libs.link_flags for lib in deps] + env.set("LDFLAGS", " ".join(ldflags+libs)) class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): def configure_args(self): """Configure arguments are passed using meson_args functions""" - return [ + args = [ "--with-xkb-config-root={0}".format(self.spec["xkbdata"].prefix), "--disable-docs", ] + self.enable_or_disable("wayland") + + return args From fb0063021b42acd7999156b26d1d769395589b51 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 22 Mar 2023 00:40:39 +0000 Subject: [PATCH 055/104] update proj --- var/spack/repos/builtin/packages/proj/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/var/spack/repos/builtin/packages/proj/package.py b/var/spack/repos/builtin/packages/proj/package.py index dd48c4a59d74a4..0c911325136820 100644 --- a/var/spack/repos/builtin/packages/proj/package.py +++ b/var/spack/repos/builtin/packages/proj/package.py @@ -48,6 +48,7 @@ class Proj(AutotoolsPackage): variant("tiff", default=True, description="Enable TIFF support") variant("curl", default=True, description="Enable curl support") variant("shared", default=True, description="Enable shared libraries") + variant("pic", default=False, description="Enable position-independent code (PIC)") # https://github.com/OSGeo/PROJ#distribution-files-and-format # https://github.com/OSGeo/PROJ-data @@ -105,6 +106,7 @@ def configure_args(self): args.append("--without-curl") args.extend(self.enable_or_disable("shared")) + args.extend(self.with_or_without("pic")) if self.spec["libtiff"].satisfies("+jpeg~shared"): args.append("LDFLAGS=%s" % self.spec["jpeg"].libs.ld_flags) From bc6fc63f3dba8bedc58ca67f8275705fdeeb43c3 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 22 Mar 2023 00:40:43 +0000 Subject: [PATCH 056/104] update libtiff --- var/spack/repos/builtin/packages/libtiff/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/libtiff/package.py b/var/spack/repos/builtin/packages/libtiff/package.py index d22ea8c650470a..15acac06c8f1d7 100644 --- a/var/spack/repos/builtin/packages/libtiff/package.py +++ b/var/spack/repos/builtin/packages/libtiff/package.py @@ -73,6 +73,7 @@ class Libtiff(CMakePackage, AutotoolsPackage): variant("webp", default=False, description="use libwebp", when="@4.0.10:") variant("shared", default=True, description="Build shared") + variant("pic", default=False, description="Enable position-independent code (PIC)") build_system( conditional("cmake", when="@4.0.5:"), @@ -117,6 +118,8 @@ class CMakeBuilder(CMakeBuilder): def cmake_args(self): args = [self.define_from_variant(var) for var in VARIANTS] args += [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] +# args += [self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")] + args += ["-DCMAKE_POSITION_INDEPENDENT_CODE=ON"] # Remove empty strings args = [arg for arg in args if arg] @@ -130,5 +133,6 @@ def configure_args(self): for var in VARIANTS: args.extend(self.enable_or_disable(var)) args.extend(self.enable_or_disable("shared")) + args.extend(self.with_or_without("pic")) return args From 5f87ec0e8b6f61aa0aae850b043e713590f0dab3 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 22 Mar 2023 00:40:54 +0000 Subject: [PATCH 057/104] update libgeotiff --- .../repos/builtin/packages/libgeotiff/package.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/var/spack/repos/builtin/packages/libgeotiff/package.py b/var/spack/repos/builtin/packages/libgeotiff/package.py index e6782ea864379a..a293e88afcf2af 100644 --- a/var/spack/repos/builtin/packages/libgeotiff/package.py +++ b/var/spack/repos/builtin/packages/libgeotiff/package.py @@ -74,4 +74,16 @@ def configure_args(self): else: args.append("--with-proj=no") + if self.spec["proj"].satisfies("~shared"): + ldflags = [] + libs = [] + for dep in ["sqlite", "libtiff", "curl", "openssl"]: + if dep not in self.spec: + continue + ldflags.append(self.spec[dep].libs.search_flags) + libs.append(self.spec[dep].libs.link_flags) + if ldflags or libs: + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) + return args From 3e1ff05cac2d821f87b7d40ed9c92958f08e15e9 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 00:17:58 +0000 Subject: [PATCH 058/104] Enable openssh to use static openssl --- var/spack/repos/builtin/packages/openssh/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/openssh/package.py b/var/spack/repos/builtin/packages/openssh/package.py index fa692c1d2b6ff8..2d6082fd6e13fa 100755 --- a/var/spack/repos/builtin/packages/openssh/package.py +++ b/var/spack/repos/builtin/packages/openssh/package.py @@ -91,6 +91,11 @@ def configure_args(self): # Somehow creating pie executables fails with nvhpc, not with gcc. if "%nvhpc" in self.spec: args.append("--without-pie") + + if self.spec["openssl"].satisfies("~shared"): + z = self.spec["zlib"] + args.append("LIBS=-L{0} -lz".format(z.prefix.lib)) + return args def install(self, spec, prefix): From 81052b8c02b35c182b57a38ef2c52c2daa8a70e5 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:07:52 +0000 Subject: [PATCH 059/104] Enable static deps for cdo --- .../repos/builtin/packages/cdo/package.py | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/cdo/package.py b/var/spack/repos/builtin/packages/cdo/package.py index 4d6b11bcabd6de..acaa06620a0376 100644 --- a/var/spack/repos/builtin/packages/cdo/package.py +++ b/var/spack/repos/builtin/packages/cdo/package.py @@ -186,7 +186,7 @@ class Cdo(AutotoolsPackage): # Internal compiler error when building with Intel 2022.1.2 # https://github.com/NOAA-EMC/spack-stack/issues/248 - patch("intel-compare.patch", when="%intel") + patch("intel-compare.patch", when="%intel@2022.1.2") def configure_args(self): config_args = [] @@ -255,6 +255,10 @@ def yes_or_prefix(spec_name): config_args += self.with_or_without( "udunits2", activation_value=lambda x: yes_or_prefix("udunits") ) + if self.spec.satisfies("+udunits2"): + if self.spec["udunits"].satisfies("~shared"): + flags["LDFLAGS"].append("-L%s" % self.spec["expat"].prefix.lib) + flags["LIBS"].append("-lexpat") if "+libxml2" in self.spec: libxml2_spec = self.spec["libxml2"] @@ -267,10 +271,34 @@ def yes_or_prefix(spec_name): flags["CPPFLAGS"].append(libxml2_spec.headers.include_flags) else: config_args.append("--with-libxml2=" + libxml2_spec.prefix) + if self.spec["libxml2"].satisfies("~shared"): + for lib in ["libiconv", "xz"]: + flags["LDFLAGS"].append(self.spec[lib].libs.search_flags) + flags["LIBS"].append(self.spec[lib].libs.link_flags) else: config_args.append("--without-libxml2") config_args += self.with_or_without("proj", activation_value=yes_or_prefix) + if self.spec.satisfies("+proj"): + if self.spec["proj"].satisfies("~shared"): + if self.spec["proj"].satisfies("^sqlite"): + flags["LDFLAGS"].append("-L%s" % self.spec["sqlite"].prefix.lib) + flags["LIBS"].append("-lsqlite3") + if self.spec["proj"].satisfies("+tiff"): + flags["LDFLAGS"].append("-L%s" % self.spec["libtiff"].prefix.lib) + flags["LIBS"].append("-ltiff") + if self.spec["libtiff"].satisfies("+zlib"): + flags["LDFLAGS"].append("-L%s" % self.spec["zlib"].prefix.lib) + flags["LIBS"].append("-lz") + if self.spec["libtiff"].satisfies("+jpeg"): + flags["LDFLAGS"].append("-L%s" % self.spec["jpeg"].prefix.lib) + flags["LIBS"].append(self.spec["jpeg"].libs.link_flags) + if self.spec["proj"].satisfies("+curl"): + flags["LDFLAGS"].append("-L%s" % self.spec["curl"].prefix.lib) + flags["LIBS"].append("-lcurl") + if self.spec["curl"].satisfies("tls=openssl"): + flags["LDFLAGS"].append("-L%s" % self.spec["openssl"].prefix.lib) + flags["LIBS"].append("-lssl -lcrypto") config_args += self.with_or_without("curl", activation_value=yes_or_prefix) From b515b92b3d274b51382be0bb3ea6ec79da77f31b Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:52:08 +0000 Subject: [PATCH 060/104] Allow static build/deps for GDAL --- .../repos/builtin/packages/gdal/package.py | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index b3ed16f6bff4b9..7e610c23c34a46 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -228,6 +228,7 @@ class Gdal(CMakePackage, AutotoolsPackage, PythonExtension): variant("php", default=False, when="@:2.3", description="Build PHP bindings") variant("shared", default=True, description="Build shared libraries") + variant("pic", default=False, description="Enable position-independent code (PIC)") # Build system build_system( @@ -470,7 +471,6 @@ class CMakeBuilder(CMakeBuilder): def cmake_args(self): # https://gdal.org/build_hints.html args = [ - self.define_from_variant("BUILD_SHARED_LIBS", "shared"), # Only use Spack-installed dependencies self.define("GDAL_USE_EXTERNAL_LIBS", False), self.define("GDAL_USE_INTERNAL_LIBS", False), @@ -555,6 +555,8 @@ def cmake_args(self): self.define_from_variant("BUILD_JAVA_BINDINGS", "java"), self.define_from_variant("BUILD_CSHARP_BINDINGS", "csharp"), ] + args.extend(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + args.extend(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "PIC")) # Remove empty strings args = [arg for arg in args if arg] @@ -598,7 +600,6 @@ def configure_args(self): # https://trac.osgeo.org/gdal/wiki/BuildHints args = [ "--prefix={}".format(self.prefix), - self.enable_or_disable("shared"), # Required dependencies "--with-geotiff={}".format(self.spec["libgeotiff"].prefix), "--with-libjson-c={}".format(self.spec["json-c"].prefix), @@ -687,6 +688,9 @@ def configure_args(self): self.with_or_without("php"), ] + args.extend(self.enable_or_disable("shared")) + args.extend(self.with_or_without("pic")) + # Renamed or modified flags if self.spec.satisfies("@3:"): args.extend( @@ -717,16 +721,40 @@ def configure_args(self): else: args.append(self.with_or_without("dwgdirect", variant="teigha", package="teigha")) + ldflags = [] + libs = [] + if "+hdf4" in self.spec: hdf4 = self.spec["hdf"] if "+external-xdr" in hdf4 and hdf4["rpc"].name != "libc": - args.append("LIBS=" + hdf4["rpc"].libs.link_flags) + libs.append(hdf4["rpc"].libs.link_flags) + + deps = [] + if self.spec["proj"].satisfies("~shared"): + deps += ["sqlite", "libtiff", "curl", "openssl"] + for dep in deps: + if dep not in self.spec: + continue + ldflags.append(self.spec[dep].libs.search_flags) + libs.append(self.spec[dep].libs.link_flags) +# if self.spec.satisfies("+iconv") and self.spec["libiconv"].satisfies("~shared"): + libs.append("-liconv") + + if ldflags: # or libs: + args.append("LDFLAGS=%s" % " ".join(ldflags+libs)) + args.append("LIBS=%s" % " ".join(libs)) + # Remove empty strings args = [arg for arg in args if arg] return args + @run_after("autoreconf") + @when("^geos~shared") + def patch(self): + filter_file("--ldflags` -lgeos_c", "--ldflags` -lgeos_c -lgeos", "configure") + def build(self, pkg, spec, prefix): # https://trac.osgeo.org/gdal/wiki/GdalOgrInJavaBuildInstructionsUnix make() From f14889eb3cad28a87c1e4b1cf16ba104891c2468 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:52:50 +0000 Subject: [PATCH 061/104] iconv fix for GDAL --- var/spack/repos/builtin/packages/gdal/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index 7e610c23c34a46..d7c0a4ae7581f1 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -737,8 +737,8 @@ def configure_args(self): continue ldflags.append(self.spec[dep].libs.search_flags) libs.append(self.spec[dep].libs.link_flags) -# if self.spec.satisfies("+iconv") and self.spec["libiconv"].satisfies("~shared"): - libs.append("-liconv") + if self.spec.satisfies("+iconv") and self.spec["libiconv"].satisfies("~shared"): + libs.append("-liconv") if ldflags: # or libs: args.append("LDFLAGS=%s" % " ".join(ldflags+libs)) From 08357ec6e207aedd126328916c9f7a482de67033 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:53:08 +0000 Subject: [PATCH 062/104] Add find_libraries for geos --- var/spack/repos/builtin/packages/geos/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/geos/package.py b/var/spack/repos/builtin/packages/geos/package.py index 365532d6ea9e3a..fc916733757183 100644 --- a/var/spack/repos/builtin/packages/geos/package.py +++ b/var/spack/repos/builtin/packages/geos/package.py @@ -69,6 +69,11 @@ class Geos(CMakePackage): def command(self): return Executable(self.prefix.bin.join("geos-config")) + @property + def libs(self): + libs = find_libraries(["libgeos"], root=self.prefix, recursive=True, shared=self.spec.variants["shared"].value) + return libs + def cmake_args(self): args = [] From 50a955bc634cc95cc6bce7a3c7ffcf0cd745ae76 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:54:13 +0000 Subject: [PATCH 063/104] Revert "Add find_libraries for geos" This reverts commit 08357ec6e207aedd126328916c9f7a482de67033. --- var/spack/repos/builtin/packages/geos/package.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/geos/package.py b/var/spack/repos/builtin/packages/geos/package.py index fc916733757183..365532d6ea9e3a 100644 --- a/var/spack/repos/builtin/packages/geos/package.py +++ b/var/spack/repos/builtin/packages/geos/package.py @@ -69,11 +69,6 @@ class Geos(CMakePackage): def command(self): return Executable(self.prefix.bin.join("geos-config")) - @property - def libs(self): - libs = find_libraries(["libgeos"], root=self.prefix, recursive=True, shared=self.spec.variants["shared"].value) - return libs - def cmake_args(self): args = [] From 18a2c7daac2527e9d7f0983550d15f5a16dae470 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:55:24 +0000 Subject: [PATCH 064/104] Enable static deps for glib --- var/spack/repos/builtin/packages/glib/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/var/spack/repos/builtin/packages/glib/package.py b/var/spack/repos/builtin/packages/glib/package.py index a83cb744897521..1059d5501b07b9 100644 --- a/var/spack/repos/builtin/packages/glib/package.py +++ b/var/spack/repos/builtin/packages/glib/package.py @@ -169,6 +169,15 @@ def patch(self): def libs(self): return find_libraries(["libglib*"], root=self.prefix, recursive=True) + def setup_build_environment(self, env): + spec = self.spec + if spec["gettext"].satisfies("~shared"): + ldflags = [spec["gettext"].libs.search_flags] + libs = ["-lintl"] + ldflags.append(spec["iconv"].libs.search_flags) + libs.append(spec["iconv"].libs.link_flags) + env.set("LDFLAGS", " ".join(ldflags+libs)) + def meson_args(self): args = [] if self.spec.satisfies("@:2.72"): From 58bb45cb4d6deb533b65e431c339dda4e009d26a Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:56:29 +0000 Subject: [PATCH 065/104] Add libs property/find_libraries to libiconv --- var/spack/repos/builtin/packages/libiconv/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/libiconv/package.py b/var/spack/repos/builtin/packages/libiconv/package.py index d80be75d4dbe03..c7f8d1e947cc9b 100644 --- a/var/spack/repos/builtin/packages/libiconv/package.py +++ b/var/spack/repos/builtin/packages/libiconv/package.py @@ -41,3 +41,8 @@ def configure_args(self): # A hack to patch config.guess in the libcharset sub directory copy("./build-aux/config.guess", "libcharset/build-aux/config.guess") return args + + @property + def libs(self): + shared = "libs=shared" in self.spec + return find_libraries(["libiconv"], root=self.prefix, recursive=True, shared=shared) From b268188ed56ccfa2a1030b4f26e2f3ca307b79d5 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 20:59:04 +0000 Subject: [PATCH 066/104] Update openssl to allow find_libraries to find static libs --- var/spack/repos/builtin/packages/openssl/package.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index a920648720b0d8..47dd044f37e320 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -348,7 +348,12 @@ def determine_version(cls, exe): @property def libs(self): - return find_libraries(["libssl", "libcrypto"], root=self.prefix, recursive=True) + return find_libraries( + ["libssl", "libcrypto"], + root=self.prefix, + recursive=True, + shared=self.spec.variants["shared"].value + ) def handle_fetch_error(self, error): tty.warn( From e1f43c4e765007a621e7c37885241dc17bebe02a Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Sat, 1 Apr 2023 21:22:00 +0000 Subject: [PATCH 067/104] Add static cairo support for gobject-introspection --- .../packages/gobject-introspection/package.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/var/spack/repos/builtin/packages/gobject-introspection/package.py b/var/spack/repos/builtin/packages/gobject-introspection/package.py index 624d0941f8e93a..1b2e2bed93a0ce 100644 --- a/var/spack/repos/builtin/packages/gobject-introspection/package.py +++ b/var/spack/repos/builtin/packages/gobject-introspection/package.py @@ -86,6 +86,20 @@ def setup_build_environment(self, env): if self.spec.satisfies("@:1.60"): env.set("SPACK_SBANG", sbang.sbang_install_path()) + cairo = self.spec["cairo"] + if cairo.satisfies("~shared"): + ldflags = [] + libs = [] + if cairo.satisfies("+fc"): + ldflags.append("-L%s" % cairo["fontconfig"].prefix.lib) + libs.append("-lfontconfig") + if cairo.satisfies("+ft"): + ldflags.append("-L%s" % cairo["freetype"].prefix.lib) + libs.append("-lfreetype") + ldflags.append("-L%s" % cairo["pixman"].prefix.lib) + libs.append("-lpixman-1") + env.set("CFLAGS", " ".join(ldflags)+" "+" ".join(libs)) + def setup_run_environment(self, env): env.prepend_path("GI_TYPELIB_PATH", join_path(self.prefix.lib, "girepository-1.0")) From 4c707639224a68297569845d48a39c7fdfaca981 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:43:51 +0000 Subject: [PATCH 068/104] Enable qt to use static openssl --- var/spack/repos/builtin/packages/qt/package.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index 4529f7e3fed523..1db1ee64621429 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -329,6 +329,10 @@ def setup_build_environment(self, env): llvm_path = "/spack-disable-llvm" env.set("LLVM_INSTALL_DIR", llvm_path) + if self.spec.satisfies("+ssl"): + if self.spec["openssl"].satisfies("~shared"): + env.set("OPENSSL_LIBS", "-lssl -lcrypto -lz") + def setup_run_environment(self, env): env.set("QTDIR", self.prefix) env.set("QTINC", self.prefix.inc) @@ -506,6 +510,12 @@ def patch(self): with open(conf_file, "a") as f: f.write("QMAKE_CXXFLAGS += -std=gnu++98\n") + @when("~shared") + @run_before("configure") + def patch(self): + filter_file("libs-only-L", "libs-only-L --static", "qtbase/mkspecs/features/qt_configure.prf") + filter_file("libs-only-l", "libs-only-l --static", "qtbase/mkspecs/features/qt_configure.prf") + def _dep_appender_factory(self, config_args): spec = self.spec @@ -576,6 +586,7 @@ def common_config_args(self): config_args.append("-no-openvg") else: # FIXME: those could work for other versions + use_spack_dep("libtiff", "tiff") use_spack_dep("libpng") use_spack_dep("jpeg", "libjpeg") use_spack_dep("zlib") From da414af79d1ad2ccc6d2b5af448ab62f4a361564 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:44:15 +0000 Subject: [PATCH 069/104] Add shared/pic variants to pixman --- var/spack/repos/builtin/packages/pixman/package.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/pixman/package.py b/var/spack/repos/builtin/packages/pixman/package.py index b20c7f847d28b9..bb0f3d740bcc46 100644 --- a/var/spack/repos/builtin/packages/pixman/package.py +++ b/var/spack/repos/builtin/packages/pixman/package.py @@ -25,6 +25,9 @@ class Pixman(AutotoolsPackage): depends_on("pkgconfig", type="build") depends_on("libpng") + variant("shared", default=True, description="Build shared library") + variant("pic", default=False, description="Enable position-independent code") + # As discussed here: # https://bugs.freedesktop.org/show_bug.cgi?id=104886 # __builtin_shuffle was removed in clang 5.0. @@ -54,7 +57,7 @@ def patch_config_h_for_intel(self): @property def libs(self): - return find_libraries("libpixman-1", self.prefix, shared=True, recursive=True) + return find_libraries("libpixman-1", self.prefix, shared=self.spec.satisfies("+shared"), recursive=True) def configure_args(self): args = [ @@ -65,4 +68,7 @@ def configure_args(self): if sys.platform == "darwin": args.append("--disable-mmx") + args.extend(self.enable_or_disable("shared")) + args.extend(self.with_or_without("pic")) + return args From a4bc4d920d05ea9440ff81449aa4b6db45aa3874 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:44:32 +0000 Subject: [PATCH 070/104] Allow pango to use static cairo --- var/spack/repos/builtin/packages/pango/package.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/var/spack/repos/builtin/packages/pango/package.py b/var/spack/repos/builtin/packages/pango/package.py index b3480c76286d47..1d357bb3eb8817 100644 --- a/var/spack/repos/builtin/packages/pango/package.py +++ b/var/spack/repos/builtin/packages/pango/package.py @@ -126,6 +126,15 @@ def configure_args(self): args.append("GTKDOC_MKPDF={0}".format(true)) args.append("GTKDOC_REBASE={0}".format(true)) + if self.spec["cairo"].satisfies("~shared"): + ldflags = [self.spec["pixman"].libs.search_flags] + libs = [self.spec["pixman"].libs.link_flags] + if self.spec["cairo"].satisfies("+png"): + ldflags.append(self.spec["libpng"].libs.search_flags) + libs.append(self.spec["libpng"].libs.link_flags) + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) + return args def setup_run_environment(self, env): From 6335b0550d8d0b3428a1804eec5d9a08ecbb9468 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:45:03 +0000 Subject: [PATCH 071/104] Enable static deps for harfbuzz --- .../builtin/packages/harfbuzz/package.py | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/var/spack/repos/builtin/packages/harfbuzz/package.py b/var/spack/repos/builtin/packages/harfbuzz/package.py index e67bba65a7e5ac..08410a40920323 100644 --- a/var/spack/repos/builtin/packages/harfbuzz/package.py +++ b/var/spack/repos/builtin/packages/harfbuzz/package.py @@ -123,19 +123,6 @@ def setup_dependent_build_environment(self, env, dependent_spec): env.prepend_path("XDG_DATA_DIRS", self.prefix.share) env.prepend_path("GI_TYPELIB_PATH", join_path(self.prefix.lib, "girepository-1.0")) - def setup_build_environment(self, env): - ldflags = [] - libs = [] - for lib in ["bzip2", "zlib", "libpng"]: - spec = self.spec[lib] - if spec.satisfies("+shared") or spec.satisfies("libs=shared"): - continue - ldflags.append(spec.libs.ld_flags) - libs.append(spec.libs.link_flags) - if ldflags: - env.set("LDFLAGS", " ".join(ldflags)) - env.set("LIBS", " ".join(libs)) - class MesonBuilder(spack.build_systems.meson.MesonBuilder, SetupEnvironment): def meson_args(self): @@ -163,4 +150,29 @@ def configure_args(self): args.extend(self.with_or_without("graphite2")) args.extend(self.with_or_without("coretext")) + ldflags = [] + libs = [] + for lib in ["bzip2", "zlib", "libpng"]: + spec = self.spec[lib] + if spec.satisfies("+shared") or spec.satisfies("libs=shared"): + continue + ldflags.append(spec.libs.ld_flags) + libs.append(spec.libs.link_flags) + cairo = self.spec["cairo"] + if cairo.satisfies("~shared"): + if cairo.satisfies("+fc"): + ldflags.append("-L%s" % cairo["fontconfig"].prefix.lib) + libs.append("-lfontconfig") + if cairo.satisfies("+ft"): + ldflags.append("-L%s" % cairo["freetype"].prefix.lib) + libs.append("-lfreetype") + if cairo.satisfies("+png"): + ldflags.append("-L%s" % cairo["libpng"].prefix.lib) + libs.append("-lpng") + ldflags.append("-L%s" % cairo["pixman"].prefix.lib) + libs.append("-lpixman-1") + if ldflags: + args.append("LDFLAGS=%s" % " ".join(ldflags)) + args.append("LIBS=%s" % " ".join(libs)) + return args From ab8db237d5d7831a669a43a280fef261c2fb798a Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:45:29 +0000 Subject: [PATCH 072/104] Add shared variant for freetype --- var/spack/repos/builtin/packages/freetype/package.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/var/spack/repos/builtin/packages/freetype/package.py b/var/spack/repos/builtin/packages/freetype/package.py index 6dddf5946e9bfe..9838ffcae80cfe 100644 --- a/var/spack/repos/builtin/packages/freetype/package.py +++ b/var/spack/repos/builtin/packages/freetype/package.py @@ -44,6 +44,7 @@ class Freetype(AutotoolsPackage, CMakePackage): "support __builtin_shuffle)", ) + variant("shared", default=True, description="Build shared libraries") variant( "pic", default=False, @@ -70,6 +71,7 @@ def configure_args(self): ] if self.spec.satisfies("@2.9.1:"): args.append("--enable-freetype-config") + args.extend(self.enable_or_disable("shared")) return args def setup_build_environment(self, env): @@ -85,5 +87,6 @@ def cmake_args(self): self.define("FT_DISABLE_HARFBUZZ", True), self.define("FT_REQUIRE_PNG", True), self.define("FT_REQUIRE_BZIP2", True), + self.define_from_variant("BUILD_SHARED_LIBS", "shared"), self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), ] From f40d3af54a7b050c8a30ab1afe49d5a9f15a135e Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:46:05 +0000 Subject: [PATCH 073/104] Add support for static freetype to cairo --- var/spack/repos/builtin/packages/cairo/package.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/var/spack/repos/builtin/packages/cairo/package.py b/var/spack/repos/builtin/packages/cairo/package.py index 4194e1d528df26..559a4f8d4bc52d 100644 --- a/var/spack/repos/builtin/packages/cairo/package.py +++ b/var/spack/repos/builtin/packages/cairo/package.py @@ -40,6 +40,7 @@ class Cairo(AutotoolsPackage): variant("png", default=False, description="Enable cairo's PNG functions feature") variant("svg", default=False, description="Enable cairo's SVN functions feature") variant("shared", default=True, description="Build shared libraries") + variant("pic", default=False, description="Enable position-independent code (PIC)") depends_on("libx11", when="+X") depends_on("libxext", when="+X") @@ -85,6 +86,12 @@ def configure_args(self): args.extend(self.enable_or_disable("ft")) args.extend(self.enable_or_disable("fc")) args.extend(self.enable_or_disable("shared")) + args.extend(self.with_or_without("pic")) + + if self.spec.satisfies("+ft"): + if self.spec["freetype"].satisfies("~shared"): + args.append("LDFLAGS=%s" % self.spec["bzip2"].libs.search_flags) + args.append("LIBS=%s" % self.spec["bzip2"].libs.link_flags) return args From 440cd6c565e45a3495a24392cbdcaf1bccbbb317 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 22:46:49 +0000 Subject: [PATCH 074/104] Support static openssl for ecflow --- .../repos/builtin/packages/ecflow/package.py | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/ecflow/package.py b/var/spack/repos/builtin/packages/ecflow/package.py index 5d625bb5bce821..19438c7cd3acf6 100644 --- a/var/spack/repos/builtin/packages/ecflow/package.py +++ b/var/spack/repos/builtin/packages/ecflow/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os + from spack.package import * from spack.pkg.builtin.boost import Boost @@ -73,19 +75,30 @@ def patch(self): "Pyext/CMakeLists.txt", ) + @when("+ssl") + def setup_build_environment(self, env): + env.set("LIBS", self.spec["zlib"].libs.search_flags) + def cmake_args(self): - boost_lib = self.spec["boost"].prefix.lib - return [ + spec = self.spec + boost_lib = spec["boost"].prefix.lib + args = [ self.define("Boost_PYTHON_LIBRARY_RELEASE", boost_lib), self.define_from_variant("ENABLE_UI", "ui"), self.define_from_variant("ENABLE_GUI", "ui"), self.define_from_variant("ENABLE_SSL", "ssl"), # https://jira.ecmwf.int/browse/SUP-2641#comment-208943 self.define_from_variant("ENABLE_STATIC_BOOST_LIBS", "static_boost"), - self.define("Python3_EXECUTABLE", self.spec["python"].package.command), - self.define("BOOST_ROOT", self.spec["boost"].prefix), + self.define("Python3_EXECUTABLE", spec["python"].package.command), + self.define("BOOST_ROOT", spec["boost"].prefix), ] + if spec.satisfies("+ssl ^openssl ~shared"): + ssl_libs = [os.path.join(spec["openssl"].prefix.lib, "libcrypto.a"), spec["zlib"].libs[0]] + args.append(self.define("OPENSSL_CRYPTO_LIBRARY", ";".join(ssl_libs))) + + return args + # A recursive link in the ecflow source code causes the binary cache # creation to fail. This file is only in the install tree if the # --source option is set when installing the package, but force_remove @@ -93,3 +106,8 @@ def cmake_args(self): @run_after("install") def remove_recursive_symlink_in_source_code(self): force_remove(join_path(self.prefix, "share/ecflow/src/cereal/cereal")) + + @when("+ssl") + def patch(self): + for sdir in ["Client", "Server"]: + filter_file("(target_link_libraries.*pthread)", r"\1 ssl crypto z", os.path.join(sdir, "CMakeLists.txt")) From 58a3ca409bf7f7931ced41774444fa5653439f60 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 5 Apr 2023 23:36:49 +0000 Subject: [PATCH 075/104] pic bug fix for GDAL --- var/spack/repos/builtin/packages/gdal/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index d7c0a4ae7581f1..7f7091af65def1 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -689,7 +689,7 @@ def configure_args(self): ] args.extend(self.enable_or_disable("shared")) - args.extend(self.with_or_without("pic")) + args.append(self.with_or_without("pic")) # Renamed or modified flags if self.spec.satisfies("@3:"): From a5e04831b8e36ee20039eca7753c2978c0c3f93d Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Thu, 6 Apr 2023 16:43:45 +0000 Subject: [PATCH 076/104] Update ecflow/static openssl --- var/spack/repos/builtin/packages/ecflow/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/ecflow/package.py b/var/spack/repos/builtin/packages/ecflow/package.py index 19438c7cd3acf6..eccf02c01960a5 100644 --- a/var/spack/repos/builtin/packages/ecflow/package.py +++ b/var/spack/repos/builtin/packages/ecflow/package.py @@ -91,10 +91,12 @@ def cmake_args(self): self.define_from_variant("ENABLE_STATIC_BOOST_LIBS", "static_boost"), self.define("Python3_EXECUTABLE", spec["python"].package.command), self.define("BOOST_ROOT", spec["boost"].prefix), + self.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON"), ] if spec.satisfies("+ssl ^openssl ~shared"): - ssl_libs = [os.path.join(spec["openssl"].prefix.lib, "libcrypto.a"), spec["zlib"].libs[0]] + ssl_libs = [os.path.join(spec["openssl"].prefix.lib, "libcrypto.a")] + ssl_libs.extend(spec["zlib"].libs) args.append(self.define("OPENSSL_CRYPTO_LIBRARY", ";".join(ssl_libs))) return args From 9dd367080cf3a45e977588355c2ce162e42f954b Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 12 Apr 2023 01:45:27 +0000 Subject: [PATCH 077/104] Add madis --- .../repos/builtin/packages/madis/package.py | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 var/spack/repos/builtin/packages/madis/package.py diff --git a/var/spack/repos/builtin/packages/madis/package.py b/var/spack/repos/builtin/packages/madis/package.py new file mode 100644 index 00000000000000..acdc36c7c7c5bd --- /dev/null +++ b/var/spack/repos/builtin/packages/madis/package.py @@ -0,0 +1,73 @@ +# 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 + +from spack.package import * + + +class Madis(MakefilePackage): + """ + Meteorological Assimilation Data Ingest System (MADIS) is an observational + database and delivery system which integrates real-time observations from a + wide variety of observing infrastructures to make them useable for + numerical weather prediction models and nowcasting. + """ + + homepage = "https://madis-data.ncep.noaa.gov/" + url = "https://madis-data.ncep.noaa.gov/source/madis-4.3.tar.gz" + + maintainers = ["AlexanderRichert-NOAA"] + + version("4.3", sha256="5d1ee9800c84e623dcf4271653aa66d17a744143e58354e70f8a0646cd6b246c") + + variant("pic", default=True, description="Build with PIC") + variant("pnetcdf", default=False, description="Build with parallel NetCDF") + + depends_on("netcdf-fortran") + depends_on("parallel-netcdf", when="+pnetcdf") + + def setup_build_environment(self, env): + if self.spec.satisfies("+pic"): + env.set("FFLAGS", "-fPIC") + env.set("CFLAGS", "-fPIC") + + ldflags = [] + libs = [] + + if self.spec.satisfies("+pnetcdf"): + pnetcdf = self.spec["parallel-netcdf"] + ldflags.append(pnetcdf.libs.ld_flags) + libs.append(pnetcdf.libs.link_flags) + + nfconfig = which(os.path.join(self.spec["netcdf-fortran"].prefix.bin, "nf-config")) + ldflags.append(nfconfig("--flibs", output=str).strip()) + netcdf_f = self.spec["netcdf-fortran"] + env.set("NETCDF_INC", netcdf_f.prefix.include) + + env.set("NETCDF_LIB", " ".join(ldflags)) + env.set("LIBS", " ".join(libs)) + + def build(self, spec, prefix): + with working_dir("src"): + make("-j1") + + def install(self, spec, prefix): + with working_dir("src"): + make("-j1") + with working_dir(self.build_directory): + copy_tree("bin", prefix.bin) + copy_tree("doc", prefix.doc) + copy_tree("include", prefix.include) + copy_tree("lib", prefix.lib) + copy_tree("src", prefix.src) + copy_tree("static", prefix.static) + + def patch(self): + filter_file("NETCDF_LIB=", "#NETCDF_LIB=", "src/makefile") + filter_file("NETCDF_INC=", "#NETCDF_INC=", "src/makefile") + filter_file("FC=", "#FC=", "src/makefile") + filter_file("FFLAGS=", "#FFLAGS=", "src/makefile") + filter_file("LDFLAGS=", "#LDFLAGS=", "src/makefile") From faa0184b44421ac5591de8f7e71fd27075d1f2be Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 12 Apr 2023 04:06:20 +0000 Subject: [PATCH 078/104] Add pic and shared variants for gsl --- var/spack/repos/builtin/packages/gsl/package.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/var/spack/repos/builtin/packages/gsl/package.py b/var/spack/repos/builtin/packages/gsl/package.py index d209c15e7dfdcb..062cdd77a51d1c 100644 --- a/var/spack/repos/builtin/packages/gsl/package.py +++ b/var/spack/repos/builtin/packages/gsl/package.py @@ -29,6 +29,8 @@ class Gsl(AutotoolsPackage, GNUMirrorPackage): version("1.16", sha256="73bc2f51b90d2a780e6d266d43e487b3dbd78945dd0b04b14ca5980fe28d2f53") variant("external-cblas", default=False, description="Build against external blas") + variant("shared", default=True, description="Build shared library") + variant("pic", default=False, description="Enable position-independent code (PIC)") # from https://dev.gentoo.org/~mgorny/dist/gsl-2.3-cblas.patch.bz2 patch("gsl-2.3-cblas.patch", when="@2.3:2.5+external-cblas") @@ -54,4 +56,7 @@ def configure_args(self): configure_args.append("CBLAS_CFLAGS=%s" % self.spec["blas"].headers.include_flags) configure_args.append("CBLAS_LIBS=%s" % self.spec["blas"].libs.ld_flags) + configure_args.append(self.enable_or_disable("shared")) + configure_args.append(self.with_or_without("pic")) + return configure_args From 8e5b4a06a0d25aaf1acd795b108fa7e64b661acd Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Wed, 12 Apr 2023 04:47:46 +0000 Subject: [PATCH 079/104] fix gsl variant logic --- var/spack/repos/builtin/packages/gsl/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/gsl/package.py b/var/spack/repos/builtin/packages/gsl/package.py index 062cdd77a51d1c..19e29306c40a11 100644 --- a/var/spack/repos/builtin/packages/gsl/package.py +++ b/var/spack/repos/builtin/packages/gsl/package.py @@ -56,7 +56,7 @@ def configure_args(self): configure_args.append("CBLAS_CFLAGS=%s" % self.spec["blas"].headers.include_flags) configure_args.append("CBLAS_LIBS=%s" % self.spec["blas"].libs.ld_flags) - configure_args.append(self.enable_or_disable("shared")) - configure_args.append(self.with_or_without("pic")) + configure_args.extend(self.enable_or_disable("shared")) + configure_args.extend(self.with_or_without("pic")) return configure_args From 1c7889135ff466197aeae0b6329515e0e431bd97 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Tue, 9 May 2023 12:57:57 -0700 Subject: [PATCH 080/104] fix maintainers function for madis --- var/spack/repos/builtin/packages/madis/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/madis/package.py b/var/spack/repos/builtin/packages/madis/package.py index acdc36c7c7c5bd..b093e22d35bdac 100644 --- a/var/spack/repos/builtin/packages/madis/package.py +++ b/var/spack/repos/builtin/packages/madis/package.py @@ -19,7 +19,7 @@ class Madis(MakefilePackage): homepage = "https://madis-data.ncep.noaa.gov/" url = "https://madis-data.ncep.noaa.gov/source/madis-4.3.tar.gz" - maintainers = ["AlexanderRichert-NOAA"] + maintainers("AlexanderRichert-NOAA") version("4.3", sha256="5d1ee9800c84e623dcf4271653aa66d17a744143e58354e70f8a0646cd6b246c") From edb91ea6cc704bb6eb476dd9ae36adbd06928b77 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 30 Mar 2023 10:07:33 -0700 Subject: [PATCH 081/104] perl: add patching to allow building with intel@19.1.3 (#35666) --- var/spack/repos/builtin/packages/perl/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py index 36829578eb9d83..16ca59508cb53c 100644 --- a/var/spack/repos/builtin/packages/perl/package.py +++ b/var/spack/repos/builtin/packages/perl/package.py @@ -152,6 +152,10 @@ def patch(self): # https://github.com/Perl/perl5/issues/15544 long PATH(>1000 chars) fails a test os.chmod("lib/perlbug.t", 0o644) filter_file("!/$B/", "! (/(?:$B|PATH)/)", "lib/perlbug.t") + # Several non-existent flags cause Intel@19.1.3 to fail + with when("%intel@19.1.3"): + os.chmod("hints/linux.sh", 0o644) + filter_file("-we147 -mp -no-gcc", "", "hints/linux.sh") @classmethod def determine_version(cls, exe): From 1746f0aad39615482ba4976dc3d9ddf9761d61b4 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Thu, 13 Apr 2023 06:33:55 -0400 Subject: [PATCH 082/104] lz4: fixup incorrect builder method signature (#36812) --- var/spack/repos/builtin/packages/lz4/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/lz4/package.py b/var/spack/repos/builtin/packages/lz4/package.py index 16fc7bcb9e13f4..43ac03425bc6bf 100644 --- a/var/spack/repos/builtin/packages/lz4/package.py +++ b/var/spack/repos/builtin/packages/lz4/package.py @@ -82,7 +82,7 @@ def cmake_args(self): class MakefileBuilder(MakefileBuilder): - def build(self, spec, prefix): + def build(self, pkg, spec, prefix): par = True if spec.compiler.name == "nvhpc": # relocation error when building shared and dynamic libs in @@ -94,7 +94,7 @@ def build(self, spec, prefix): else: make(parallel=par) - def install(self, spec, prefix): + def install(self, pkg, spec, prefix): make( "install", "PREFIX={0}".format(prefix), From 1c6b17a7846598bd2ddff6ce9b76fd41cb0f6bc8 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 12 May 2023 18:02:40 +0000 Subject: [PATCH 083/104] allow pixman to use static libpng --- var/spack/repos/builtin/packages/pixman/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/var/spack/repos/builtin/packages/pixman/package.py b/var/spack/repos/builtin/packages/pixman/package.py index 376e835ef26231..26dd0462eb73d4 100644 --- a/var/spack/repos/builtin/packages/pixman/package.py +++ b/var/spack/repos/builtin/packages/pixman/package.py @@ -70,4 +70,8 @@ def configure_args(self): args.extend(self.enable_or_disable("shared")) args.extend(self.with_or_without("pic")) + png = self.spec["libpng"] + if png.satisfies("libs=static") and not png.satisfies("libs=shared"): + args.append("LIBS=%s" % which("libpng-config")("--static", "--ldflags", output=str).strip()) + return args From 577d760197d3fb8e431b2010abeb8d8d07602187 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 12 May 2023 19:12:43 +0000 Subject: [PATCH 084/104] Update pic setting for subversion --- var/spack/repos/builtin/packages/subversion/package.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/subversion/package.py b/var/spack/repos/builtin/packages/subversion/package.py index 63c07a304dee1c..2d7badcbe0fd92 100644 --- a/var/spack/repos/builtin/packages/subversion/package.py +++ b/var/spack/repos/builtin/packages/subversion/package.py @@ -117,8 +117,7 @@ def configure_args(self): else: args.append("--disable-nls") - if spec.satisfies("+pic"): - args.append("CFLAGS=-fPIC") + args.extend(self.with_or_without("pic")) return args From f100a38bed5bb697f1c2238a67ddb1233df2fe51 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Fri, 12 May 2023 19:12:52 +0000 Subject: [PATCH 085/104] Update pic setting for lz4 --- var/spack/repos/builtin/packages/lz4/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/lz4/package.py b/var/spack/repos/builtin/packages/lz4/package.py index 43ac03425bc6bf..edfd7958d59c7b 100644 --- a/var/spack/repos/builtin/packages/lz4/package.py +++ b/var/spack/repos/builtin/packages/lz4/package.py @@ -72,6 +72,7 @@ def cmake_args(self): # # no pic on windows if "platform=windows" in self.spec: args.append(self.define("LZ4_POSITION_INDEPENDENT_LIB", False)) + args.append(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")) args.append( self.define("BUILD_SHARED_LIBS", True if "libs=shared" in self.spec else False) ) From b36a674a68423aea2166475a9480954e411a8f49 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 16 May 2023 01:18:06 +0000 Subject: [PATCH 086/104] change fpic to pic for fms in jedi-ufs-env --- .../repos/jcsda-emc-bundles/packages/jedi-ufs-env/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/jcsda-emc-bundles/packages/jedi-ufs-env/package.py b/var/spack/repos/jcsda-emc-bundles/packages/jedi-ufs-env/package.py index 8a276cb4768346..a228743c45953b 100644 --- a/var/spack/repos/jcsda-emc-bundles/packages/jedi-ufs-env/package.py +++ b/var/spack/repos/jcsda-emc-bundles/packages/jedi-ufs-env/package.py @@ -17,7 +17,7 @@ class JediUfsEnv(BundlePackage): version("1.0.0") depends_on("jedi-base-env", type="run") - depends_on("fms@2022.04+fpic", type="run") + depends_on("fms@2022.04+pic", type="run") depends_on("bacio", type="run") depends_on("g2", type="run") From fc417a68a51dd42db5f52b294f8739c0668c9faa Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 16 May 2023 05:19:34 +0000 Subject: [PATCH 087/104] openssl bugfix --- var/spack/repos/builtin/packages/openssl/package.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index f3780b8e476302..3cb5bd08e1a580 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -334,11 +334,9 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package ), ) variant("docs", default=False, description="Install docs and manpages") - with when("platform=linux"): - variant("shared", default=True, description="Build shared library version") + variant("shared", default=False, description="Build shared library version") with when("platform=windows"): variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") - variant("shared", default=False, description="Build shared library version") depends_on("zlib") depends_on("perl@5.14.0:", type=("build", "test")) From 5bc84f8a77f74cbbc1b28e07ffa37bbb94a38c39 Mon Sep 17 00:00:00 2001 From: AlexanderRichert-NOAA Date: Tue, 16 May 2023 06:06:34 +0000 Subject: [PATCH 088/104] shuffle around shared defaults for openssl --- var/spack/repos/builtin/packages/openssl/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 3cb5bd08e1a580..9c6f489a5412dc 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -334,7 +334,9 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package ), ) variant("docs", default=False, description="Install docs and manpages") - variant("shared", default=False, description="Build shared library version") + variant("shared", default=True, description="Build shared library version", when="platform=linux") + variant("shared", default=True, description="Build shared library version", when="platform=macos") + variant("shared", default=False, description="Build shared library version", when="platform=windows") with when("platform=windows"): variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") From c3f0a2c7b0e68c49b2723fb0d97a0fb3929283dd Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 15 May 2023 23:19:49 -0700 Subject: [PATCH 089/104] make +pic default for gsl --- var/spack/repos/builtin/packages/gsl/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gsl/package.py b/var/spack/repos/builtin/packages/gsl/package.py index dd82f289e2f13b..2a5cce4c521488 100644 --- a/var/spack/repos/builtin/packages/gsl/package.py +++ b/var/spack/repos/builtin/packages/gsl/package.py @@ -30,7 +30,7 @@ class Gsl(AutotoolsPackage, GNUMirrorPackage): variant("external-cblas", default=False, description="Build against external blas") variant("shared", default=True, description="Build shared library") - variant("pic", default=False, description="Enable position-independent code (PIC)") + variant("pic", default=True, description="Enable position-independent code (PIC)") # from https://dev.gentoo.org/~mgorny/dist/gsl-2.3-cblas.patch.bz2 patch("gsl-2.3-cblas.patch", when="@2.3:2.5+external-cblas") From 401db85db701d71b2229785e4403e031944cc4ac Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 15 May 2023 23:21:16 -0700 Subject: [PATCH 090/104] correct platform name --- var/spack/repos/builtin/packages/openssl/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 9c6f489a5412dc..f66bb5d3e974d2 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -335,7 +335,7 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package ) variant("docs", default=False, description="Install docs and manpages") variant("shared", default=True, description="Build shared library version", when="platform=linux") - variant("shared", default=True, description="Build shared library version", when="platform=macos") + variant("shared", default=True, description="Build shared library version", when="platform=darwin") variant("shared", default=False, description="Build shared library version", when="platform=windows") with when("platform=windows"): variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") From 8e33ff6dadf42beff3163a6b1b96ae7167182006 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 15 May 2023 23:44:32 -0700 Subject: [PATCH 091/104] test tweak for openssl --- var/spack/repos/builtin/packages/openssl/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index f66bb5d3e974d2..4822c7e74fb06b 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -385,7 +385,7 @@ def install(self, spec, prefix): # where it happens automatically?) env["KERNEL_BITS"] = "64" - options = ["zlib", "shared"] + options = ["zlib"] if spec.satisfies("@1.0"): options.append("no-krb5") # clang does not support the .arch directive in assembly files. @@ -422,6 +422,8 @@ def install(self, spec, prefix): if spec.satisfies("~shared"): base_args.append("no-shared") + else: + base_args.append("shared") # On Windows, we use perl for configuration and build through MSVC # nmake. From 5b30e1d63fdc8690cbbdabae994768f0825c3cee Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Tue, 16 May 2023 10:02:54 -0700 Subject: [PATCH 092/104] revert openssl changes for CI debugging purposes --- .../repos/builtin/packages/openssl/package.py | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 4822c7e74fb06b..d6489c69d1e336 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -3,7 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -#import glob import os import re @@ -334,9 +333,7 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package ), ) variant("docs", default=False, description="Install docs and manpages") - variant("shared", default=True, description="Build shared library version", when="platform=linux") - variant("shared", default=True, description="Build shared library version", when="platform=darwin") - variant("shared", default=False, description="Build shared library version", when="platform=windows") + variant("shared", default=False, description="Build shared library version") with when("platform=windows"): variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") @@ -359,12 +356,7 @@ def determine_version(cls, exe): @property def libs(self): - return find_libraries( - ["libssl", "libcrypto"], - root=self.prefix, - recursive=True, - shared=self.spec.variants["shared"].value - ) + return find_libraries(["libssl", "libcrypto"], root=self.prefix, recursive=True) def handle_fetch_error(self, error): tty.warn( @@ -385,7 +377,7 @@ def install(self, spec, prefix): # where it happens automatically?) env["KERNEL_BITS"] = "64" - options = ["zlib"] + options = ["zlib", "shared"] if spec.satisfies("@1.0"): options.append("no-krb5") # clang does not support the .arch directive in assembly files. @@ -411,6 +403,8 @@ def install(self, spec, prefix): base_args.extend( ['CC="%s"' % os.environ.get("CC"), 'CXX="%s"' % os.environ.get("CXX"), "VC-WIN64A"] ) + if spec.satisfies("~shared"): + base_args.append("no-shared") else: base_args.extend( [ @@ -419,12 +413,6 @@ def install(self, spec, prefix): ] ) base_args.extend(options) - - if spec.satisfies("~shared"): - base_args.append("no-shared") - else: - base_args.append("shared") - # On Windows, we use perl for configuration and build through MSVC # nmake. if spec.satisfies("platform=windows"): From dc830255823d8282a0af3bdf366efeb202a16fa6 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Tue, 16 May 2023 11:56:49 -0700 Subject: [PATCH 093/104] Revert "revert openssl changes for CI debugging purposes" This reverts commit 5b30e1d63fdc8690cbbdabae994768f0825c3cee. --- .../repos/builtin/packages/openssl/package.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index d6489c69d1e336..4822c7e74fb06b 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +#import glob import os import re @@ -333,7 +334,9 @@ class Openssl(Package): # Uses Fake Autotools, should subclass Package ), ) variant("docs", default=False, description="Install docs and manpages") - variant("shared", default=False, description="Build shared library version") + variant("shared", default=True, description="Build shared library version", when="platform=linux") + variant("shared", default=True, description="Build shared library version", when="platform=darwin") + variant("shared", default=False, description="Build shared library version", when="platform=windows") with when("platform=windows"): variant("dynamic", default=False, description="Link with MSVC's dynamic runtime library") @@ -356,7 +359,12 @@ def determine_version(cls, exe): @property def libs(self): - return find_libraries(["libssl", "libcrypto"], root=self.prefix, recursive=True) + return find_libraries( + ["libssl", "libcrypto"], + root=self.prefix, + recursive=True, + shared=self.spec.variants["shared"].value + ) def handle_fetch_error(self, error): tty.warn( @@ -377,7 +385,7 @@ def install(self, spec, prefix): # where it happens automatically?) env["KERNEL_BITS"] = "64" - options = ["zlib", "shared"] + options = ["zlib"] if spec.satisfies("@1.0"): options.append("no-krb5") # clang does not support the .arch directive in assembly files. @@ -403,8 +411,6 @@ def install(self, spec, prefix): base_args.extend( ['CC="%s"' % os.environ.get("CC"), 'CXX="%s"' % os.environ.get("CXX"), "VC-WIN64A"] ) - if spec.satisfies("~shared"): - base_args.append("no-shared") else: base_args.extend( [ @@ -413,6 +419,12 @@ def install(self, spec, prefix): ] ) base_args.extend(options) + + if spec.satisfies("~shared"): + base_args.append("no-shared") + else: + base_args.append("shared") + # On Windows, we use perl for configuration and build through MSVC # nmake. if spec.satisfies("platform=windows"): From 143e6536c4a4540b95329cda2a902c5f204a6436 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Tue, 16 May 2023 15:13:41 -0700 Subject: [PATCH 094/104] Update package.py --- var/spack/repos/builtin/packages/gdal/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index 4f13acbf8c5079..f26f4cff0def95 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -554,7 +554,7 @@ def cmake_args(self): self.define_from_variant("BUILD_CSHARP_BINDINGS", "csharp"), ] args.extend(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) - args.extend(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "PIC")) + args.extend(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")) # Remove empty strings args = [arg for arg in args if arg] From dc8517801df81ff267c3dae6793eac9fea5e4541 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Tue, 16 May 2023 16:23:03 -0700 Subject: [PATCH 095/104] Update package.py --- var/spack/repos/builtin/packages/gdal/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index f26f4cff0def95..df1ff66f92b03a 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -553,8 +553,8 @@ def cmake_args(self): self.define_from_variant("BUILD_JAVA_BINDINGS", "java"), self.define_from_variant("BUILD_CSHARP_BINDINGS", "csharp"), ] - args.extend(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) - args.extend(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")) + args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + args.append(self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")) # Remove empty strings args = [arg for arg in args if arg] From e121381222e52b42f7d4f864bf95ff6ef602a62e Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 16 May 2023 16:31:13 +0200 Subject: [PATCH 096/104] gha rhel8-platform-python: configure git safe.directory (#37708) --- .github/workflows/unit_tests.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 43e2425f3c52cc..ed391bf7d2b2b3 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -151,6 +151,7 @@ jobs: - name: Setup repo and non-root user run: | git --version + git config --global --add safe.directory /__w/spack/spack git fetch --unshallow . .github/workflows/setup_git.sh useradd spack-test From 124a57bba6e8c6ba194bfb43f5981118f707b407 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Wed, 17 May 2023 01:23:16 -0700 Subject: [PATCH 097/104] mkfontscale bugfix --- var/spack/repos/builtin/packages/mkfontscale/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/mkfontscale/package.py b/var/spack/repos/builtin/packages/mkfontscale/package.py index e07953e1fe1f4c..5012dd767a18ff 100644 --- a/var/spack/repos/builtin/packages/mkfontscale/package.py +++ b/var/spack/repos/builtin/packages/mkfontscale/package.py @@ -35,4 +35,4 @@ def configure_args(self): if ldflags: args.append("LDFLAGS=%s" % " ".join(ldflags)) args.append("LIBS=%s" % " ".join(libs)) - return args + return args From 2a2241135f111bb9b7c7df87bb4b147d1fec959e Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Wed, 17 May 2023 02:29:54 -0700 Subject: [PATCH 098/104] Update pic setting for fontconfig --- var/spack/repos/builtin/packages/fontconfig/package.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index 0ab1acde5fa636..c87c631df0e321 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -59,9 +59,7 @@ def configure_args(self): args.append("LDFLAGS=%s" % " ".join(ldflags)) args.append("LIBS=%s" % " ".join(libs)) - if self.spec.satisfies("+pic"): - args.append("CFLAGS=-fPIC") - args.append("FFLAGS=-fPIC") + args.extend(self.with_or_without("pic")) return args From de9e3804ed2e40180332e13ae420096085a1d888 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Wed, 17 May 2023 02:44:14 -0700 Subject: [PATCH 099/104] fix libtiff pic setting --- var/spack/repos/builtin/packages/libtiff/package.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/libtiff/package.py b/var/spack/repos/builtin/packages/libtiff/package.py index e37aa07efe5b71..9047de84f71c43 100644 --- a/var/spack/repos/builtin/packages/libtiff/package.py +++ b/var/spack/repos/builtin/packages/libtiff/package.py @@ -113,8 +113,7 @@ class CMakeBuilder(CMakeBuilder): def cmake_args(self): args = [self.define_from_variant(var) for var in VARIANTS] args += [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] -# args += [self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")] - args += ["-DCMAKE_POSITION_INDEPENDENT_CODE=ON"] + args += [self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic")] # Remove empty strings args = [arg for arg in args if arg] From 149ea93d0e38f76b9cbdc8cd10f597cf181b96c2 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Wed, 17 May 2023 02:46:34 -0700 Subject: [PATCH 100/104] Update pic setting in libxml2 --- var/spack/repos/builtin/packages/libxml2/package.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/libxml2/package.py b/var/spack/repos/builtin/packages/libxml2/package.py index d98861851bc1b7..7a81a4625827af 100644 --- a/var/spack/repos/builtin/packages/libxml2/package.py +++ b/var/spack/repos/builtin/packages/libxml2/package.py @@ -109,9 +109,7 @@ def configure_args(self): args.append("--without-python") args.extend(self.enable_or_disable("shared")) - - if spec.satisfies("+pic"): - args.append("CFLAGS=-fPIC") + args.extend(self.with_or_without("pic")) return args From f1fb5d6b021d1ed83c50afb9e7e8037e46edac64 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Wed, 17 May 2023 02:48:00 -0700 Subject: [PATCH 101/104] remove extra comment from openssl --- var/spack/repos/builtin/packages/openssl/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 4822c7e74fb06b..1e3824a0a9c767 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -3,7 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -#import glob import os import re From 484d0c2d8cde04caa968dab782b7992e30d22ea6 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Wed, 17 May 2023 03:01:26 -0700 Subject: [PATCH 102/104] Update ssl settings in ecflow --- var/spack/repos/builtin/packages/ecflow/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/ecflow/package.py b/var/spack/repos/builtin/packages/ecflow/package.py index 1c6b68eb877e8f..a1947153a8378d 100644 --- a/var/spack/repos/builtin/packages/ecflow/package.py +++ b/var/spack/repos/builtin/packages/ecflow/package.py @@ -75,7 +75,7 @@ def patch(self): "Pyext/CMakeLists.txt", ) - @when("+ssl") + @when("+ssl ^openssl~shared") def setup_build_environment(self, env): env.set("LIBS", self.spec["zlib"].libs.search_flags) @@ -109,7 +109,7 @@ def cmake_args(self): def remove_recursive_symlink_in_source_code(self): force_remove(join_path(self.prefix, "share/ecflow/src/cereal/cereal")) - @when("+ssl") + @when("+ssl ^openssl~shared") def patch(self): for sdir in ["Client", "Server"]: filter_file("(target_link_libraries.*pthread)", r"\1 ssl crypto z", os.path.join(sdir, "CMakeLists.txt")) From 52b750aa6856c4ece9a14ea4bdaf4bcc58fc519d Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 18 May 2023 09:51:15 -0700 Subject: [PATCH 103/104] add pic variant for ecflow --- var/spack/repos/builtin/packages/ecflow/package.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/ecflow/package.py b/var/spack/repos/builtin/packages/ecflow/package.py index a1947153a8378d..37bde293ecfd96 100644 --- a/var/spack/repos/builtin/packages/ecflow/package.py +++ b/var/spack/repos/builtin/packages/ecflow/package.py @@ -35,6 +35,7 @@ class Ecflow(CMakePackage): "static_boost", default=False, description="Use also static boost libraries when compiling" ) variant("ui", default=False, description="Enable ecflow_ui") + variant("pic", default=False, description="Enable position-independent code (PIC)") extends("python") @@ -91,7 +92,7 @@ def cmake_args(self): self.define_from_variant("ENABLE_STATIC_BOOST_LIBS", "static_boost"), self.define("Python3_EXECUTABLE", spec["python"].package.command), self.define("BOOST_ROOT", spec["boost"].prefix), - self.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), ] if spec.satisfies("+ssl ^openssl ~shared"): From ccb0d5b187dbf668f28013728076fa7394a1359c Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Thu, 18 May 2023 09:53:12 -0700 Subject: [PATCH 104/104] correct build flag logic for gdal --- var/spack/repos/builtin/packages/gdal/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/gdal/package.py b/var/spack/repos/builtin/packages/gdal/package.py index df1ff66f92b03a..8683e63c8d609d 100644 --- a/var/spack/repos/builtin/packages/gdal/package.py +++ b/var/spack/repos/builtin/packages/gdal/package.py @@ -738,7 +738,7 @@ def configure_args(self): if self.spec.satisfies("+iconv") and self.spec["libiconv"].satisfies("~shared"): libs.append("-liconv") - if ldflags: # or libs: + if ldflags or libs: args.append("LDFLAGS=%s" % " ".join(ldflags+libs)) args.append("LIBS=%s" % " ".join(libs))