LFS-RPM/tools.sh

1340 lines
41 KiB
Bash
Raw Normal View History

2019-05-24 08:27:40 -04:00
#!/bin/bash
#-----------------------------------------------------------------------------
# Title: tools.sh
2020-05-31 13:19:17 -04:00
# Date: 2020-05-31
# Version: 2.0
# Author: chris@cromer.cl
2019-05-24 08:27:40 -04:00
# Options:
#-----------------------------------------------------------------------------
2020-05-31 13:19:17 -04:00
# Copyright 2020 Chris Cromer
2019-05-24 08:27:40 -04:00
# Copyright 2019 Baho Utot
#-----------------------------------------------------------------------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#-----------------------------------------------------------------------------
set -o errexit # exit if error...insurance ;)
set -o nounset # exit if variable not initalized
set +h # disable hashall
#-----------------------------------------------------------------------------
# Common variables
PRGNAME=${0##*/} # script name minus the path
TOPDIR=${PWD} # this directory
PARENT=/usr/src/LFS-RPM # build system master directory
2020-05-31 13:19:17 -04:00
MKFLAGS="-j 1" # Number of cpu to use in building pkgs default = 1
2019-05-24 08:27:40 -04:00
#-----------------------------------------------------------------------------
# Common support functions
function die {
local _red="\\033[1;31m"
local _normal="\\033[0;39m"
[ -n "$*" ] && printf "${_red}$*${_normal}\n"
false
exit 1
}
function msg {
printf "%s\n" "${1}"
return
}
function msg_line {
printf "%s" "${1}"
return
}
function msg_failure {
local _red="\\033[1;31m"
local _normal="\\033[0;39m"
printf "${_red}%s${_normal}\n" "FAILURE"
exit 2
}
function msg_success {
local _green="\\033[1;32m"
local _normal="\\033[0;39m"
printf "${_green}%s${_normal}\n" "SUCCESS"
return
}
function msg_log {
printf "\n%s\n\n" "${1}" >> ${_logfile} 2>&1
return
}
function end_run {
local _green="\\033[1;32m"
local _normal="\\033[0;39m"
printf "${_green}%s${_normal}\n" "Run Complete - ${PRGNAME}"
return
}
#-----------------------------------------------------------------------------
# Local functions
function _sanity {
[ $(whoami) = "lfs" ] || die "Not running as user lfs, you should be!"
[ -v LFS ] || die "LFS environment variable missing/not set"
[ "/tools/bin:/bin:/usr/bin" = "${PATH}" ] || die "PATH environment variable missing/not corrrect"
[ -v LFS_TGT ] || die "LFS_TGT environment variable missing/not set"
[ "${HOSTTYPE}-lfs-${OSTYPE}" = "${LFS_TGT}" ] || die "LFS_TGT environment variable incorrect"
[ -d ${LFS} ] || die "${LFS} directory missing"
[ -d ${LFS}/tools ] || die "${LFS}/tools directory missing"
[ -h /tools ] || die "tools root symlink missing"
[ $(stat -c %U ${LFS}/tools) = "lfs" ] || die "The tools directory not owned by user lfs"
[ ${TOPDIR} = ${LFS}${PARENT} ] || die "Not in the correct build directory"
[ -d "${TOPDIR}/LOGS" ] || install -dm 755 "${TOPDIR}/LOGS"
[ -d "${TOPDIR}/BUILD" ] || install -dm 755 "${TOPDIR}/BUILD"
return
}
function do_strip {
msg_line "Stripping file: "
strip --strip-debug /tools/lib/* > /dev/null 2&>1 || true
/usr/bin/strip --strip-unneeded /tools/{,s}bin/* > /dev/null 2&>1 || true
rm -rf /tools/{,share}/{info,man,doc}
find /tools/{lib,libexec} -name \*.la -delete
msg_success
return
}
function set-mkflags {
msg_line "Setting MKFLAGS: "
MKFLAGS="-j 1" # default
MKFLAGS="-j $(getconf _NPROCESSORS_ONLN || true)" # how many processors on this host
[ '-j' == "${MKFLAGS}" ] && MKFLAGS="-j 2" # set two cpu's default
printf "%s" "${FUNCNAME}: MKFLAGS: ${MKFLAGS}: "
msg_success
return
}
function unpack {
# $1 = source package name
local tarball=${TOPDIR}/SOURCES/${1}
msg_line " Unpacking: ${1}: "
[ -e ${tarball} ] || die " File not found: FAILURE"
tar xf ${tarball} && msg_success || msg_failure
return 0
}
function clean-build-directory {
msg_line "Cleaning BUILD directory: "
rm -rf ${TOPDIR}/BUILD/*
rm -rf ${TOPDIR}/BUILDROOT/*
msg_success
return
}
#-----------------------------------------------------------------------------
# Package functions
function Binutils-Pass-1 {
2020-05-31 15:25:14 -04:00
# Binutils-2.34 - Pass 1
local pkg=binutils-2.34.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
mkdir build
pushd build >> /dev/null 2>&1
msg_line " Configure: "
../configure --prefix=/tools \
--with-sysroot=${LFS} \
--with-lib-path=/tools/lib \
--target=${LFS_TGT} \
--disable-nls \
--disable-werror >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
install -vdm 755 /tools/lib >> ${logfile} 2>&1
[ "x86_64" = ${HOSTTYPE} ] && ln -sv lib /tools/lib64 >> ${logfile} 2>&1
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function GCC-Pass-1 {
2020-05-31 15:25:14 -04:00
# GCC-9.2.0 - Pass 1
local pkg=gcc-9.2.0.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
for file in gcc/config/{linux,i386/linux{,64}}.h; do
cp -u $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' -e 's@/usr@/tools@g' $file.orig > $file
cat >> ${file} <<- EOF
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""
EOF
touch $file.orig
done
case ${HOSTTYPE} in
x86_64) sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
;;
esac
unpack mpfr-4.0.2.tar.xz
2020-05-31 15:25:14 -04:00
unpack gmp-6.2.0.tar.xz
2019-05-24 08:27:40 -04:00
unpack mpc-1.1.0.tar.gz
mv -v mpfr-4.0.2 mpfr >> ${logfile} 2>&1
2020-05-31 15:25:14 -04:00
mv -v gmp-6.2.0 gmp >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
mv -v mpc-1.1.0 mpc >> ${logfile} 2>&1
mkdir build
pushd build >> /dev/null 2>&1
msg_line " Configure: "
../configure \
--target=${LFS_TGT} \
--prefix=/tools \
--with-glibc-version=2.11 \
--with-sysroot=${LFS} \
--with-newlib \
--without-headers \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++ >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Linux-API-Headers {
2020-05-31 15:25:14 -04:00
# Linux-5.5.3 API Headers
local pkg=linux-5.5.3.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Make: "
make mrproper >> ${logfile} 2>&1
msg_success
msg_line " Install: "
2020-05-31 15:25:14 -04:00
make headers >> ${logfile} 2>&1
cp -rv usr/include/* /tools/include >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Glibc {
2020-05-31 15:25:14 -04:00
# Glibc-2.31
local pkg=glibc-2.31.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
mkdir build
pushd build >> /dev/null 2>&1
msg_line " Configure: "
../configure \
--prefix=/tools \
--host=${LFS_TGT} \
--build=$(../scripts/config.guess) \
--enable-kernel=3.2 \
--with-headers=/tools/include >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
msg_line " Testing glibc: "
echo 'int main(){}' > dummy.c
${LFS_TGT}-gcc dummy.c >> ${logfile}.test 2>&1
echo "Test: [Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]" >> ${logfile}.test 2>&1
readelf -l a.out | grep ': /tools' >> ${logfile}.test 2>&1
rm dummy.c a.out
msg_success
return
}
function Libstdc {
2020-05-31 15:25:14 -04:00
# Libstdc++ from GCC-9.2.0
local pkg=gcc-9.2.0.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
mkdir build
pushd build >> /dev/null 2>&1
msg_line " Configure: "
../libstdc++-v3/configure \
--host=${LFS_TGT} \
--prefix=/tools \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-threads \
--disable-libstdcxx-pch \
2020-05-31 15:25:14 -04:00
--with-gxx-include-dir=/tools/${LFS_TGT}/include/c++/9.2.0 >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Binutils-Pass-2 {
2020-05-31 15:25:14 -04:00
# Binutils-2.34 - Pass 2
local pkg=binutils-2.34.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
mkdir build
pushd build >> /dev/null 2>&1
msg_line " Configure: "
CC=${LFS_TGT}-gcc \
AR=${LFS_TGT}-ar \
RANLIB=${LFS_TGT}-ranlib \
../configure \
--prefix=/tools \
--disable-nls \
--disable-werror \
--with-lib-path=/tools/lib \
--with-sysroot >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
msg_line " Prepare the linker for Re-adjusting: "
make -C ld clean >> ${logfile} 2>&1
make -C ld LIB_PATH=/usr/lib:/lib >> ${logfile} 2>&1
cp -v ld/ld-new /tools/bin >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function GCC-Pass-2 {
2020-05-31 15:25:14 -04:00
# GCC-9.2.0 - Pass 2
local pkg=gcc-9.2.0.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > `dirname $(${LFS_TGT}-gcc -print-libgcc-file-name)`/include-fixed/limits.h
for file in gcc/config/{linux,i386/linux{,64}}.h; do
cp -u $file{,.orig} >> ${logfile} 2>&1
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' -e 's@/usr@/tools@g' $file.orig > $file
cat >> ${file} <<- EOF
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""
EOF
touch $file.orig
done
case ${HOSTTYPE} in
x86_64) sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
;;
esac
unpack mpfr-4.0.2.tar.xz
2020-05-31 15:25:14 -04:00
unpack gmp-6.2.0.tar.xz
2019-05-24 08:27:40 -04:00
unpack mpc-1.1.0.tar.gz
mv -v mpfr-4.0.2 mpfr >> ${logfile} 2>&1
2020-05-31 15:25:14 -04:00
mv -v gmp-6.2.0 gmp >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
mv -v mpc-1.1.0 mpc >> ${logfile} 2>&1
2020-05-31 15:25:14 -04:00
sed -e '1161 s|^|//|' -i libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
2019-05-24 08:27:40 -04:00
mkdir build
pushd build >> /dev/null 2>&1
msg_line " Configure: "
CC=${LFS_TGT}-gcc \
CXX=${LFS_TGT}-g++ \
AR=${LFS_TGT}-ar \
RANLIB=${LFS_TGT}-ranlib \
../configure \
--prefix=/tools \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--enable-languages=c,c++ \
--disable-libstdcxx-pch \
--disable-multilib \
2020-05-31 19:06:33 -04:00
--disable-bootstrap \
--disable-libgomp >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
ln -sv gcc /tools/bin/cc >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
msg_line "Testing gcc pass-2: "
echo 'int main(){}' > dummy.c
cc dummy.c >> ${logfile}.test 2>&1
echo "Test: [Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]" >> ${logfile}.test 2>&1
readelf -l a.out | grep ': /tools' >> ${logfile}.test 2>&1
rm dummy.c a.out
msg_success
return
}
function Tcl {
2020-05-31 15:25:14 -04:00
# Tcl-8.6.10
local pkg=tcl8.6.10-src.tar.gz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%-src*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
cd unix
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
chmod -v u+w /tools/lib/libtcl8.6.so >> ${logfile} 2>&1
make install-private-headers >> ${logfile} 2>&1
ln -sv tclsh8.6 /tools/bin/tclsh >> ${logfile} 2>&1
msg_success
cd -
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Expect {
# Expect-5.45.4
local pkg=expect5.45.4.tar.gz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
cp -v configure{,.orig} >> ${logfile} 2>&1
sed 's:/usr/local/bin:/bin:' configure.orig > configure
./configure \
--prefix=/tools \
--with-tcl=/tools/lib \
--with-tclinclude=/tools/include>> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make SCRIPTS="" install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function DejaGNU {
# DejaGNU-1.6.2
local pkg=dejagnu-1.6.2.tar.gz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
# M4-1.4.18
function M4 {
# M4-1.4.18
local pkg=m4-1.4.18.tar.xz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c >> ${logfile} 2>&1
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Ncurses {
2020-05-31 15:25:14 -04:00
# Ncurses-6.2
local pkg=ncurses-6.2.tar.gz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
sed -i s/mawk// configure >> ${logfile} 2>&1
./configure \
--prefix=/tools \
--with-shared \
--without-debug \
--without-ada \
--enable-widec \
--enable-overwrite >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
ln -s libncursesw.so /tools/lib/libncurses.so >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Bash {
# Bash-5.0
local pkg=bash-5.0.tar.gz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools --without-bash-malloc >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
ln -sv bash /tools/bin/sh >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Bison {
2020-05-31 15:25:14 -04:00
# Bison-3.5.2
local pkg=bison-3.5.2.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Bzip {
2020-05-31 15:25:14 -04:00
# Bzip2-1.0.8
local pkg=bzip2-1.0.8.tar.gz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
local OPTFLAGS=" -march=x86-64 -mtune=generic -O2 -pipe -fPIC "
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
2020-05-31 15:25:14 -04:00
make ${MKFLAGS} -f Makefile-libbz2_so >> ${logfile} 2>&1
make ${MKFLAGS} clean >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make PREFIX=/tools install >> ${logfile} 2>&1
2020-05-31 15:25:14 -04:00
cp -v bzip2-shared /tools/bin/bzip2 >> ${logfile} 2>&1
cp -av libbz2.so* /tools/lib >> ${logfile} 2>&1
ln -sv libbz2.so.1.0 /tools/lib/libbz2.so >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Coreutils {
2020-05-31 15:25:14 -04:00
# Coreutils-8.31
local pkg=coreutils-8.31.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools --enable-install-program=hostname >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Diffutils {
# Diffutils-3.7
local pkg=diffutils-3.7.tar.xz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function File {
2020-05-31 15:25:14 -04:00
# File-5.38
local pkg=file-5.38.tar.gz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Findutils {
2020-05-31 15:25:14 -04:00
# Findutils-4.7.0
2020-05-31 16:33:29 -04:00
local pkg=findutils-4.7.0.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Gawk {
2020-05-31 15:25:14 -04:00
# Gawk-5.0.1
local pkg=gawk-5.0.1.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Gettext {
2020-05-31 15:25:14 -04:00
# Gettext-0.20.1
local pkg=gettext-0.20.1.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
2020-05-31 15:25:14 -04:00
./configure --disable-shared >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
msg_line " Make: "
2020-05-31 15:25:14 -04:00
make ${MKFLAGS} >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
msg_line " Install: "
2020-05-31 15:25:14 -04:00
cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /tools/bin >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
cd - > /dev/null 2>&1
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Grep {
2020-05-31 15:25:14 -04:00
# Grep-3.4
local pkg=grep-3.4.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Gzip {
# Gzip-1.10
local pkg=gzip-1.10.tar.xz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Make {
2020-05-31 15:25:14 -04:00
# Make-4.3
2020-05-31 17:20:20 -04:00
local pkg=make-4.3.tar.gz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools --without-guile >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Patch {
# Patch-2.7.6
local pkg=patch-2.7.6.tar.xz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Perl {
2020-05-31 15:25:14 -04:00
# Perl-5.30.1
local pkg=perl-5.30.1.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
sh Configure -des -Dprefix=/tools -Dlibs=-lm -Uloclibpth -Ulocincpth >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
cp -v perl cpan/podlators/scripts/pod2man /tools/bin >> ${logfile} 2>&1
2020-05-31 15:25:14 -04:00
mkdir -pv /tools/lib/perl5/5.30.1 >> ${logfile} 2>&1
cp -Rv lib/* /tools/lib/perl5/5.30.1 >> ${logfile} 2>&1
2019-05-24 08:27:40 -04:00
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Python {
2020-05-31 15:25:14 -04:00
# Python-3.8.1
local pkg=Python-3.8.1.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
sed -i '/def add_multiarch_paths/a \ return' setup.py
./configure --prefix=/tools --without-ensurepip >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Sed {
2020-05-31 15:25:14 -04:00
# Sed-4.8
local pkg=sed-4.8.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Tar {
2020-05-31 15:25:14 -04:00
# Tar-1.32
local pkg=tar-1.32.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Texinfo {
2020-05-31 15:25:14 -04:00
# Texinfo-6.7
local pkg=texinfo-6.7.tar.xz
2019-05-24 08:27:40 -04:00
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
function Xz {
# Xz-5.2.4
local pkg=xz-5.2.4.tar.xz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"
pushd ${pkg_dir} >> /dev/null 2>&1
msg_line " Configure: "
./configure --prefix=/tools >> ${logfile} 2>&1
msg_success
msg_line " Make: "
make ${MKFLAGS} >> ${logfile} 2>&1
msg_success
msg_line " Install: "
make install >> ${logfile} 2>&1
msg_success
popd > /dev/null 2>&1
popd > /dev/null 2>&1
clean-build-directory
mv ${logfile} ${logfile}.complete
return
}
# RPM STUFF
function Zlib {
local pkg=zlib-1.2.11.tar.xz
local pkg_dir=${pkg%%.tar*}
local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
local OPTFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fPIC"
[ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
> ${logfile}
install -dm 755 ${TOPDIR}/BUILDROOT
pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
unpack "${pkg}"