#!/bin/bash

if ! type "include" > /dev/null 2>&1; then
  include() {
  . "$(cd "$(dirname "$1")" && pwd)/${2}";
  };
fi
include "${BASH_SOURCE[0]}" ./global.bash
if ! pragma_once ${BASH_SOURCE[0]}; then return 0;
  source ./../gcc/global.bash
fi

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:patchelf-0.18.0"
  export LD_LIBRARY_PATH=/home/env/Qt5.14.2/5.14.2/gcc_64/lib/:$LD_LIBRARY_PATH
}
load_compile_environment

_install_=""
_src_=""

if [[ "$(uname)" == "Linux" ]]; then
  echo "This is Linux."
  _install_="/ae/install"
  _src_="/ae/src"
elif [[ "$(uname)" == "MINGW"* || "$(uname)" == "CYGWIN"* ]]; then
  echo "This is Windows (Cygwin or MinGW)."
  _install_="D:\wyc\cached_external_library\bash_install"
  _src_="D:\wyc\cached_external_library\bash_srcs"
else
  echo "Unknown system."
fi



packageName="elfutils"
version="0.189"
_src="${_src_}/${packageName}-${version}"
_build="${_src_}/${packageName}-${version}-build"
_install="${_install_}/${packageName}-${version}-install"

#wget -P "${src}" https://sourceware.org/elfutils/ftp/0.189/elfutils-0.189.tar.bz2
tar -xvf "${_src_}/elfutils-0.189.tar.bz2" -C "${_src_}"
chmod 777 "${_src}"
mkdir -m 777 "${_build}"
cd "${_build}" || exit
../"${_src}"/configure --prefix="${_install}"
make -j"$(nproc)"
sudo make install
sudo chmod -R 777 "${_install}"
