Skip to content

Commit

Permalink
Merge pull request #301 from climbfuji/feature/detect_external_libiconv
Browse files Browse the repository at this point in the history
Detect external libiconv on macOS, make non-buildable
  • Loading branch information
climbfuji authored Aug 14, 2023
2 parents 677614b + d5c7055 commit 9571823
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions var/spack/repos/builtin/packages/libiconv/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re

from spack.package import *

Expand Down Expand Up @@ -33,6 +34,25 @@ class Libiconv(AutotoolsPackage, GNUMirrorPackage):

conflicts("@1.14", when="%gcc@5:")

# Don't build on Darwin to avoid problems with _iconv vs _libiconv; use native package - see
# https://stackoverflow.com/questions/57734434/libiconv-or-iconv-undefined-symbol-on-mac-osx
conflicts("platform=darwin")

# For spack external find
executables = ["^iconv$"]

@classmethod
def determine_version(cls, exe):
# We only need to find libiconv on macOS to avoid problems with _iconv vs _libiconv - see
# https://stackoverflow.com/questions/57734434/libiconv-or-iconv-undefined-symbol-on-mac-osx
macos_pattern = re.compile("\(GNU libiconv (\w+\.\w+)\)") # noqa: W605
version_string = Executable(exe)("--version", output=str, error=str)
match = macos_pattern.search(version_string)
version = None
if match:
version = match.group(1)
return version

def configure_args(self):
args = ["--enable-extra-encodings"]

Expand Down

0 comments on commit 9571823

Please sign in to comment.