#!/bin/bash
if ! type "include" > /dev/null 2>&1; then
  include() {
  . "$(cd "$(dirname "$1")" && pwd)/${2}";
  };
fi

if ! pragma_once ${BASH_SOURCE[0]}; then return 0;
  source ../base/export.bash
fi

include "${BASH_SOURCE[0]}" ../base/export.bash


if pragma_once "${BASH_SOURCE[0]}"; then
  load_compile_environment() {
    load_library "gcc-14.2.0:mpc-1.3.1:mpfr-4.2.1:gmp-6.2.1:cmake-3.26.5:make-4.4"
  }
  load_compile_environment
  git clone https://github.com/NixOS/patchelf.git "${_src_}/patchelf-0.18.0"
  cd "$_src_/patchelf-0.18.0" || {
    echo "$_src_/patchelf-0.18 不存在！"
    exit 1
  }
  git checkout 0.18.0
  ./bootstrap.sh
  ./configure --prefix="${_install_}/patchelf-0.18.0"
  make -j"$(nproc)"
  make check
  sudo make install
  sudo chmod -R 777 "${_install_}/patchelf-0.18.0"
  patchelf --version
fi

#  /ae/win/wyc/projects/CLionProjects/plantSunCat/0_linux_pro

#./bootstrap.sh
#./configure
#make
#make check
#sudo make install
