forked from Dark-Horse-Linux/pyrois
up through binutils - pass 3
parent
b8bfec9722
commit
360f2afae7
|
@ -116,7 +116,7 @@ function restore() {
|
||||||
echo
|
echo
|
||||||
pushd ${dir_artifacts}
|
pushd ${dir_artifacts}
|
||||||
assert_zero $?
|
assert_zero $?
|
||||||
tar xvpf ${project_root}/$selected
|
tar xpf ${project_root}/$selected
|
||||||
assert_zero $?
|
assert_zero $?
|
||||||
|
|
||||||
logprint "Backup restored successfully. Arming chroot."
|
logprint "Backup restored successfully. Arming chroot."
|
||||||
|
@ -124,7 +124,7 @@ function restore() {
|
||||||
assert_zero $?
|
assert_zero $?
|
||||||
make arm_chroot
|
make arm_chroot
|
||||||
echo
|
echo
|
||||||
logprint "You may now proceed to run 'make build_stage4' or higher."
|
logprint "You may now proceed."
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
logprint "User canceled. Moving on."
|
logprint "User canceled. Moving on."
|
||||||
|
|
|
@ -23,7 +23,7 @@ logprint() {
|
||||||
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||||
| tee -a "${LOG_DIR}/${LOGFILE}"
|
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||||
}
|
}
|
||||||
|
ulimit -n 3000000
|
||||||
/usr/sbin/chroot "${T_SYSROOT}" /usr/bin/env -i \
|
/usr/sbin/chroot "${T_SYSROOT}" /usr/bin/env -i \
|
||||||
HOME=/root \
|
HOME=/root \
|
||||||
TERM="$TERM" \
|
TERM="$TERM" \
|
||||||
|
|
|
@ -5,6 +5,7 @@ ulimit -l unlimited
|
||||||
|
|
||||||
#ulimit -n 10240
|
#ulimit -n 10240
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
|
ulimit -n 3000000
|
||||||
|
|
||||||
|
|
||||||
# closely aligns with LFS Ch 5, 6
|
# closely aligns with LFS Ch 5, 6
|
||||||
|
|
|
@ -36,6 +36,9 @@ ARGUMENT_LIST=(
|
||||||
"build_pass2"
|
"build_pass2"
|
||||||
"install_pass2"
|
"install_pass2"
|
||||||
"pass2"
|
"pass2"
|
||||||
|
"build_pass3"
|
||||||
|
"install_pass3"
|
||||||
|
"pass3"
|
||||||
"help"
|
"help"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,6 +51,9 @@ MODE_PASS1=false
|
||||||
MODE_BUILD_PASS2=false
|
MODE_BUILD_PASS2=false
|
||||||
MODE_INSTALL_PASS2=false
|
MODE_INSTALL_PASS2=false
|
||||||
MODE_PASS2=false
|
MODE_PASS2=false
|
||||||
|
MODE_BUILD_PASS3=false
|
||||||
|
MODE_INSTALL_PASS3=false
|
||||||
|
MODE_PASS3=false
|
||||||
MODE_HELP=false
|
MODE_HELP=false
|
||||||
|
|
||||||
# the file to log to
|
# the file to log to
|
||||||
|
@ -58,7 +64,7 @@ TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
|
|
||||||
# the path where logs are written to
|
# the path where logs are written to
|
||||||
# note: LOGS_ROOT is sourced from environment
|
# note: LOGS_ROOT is sourced from environment
|
||||||
LOG_DIR="${dir_logs}/${APPNAME}-${TIMESTAMP}"
|
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||||
|
|
||||||
# the path where the source will be located when complete
|
# the path where the source will be located when complete
|
||||||
# note: TEMP_STAGE_DIR is sourced from environment
|
# note: TEMP_STAGE_DIR is sourced from environment
|
||||||
|
@ -110,6 +116,18 @@ while [[ $# -gt 0 ]]; do
|
||||||
MODE_PASS2=true
|
MODE_PASS2=true
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
|
--build_pass3)
|
||||||
|
MODE_BUILD_PASS3=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--install_pass3)
|
||||||
|
MODE_INSTALL_PASS3=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--pass3)
|
||||||
|
MODE_PASS3=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
--help)
|
--help)
|
||||||
MODE_HELP=true
|
MODE_HELP=true
|
||||||
shift 1
|
shift 1
|
||||||
|
@ -136,6 +154,7 @@ mode_stage() {
|
||||||
|
|
||||||
logprint "Removing any pre-existing staging for ${APPNAME}."
|
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||||
rm -Rf "${T_SOURCE_DIR}"*
|
rm -Rf "${T_SOURCE_DIR}"*
|
||||||
|
rm -Rf "${T_SOURCE_DIR}"
|
||||||
|
|
||||||
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||||
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" \
|
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}" \
|
||||||
|
@ -216,6 +235,66 @@ mode_build_pass2() {
|
||||||
logprint "Build operation complete."
|
logprint "Build operation complete."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode_build_pass3() {
|
||||||
|
echo -n "3000000" >/proc/sys/fs/file-max
|
||||||
|
ulimit -n 3000000
|
||||||
|
ulimit -a
|
||||||
|
|
||||||
|
logprint "Starting build of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Entering build dir."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Checking for PTY viability..."
|
||||||
|
|
||||||
|
expect -c 'spawn bash -c "echo test > /dev/pts/1"; expect "test"; exit [catch wait]'
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
mkdir -pv build
|
||||||
|
assert_zero $?
|
||||||
|
pushd build
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Configuring ${APPNAME}..."
|
||||||
|
../configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--sysconfdir=/etc \
|
||||||
|
--enable-gold \
|
||||||
|
--enable-ld=default \
|
||||||
|
--enable-plugins \
|
||||||
|
--enable-shared \
|
||||||
|
--disable-werror \
|
||||||
|
--enable-64-bit-bfd \
|
||||||
|
--with-system-zlib
|
||||||
|
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Compiling..."
|
||||||
|
make tooldir=/usr
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Testing..."
|
||||||
|
err=0
|
||||||
|
make -k \
|
||||||
|
CFLAGS="-g -O2 -no-pie -fno-PIC" \
|
||||||
|
CXXFLAGS="-g -O2 -no-pie -fno-PIC" \
|
||||||
|
CFLAGS_FOR_TARGET="-g -O2" \
|
||||||
|
CXXFLAGS_FOR_TARGET="-g -O2" \
|
||||||
|
LDFLAGS= \
|
||||||
|
check \
|
||||||
|
|| err=1
|
||||||
|
|
||||||
|
if [ $err -ne 0 ]; then
|
||||||
|
logprint "Testing failed."
|
||||||
|
grep -nl '^FAIL:' $(find -name '*.log')
|
||||||
|
#assert_zero $err
|
||||||
|
fi
|
||||||
|
|
||||||
|
logprint "Build operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mode_install_pass1() {
|
mode_install_pass1() {
|
||||||
logprint "Starting install of ${APPNAME}..."
|
logprint "Starting install of ${APPNAME}..."
|
||||||
pushd "${T_SOURCE_DIR}/build"
|
pushd "${T_SOURCE_DIR}/build"
|
||||||
|
@ -243,9 +322,29 @@ mode_install_pass2() {
|
||||||
logprint "Install operation complete."
|
logprint "Install operation complete."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode_install_pass3() {
|
||||||
|
logprint "Starting install of ${APPNAME}..."
|
||||||
|
pushd "${T_SOURCE_DIR}/build"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
make tooldir=/usr install
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Cleaning up..."
|
||||||
|
rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,sframe,opcodes}.a
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
rm -fv /usr/share/man/man1/{gprofng,gp-*}.1
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
|
||||||
|
logprint "Install operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mode_help() {
|
mode_help() {
|
||||||
echo "${APPNAME} [ --stage ] [ --build_pass1 ] [ --install_pass1 ] [ --pass1 ] [ --build_pass2 ] [ --install_pass2 ] [ --pass2 ][ --help ]"
|
echo "${APPNAME} [ --stage ] [ --build_pass1 ] [ --install_pass1 ] [ --pass1 ] [ --build_pass2 ] [ --install_pass2 ] [ --pass2 ][ --build_pass3 ] [ --install_pass3 ] [ --pass3 ][ --help ]"
|
||||||
exit 0
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# MODE_PASS1 is a meta toggle for all pass1 modes. Modes will always
|
# MODE_PASS1 is a meta toggle for all pass1 modes. Modes will always
|
||||||
|
@ -262,6 +361,12 @@ if [ "$MODE_PASS2" = "true" ]; then
|
||||||
MODE_INSTALL_PASS2=true
|
MODE_INSTALL_PASS2=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_PASS3" = "true" ]; then
|
||||||
|
MODE_STAGE=true
|
||||||
|
MODE_BUILD_PASS3=true
|
||||||
|
MODE_INSTALL_PASS3=true
|
||||||
|
fi
|
||||||
|
|
||||||
# if no options were selected, then show help and exit
|
# if no options were selected, then show help and exit
|
||||||
if \
|
if \
|
||||||
[ "$MODE_HELP" != "true" ] && \
|
[ "$MODE_HELP" != "true" ] && \
|
||||||
|
@ -269,7 +374,9 @@ if \
|
||||||
[ "$MODE_BUILD_PASS1" != "true" ] && \
|
[ "$MODE_BUILD_PASS1" != "true" ] && \
|
||||||
[ "$MODE_INSTALL_PASS1" != "true" ] && \
|
[ "$MODE_INSTALL_PASS1" != "true" ] && \
|
||||||
[ "$MODE_BUILD_PASS2" != "true" ] && \
|
[ "$MODE_BUILD_PASS2" != "true" ] && \
|
||||||
[ "$MODE_INSTALL_PASS2" != "true" ]
|
[ "$MODE_INSTALL_PASS2" != "true" ] && \
|
||||||
|
[ "$MODE_BUILD_PASS3" != "true" ] && \
|
||||||
|
[ "$MODE_INSTALL_PASS3" != "true" ]
|
||||||
then
|
then
|
||||||
logprint "No option selected during execution."
|
logprint "No option selected during execution."
|
||||||
mode_help
|
mode_help
|
||||||
|
@ -311,4 +418,16 @@ if [ "$MODE_INSTALL_PASS2" = "true" ]; then
|
||||||
assert_zero $?
|
assert_zero $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_BUILD_PASS3" = "true" ]; then
|
||||||
|
logprint "Build of PASS3 selected."
|
||||||
|
mode_build_pass3
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_INSTALL_PASS3" = "true" ]; then
|
||||||
|
logprint "Install of PASS3 selected."
|
||||||
|
mode_install_pass3
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
logprint "Execution of ${APPNAME} completed."
|
logprint "Execution of ${APPNAME} completed."
|
||||||
|
|
|
@ -0,0 +1,213 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# desc:
|
||||||
|
# stages, builds, installs
|
||||||
|
|
||||||
|
# make variables persist in subprocesses for logging function
|
||||||
|
set -a
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Configuration:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# the name of this application
|
||||||
|
APPNAME="bc"
|
||||||
|
|
||||||
|
# the version of this application
|
||||||
|
VERSION="6.2.4"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Variables and functions sourced from Environment:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# assert_zero()
|
||||||
|
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||||
|
#
|
||||||
|
# LOGS_ROOT
|
||||||
|
# The parent directory where logs from this project will go.
|
||||||
|
#
|
||||||
|
# TEMP_STAGE_DIR
|
||||||
|
# The parent directory of where source archives are extracted to.
|
||||||
|
|
||||||
|
# register mode selections
|
||||||
|
ARGUMENT_LIST=(
|
||||||
|
"stage"
|
||||||
|
"build"
|
||||||
|
"install"
|
||||||
|
"all"
|
||||||
|
"help"
|
||||||
|
)
|
||||||
|
|
||||||
|
# modes to associate with switches
|
||||||
|
# assumes you want nothing done unless you ask for it.
|
||||||
|
MODE_STAGE=false
|
||||||
|
MODE_BUILD=false
|
||||||
|
MODE_INSTALL=false
|
||||||
|
MODE_ALL=false
|
||||||
|
MODE_HELP=false
|
||||||
|
|
||||||
|
# the file to log to
|
||||||
|
LOGFILE="${APPNAME}.log"
|
||||||
|
|
||||||
|
# ISO 8601 variation
|
||||||
|
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
|
|
||||||
|
# the path where logs are written to
|
||||||
|
# note: LOGS_ROOT is sourced from environment
|
||||||
|
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||||
|
|
||||||
|
# the path where the source will be located when complete
|
||||||
|
# note: TEMP_STAGE_DIR is sourced from environment
|
||||||
|
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||||
|
|
||||||
|
# read defined arguments
|
||||||
|
opts=$(getopt \
|
||||||
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
|
--name "$APPNAME" \
|
||||||
|
--options "" \
|
||||||
|
-- "$@"
|
||||||
|
)
|
||||||
|
|
||||||
|
# process supplied arguments into flags that enable execution modes
|
||||||
|
eval set --$opts
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--stage)
|
||||||
|
MODE_STAGE=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--build)
|
||||||
|
MODE_BUILD=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--install)
|
||||||
|
MODE_INSTALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
MODE_ALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
MODE_HELP=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# print to stdout, print to log
|
||||||
|
logprint() {
|
||||||
|
mkdir -p "${LOG_DIR}"
|
||||||
|
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||||
|
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell the user we're alive...
|
||||||
|
logprint "Initializing the ${APPNAME} utility..."
|
||||||
|
|
||||||
|
# when the stage mode is enabled, this will execute
|
||||||
|
mode_stage() {
|
||||||
|
logprint "Starting stage of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||||
|
rm -Rf "${T_SOURCE_DIR}"*
|
||||||
|
|
||||||
|
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||||
|
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
# conditionally rename if it needs it
|
||||||
|
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||||
|
|
||||||
|
logprint "Staging operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
# when the build_pass1 mode is enabled, this will execute
|
||||||
|
mode_build() {
|
||||||
|
|
||||||
|
# patch, configure and build
|
||||||
|
logprint "Starting build of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Entering build dir."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Configuring ${APPNAME}..."
|
||||||
|
CC=gcc ./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
-G \
|
||||||
|
-O3 \
|
||||||
|
-r
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Compiling..."
|
||||||
|
make
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Checking"
|
||||||
|
make test
|
||||||
|
logprint "Checks exited with '$?'. "
|
||||||
|
|
||||||
|
logprint "Build operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
mode_install() {
|
||||||
|
logprint "Starting install of ${APPNAME}..."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing..."
|
||||||
|
make install
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Install operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_help() {
|
||||||
|
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$MODE_ALL" = "true" ]; then
|
||||||
|
MODE_STAGE=true
|
||||||
|
MODE_BUILD=true
|
||||||
|
MODE_INSTALL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no options were selected, then show help and exit
|
||||||
|
if \
|
||||||
|
[ "$MODE_HELP" != "true" ] && \
|
||||||
|
[ "$MODE_STAGE" != "true" ] && \
|
||||||
|
[ "$MODE_BUILD" != "true" ] && \
|
||||||
|
[ "$MODE_INSTALL" != "true" ]
|
||||||
|
then
|
||||||
|
logprint "No option selected during execution."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if help was supplied at all, show help and exit
|
||||||
|
if [ "$MODE_HELP" = "true" ]; then
|
||||||
|
logprint "Help option selected. Printing options and exiting."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_STAGE" = "true" ]; then
|
||||||
|
logprint "Staging option selected."
|
||||||
|
mode_stage
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_BUILD" = "true" ]; then
|
||||||
|
logprint "Build of ${APPNAME} selected."
|
||||||
|
mode_build
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_INSTALL" = "true" ]; then
|
||||||
|
logprint "Install of ${APPNAME} selected."
|
||||||
|
mode_install
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
logprint "Execution of ${APPNAME} completed."
|
|
@ -0,0 +1,221 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# desc:
|
||||||
|
# stages, builds, installs
|
||||||
|
|
||||||
|
# make variables persist in subprocesses for logging function
|
||||||
|
set -a
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Configuration:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# the name of this application
|
||||||
|
APPNAME="dejagnu"
|
||||||
|
|
||||||
|
# the version of this application
|
||||||
|
VERSION="1.6.3"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Variables and functions sourced from Environment:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# assert_zero()
|
||||||
|
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||||
|
#
|
||||||
|
# LOGS_ROOT
|
||||||
|
# The parent directory where logs from this project will go.
|
||||||
|
#
|
||||||
|
# TEMP_STAGE_DIR
|
||||||
|
# The parent directory of where source archives are extracted to.
|
||||||
|
|
||||||
|
# register mode selections
|
||||||
|
ARGUMENT_LIST=(
|
||||||
|
"stage"
|
||||||
|
"build"
|
||||||
|
"install"
|
||||||
|
"all"
|
||||||
|
"help"
|
||||||
|
)
|
||||||
|
|
||||||
|
# modes to associate with switches
|
||||||
|
# assumes you want nothing done unless you ask for it.
|
||||||
|
MODE_STAGE=false
|
||||||
|
MODE_BUILD=false
|
||||||
|
MODE_INSTALL=false
|
||||||
|
MODE_ALL=false
|
||||||
|
MODE_HELP=false
|
||||||
|
|
||||||
|
# the file to log to
|
||||||
|
LOGFILE="${APPNAME}.log"
|
||||||
|
|
||||||
|
# ISO 8601 variation
|
||||||
|
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
|
|
||||||
|
# the path where logs are written to
|
||||||
|
# note: LOGS_ROOT is sourced from environment
|
||||||
|
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||||
|
|
||||||
|
# the path where the source will be located when complete
|
||||||
|
# note: TEMP_STAGE_DIR is sourced from environment
|
||||||
|
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||||
|
|
||||||
|
# read defined arguments
|
||||||
|
opts=$(getopt \
|
||||||
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
|
--name "$APPNAME" \
|
||||||
|
--options "" \
|
||||||
|
-- "$@"
|
||||||
|
)
|
||||||
|
|
||||||
|
# process supplied arguments into flags that enable execution modes
|
||||||
|
eval set --$opts
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--stage)
|
||||||
|
MODE_STAGE=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--build)
|
||||||
|
MODE_BUILD=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--install)
|
||||||
|
MODE_INSTALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
MODE_ALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
MODE_HELP=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# print to stdout, print to log
|
||||||
|
logprint() {
|
||||||
|
mkdir -p "${LOG_DIR}"
|
||||||
|
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||||
|
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell the user we're alive...
|
||||||
|
logprint "Initializing the ${APPNAME} utility..."
|
||||||
|
|
||||||
|
# when the stage mode is enabled, this will execute
|
||||||
|
mode_stage() {
|
||||||
|
logprint "Starting stage of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||||
|
rm -Rf "${T_SOURCE_DIR}"*
|
||||||
|
|
||||||
|
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||||
|
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
# conditionally rename if it needs it
|
||||||
|
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||||
|
|
||||||
|
logprint "Staging operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
# when the build_pass1 mode is enabled, this will execute
|
||||||
|
mode_build() {
|
||||||
|
|
||||||
|
# patch, configure and build
|
||||||
|
logprint "Starting build of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Entering build dir."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
mkdir -pv build
|
||||||
|
pushd build
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Configuring ${APPNAME}..."
|
||||||
|
../configure --prefix=/usr
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Build operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
mode_install() {
|
||||||
|
logprint "Starting install of ${APPNAME}..."
|
||||||
|
pushd "${T_SOURCE_DIR}/build"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing...."
|
||||||
|
make install
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
install -v -dm755 /usr/share/doc/${APPNAME}-${VERSION}
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
install -v -m644 doc/${APPNAME}.{html,txt} /usr/share/doc/${APPNAME}-${VERSION}
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Checking"
|
||||||
|
make check
|
||||||
|
logprint "Checks exited with '$?'. "
|
||||||
|
|
||||||
|
logprint "Install operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_help() {
|
||||||
|
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$MODE_ALL" = "true" ]; then
|
||||||
|
MODE_STAGE=true
|
||||||
|
MODE_BUILD=true
|
||||||
|
MODE_INSTALL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no options were selected, then show help and exit
|
||||||
|
if \
|
||||||
|
[ "$MODE_HELP" != "true" ] && \
|
||||||
|
[ "$MODE_STAGE" != "true" ] && \
|
||||||
|
[ "$MODE_BUILD" != "true" ] && \
|
||||||
|
[ "$MODE_INSTALL" != "true" ]
|
||||||
|
then
|
||||||
|
logprint "No option selected during execution."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if help was supplied at all, show help and exit
|
||||||
|
if [ "$MODE_HELP" = "true" ]; then
|
||||||
|
logprint "Help option selected. Printing options and exiting."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_STAGE" = "true" ]; then
|
||||||
|
logprint "Staging option selected."
|
||||||
|
mode_stage
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_BUILD" = "true" ]; then
|
||||||
|
logprint "Build of ${APPNAME} selected."
|
||||||
|
mode_build
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_INSTALL" = "true" ]; then
|
||||||
|
logprint "Install of ${APPNAME} selected."
|
||||||
|
mode_install
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
logprint "Execution of ${APPNAME} completed."
|
|
@ -0,0 +1,221 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# desc:
|
||||||
|
# stages, builds, installs
|
||||||
|
|
||||||
|
# make variables persist in subprocesses for logging function
|
||||||
|
set -a
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Configuration:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# the name of this application
|
||||||
|
APPNAME="expect"
|
||||||
|
|
||||||
|
# the version of this application
|
||||||
|
VERSION="5.45.4"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Variables and functions sourced from Environment:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# assert_zero()
|
||||||
|
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||||
|
#
|
||||||
|
# LOGS_ROOT
|
||||||
|
# The parent directory where logs from this project will go.
|
||||||
|
#
|
||||||
|
# TEMP_STAGE_DIR
|
||||||
|
# The parent directory of where source archives are extracted to.
|
||||||
|
|
||||||
|
# register mode selections
|
||||||
|
ARGUMENT_LIST=(
|
||||||
|
"stage"
|
||||||
|
"build"
|
||||||
|
"install"
|
||||||
|
"all"
|
||||||
|
"help"
|
||||||
|
)
|
||||||
|
|
||||||
|
# modes to associate with switches
|
||||||
|
# assumes you want nothing done unless you ask for it.
|
||||||
|
MODE_STAGE=false
|
||||||
|
MODE_BUILD=false
|
||||||
|
MODE_INSTALL=false
|
||||||
|
MODE_ALL=false
|
||||||
|
MODE_HELP=false
|
||||||
|
|
||||||
|
# the file to log to
|
||||||
|
LOGFILE="${APPNAME}.log"
|
||||||
|
|
||||||
|
# ISO 8601 variation
|
||||||
|
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
|
|
||||||
|
# the path where logs are written to
|
||||||
|
# note: LOGS_ROOT is sourced from environment
|
||||||
|
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||||
|
|
||||||
|
# the path where the source will be located when complete
|
||||||
|
# note: TEMP_STAGE_DIR is sourced from environment
|
||||||
|
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||||
|
|
||||||
|
# read defined arguments
|
||||||
|
opts=$(getopt \
|
||||||
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
|
--name "$APPNAME" \
|
||||||
|
--options "" \
|
||||||
|
-- "$@"
|
||||||
|
)
|
||||||
|
|
||||||
|
# process supplied arguments into flags that enable execution modes
|
||||||
|
eval set --$opts
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--stage)
|
||||||
|
MODE_STAGE=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--build)
|
||||||
|
MODE_BUILD=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--install)
|
||||||
|
MODE_INSTALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
MODE_ALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
MODE_HELP=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# print to stdout, print to log
|
||||||
|
logprint() {
|
||||||
|
mkdir -p "${LOG_DIR}"
|
||||||
|
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||||
|
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell the user we're alive...
|
||||||
|
logprint "Initializing the ${APPNAME} utility..."
|
||||||
|
|
||||||
|
# when the stage mode is enabled, this will execute
|
||||||
|
mode_stage() {
|
||||||
|
logprint "Starting stage of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||||
|
rm -Rf "${T_SOURCE_DIR}"*
|
||||||
|
|
||||||
|
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||||
|
tar xf "${SOURCES_DIR}/${APPNAME}${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
# conditionally rename if it needs it
|
||||||
|
stat "${T_SOURCE_DIR}"* && mv "${T_SOURCE_DIR}"* "${T_SOURCE_DIR}"
|
||||||
|
|
||||||
|
logprint "Staging operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
# when the build_pass1 mode is enabled, this will execute
|
||||||
|
mode_build() {
|
||||||
|
|
||||||
|
# patch, configure and build
|
||||||
|
logprint "Starting build of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Entering build dir."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Configuring ${APPNAME}..."
|
||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--with-tcl=/usr/lib \
|
||||||
|
--enable-shared \
|
||||||
|
--mandir=/usr/share/man \
|
||||||
|
--with-tclinclude=/usr/include
|
||||||
|
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Compiling..."
|
||||||
|
make
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Checking"
|
||||||
|
make test
|
||||||
|
|
||||||
|
logprint "Checks exited with '$?'. "
|
||||||
|
|
||||||
|
logprint "Build operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
mode_install() {
|
||||||
|
logprint "Starting install of ${APPNAME}..."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing..."
|
||||||
|
make install
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Creating shared object symlink..."
|
||||||
|
ln -svf expect${VERSION}/libexpect${VERSION}.so /usr/lib
|
||||||
|
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Install operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_help() {
|
||||||
|
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$MODE_ALL" = "true" ]; then
|
||||||
|
MODE_STAGE=true
|
||||||
|
MODE_BUILD=true
|
||||||
|
MODE_INSTALL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no options were selected, then show help and exit
|
||||||
|
if \
|
||||||
|
[ "$MODE_HELP" != "true" ] && \
|
||||||
|
[ "$MODE_STAGE" != "true" ] && \
|
||||||
|
[ "$MODE_BUILD" != "true" ] && \
|
||||||
|
[ "$MODE_INSTALL" != "true" ]
|
||||||
|
then
|
||||||
|
logprint "No option selected during execution."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if help was supplied at all, show help and exit
|
||||||
|
if [ "$MODE_HELP" = "true" ]; then
|
||||||
|
logprint "Help option selected. Printing options and exiting."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_STAGE" = "true" ]; then
|
||||||
|
logprint "Staging option selected."
|
||||||
|
mode_stage
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_BUILD" = "true" ]; then
|
||||||
|
logprint "Build of ${APPNAME} selected."
|
||||||
|
mode_build
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_INSTALL" = "true" ]; then
|
||||||
|
logprint "Install of ${APPNAME} selected."
|
||||||
|
mode_install
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
logprint "Execution of ${APPNAME} completed."
|
|
@ -0,0 +1,217 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# desc:
|
||||||
|
# stages, builds, installs
|
||||||
|
|
||||||
|
# make variables persist in subprocesses for logging function
|
||||||
|
set -a
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Configuration:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# the name of this application
|
||||||
|
APPNAME="flex"
|
||||||
|
|
||||||
|
# the version of this application
|
||||||
|
VERSION="2.6.4"
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Variables and functions sourced from Environment:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# assert_zero()
|
||||||
|
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||||
|
#
|
||||||
|
# LOGS_ROOT
|
||||||
|
# The parent directory where logs from this project will go.
|
||||||
|
#
|
||||||
|
# TEMP_STAGE_DIR
|
||||||
|
# The parent directory of where source archives are extracted to.
|
||||||
|
|
||||||
|
# register mode selections
|
||||||
|
ARGUMENT_LIST=(
|
||||||
|
"stage"
|
||||||
|
"build"
|
||||||
|
"install"
|
||||||
|
"all"
|
||||||
|
"help"
|
||||||
|
)
|
||||||
|
|
||||||
|
# modes to associate with switches
|
||||||
|
# assumes you want nothing done unless you ask for it.
|
||||||
|
MODE_STAGE=false
|
||||||
|
MODE_BUILD=false
|
||||||
|
MODE_INSTALL=false
|
||||||
|
MODE_ALL=false
|
||||||
|
MODE_HELP=false
|
||||||
|
|
||||||
|
# the file to log to
|
||||||
|
LOGFILE="${APPNAME}.log"
|
||||||
|
|
||||||
|
# ISO 8601 variation
|
||||||
|
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
|
|
||||||
|
# the path where logs are written to
|
||||||
|
# note: LOGS_ROOT is sourced from environment
|
||||||
|
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||||
|
|
||||||
|
# the path where the source will be located when complete
|
||||||
|
# note: TEMP_STAGE_DIR is sourced from environment
|
||||||
|
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||||
|
|
||||||
|
# read defined arguments
|
||||||
|
opts=$(getopt \
|
||||||
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
|
--name "$APPNAME" \
|
||||||
|
--options "" \
|
||||||
|
-- "$@"
|
||||||
|
)
|
||||||
|
|
||||||
|
# process supplied arguments into flags that enable execution modes
|
||||||
|
eval set --$opts
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--stage)
|
||||||
|
MODE_STAGE=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--build)
|
||||||
|
MODE_BUILD=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--install)
|
||||||
|
MODE_INSTALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
MODE_ALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
MODE_HELP=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# print to stdout, print to log
|
||||||
|
logprint() {
|
||||||
|
mkdir -p "${LOG_DIR}"
|
||||||
|
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||||
|
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell the user we're alive...
|
||||||
|
logprint "Initializing the ${APPNAME} utility..."
|
||||||
|
|
||||||
|
# when the stage mode is enabled, this will execute
|
||||||
|
mode_stage() {
|
||||||
|
logprint "Starting stage of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||||
|
rm -Rf "${T_SOURCE_DIR}"*
|
||||||
|
|
||||||
|
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||||
|
tar xf "${SOURCES_DIR}/${APPNAME}-${VERSION}.tar."* -C "${TEMP_STAGE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
# conditionally rename if it needs it
|
||||||
|
stat "${T_SOURCE_DIR}-"* && mv "${T_SOURCE_DIR}-"* "${T_SOURCE_DIR}"
|
||||||
|
|
||||||
|
logprint "Staging operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
# when the build_pass1 mode is enabled, this will execute
|
||||||
|
mode_build() {
|
||||||
|
|
||||||
|
# patch, configure and build
|
||||||
|
logprint "Starting build of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Entering build dir."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Configuring ${APPNAME}..."
|
||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--docdir=/usr/share/doc/flex-${VERSION} \
|
||||||
|
--disable-static
|
||||||
|
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Compiling..."
|
||||||
|
make
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Checking"
|
||||||
|
make check
|
||||||
|
logprint "Checks exited with '$?'. "
|
||||||
|
|
||||||
|
logprint "Build operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
mode_install() {
|
||||||
|
logprint "Starting install of ${APPNAME}..."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing..."
|
||||||
|
make install
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Creating lex legacy symlink..."
|
||||||
|
ln -sv flex /usr/bin/lex
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Install operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_help() {
|
||||||
|
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$MODE_ALL" = "true" ]; then
|
||||||
|
MODE_STAGE=true
|
||||||
|
MODE_BUILD=true
|
||||||
|
MODE_INSTALL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no options were selected, then show help and exit
|
||||||
|
if \
|
||||||
|
[ "$MODE_HELP" != "true" ] && \
|
||||||
|
[ "$MODE_STAGE" != "true" ] && \
|
||||||
|
[ "$MODE_BUILD" != "true" ] && \
|
||||||
|
[ "$MODE_INSTALL" != "true" ]
|
||||||
|
then
|
||||||
|
logprint "No option selected during execution."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if help was supplied at all, show help and exit
|
||||||
|
if [ "$MODE_HELP" = "true" ]; then
|
||||||
|
logprint "Help option selected. Printing options and exiting."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_STAGE" = "true" ]; then
|
||||||
|
logprint "Staging option selected."
|
||||||
|
mode_stage
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_BUILD" = "true" ]; then
|
||||||
|
logprint "Build of ${APPNAME} selected."
|
||||||
|
mode_build
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_INSTALL" = "true" ]; then
|
||||||
|
logprint "Install of ${APPNAME} selected."
|
||||||
|
mode_install
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
logprint "Execution of ${APPNAME} completed."
|
|
@ -0,0 +1,276 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# desc:
|
||||||
|
# stages, builds, installs
|
||||||
|
|
||||||
|
# make variables persist in subprocesses for logging function
|
||||||
|
set -a
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Configuration:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# the name of this application
|
||||||
|
APPNAME="tcl"
|
||||||
|
|
||||||
|
# the version of this application
|
||||||
|
VERSION="8.6.13"
|
||||||
|
SVERSION="$(cut -d '.' -f 1 <<< "$VERSION")"."$(cut -d '.' -f 2 <<< "$VERSION")"
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Variables and functions sourced from Environment:
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# assert_zero()
|
||||||
|
# Checks if $1 is 0. If non-0 value, halts the execution of the script.
|
||||||
|
#
|
||||||
|
# LOGS_ROOT
|
||||||
|
# The parent directory where logs from this project will go.
|
||||||
|
#
|
||||||
|
# TEMP_STAGE_DIR
|
||||||
|
# The parent directory of where source archives are extracted to.
|
||||||
|
|
||||||
|
# register mode selections
|
||||||
|
ARGUMENT_LIST=(
|
||||||
|
"stage"
|
||||||
|
"build"
|
||||||
|
"install"
|
||||||
|
"all"
|
||||||
|
"help"
|
||||||
|
)
|
||||||
|
|
||||||
|
# modes to associate with switches
|
||||||
|
# assumes you want nothing done unless you ask for it.
|
||||||
|
MODE_STAGE=false
|
||||||
|
MODE_BUILD=false
|
||||||
|
MODE_INSTALL=false
|
||||||
|
MODE_ALL=false
|
||||||
|
MODE_HELP=false
|
||||||
|
|
||||||
|
# the file to log to
|
||||||
|
LOGFILE="${APPNAME}.log"
|
||||||
|
|
||||||
|
# ISO 8601 variation
|
||||||
|
TIMESTAMP="$(date +%Y-%m-%d_%H:%M:%S)"
|
||||||
|
|
||||||
|
# the path where logs are written to
|
||||||
|
# note: LOGS_ROOT is sourced from environment
|
||||||
|
LOG_DIR="${LOGS_ROOT}/${APPNAME}-${TIMESTAMP}"
|
||||||
|
|
||||||
|
# the path where the source will be located when complete
|
||||||
|
# note: TEMP_STAGE_DIR is sourced from environment
|
||||||
|
T_SOURCE_DIR="${TEMP_STAGE_DIR}/${APPNAME}"
|
||||||
|
|
||||||
|
# read defined arguments
|
||||||
|
opts=$(getopt \
|
||||||
|
--longoptions "$(printf "%s," "${ARGUMENT_LIST[@]}")" \
|
||||||
|
--name "$APPNAME" \
|
||||||
|
--options "" \
|
||||||
|
-- "$@"
|
||||||
|
)
|
||||||
|
|
||||||
|
# process supplied arguments into flags that enable execution modes
|
||||||
|
eval set --$opts
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--stage)
|
||||||
|
MODE_STAGE=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--build)
|
||||||
|
MODE_BUILD=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--install)
|
||||||
|
MODE_INSTALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--all)
|
||||||
|
MODE_ALL=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
MODE_HELP=true
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# print to stdout, print to log
|
||||||
|
logprint() {
|
||||||
|
mkdir -p "${LOG_DIR}"
|
||||||
|
echo "[$(date +%Y-%m-%d_%H:%M:%S)] [${APPNAME}] $1" \
|
||||||
|
| tee -a "${LOG_DIR}/${LOGFILE}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell the user we're alive...
|
||||||
|
logprint "Initializing the ${APPNAME} utility..."
|
||||||
|
|
||||||
|
# when the stage mode is enabled, this will execute
|
||||||
|
mode_stage() {
|
||||||
|
logprint "Starting stage of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Removing any pre-existing staging for ${APPNAME}."
|
||||||
|
rm -Rf "${T_SOURCE_DIR}"*
|
||||||
|
|
||||||
|
logprint "Extracting ${APPNAME}-${VERSION} source archive to ${TEMP_STAGE_DIR}"
|
||||||
|
tar xf "${SOURCES_DIR}/${APPNAME}${VERSION}-src.tar."* -C "${TEMP_STAGE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
# conditionally rename if it needs it
|
||||||
|
stat "${T_SOURCE_DIR}"* && mv "${T_SOURCE_DIR}"* "${T_SOURCE_DIR}"
|
||||||
|
|
||||||
|
logprint "Staging operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
stage_docs() {
|
||||||
|
logprint "Starting stage of ${APPNAME} docs..."
|
||||||
|
|
||||||
|
logprint "Extracting ${APPNAME}${VERSION} docs archive to ${TEMP_STAGE_DIR}"
|
||||||
|
tar xf "${SOURCES_DIR}/${APPNAME}${VERSION}-html.tar."* -C "${T_SOURCE_DIR}" --strip-components=1
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Staging operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
# when the build_pass1 mode is enabled, this will execute
|
||||||
|
mode_build() {
|
||||||
|
|
||||||
|
# patch, configure and build
|
||||||
|
logprint "Starting build of ${APPNAME}..."
|
||||||
|
|
||||||
|
logprint "Entering build dir."
|
||||||
|
pushd "${T_SOURCE_DIR}"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Entering unix dir..."
|
||||||
|
pushd unix
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Configuring ${APPNAME}..."
|
||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--mandir=/usr/share/man
|
||||||
|
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Compiling..."
|
||||||
|
make
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
# TODO turn these into patches
|
||||||
|
logprint "Post-build, Pre-Install Patching..."
|
||||||
|
sed -e "s|$T_SOURCE_DIR/unix|/usr/lib|" \
|
||||||
|
-e "s|$T_SOURCE_DIR|/usr/include|" \
|
||||||
|
-i tclConfig.sh
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
sed -e "s|$T_SOURCE_DIR/unix/pkgs/tdbc1.1.5|/usr/lib/tdbc1.1.5|" \
|
||||||
|
-e "s|$T_SOURCE_DIR/pkgs/tdbc1.1.5/generic|/usr/include|" \
|
||||||
|
-e "s|$T_SOURCE_DIR/pkgs/tdbc1.1.5/library|/usr/lib/tcl$SVERSION|" \
|
||||||
|
-e "s|$T_SOURCE_DIR/pkgs/tdbc1.1.5|/usr/include|" \
|
||||||
|
-i pkgs/tdbc1.1.5/tdbcConfig.sh
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
sed -e "s|$T_SOURCE_DIR/unix/pkgs/itcl4.2.3|/usr/lib/itcl4.2.3|" \
|
||||||
|
-e "s|$T_SOURCE_DIR/pkgs/itcl4.2.3/generic|/usr/include|" \
|
||||||
|
-e "s|$T_SOURCE_DIR/pkgs/itcl4.2.3|/usr/include|" \
|
||||||
|
-i pkgs/itcl4.2.3/itclConfig.sh
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
|
||||||
|
logprint "Checking"
|
||||||
|
make test
|
||||||
|
logprint "Checks exited with '$?'. "
|
||||||
|
|
||||||
|
logprint "Build operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
mode_install() {
|
||||||
|
logprint "Starting install of ${APPNAME}..."
|
||||||
|
pushd "${T_SOURCE_DIR}/unix"
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing..."
|
||||||
|
make install
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Post-Install Cleanup"
|
||||||
|
# not portable with full version var
|
||||||
|
chmod u+w /usr/lib/libtcl${SVERSION}.so
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing private headers..."
|
||||||
|
make install-private-headers
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Symlinking for tclsh shell..."
|
||||||
|
ln -sfv tclsh${SVERSION} /usr/bin/tclsh
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Fixing Thread/Tcl_Thread manpage names..."
|
||||||
|
mv -v /usr/share/man/man3/{Thread,Tcl_Thread}.3
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Installing documentation..."
|
||||||
|
popd
|
||||||
|
stage_docs
|
||||||
|
|
||||||
|
logprint "Creating doc dirs..."
|
||||||
|
mkdir -v -p /usr/share/doc/tcl-${VERSION}
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Copying HTML doc dir contents...."
|
||||||
|
cp -v -r ${T_SOURCE_DIR}/html/* /usr/share/doc/tcl-${VERSION}
|
||||||
|
assert_zero $?
|
||||||
|
|
||||||
|
logprint "Install operation complete."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mode_help() {
|
||||||
|
echo "${APPNAME} [ --stage ] [ --build_temp ] [ --install_temp ] [ --all_temp ] [ --help ]"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$MODE_ALL" = "true" ]; then
|
||||||
|
MODE_STAGE=true
|
||||||
|
MODE_BUILD=true
|
||||||
|
MODE_INSTALL=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no options were selected, then show help and exit
|
||||||
|
if \
|
||||||
|
[ "$MODE_HELP" != "true" ] && \
|
||||||
|
[ "$MODE_STAGE" != "true" ] && \
|
||||||
|
[ "$MODE_BUILD" != "true" ] && \
|
||||||
|
[ "$MODE_INSTALL" != "true" ]
|
||||||
|
then
|
||||||
|
logprint "No option selected during execution."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if help was supplied at all, show help and exit
|
||||||
|
if [ "$MODE_HELP" = "true" ]; then
|
||||||
|
logprint "Help option selected. Printing options and exiting."
|
||||||
|
mode_help
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_STAGE" = "true" ]; then
|
||||||
|
logprint "Staging option selected."
|
||||||
|
mode_stage
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_BUILD" = "true" ]; then
|
||||||
|
logprint "Build of ${APPNAME} selected."
|
||||||
|
mode_build
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE_INSTALL" = "true" ]; then
|
||||||
|
logprint "Install of ${APPNAME} selected."
|
||||||
|
mode_install
|
||||||
|
assert_zero $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
logprint "Execution of ${APPNAME} completed."
|
|
@ -69,3 +69,4 @@ assert_zero() {
|
||||||
}
|
}
|
||||||
ARCHLIB_DIR=/lib64
|
ARCHLIB_DIR=/lib64
|
||||||
PATH=/usr/bin:/usr/sbin
|
PATH=/usr/bin:/usr/sbin
|
||||||
|
HOME=/
|
||||||
|
|
|
@ -5,6 +5,36 @@
|
||||||
"name": "welcome master",
|
"name": "welcome master",
|
||||||
"dependencies": [ null ],
|
"dependencies": [ null ],
|
||||||
"comment": "greet the user"
|
"comment": "greet the user"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bc",
|
||||||
|
"dependencies": [ null ],
|
||||||
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.13"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flex",
|
||||||
|
"dependencies": [ null ],
|
||||||
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.14"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tcl",
|
||||||
|
"dependencies": [ null ],
|
||||||
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.15"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "expect",
|
||||||
|
"dependencies": [ null ],
|
||||||
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.16"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dejagnu",
|
||||||
|
"dependencies": [ null ],
|
||||||
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.17"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "binutils pass 3",
|
||||||
|
"dependencies": [ null ],
|
||||||
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.18"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"comment": "LFS 11.3-systemd-rc1 Ch. 8.7"
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.7"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "xz",
|
"name": "xz final",
|
||||||
"dependencies": [ null ],
|
"dependencies": [ null ],
|
||||||
"comment": "LFS 11.3-systemd-rc1 Ch. 8.8"
|
"comment": "LFS 11.3-systemd-rc1 Ch. 8.8"
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,6 +17,114 @@
|
||||||
"group": "root",
|
"group": "root",
|
||||||
"supply_environment": true,
|
"supply_environment": true,
|
||||||
"environment": "environments/stage4.env.bash"
|
"environment": "environments/stage4.env.bash"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bc",
|
||||||
|
"target": "components/stage4/bc.bash --all",
|
||||||
|
"is_shell_command": true,
|
||||||
|
"shell_definition": "bash",
|
||||||
|
"force_pty": true,
|
||||||
|
"set_working_directory": false,
|
||||||
|
"working_directory": "",
|
||||||
|
"rectify": false,
|
||||||
|
"rectifier": "",
|
||||||
|
"active": true,
|
||||||
|
"required": true,
|
||||||
|
"set_user_context": true,
|
||||||
|
"user": "root",
|
||||||
|
"group": "root",
|
||||||
|
"supply_environment": true,
|
||||||
|
"environment": "environments/stage4.env.bash"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flex",
|
||||||
|
"target": "components/stage4/flex.bash --all",
|
||||||
|
"is_shell_command": true,
|
||||||
|
"shell_definition": "bash",
|
||||||
|
"force_pty": true,
|
||||||
|
"set_working_directory": false,
|
||||||
|
"working_directory": "",
|
||||||
|
"rectify": false,
|
||||||
|
"rectifier": "",
|
||||||
|
"active": true,
|
||||||
|
"required": true,
|
||||||
|
"set_user_context": true,
|
||||||
|
"user": "root",
|
||||||
|
"group": "root",
|
||||||
|
"supply_environment": true,
|
||||||
|
"environment": "environments/stage4.env.bash"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "tcl",
|
||||||
|
"target": "components/stage4/tcl.bash --all",
|
||||||
|
"is_shell_command": true,
|
||||||
|
"shell_definition": "bash",
|
||||||
|
"force_pty": true,
|
||||||
|
"set_working_directory": false,
|
||||||
|
"working_directory": "",
|
||||||
|
"rectify": false,
|
||||||
|
"rectifier": "",
|
||||||
|
"active": true,
|
||||||
|
"required": true,
|
||||||
|
"set_user_context": true,
|
||||||
|
"user": "root",
|
||||||
|
"group": "root",
|
||||||
|
"supply_environment": true,
|
||||||
|
"environment": "environments/stage4.env.bash"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "expect",
|
||||||
|
"target": "components/stage4/expect.bash --all",
|
||||||
|
"is_shell_command": true,
|
||||||
|
"shell_definition": "bash",
|
||||||
|
"force_pty": true,
|
||||||
|
"set_working_directory": false,
|
||||||
|
"working_directory": "",
|
||||||
|
"rectify": false,
|
||||||
|
"rectifier": "",
|
||||||
|
"active": true,
|
||||||
|
"required": true,
|
||||||
|
"set_user_context": true,
|
||||||
|
"user": "root",
|
||||||
|
"group": "root",
|
||||||
|
"supply_environment": true,
|
||||||
|
"environment": "environments/stage4.env.bash"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "dejagnu",
|
||||||
|
"target": "components/stage4/dejagnu.bash --all",
|
||||||
|
"is_shell_command": true,
|
||||||
|
"shell_definition": "bash",
|
||||||
|
"force_pty": true,
|
||||||
|
"set_working_directory": false,
|
||||||
|
"working_directory": "",
|
||||||
|
"rectify": false,
|
||||||
|
"rectifier": "",
|
||||||
|
"active": true,
|
||||||
|
"required": true,
|
||||||
|
"set_user_context": true,
|
||||||
|
"user": "root",
|
||||||
|
"group": "root",
|
||||||
|
"supply_environment": true,
|
||||||
|
"environment": "environments/stage4.env.bash"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "binutils pass 3",
|
||||||
|
"target": "components/stage1/binutils.bash --pass3",
|
||||||
|
"is_shell_command": true,
|
||||||
|
"shell_definition": "bash",
|
||||||
|
"force_pty": true,
|
||||||
|
"set_working_directory": false,
|
||||||
|
"working_directory": "",
|
||||||
|
"rectify": false,
|
||||||
|
"rectifier": "",
|
||||||
|
"active": true,
|
||||||
|
"required": true,
|
||||||
|
"set_user_context": true,
|
||||||
|
"user": "root",
|
||||||
|
"group": "root",
|
||||||
|
"supply_environment": true,
|
||||||
|
"environment": "environments/stage4.env.bash"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
"environment": "environments/stage4.env.bash"
|
"environment": "environments/stage4.env.bash"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "xz",
|
"name": "xz final",
|
||||||
"target": "components/stage4/xz.bash --all",
|
"target": "components/stage4/xz.bash --all",
|
||||||
"is_shell_command": true,
|
"is_shell_command": true,
|
||||||
"shell_definition": "bash",
|
"shell_definition": "bash",
|
||||||
|
|
Loading…
Reference in New Issue