diff options
Diffstat (limited to 'etc/pkgs')
-rwxr-xr-x | etc/pkgs/000-base.sh | 27 | ||||
-rwxr-xr-x | etc/pkgs/001-gcc.sh | 90 | ||||
-rwxr-xr-x | etc/pkgs/002-binutils.sh | 16 | ||||
-rwxr-xr-x | etc/pkgs/003-openssh.sh | 73 | ||||
-rwxr-xr-x | etc/pkgs/004-python.sh | 133 |
5 files changed, 339 insertions, 0 deletions
diff --git a/etc/pkgs/000-base.sh b/etc/pkgs/000-base.sh new file mode 100755 index 0000000..e32bbae --- /dev/null +++ b/etc/pkgs/000-base.sh @@ -0,0 +1,27 @@ +#!/bin/bash +packages=( + gcc + gcc-c++ + gcc-gfortran + git + glibc + libuuid-devel + make + perl + pkgconfig + expat-devel + bzip2-devel + gdbm-devel + libffi-devel + ncurses-devel + openssl-devel + readline-devel + sqlite-devel + sudo + tcl-devel + tk-devel + which + xz-devel + zlib-devel +) +yum install -y "${packages[@]}" diff --git a/etc/pkgs/001-gcc.sh b/etc/pkgs/001-gcc.sh new file mode 100755 index 0000000..52c01da --- /dev/null +++ b/etc/pkgs/001-gcc.sh @@ -0,0 +1,90 @@ +#!/bin/bash -e +set -x +name=gcc +version=8.2.0 +url=http://mirrors-usa.go-parts.com/gcc/releases/${name}-${version}/${name}-${version}.tar.gz +src=${name}-${version} +bld=${src}_build + +version_isl=0.20 +url_isl=http://isl.gforge.inria.fr/isl-${version_isl}.tar.bz2 + +version_cloog=0.18.4 +url_cloog="http://www.bastoul.net/cloog/pages/download/count.php3?url=./cloog-${version_cloog}.tar.gz" + +sudo yum install -y wget +sudo ln -sf ${TOOLCHAIN_LIB} ${TOOLCHAIN}/lib64 + +curl -LO ${url} +tar xf ${src}.tar.gz + +mkdir -p ${bld} +pushd ${src} + unset CFLAGS + unset LDFLAGS + + # Disable fixincludes + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + + # Use /lib, not /lib64 + #sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 + #sed -i 's/lib64/lib/g' gcc/config.gcc + #sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure + + # Download MPFR and friends + ./contrib/download_prerequisites + + curl -LO ${url_isl} + tar xf $(basename ${url_isl}) + ln -s isl-${version_isl} isl + + curl -LO ${url_cloog} + tar xf $(basename ${url_cloog}) + ln -s cloog-${version_cloog} cloog +popd + +pushd ${bld} + # Beware: x86_64-only toolchain (multilib disabled) + ../${src}/configure \ + --prefix=${TOOLCHAIN} \ + --libdir=${TOOLCHAIN_LIB} \ + --libexecdir=${TOOLCHAIN_LIB} \ + --disable-bootstrap \ + --disable-multilib \ + --disable-werror \ + --disable-libunwind-exceptions \ + --disable-libstdcxx-pch \ + --disable-libssp \ + --with-system-zlib \ + --with-isl \ + --with-linker-hash-style=gnu \ + --enable-languages=c,c++,fortran,lto,go \ + --enable-shared \ + --enable-threads=posix \ + --enable-libmpx \ + --enable-__cxa_atexit \ + --enable-clocale=gnu \ + --enable-gnu-unique-object \ + --enable-linker-build-id \ + --enable-lto \ + --enable-plugin \ + --enable-install-libiberty \ + --enable-gnu-indirect-function \ + --enable-default-pie \ + --enable-default-ssp \ + --enable-cet=auto \ + --enable-checking=release + + make -j${_maxjobs} + make install-strip + + # Prevent ldconfig from picking up gdb python scripts + autoload="${TOOLCHAIN_DATA}/gdb/auto-load${TOOLCHAIN_LIB}" + mkdir -p "${autoload}" + mv -v "${TOOLCHAIN_LIB}"/*gdb.py "${autoload}" + + # Enforce global linkage to toolchain + /bin/echo "${TOOLCHAIN_LIB}" > gcc.conf + sudo cp -a gcc.conf /etc/ld.so.conf.d + sudo ldconfig +popd diff --git a/etc/pkgs/002-binutils.sh b/etc/pkgs/002-binutils.sh new file mode 100755 index 0000000..bd119fe --- /dev/null +++ b/etc/pkgs/002-binutils.sh @@ -0,0 +1,16 @@ +#!/bin/bash +name=binutils +version=2.31.1 +url=https://ftp.gnu.org/gnu/binutils/${name}-${version}.tar.gz + +curl -LO ${url} +tar xf ${name}-${version}.tar.gz + +mkdir -p binutils +pushd binutils + ../${name}-${version}/configure \ + --prefix=${TOOLCHAIN} \ + --with-sysroot=${TOOLCHAIN} + make -j${_maxjobs} + make install +popd diff --git a/etc/pkgs/003-openssh.sh b/etc/pkgs/003-openssh.sh new file mode 100755 index 0000000..1f99fe8 --- /dev/null +++ b/etc/pkgs/003-openssh.sh @@ -0,0 +1,73 @@ +#!/bin/bash +set -e +set -x + +name="openssl" +version="1.1.0j" + +tarball="${name}-${version}.tar.gz" +dest="${tarball%%.tar.gz}" +url="https://www.openssl.org/source/${tarball}" +prefix="${TOOLCHAIN}" + + +function pre() +{ + curl -LO "${url}" + tar xf "${tarball}" +} + + +function get_system_cacert() { + local paths=( + /etc/ssl/cert.pem + /etc/ssl/cacert.pem + /etc/ssl/certs/cacert.pem + /etc/ssl/certs/ca-bundle.crt + ) + for bundle in "${paths[@]}" + do + if [[ -f ${bundle} ]]; then + echo "${bundle}" + break + fi + done +} + + +function build() +{ + pre + pushd "${dest}" + export PATH="${prefix}/bin:${PATH}" + export LDFLAGS="-Wl,-rpath=${prefix}/lib" + export KERNEL_BITS=64 + target="linux-x86_64" + + ./Configure \ + --prefix="${prefix}" \ + --openssldir="ssl" \ + --libdir="lib" \ + ${LDFLAGS} \ + ${target} \ + enable-ec_nistp_64_gcc_128 \ + zlib-dynamic \ + shared \ + no-ssl3-method + make + make install MANDIR="${prefix}/share/man" MANSUFFIX=ssl + popd + post +} + +function post() +{ + bundle=$(get_system_cacert) + install -D -m644 "${bundle}" "${prefix}/ssl/cert.pem" + rm -rf "${dest}" + rm -rf "${tarball}" + echo "All done." +} + +# Main +build diff --git a/etc/pkgs/004-python.sh b/etc/pkgs/004-python.sh new file mode 100755 index 0000000..d7db12f --- /dev/null +++ b/etc/pkgs/004-python.sh @@ -0,0 +1,133 @@ +#!/bin/bash +set -e +set -x + +python_version="${PYTHON_VERSION}" +python_basever="${python_version%.*}" + +if [[ ! ${python_version} || ! ${python_basever} ]]; then + echo "Need a python version..." + exit 1 +fi + +python_base_url="https://www.python.org/ftp/python" +python_tarball="Python-${python_version}.tgz" +python_source="${python_tarball%%.tgz}" +python_url="${python_base_url}/${python_version}/${python_tarball}" +prefix="${TOOLCHAIN}" + +dep_table=( + "bzlib.h libbz2.so" + "expat.h libexpat.so" + "ffi.h libffi.so" + "gdbm.h libgdbm.so" + "lzma.h liblzma.so" + "ncurses.h libncurses.so" + "nislib.h libnsl.so" + "readline.h libreadline.so" + "ssl.h libssl.so" + "sqlite3.h libsqlite3.so" + "tcl.h libtcl.so" + "tk.h libtk.so" + "zlib.h libz.so" +) + + +function depcheck() +{ + dep_count=0 + dep_total="${#dep_table[@]}" + + set +x + for _record in "${dep_table[@]}" + do + unset record + read -ra record <<< $_record + + header=$(find /usr/include /usr/lib{,64} -regex ".*\/${record[0]}" 2>/dev/null | head -n 1 || true) + if [[ -n $header ]]; then + dep_count=$((dep_count+1)) + else + echo "Missing header: ${record[0]}" + fi + lib=$(find /usr/lib{,64} -regex ".*\/${record[1]}" 2>/dev/null | head -n 1 || true) + if [[ -n "$lib" ]]; then + dep_count=$((dep_count+1)) + else + echo "Missing library: ${record[1]}" + fi + done + set -x + + if [[ ${dep_count} != $(( (dep_total * 2) )) ]]; then + echo 'Missing dependencies...' + exit 1 + fi +} + + +function pre() +{ + depcheck + + if [[ ! -f ${python_tarball} ]]; then + curl -LO "${python_url}" + fi + + if [[ -d ${python_source} ]]; then + rm -rf "${python_source}" + fi + + tar xf "${python_tarball}" +} + + +function build() +{ + pre + export CFLAGS="-I${prefix}/include" + export LDFLAGS="-L${prefix}/lib -Wl,-rpath=${prefix}/lib" + pushd "${python_source}" + #--enable-optimizations \ + ./configure \ + --prefix="${prefix}" \ + --enable-ipv6 \ + --enable-loadable-sqlite-extensions \ + --enable-profiling \ + --enable-shared \ + --with-dbmliborder=gdbm:ndbm \ + --with-pymalloc \ + --with-system-expat + make -j4 + make install + popd + post +} + + +function post() +{ + export PATH=$prefix/bin:$PATH + ln -sf python3 "${prefix}"/bin/python + ln -sf python3-config "${prefix}"/bin/python-config + ln -sf idle3 "${prefix}"/bin/idle + ln -sf pydoc3 "${prefix}"/bin/pydoc + ln -sf pip3 "${prefix}"/bin/pip + ln -sf python${python_basever}.1 "${prefix}"/share/man/man1/python.1 + + echo '---' + python --version + python -c "import sys; from pprint import pprint; pprint(sys.path)" + echo '---' + ldd $(which python) + echo '---' + + rm -rf $HOME/.config/pip + rm -rf "${python_tarball}" + rm -rf "${python_source}" + echo "All done." +} + + +# Main +build |