Skip to content

Commit

Permalink
Merge pull request #353 from AlexanderRichert-NOAA/release/1.5.0-nco
Browse files Browse the repository at this point in the history
approve me: updates for nco branch
  • Loading branch information
AlexanderRichert-NOAA authored Oct 20, 2023
2 parents 8672dc2 + 20fcdd1 commit 081dce5
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 46 deletions.
6 changes: 6 additions & 0 deletions var/spack/repos/builtin/packages/glib/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ def meson_args(self):
args.append("-Diconv=external")
else:
args.append("-Diconv=gnu")

if self.spec.satisfies("^gettext ~shared"):
libs = self.spec["iconv"].libs.search_flags + " " + self.spec["iconv"].libs.link_flags
args.append(f"-Dc_link_args={libs}")
args.append(f"-Dcpp_link_args={libs}")

return args


Expand Down
17 changes: 4 additions & 13 deletions var/spack/repos/builtin/packages/gobject-introspection/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,10 @@ 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))
if self.spec.satisfies("^cairo ~shared"):
pkgconfig = which("pkg-config")
cairo_libs = pkgconfig("cairo", "--static", "--libs", output=str).strip()
env.set("CFLAGS", cairo_libs)

def setup_run_environment(self, env):
env.prepend_path("GI_TYPELIB_PATH", join_path(self.prefix.lib, "girepository-1.0"))
Expand Down
41 changes: 18 additions & 23 deletions var/spack/repos/builtin/packages/harfbuzz/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,23 @@ class MesonBuilder(spack.build_systems.meson.MesonBuilder, SetupEnvironment):
def meson_args(self):
graphite2 = "enabled" if self.pkg.spec.satisfies("+graphite2") else "disabled"
coretext = "enabled" if self.pkg.spec.satisfies("+coretext") else "disabled"
return [
meson_args = [
# disable building of gtk-doc files following #9885 and #9771
"-Ddocs=disabled",
"-Dgraphite2={0}".format(graphite2),
"-Dcoretext={0}".format(coretext),
]
libs = []
pc = which("pkg-config")
deps = {"zlib": "~shared", "bzip": "~shared", "libpng": "libs=static", "cairo": "~shared"}
for dep in deps.keys():
if self.spec.satisfies(f"^{dep} {deps[dep]}"):
libs.append(pc(dep, "--static", "--libs", output=str).strip())
if libs:
meson_args.append("-Dc_link_args=%s" % " ".join(libs))
meson_args.append("-Dcpp_link_args=%s" % " ".join(libs))

return meson_args


class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder, SetupEnvironment):
Expand All @@ -148,29 +159,13 @@ 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))
pc = which("pkg-config")
deps = {"zlib": "~shared", "bzip": "~shared", "libpng": "libs=static", "cairo": "~shared"}
for dep in deps.keys():
if self.spec.satisfies(f"^{dep} {deps[dep]}"):
libs.append(pc(dep, "--static", "--libs", output=str).strip())
if libs:
args.append("LIBS=%s" % " ".join(libs))

return args
7 changes: 7 additions & 0 deletions var/spack/repos/builtin/packages/libxpm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ def flag_handler(self, name, flags):
if name == "ldflags" and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return env_flags(name, flags)

def configure_args(self):
args = []
if self.spec.satisfies("^gettext ~shared"):
libs = self.spec["iconv"].libs.search_flags + " " + self.spec["iconv"].libs.link_flags
args.append(f"LIBS={libs}")
return args
4 changes: 4 additions & 0 deletions var/spack/repos/builtin/packages/nco/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def configure_args(self):
config_args.append("CFLAGS=-O1")
config_args.append("CXXFLAGS=-O1")

ncconfig = which("nc-config")
nc_libs = ncconfig("--static", "--libs", output=str).strip()
config_args.append(f"LIBS={nc_libs}")

return config_args

def setup_build_environment(self, env):
Expand Down
12 changes: 4 additions & 8 deletions var/spack/repos/builtin/packages/pango/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,10 @@ 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))
if self.spec.satisfies("^cairo ~shared"):
pkgconfig = which("pkg-config")
cairo_libs = pkgconfig("cairo", "--static", "--libs", output=str).strip()
args.append(f"LIBS={cairo_libs}")

return args

Expand Down
12 changes: 10 additions & 2 deletions var/spack/repos/builtin/packages/udunits/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,18 @@ class Udunits(AutotoolsPackage):
depends_on("expat")

variant("shared", default=True, description="Build shared library")
variant(
"pic", default=True, description="Enable position-independent code (PIC)", when="~shared"
)

@property
def libs(self):
return find_libraries(["libudunits2"], root=self.prefix, recursive=True, shared=True)
return find_libraries(
"libudunits2", root=self.prefix, recursive=True, shared=self.spec.satisfies("+shared")
)

def configure_args(self):
return self.enable_or_disable("shared")
config_args = []
config_args.extend(self.enable_or_disable("shared"))
config_args.extend(self.with_or_without("pic"))
return config_args
4 changes: 4 additions & 0 deletions var/spack/repos/builtin/packages/zstd/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Zstd(CMakePackage, MakefilePackage):
values=any_combination_of("zlib", "lz4", "lzma"),
description="Enable support for additional compression methods in programs",
)
variant("pic", default=True, description="Enable position-independent code (PIC)")

depends_on("zlib", when="compression=zlib")
depends_on("lz4", when="compression=lz4")
Expand All @@ -61,6 +62,8 @@ class Zstd(CMakePackage, MakefilePackage):
# (last tested: [email protected])
conflicts("+programs %nvhpc")

conflicts("+pic libs=shared")

build_system("cmake", "makefile", default="makefile")


Expand All @@ -77,6 +80,7 @@ def cmake_args(self):
[
self.define("ZSTD_BUILD_STATIC", self.spec.satisfies("libs=static")),
self.define("ZSTD_BUILD_SHARED", self.spec.satisfies("libs=shared")),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
]
)
if "compression=zlib" in spec:
Expand Down

0 comments on commit 081dce5

Please sign in to comment.