libintl, iconv, gettext: account for libc provider and externals (#35450)

* libiconv can be provided by libc, so update packages which depend on
  libiconv to require the iconv virtual instead
* Many packages need special consideration when locating iconv depending
  on whether it is provided by libc (no prefix provided) or the libiconv
  package (in that case we want to provide a prefix)
* It was also noticed that when an iconv external was provided, that
  there was interference with linking (this should generally be handled
  by Spack's compiler wrappers and bears further investigation)
* Like iconv, libintl can be provided by libc or another package, namely
  gettext. It is not converted to a provider like libiconv because it
  provides additional routines. The logic is similar to that of iconv
  but instead of checking the provider, we check whether the gettext
  installation includes libintl.
This commit is contained in:
Chris Green 2023-05-02 20:18:30 -05:00 committed by GitHub
parent 4edd364a8b
commit c110bcc5af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 242 additions and 126 deletions

View File

@ -26,8 +26,10 @@ class Acl(AutotoolsPackage):
depends_on("attr") depends_on("attr")
depends_on("gettext") depends_on("gettext")
def setup_build_environment(self, env): def flag_handler(self, name, flags):
env.append_flags("LDFLAGS", "-lintl") if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return self.build_system_flags(name, flags)
def autoreconf(self, spec, prefix): def autoreconf(self, spec, prefix):
bash = which("bash") bash = which("bash")

View File

@ -154,7 +154,8 @@ def cmake_args(self):
args.append("-DBFD_ROOT={0}".format(spec["binutils"].prefix)) args.append("-DBFD_ROOT={0}".format(spec["binutils"].prefix))
if "+binutils ^binutils+nls" in spec: if "+binutils ^binutils+nls" in spec:
args.append("-DCMAKE_SHARED_LINKER_FLAGS=-lintl") if "intl" in self.spec["gettext"].libs.names:
args.append("-DCMAKE_SHARED_LINKER_FLAGS=-lintl")
if "+otf2" in spec: if "+otf2" in spec:
args.append("-DOTF2_ROOT={0}".format(spec["otf2"].prefix)) args.append("-DOTF2_ROOT={0}".format(spec["otf2"].prefix))

View File

@ -6,6 +6,7 @@
import re import re
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Bash(AutotoolsPackage, GNUMirrorPackage): class Bash(AutotoolsPackage, GNUMirrorPackage):
@ -177,8 +178,7 @@ def determine_version(cls, exe):
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
args = [
return [
# https://github.com/Homebrew/legacy-homebrew/pull/23234 # https://github.com/Homebrew/legacy-homebrew/pull/23234
# https://trac.macports.org/ticket/40603 # https://trac.macports.org/ticket/40603
"CFLAGS=-DSSH_SOURCE_BASHRC", "CFLAGS=-DSSH_SOURCE_BASHRC",
@ -186,8 +186,12 @@ def configure_args(self):
"--with-curses", "--with-curses",
"--enable-readline", "--enable-readline",
"--with-installed-readline", "--with-installed-readline",
"--with-libiconv-prefix={0}".format(spec["iconv"].prefix),
] ]
if spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(spec["iconv"].prefix):
args.append("--with-libiconv-prefix={0}".format(spec["iconv"].prefix))
return args
def check(self): def check(self):
make("tests") make("tests")

View File

@ -24,16 +24,16 @@ class Bcache(MakefilePackage):
depends_on("gettext") depends_on("gettext")
depends_on("pkgconfig", type="build") depends_on("pkgconfig", type="build")
def setup_build_environment(self, env):
# Add -lintl if provided by gettext, otherwise libintl is provided by the system's glibc:
if "gettext" in self.spec and "intl" in self.spec["gettext"].libs.names:
env.append_flags("LDFLAGS", "-lintl")
patch( patch(
"func_crc64.patch", "func_crc64.patch",
sha256="558b35cadab4f410ce8f87f0766424a429ca0611aa2fd247326ad10da115737d", sha256="558b35cadab4f410ce8f87f0766424a429ca0611aa2fd247326ad10da115737d",
) )
def flag_handler(self, name, flags):
if name == "ldflags" and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return self.env_flags(name, flags)
def install(self, spec, prefix): def install(self, spec, prefix):
mkdirp(prefix.bin) mkdirp(prefix.bin)
install("bcache-register", prefix.bin) install("bcache-register", prefix.bin)

View File

@ -19,7 +19,7 @@ class Bind9(AutotoolsPackage):
depends_on("libuv", type="link") depends_on("libuv", type="link")
depends_on("pkgconfig", type="build") depends_on("pkgconfig", type="build")
depends_on("openssl", type="link") depends_on("openssl", type="link")
depends_on("libiconv", type="link") depends_on("iconv", type="link")
def configure_args(self): def configure_args(self):
args = [ args = [

View File

@ -269,9 +269,12 @@ def install_headers(self):
# also grab the headers from the bfd directory # also grab the headers from the bfd directory
install(join_path(self.build_directory, "bfd", "*.h"), extradir) install(join_path(self.build_directory, "bfd", "*.h"), extradir)
def setup_build_environment(self, env): def flag_handler(self, name, flags):
if self.spec.satisfies("%cce"): spec = self.spec
env.append_flags("LDFLAGS", "-Wl,-z,muldefs") if name == "ldflags":
if spec.satisfies("%cce"):
if "+nls" in self.spec: flags.append("-Wl,-z,muldefs")
env.append_flags("LDFLAGS", "-lintl") elif name == "ldlibs":
if "+nls" in self.spec and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return self.build_system_flags(name, flags)

View File

@ -7,6 +7,7 @@
import os.path import os.path
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Elfutils(AutotoolsPackage, SourcewarePackage): class Elfutils(AutotoolsPackage, SourcewarePackage):
@ -105,7 +106,12 @@ def patch(self):
files = glob.glob(os.path.join("*", "Makefile.in")) files = glob.glob(os.path.join("*", "Makefile.in"))
filter_file("-Werror", "", *files) filter_file("-Werror", "", *files)
flag_handler = AutotoolsPackage.build_system_flags def flag_handler(self, name, flags):
if name == "ldlibs":
spec = self.spec
if "+nls" in spec and "intl" in spec["gettext"].libs.names:
flags.append("-lintl")
return self.inject_flags(name, flags)
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
@ -126,9 +132,19 @@ def configure_args(self):
# zlib is required # zlib is required
args.append("--with-zlib=%s" % spec["zlib"].prefix) args.append("--with-zlib=%s" % spec["zlib"].prefix)
if spec.satisfies("@0.183:"):
if spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(spec["iconv"].prefix):
args.append("--with-libiconv-prefix=" + format(spec["iconv"].prefix))
if "+nls" in spec: if "+nls" in spec:
# configure doesn't use LIBS correctly # Prior to 0.183, only msgfmt is used from gettext.
args.append("LDFLAGS=-Wl,--no-as-needed -L%s -lintl" % spec["gettext"].prefix.lib) if spec.satisfies("@0.183:"):
if "intl" not in spec["gettext"].libs.names:
args.append("--without-libintl-prefix")
elif not is_system_path(spec["gettext"].prefix):
args.append("--with-libintl-prefix=" + spec["gettext"].prefix)
else: else:
args.append("--disable-nls") args.append("--disable-nls")

View File

@ -127,14 +127,20 @@ def configure_args(self):
make.add_default_arg("CXXFLAGS=%s" % self.compiler.cxx11_flag) make.add_default_arg("CXXFLAGS=%s" % self.compiler.cxx11_flag)
args.append("CXXFLAGS=%s" % self.compiler.cxx11_flag) args.append("CXXFLAGS=%s" % self.compiler.cxx11_flag)
return args
def flag_handler(self, name, flags):
# This was added due to: # This was added due to:
# - configure failure # - configure failure
# https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined # https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined
# - linking error # - linking error
# https://github.com/bsc-performance-tools/extrae/issues/57 # https://github.com/bsc-performance-tools/extrae/issues/57
args.append("LDFLAGS=-lintl -pthread") if name == "ldlibs":
if "intl" in self.spec["gettext"].libs.names:
return args flags.append("-lintl")
elif name == "ldflags":
flags.append("-pthread")
return self.build_system_flags(name, flags)
def install(self, spec, prefix): def install(self, spec, prefix):
with working_dir(self.build_directory): with working_dir(self.build_directory):

View File

@ -75,7 +75,7 @@ class Ffmpeg(AutotoolsPackage):
variant("libx264", default=False, description="H.264 encoding") variant("libx264", default=False, description="H.264 encoding")
depends_on("alsa-lib", when="platform=linux") depends_on("alsa-lib", when="platform=linux")
depends_on("libiconv") depends_on("iconv")
depends_on("yasm@1.2.0:") depends_on("yasm@1.2.0:")
depends_on("zlib") depends_on("zlib")

View File

@ -31,7 +31,7 @@ class Fsl(Package, CudaPackage):
depends_on("expat") depends_on("expat")
depends_on("libx11") depends_on("libx11")
depends_on("glu") depends_on("glu")
depends_on("libiconv") depends_on("iconv")
depends_on("openblas", when="@6:") depends_on("openblas", when="@6:")
depends_on("vtk@:8") depends_on("vtk@:8")
@ -40,7 +40,7 @@ class Fsl(Package, CudaPackage):
patch("build_log.patch") patch("build_log.patch")
patch("eddy_Makefile.patch", when="@6.0.4") patch("eddy_Makefile.patch", when="@6.0.4")
patch("iconv.patch") patch("iconv.patch", when="^libiconv")
patch("fslpython_install_v5.patch", when="@:5") patch("fslpython_install_v5.patch", when="@:5")
patch("fslpython_install_v604.patch", when="@6.0.4") patch("fslpython_install_v604.patch", when="@6.0.4")
patch("fslpython_install_v605.patch", when="@6.0.5") patch("fslpython_install_v605.patch", when="@6.0.5")

View File

@ -9,7 +9,7 @@
from spack.build_systems.autotools import AutotoolsBuilder from spack.build_systems.autotools import AutotoolsBuilder
from spack.build_systems.cmake import CMakeBuilder from spack.build_systems.cmake import CMakeBuilder
from spack.package import * from spack.package import *
from spack.util.environment import filter_system_paths from spack.util.environment import filter_system_paths, is_system_path
class Gdal(CMakePackage, AutotoolsPackage, PythonExtension): class Gdal(CMakePackage, AutotoolsPackage, PythonExtension):
@ -627,7 +627,6 @@ def configure_args(self):
self.with_or_without("hdf4", package="hdf"), self.with_or_without("hdf4", package="hdf"),
self.with_or_without("hdf5", package="hdf5"), self.with_or_without("hdf5", package="hdf5"),
self.with_or_without("hdfs", package="hadoop"), self.with_or_without("hdfs", package="hadoop"),
self.with_or_without("libiconv-prefix", variant="iconv", package="iconv"),
self.with_or_without("idb", package="idb"), self.with_or_without("idb", package="idb"),
self.with_or_without("ingres", package="ingres"), self.with_or_without("ingres", package="ingres"),
self.with_or_without("jasper", package="jasper"), self.with_or_without("jasper", package="jasper"),
@ -681,6 +680,11 @@ def configure_args(self):
self.with_or_without("perl"), self.with_or_without("perl"),
self.with_or_without("php"), self.with_or_without("php"),
] ]
if "+iconv" in self.spec:
if self.spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(self.spec["iconv"].prefix):
args.append("--with-libiconv-prefix=" + self.spec["iconv"].prefix)
# Renamed or modified flags # Renamed or modified flags
if self.spec.satisfies("@3:"): if self.spec.satisfies("@3:"):

View File

@ -6,6 +6,7 @@
import re import re
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Gettext(AutotoolsPackage, GNUMirrorPackage): class Gettext(AutotoolsPackage, GNUMirrorPackage):
@ -78,7 +79,6 @@ def configure_args(self):
config_args = [ config_args = [
"--disable-java", "--disable-java",
"--disable-csharp", "--disable-csharp",
"--with-libiconv-prefix={0}".format(spec["iconv"].prefix),
"--with-included-glib", "--with-included-glib",
"--with-included-gettext", "--with-included-gettext",
"--with-included-libcroco", "--with-included-libcroco",
@ -87,6 +87,11 @@ def configure_args(self):
"--without-cvs", "--without-cvs",
] ]
if self.spec["iconv"].name == "libc":
config_args.append("--without-libiconv-prefix")
elif not is_system_path(self.spec["iconv"].prefix):
config_args.append("--with-libiconv-prefix=" + self.spec["iconv"].prefix)
if "+curses" in spec: if "+curses" in spec:
config_args.append("--with-ncurses-prefix={0}".format(spec["ncurses"].prefix)) config_args.append("--with-ncurses-prefix={0}".format(spec["ncurses"].prefix))
else: else:

View File

@ -7,6 +7,7 @@
import re import re
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Git(AutotoolsPackage): class Git(AutotoolsPackage):
@ -466,12 +467,18 @@ def setup_build_environment(self, env):
# The test avoids failures when git is an external package. # The test avoids failures when git is an external package.
# In that case the node in the DAG gets truncated and git DOES NOT # In that case the node in the DAG gets truncated and git DOES NOT
# have a gettext dependency. # have a gettext dependency.
if "+nls" in self.spec: spec = self.spec
if "intl" in self.spec["gettext"].libs.names: if "+nls" in spec:
env.append_flags("EXTLIBS", "-L{0} -lintl".format(self.spec["gettext"].prefix.lib)) if "intl" in spec["gettext"].libs.names:
env.append_flags("CFLAGS", "-I{0}".format(self.spec["gettext"].prefix.include)) extlib_bits = []
if not is_system_path(spec["gettext"].prefix):
extlib_bits.append(spec["gettext"].libs.search_flags)
extlib_bits.append("-lintl")
env.append_flags("EXTLIBS", " ".join(extlib_bits))
if not is_system_path(spec["gettext"].prefix):
env.append_flags("CFLAGS", spec["gettext"].headers.include_flags)
if "~perl" in self.spec: if "~perl" in spec:
env.append_flags("NO_PERL", "1") env.append_flags("NO_PERL", "1")
def configure_args(self): def configure_args(self):
@ -480,11 +487,17 @@ def configure_args(self):
configure_args = [ configure_args = [
"--with-curl={0}".format(spec["curl"].prefix), "--with-curl={0}".format(spec["curl"].prefix),
"--with-expat={0}".format(spec["expat"].prefix), "--with-expat={0}".format(spec["expat"].prefix),
"--with-iconv={0}".format(spec["iconv"].prefix),
"--with-openssl={0}".format(spec["openssl"].prefix), "--with-openssl={0}".format(spec["openssl"].prefix),
"--with-zlib={0}".format(spec["zlib"].prefix), "--with-zlib={0}".format(spec["zlib"].prefix),
] ]
if not self.spec["iconv"].name == "libc":
configure_args.append(
"--with-iconv={0}".format(
"yes" if is_system_path(spec["iconv"].prefix) else spec["iconv"].prefix
)
)
if "+perl" in self.spec: if "+perl" in self.spec:
configure_args.append("--with-perl={0}".format(spec["perl"].command.path)) configure_args.append("--with-perl={0}".format(spec["perl"].command.path))

View File

@ -6,6 +6,7 @@
import os.path import os.path
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Glib(Package): class Glib(Package):
@ -210,7 +211,7 @@ def meson_args(self):
if self.spec.satisfies("@:2.72"): if self.spec.satisfies("@:2.72"):
args.append("-Dgettext=external") args.append("-Dgettext=external")
if self.spec.satisfies("@:2.74"): if self.spec.satisfies("@:2.74"):
if "libc" in self.spec: if self.spec["iconv"].name == "libc":
args.append("-Diconv=libc") args.append("-Diconv=libc")
else: else:
if self.spec.satisfies("@2.61.0:"): if self.spec.satisfies("@2.61.0:"):
@ -244,7 +245,7 @@ def configure_args(self):
args.append( args.append(
"--with-python={0}".format(os.path.basename(self.spec["python"].command.path)) "--with-python={0}".format(os.path.basename(self.spec["python"].command.path))
) )
if "libc" in self.spec: if self.spec["iconv"].name == "libc":
args.append("--with-libiconv=maybe") args.append("--with-libiconv=maybe")
else: else:
args.append("--with-libiconv=gnu") args.append("--with-libiconv=gnu")
@ -350,10 +351,14 @@ def gettext_libdir(self):
# Packages that link to glib were also picking up -lintl from glib's # Packages that link to glib were also picking up -lintl from glib's
# glib-2.0.pc file. However, packages such as py-pygobject were # glib-2.0.pc file. However, packages such as py-pygobject were
# bypassing spack's compiler wrapper for linking and thus not finding # bypassing spack's compiler wrapper for linking and thus not finding
# the gettext library directory. The patch below explitly adds the # the gettext library directory. The patch below explicitly adds the
# appropriate -L path. # appropriate -L path.
spec = self.spec spec = self.spec
if spec.satisfies("@2.0:2"): if (
spec.satisfies("@2.0:2")
and "intl" in self.spec["gettext"].libs.names
and not is_system_path(spec["gettext"].prefix)
):
pattern = "Libs:" pattern = "Libs:"
repl = "Libs: -L{0} -Wl,-rpath={0} ".format(spec["gettext"].libs.directories[0]) repl = "Libs: -L{0} -Wl,-rpath={0} ".format(spec["gettext"].libs.directories[0])
myfile = join_path(self.spec["glib"].libs.directories[0], "pkgconfig", "glib-2.0.pc") myfile = join_path(self.spec["glib"].libs.directories[0], "pkgconfig", "glib-2.0.pc")

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Gnupg(AutotoolsPackage): class Gnupg(AutotoolsPackage):
@ -143,7 +144,6 @@ def configure_args(self):
"--disable-regex", "--disable-regex",
"--with-zlib=" + self.spec["zlib"].prefix, "--with-zlib=" + self.spec["zlib"].prefix,
"--without-tar", "--without-tar",
"--without-libiconv-prefix",
"--without-readline", "--without-readline",
] ]
@ -159,9 +159,12 @@ def configure_args(self):
"--with-libassuan-prefix=" + self.spec["libassuan"].prefix, "--with-libassuan-prefix=" + self.spec["libassuan"].prefix,
"--with-ksba-prefix=" + self.spec["libksba"].prefix, "--with-ksba-prefix=" + self.spec["libksba"].prefix,
"--with-npth-prefix=" + self.spec["npth"].prefix, "--with-npth-prefix=" + self.spec["npth"].prefix,
"--with-libiconv-prefix=" + self.spec["iconv"].prefix,
] ]
) )
if self.spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(self.spec["iconv"].prefix):
args.append("--with-libiconv-prefix=" + self.spec["iconv"].prefix)
if self.spec.satisfies("@:1"): if self.spec.satisfies("@:1"):
args.extend( args.extend(

View File

@ -6,6 +6,7 @@
import re import re
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Groff(AutotoolsPackage, GNUMirrorPackage): class Groff(AutotoolsPackage, GNUMirrorPackage):
@ -77,7 +78,10 @@ def configure_args(self):
args.extend(self.with_or_without("x")) args.extend(self.with_or_without("x"))
if "@1.22.4:" in self.spec: if "@1.22.4:" in self.spec:
args.extend(self.with_or_without("uchardet")) args.extend(self.with_or_without("uchardet"))
args.append("--with-libiconv-prefix={0}".format(self.spec["iconv"].prefix)) if self.spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(self.spec["iconv"].prefix):
args.append("--with-libiconv-prefix={0}".format(self.spec["iconv"].prefix))
return args return args
def setup_run_environment(self, env): def setup_run_environment(self, env):

View File

@ -81,10 +81,7 @@ def configure_args(self):
return args return args
def setup_build_environment(self, env):
env.prepend_path("LD_LIBRARY_PATH", self.spec["gettext"].prefix.lib)
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
if name == "ldlibs": if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl") flags.append("-lintl")
return (flags, None, None) return inject_flags(name, flags)

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Lftp(AutotoolsPackage): class Lftp(AutotoolsPackage):
@ -19,6 +20,7 @@ class Lftp(AutotoolsPackage):
version("4.6.4", sha256="791e783779d3d6b519d0c23155430b9785f2854023eb834c716f5ba78873b15a") version("4.6.4", sha256="791e783779d3d6b519d0c23155430b9785f2854023eb834c716f5ba78873b15a")
depends_on("expat") depends_on("expat")
depends_on("gettext")
depends_on("iconv") depends_on("iconv")
depends_on("ncurses") depends_on("ncurses")
depends_on("openssl") depends_on("openssl")
@ -26,11 +28,20 @@ class Lftp(AutotoolsPackage):
depends_on("zlib") depends_on("zlib")
def configure_args(self): def configure_args(self):
return [ args = [
"--with-expat={0}".format(self.spec["expat"].prefix), "--with-expat={0}".format(self.spec["expat"].prefix),
"--with-libiconv={0}".format(self.spec["iconv"].prefix),
"--with-openssl={0}".format(self.spec["openssl"].prefix), "--with-openssl={0}".format(self.spec["openssl"].prefix),
"--with-readline={0}".format(self.spec["readline"].prefix), "--with-readline={0}".format(self.spec["readline"].prefix),
"--with-zlib={0}".format(self.spec["zlib"].prefix), "--with-zlib={0}".format(self.spec["zlib"].prefix),
"--disable-dependency-tracking", "--disable-dependency-tracking",
] ]
if self.spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(self.spec["iconv"].prefix):
args.append("--with-libiconv-prefix={0}".format(self.spec["iconv"].prefix))
if "intl" not in self.spec["gettext"].libs.names:
args.append("--without-libintl-prefix")
elif not is_system_path(self.spec["gettext"].prefix):
args.append("--with-libintl-prefix={0}".format(self.spec["gettext"].prefix))
return args

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Libarchive(AutotoolsPackage): class Libarchive(AutotoolsPackage):
@ -109,7 +110,7 @@ class Libarchive(AutotoolsPackage):
depends_on("libxml2", when="xar=libxml2") depends_on("libxml2", when="xar=libxml2")
depends_on("expat", when="xar=expat") depends_on("expat", when="xar=expat")
depends_on("libiconv", when="+iconv") depends_on("iconv", when="+iconv")
conflicts( conflicts(
"crypto=mbedtls", when="@:3.4.1", msg="mbed TLS is only supported from libarchive 3.4.2" "crypto=mbedtls", when="@:3.4.1", msg="mbed TLS is only supported from libarchive 3.4.2"
@ -119,11 +120,19 @@ class Libarchive(AutotoolsPackage):
# The build test suite cannot be built with Intel # The build test suite cannot be built with Intel
def configure_args(self): def configure_args(self):
spec = self.spec
args = ["--without-libb2"] args = ["--without-libb2"]
args += self.with_or_without("compression") args += self.with_or_without("compression")
args += self.with_or_without("crypto") args += self.with_or_without("crypto")
args += self.with_or_without("iconv")
args += self.with_or_without("xar") args += self.with_or_without("xar")
args += self.enable_or_disable("programs") args += self.enable_or_disable("programs")
if "+iconv" in spec:
if spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(spec["iconv"].prefix):
args.append("--with-libiconv-prefix={p}".format(p=spec["iconv"].prefix))
else:
args.append("--without-iconv")
return args return args

View File

@ -26,9 +26,7 @@ class Libxpm(AutotoolsPackage, XorgPackage):
depends_on("pkgconfig", type="build") depends_on("pkgconfig", type="build")
depends_on("util-macros", type="build") depends_on("util-macros", type="build")
def setup_build_environment(self, env): def flag_handler(self, name, flags):
# If libxpm is installed as an external package, gettext won't if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
# be available in the spec. See flags.append("-lintl")
# https://github.com/spack/spack/issues/9149 for details. return env_flags(name, flags)
if "gettext" in self.spec and "intl" in self.spec["gettext"].libs.names:
env.append_flags("LDFLAGS", "-lintl")

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Mono(AutotoolsPackage): class Mono(AutotoolsPackage):
@ -74,6 +75,8 @@ def patch(self):
def configure_args(self): def configure_args(self):
args = [] args = []
li = self.spec["iconv"].prefix if self.spec["iconv"].name == "libc":
args.append("--with-libiconv-prefix={p}".format(p=li)) args.append("--without-libiconv-prefix")
elif not is_system_path(self.spec["iconv"].prefix):
args.append("--with-libiconv-prefix={p}".format(p=self.spec["iconv"].prefix))
return args return args

View File

@ -94,7 +94,7 @@ class Neovim(CMakePackage):
depends_on("jemalloc", type="link", when="platform=linux") depends_on("jemalloc", type="link", when="platform=linux")
depends_on("lua-lpeg") depends_on("lua-lpeg")
depends_on("lua-mpack") depends_on("lua-mpack")
depends_on("libiconv", type="link") depends_on("iconv", type="link")
depends_on("libtermkey", type="link") depends_on("libtermkey", type="link")
depends_on("libuv", type="link") depends_on("libuv", type="link")
depends_on("libluv", type="link") depends_on("libluv", type="link")
@ -117,7 +117,7 @@ class Neovim(CMakePackage):
with when("@0.6:"): with when("@0.6:"):
depends_on("cmake@3.10:", type="build") depends_on("cmake@3.10:", type="build")
depends_on("gperf@3.1:", type="link") depends_on("gperf@3.1:", type="link")
depends_on("libiconv@1.15:", type="link") conflicts("libiconv@:1.14")
depends_on("libtermkey@0.22:", type="link") depends_on("libtermkey@0.22:", type="link")
depends_on("libvterm@0.1.4:", type="link") depends_on("libvterm@0.1.4:", type="link")
depends_on("msgpack-c@3.0.0:", type="link") depends_on("msgpack-c@3.0.0:", type="link")

View File

@ -29,9 +29,8 @@ class NfsUtils(AutotoolsPackage):
depends_on("util-linux") depends_on("util-linux")
depends_on("gettext") depends_on("gettext")
def setup_build_environment(self, env):
env.append_flags("LIBS", "-lintl")
def configure_args(self): def configure_args(self):
args = ["--disable-gss", "--with-rpcgen=internal"] args = ["--disable-gss", "--with-rpcgen=internal"]
if "intl" in self.spec["gettext"].libs.names:
args.append("LIBS=-lintl")
return args return args

View File

@ -27,9 +27,11 @@ class OciSystemdHook(AutotoolsPackage):
depends_on("util-linux") depends_on("util-linux")
depends_on("go-md2man") depends_on("go-md2man")
def configure_args(self): def flag_handler(self, name, flags):
args = ["LDFLAGS=-lintl"] if name == "ldlibs":
return args if "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return self.build_system_flags(name, flags)
def install(self, spec, prefix): def install(self, spec, prefix):
oci_systemd_hook_jsondir = "oci_systemd_hook_jsondir=" oci_systemd_hook_jsondir = "oci_systemd_hook_jsondir="

View File

@ -595,7 +595,7 @@ class Opencv(CMakePackage, CudaPackage):
with when("+wechat_qrcode"): with when("+wechat_qrcode"):
conflicts("~dnn") conflicts("~dnn")
conflicts("~imgproc") conflicts("~imgproc")
depends_on("libiconv") depends_on("iconv")
with when("+xfeatures2d"): with when("+xfeatures2d"):
with when("+cuda"): with when("+cuda"):

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Procps(AutotoolsPackage): class Procps(AutotoolsPackage):
@ -17,6 +18,8 @@ class Procps(AutotoolsPackage):
version("master", branch="master") version("master", branch="master")
version("3.3.15", tag="v3.3.15") version("3.3.15", tag="v3.3.15")
variant("nls", default=True, description="Enable Native Language Support.")
depends_on("autoconf", type="build") depends_on("autoconf", type="build")
depends_on("automake", type="build") depends_on("automake", type="build")
depends_on("libtool", type="build") depends_on("libtool", type="build")
@ -24,7 +27,7 @@ class Procps(AutotoolsPackage):
depends_on("pkgconfig@0.9.0:", type="build") depends_on("pkgconfig@0.9.0:", type="build")
depends_on("dejagnu", type="test") depends_on("dejagnu", type="test")
depends_on("iconv") depends_on("iconv")
depends_on("gettext") depends_on("gettext", when="+nls")
depends_on("ncurses") depends_on("ncurses")
conflicts("platform=darwin", msg="procps is linux-only") conflicts("platform=darwin", msg="procps is linux-only")
@ -33,11 +36,29 @@ def autoreconf(self, spec, prefix):
sh = which("sh") sh = which("sh")
sh("autogen.sh") sh("autogen.sh")
def flag_handler(self, name, flags):
if name == "ldlibs":
spec = self.spec
if "+nls" in spec and "intl" in spec["gettext"].libs.names:
flags.append("-lintl")
return self.build_system_flags(name, flags)
def configure_args(self): def configure_args(self):
return [ spec = self.spec
"--with-libiconv-prefix={0}".format(self.spec["iconv"].prefix), args = ["--with-ncurses"]
"--with-libintl-prefix={0}".format(self.spec["gettext"].prefix),
"--with-ncurses", if "+nls" in spec:
# Required to avoid libintl linking errors args.append("--enable-nls")
"--disable-nls", if "intl" not in spec["gettext"].libs.names:
] args.append("--without-libintl-prefix")
elif not is_system_path(spec["gettext"].prefix):
args.append("--with-libintl-prefix=" + spec["gettext"].prefix)
else:
args.append("--disable-nls")
if spec["iconv"].name == "libc":
args.append("--without-libiconv-prefix")
elif not is_system_path(spec["iconv"].prefix):
args.append("--with-libiconv-prefix={0}".format(spec["iconv"].prefix))
return args

View File

@ -37,7 +37,7 @@ class Pulseaudio(AutotoolsPackage):
depends_on("gconf", when="+gconf") depends_on("gconf", when="+gconf")
depends_on("json-c@0.11:") depends_on("json-c@0.11:")
depends_on("libcap") depends_on("libcap")
depends_on("libiconv") depends_on("iconv")
depends_on("libsndfile@1.0.18:") depends_on("libsndfile@1.0.18:")
depends_on("libtool@2.4:") # links to libltdl.so depends_on("libtool@2.4:") # links to libltdl.so
depends_on("libsm", when="+x11") depends_on("libsm", when="+x11")

View File

@ -52,7 +52,7 @@ class PyOnnxruntime(CMakePackage, PythonExtension):
# https://github.com/cms-externals/onnxruntime/compare/5bc92df...d594f80 # https://github.com/cms-externals/onnxruntime/compare/5bc92df...d594f80
patch("cms.patch", level=1, when="@1.7.2") patch("cms.patch", level=1, when="@1.7.2")
# https://github.com/cms-externals/onnxruntime/compare/0d9030e...7a6355a # https://github.com/cms-externals/onnxruntime/compare/0d9030e...7a6355a
patch("cms_1_10.patch", whe="@1.10") patch("cms_1_10.patch", when="@1.10")
# https://github.com/microsoft/onnxruntime/issues/4234#issuecomment-698077636 # https://github.com/microsoft/onnxruntime/issues/4234#issuecomment-698077636
# only needed when iconv is provided by libiconv # only needed when iconv is provided by libiconv
patch("libiconv.patch", level=0, when="@1.7.2 ^libiconv") patch("libiconv.patch", level=0, when="@1.7.2 ^libiconv")

View File

@ -368,10 +368,11 @@ def get_mkspec(self):
# webkit requires libintl (gettext), but does not test for it # webkit requires libintl (gettext), but does not test for it
# correctly, so add it here. # correctly, so add it here.
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
if "+webkit" in self.spec and name == "ldlibs": if self.name == "ldlibs":
flags.append("-lintl") spec = self.spec
if "+webkit" in spec and "intl" in spec["gettext"].libs.names:
return (flags, None, None) flags.append("-lintl")
return self.inject_flags(name, flags)
@when("@4 platform=darwin") @when("@4 platform=darwin")
def patch(self): def patch(self):

View File

@ -27,7 +27,7 @@ class RRjava(RPackage):
# these are not listed as dependencies but are needed # these are not listed as dependencies but are needed
depends_on("bzip2") depends_on("bzip2")
depends_on("icu4c") depends_on("icu4c")
depends_on("libiconv") depends_on("iconv")
depends_on("pcre2") depends_on("pcre2")
depends_on("xz") depends_on("xz")
depends_on("zlib") depends_on("zlib")

View File

@ -20,7 +20,10 @@ class RpcsvcProto(AutotoolsPackage):
depends_on("gettext") depends_on("gettext")
def configure_args(self): def configure_args(self):
return ["LIBS=-lintl"] if "intl" in self.spec["gettext"].libs.names:
return ["LIBS=-lintl"]
else:
return []
@run_before("build") @run_before("build")
def change_makefile(self): def change_makefile(self):

View File

@ -22,8 +22,9 @@ class Rrdtool(AutotoolsPackage):
depends_on("perl-extutils-makemaker") depends_on("perl-extutils-makemaker")
def configure_args(self): def configure_args(self):
args = [ return ["--with-systemdsystemunitdir=" + self.spec["rrdtool"].prefix.lib.systemd.system]
"LDFLAGS=-lintl",
"--with-systemdsystemunitdir=" + self.spec["rrdtool"].prefix.lib.systemd.system, def flag_handler(self, name, flags):
] if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
return args flags.append("-lintl")
return self.build_system_flags(name, flags)

View File

@ -6,6 +6,7 @@
import re import re
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Subversion(AutotoolsPackage): class Subversion(AutotoolsPackage):
@ -102,16 +103,14 @@ def configure_args(self):
args.append("APXS=no") args.append("APXS=no")
if "+nls" in spec: if "+nls" in spec:
args.extend( args.append("--enable-nls")
[ if "intl" in spec["gettext"].libs.names:
"LDFLAGS={0}".format(spec["gettext"].libs.search_flags), # Using .libs.link_flags is the canonical way to add these arguments,
# 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
# but since libintl is much smaller than the rest and also the only # necessary one, we would specify it by hand here
# necessary one, we specify it by hand here. args.append("LIBS=-lintl")
"LIBS=-lintl", if not is_system_path(spec["gettext"].prefix):
"--enable-nls", args.append("LDFLAGS={0}".format(spec["gettext"].libs.search_flags))
]
)
else: else:
args.append("--disable-nls") args.append("--disable-nls")

View File

@ -28,6 +28,7 @@ class Systemtap(AutotoolsPackage):
depends_on("py-setuptools", type="build") depends_on("py-setuptools", type="build")
depends_on("python", type=("build", "run")) depends_on("python", type=("build", "run"))
def configure_args(self): def flag_handler(self, name, flags):
args = ["LDFLAGS=-lintl"] if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
return args flags.append("-lintl")
return self.build_system_flags(name, flags)

View File

@ -6,6 +6,7 @@
import re import re
from spack.package import * from spack.package import *
from spack.util.environment import is_system_path
class Tar(AutotoolsPackage, GNUMirrorPackage): class Tar(AutotoolsPackage, GNUMirrorPackage):
@ -62,23 +63,28 @@ def determine_version(cls, exe):
return match.group(1) if match else None return match.group(1) if match else None
def configure_args(self): def configure_args(self):
spec = self.spec
# Note: compression programs are passed by abs path, # Note: compression programs are passed by abs path,
# so that tar can locate them when invoked without spack load. # so that tar can locate them when invoked without spack load.
args = [ args = [
"--with-libiconv-prefix={0}".format(self.spec["iconv"].prefix), "--with-xz={0}".format(spec["xz"].prefix.bin.xz),
"--with-xz={0}".format(self.spec["xz"].prefix.bin.xz), "--with-lzma={0}".format(spec["xz"].prefix.bin.lzma),
"--with-lzma={0}".format(self.spec["xz"].prefix.bin.lzma), "--with-bzip2={0}".format(spec["bzip2"].prefix.bin.bzip2),
"--with-bzip2={0}".format(self.spec["bzip2"].prefix.bin.bzip2),
] ]
if "^zstd" in self.spec: if spec["iconv"].name == "libc":
args.append("--with-zstd={0}".format(self.spec["zstd"].prefix.bin.zstd)) args.append("--without-libiconv-prefix")
elif not is_system_path(spec["iconv"].prefix):
args.append("--with-libiconv-prefix={0}".format(spec["iconv"].prefix))
if "^zstd" in spec:
args.append("--with-zstd={0}".format(spec["zstd"].prefix.bin.zstd))
# Choose gzip/pigz # Choose gzip/pigz
zip = self.spec.variants["zip"].value zip = spec.variants["zip"].value
if zip == "gzip": if zip == "gzip":
gzip_path = self.spec["gzip"].prefix.bin.gzip gzip_path = spec["gzip"].prefix.bin.gzip
elif zip == "pigz": elif zip == "pigz":
gzip_path = self.spec["pigz"].prefix.bin.pigz gzip_path = spec["pigz"].prefix.bin.pigz
args.append("--with-gzip={}".format(gzip_path)) args.append("--with-gzip={}".format(gzip_path))
return args return args

View File

@ -28,7 +28,7 @@ class UniversalCtags(AutotoolsPackage):
depends_on("automake", type="build") depends_on("automake", type="build")
depends_on("libtool", type="build") depends_on("libtool", type="build")
depends_on("m4", type="build") depends_on("m4", type="build")
depends_on("libiconv", type="link") depends_on("iconv", type="link")
depends_on("pkgconfig", type="build") depends_on("pkgconfig", type="build")
def autoreconf(self, spec, prefix): def autoreconf(self, spec, prefix):

View File

@ -32,10 +32,9 @@ class Xfd(AutotoolsPackage, XorgPackage):
# Xfd requires libintl (gettext), but does not test for it # Xfd requires libintl (gettext), but does not test for it
# correctly, so add it here. # correctly, so add it here.
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
if name == "ldlibs": if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl") flags.append("-lintl")
return self.inject_flags(name, flags)
return (flags, None, None)
def configure_args(self): def configure_args(self):
args = [] args = []

View File

@ -25,8 +25,10 @@ class Xfsdump(MakefilePackage):
depends_on("attr") depends_on("attr")
depends_on("xfsprogs@:4.20.0") depends_on("xfsprogs@:4.20.0")
def setup_build_environment(self, env): def flag_handler(self, name, flags):
env.append_flags("LDFLAGS", "-lintl") if name == "ldlibs" and "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return env_flags(name, flags)
def build(self, spec, prefix): def build(self, spec, prefix):
make( make(

View File

@ -25,21 +25,19 @@ class Xfsprogs(AutotoolsPackage):
depends_on("util-linux") depends_on("util-linux")
def flag_handler(self, name, flags): def flag_handler(self, name, flags):
iflags = []
if name == "cflags": if name == "cflags":
if self.spec.satisfies("@:5.4.0 %gcc@10:"): if self.spec.satisfies("@:5.4.0 %gcc@10:"):
iflags.append("-fcommon") flags.append("-fcommon")
return (iflags, None, flags) elif name == "ldlibs":
if "intl" in self.spec["gettext"].libs.names:
flags.append("-lintl")
return build_system_flags(name, flags)
def setup_build_environment(self, env): def setup_build_environment(self, env):
env.append_path("C_INCLUDE_PATH", self.spec["util-linux"].prefix.include.blkid) env.append_path("C_INCLUDE_PATH", self.spec["util-linux"].prefix.include.blkid)
def configure_args(self): def configure_args(self):
args = [ return ["--with-systemd-unit-dir=" + self.spec["xfsprogs"].prefix.lib.systemd.system]
"LDFLAGS=-lintl",
"--with-systemd-unit-dir=" + self.spec["xfsprogs"].prefix.lib.systemd.system,
]
return args
def install(self, spec, prefix): def install(self, spec, prefix):
make("install") make("install")