# python-build definition for prebuilt Python 3.14.7-macos-15-arm64 (Darwin/arm64, macos 15.7.9).
# Generated by `pyenv binary generate-installer'.

EXPECT_OS=Darwin
EXPECT_ARCH=arm64
EXPECT_LIBC=''
BUILD_PREFIX=/Users/runner/work/pyenv/pyenv/versions/3.14.7-macos-15-arm64
VERSION=3.14.7-macos-15-arm64
ARCHIVE_URL=https://pyenv.github.io/pythons/binaries/3.14.7-macos-15-arm64.tar.xz
SHA256=e54a1d984733ab3091a55b3eb9e8d2a02b6f2d59f634252a8e98e9640429b089
DEPS=/opt/homebrew/opt/gdbm/lib/libgdbm_compat.4.dylib\ /opt/homebrew/opt/gdbm/lib/libgdbm.6.dylib\ /opt/homebrew/opt/gettext/lib/libintl.8.dylib\ /opt/homebrew/opt/mpdecimal/lib/libmpdec.4.dylib\ /opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib\ /opt/homebrew/opt/openssl@3/lib/libssl.3.dylib\ /opt/homebrew/opt/readline/lib/libreadline.8.dylib\ /opt/homebrew/opt/tcl-tk@8/lib/libtcl8.6.dylib\ /opt/homebrew/opt/tcl-tk@8/lib/libtk8.6.dylib\ /opt/homebrew/opt/xz/lib/liblzma.5.dylib\ /opt/homebrew/opt/zstd/lib/libzstd.1.dylib\ /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation\ /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration\ /usr/lib/libbz2.1.0.dylib\ /usr/lib/libffi.dylib\ /usr/lib/libncurses.5.4.dylib\ /usr/lib/libpanel.5.4.dylib\ /usr/lib/libsqlite3.dylib\ /usr/lib/libSystem.B.dylib\ /usr/lib/libz.1.dylib

os="$(uname -s)"
arch="$(uname -m)"
if [ "$os" != "$EXPECT_OS" ] || [ "$arch" != "$EXPECT_ARCH" ]; then
  echo "pyenv-binary: this archive is for ${EXPECT_OS}/${EXPECT_ARCH}, not ${os}/${arch}" >&2
  exit 1
fi

# Refuse a target whose glibc is older than the one the archive was built on;
# the dynamic loader would reject the binaries.
case "$EXPECT_LIBC" in
"glibc "* )
  build_libc="${EXPECT_LIBC#glibc }"
  target_libc="$(getconf GNU_LIBC_VERSION 2>/dev/null || true)"
  case "$target_libc" in
  "glibc "* )
    target_libc="${target_libc#glibc }"
    older="$(printf '%s\n%s\n' "$build_libc" "$target_libc" | sort -V | head -n1)"
    if [ "$older" = "$target_libc" ] && [ "$target_libc" != "$build_libc" ]; then
      echo "pyenv-binary: archive needs glibc ${build_libc} or newer, but this system has ${target_libc}" >&2
      exit 1
    fi
    ;;
  esac
  ;;
esac

# Required system libraries must already be present on the target. Linux lists
# the soname first; FreeBSD lists it in the resolved path, so normalize that
# path before matching exact names.
cache=""
if command -v ldconfig &>/dev/null; then
  case "$os" in
  FreeBSD )
    cache="$(ldconfig -r 2>/dev/null)" &&
      cache="$(printf '%s\n' "$cache" | awk -F ' *=> *' '{ sub(/^.*\//, "", $2); print $2 }')" \
      || cache=""
    ;;
  * )
    cache="$(ldconfig -p 2>/dev/null)" || cache=""
    ;;
  esac
fi
if [ -n "$cache" ]; then
  missing=""
  for dep in $DEPS; do
    printf '%s\n' "$cache" | awk -v d="$dep" '$1 == d { found = 1 } END { exit !found }' \
      || missing="${missing} ${dep}"
  done
  if [ -n "$missing" ]; then
    echo "pyenv-binary: missing required system libraries:${missing}" >&2
    exit 1
  fi
elif [ -n "$DEPS" ]; then
  echo "pyenv-binary: cannot check required system libraries (ldconfig cache unavailable)" >&2
fi

case "$os" in
Darwin )
  for tool in otool install_name_tool; do
    if ! command -v "$tool" >/dev/null 2>&1; then
      echo "pyenv-binary: need ${tool} to relocate the binary" >&2
      exit 1
    fi
  done
  ;;
* )
  if ! command -v patchelf >/dev/null 2>&1; then
    echo "pyenv-binary: need patchelf to relocate the binary" >&2
    exit 1
  fi
  ;;
esac

build_package_relocate() {
  if [ "$os" = "Darwin" ]; then
    pyenv binary relocate "$PREFIX_PATH" "$BUILD_PREFIX"
  else
    pyenv binary relocate "$PREFIX_PATH"
  fi
}

install_package "Python-${VERSION}-binary" "${ARCHIVE_URL}#${SHA256}" copy relocate

