Created
April 14, 2024 15:20
-
-
Save Chaz6/3944c42ef4466fb24c370c76342eb6e5 to your computer and use it in GitHub Desktop.
build-python-on-almalinux.bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
PYTHON_VERSION=3.13.0 | |
BETA_VERSION=a6 | |
INSTALLDIR="${HOME}"/.local/local | |
cd /tmp && | |
wget -4 "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}${BETA_VERSION}.tar.xz" && | |
echo "Extracting archive..." && | |
tar xvf "Python-${PYTHON_VERSION}${BETA_VERSION}.tar.xz" && | |
echo "Building Python..." && | |
(cd "Python-${PYTHON_VERSION}${BETA_VERSION}" && | |
CPPFLAGS="-march=native" \ | |
LDFLAGS="-Wl,-rpath,'${INSTALLDIR}/python-'${PYTHON_VERSION}${BETA_VERSION}'/lib' -Wl,--enable-new-dtags" \ | |
LLVM_PROFDATA=/usr/bin/llvm-profdata \ | |
CC=/usr/bin/clang \ | |
CXX=/usr/bin/clang++ \ | |
./configure \ | |
--prefix=/home/chaz/.local/local/python-"${PYTHON_VERSION}${BETA_VERSION}" \ | |
--enable-optimizations \ | |
--enable-shared \ | |
--enable-loadable-sqlite-extensions && | |
make -j4 && make install) && | |
echo "Creating archive..." && | |
([ ! -d "${INSTALLDIR}" ] && mkdir -p "${INSTALLDIR}"; cd "${INSTALLDIR}" && | |
tar Jcvf "python-${PYTHON_VERSION}${BETA_VERSION}.tar.xz" "python-${PYTHON_VERSION}${BETA_VERSION}") && | |
echo "Deleting build files..." && | |
rm -rf "Python-${PYTHON_VERSION}${BETA_VERSION}" "Python-${PYTHON_VERSION}${BETA_VERSION}.tar.xz" && | |
echo "Successful!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment