Merge branch '32-overlay-implementation' into 164-modbuild-add-checks-when-constructing-hierarchical-names-for-modulefile-and-prefix

This commit is contained in:
2022-06-28 14:45:37 +02:00
3 changed files with 186 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
#
# https://frodo.looijaard.name/project/getopt
#
P=getopt
V=${GETOPT_VERSION:-1.1.6}
FNAME="$P-$V.tar.gz"
DOWNLOAD_URL="http://frodo.looijaard.name/system/files/software/$P/$P-$V.tar.gz"
#---
# build on macOS only
[[ $(uname -s) == 'Darwin' ]] || exit 0
#---
source "$(dirname "$0")/librecipes.bash"
#---
# configure
# nothing to configure but we need gettext from Macports
if [[ ! -d '/opt/local/bin' ]] || [[ ! -x '/opt/local/bin/msgfmt' ]]; then
echo "gettext port from Macports is required to build 'getopt'!" 1>&2
exit 1
fi
#---
# compile
PATH+=':/opt/local/bin'
declare -x C_INCLUDE_PATH="${PREFIX}/include:/opt/local/include"
declare -x LDFLAGS="/opt/local/lib/libintl.a /opt/local/lib/libiconv.a -framework CoreFoundation"
declare -x LIBRARY_PATH="${PREFIX}/lib"
make -e all || exit 1
#---
# install
declare -x DESTDIR="${PREFIX}"
declare -x prefix=''
#PATH="${PREFIX}/${UTILBIN_DIR}:${PATH}"
make -e install
#---
# post-install
mv "${PREFIX}/bin/getopt" "${PREFIX}/${UTILBIN_DIR}"
rm -rf "${PREFIX}/man"
rm -rf "${PREFIX}/share/locale"
#---
# Local Variables:
# mode: sh
# sh-basic-offset: 8
# tab-width: 8
# End:
+43
View File
@@ -0,0 +1,43 @@
#!/bin/bash
#
# https://www.gnu.org/software/findutils/
#
P=findutils
V=${FINDUTILS_VERSION:-4.9.0}
FNAME="$P-$V.tar.xz"
DOWNLOAD_URL="https://ftp.gnu.org/gnu/$P/${FNAME}"
#---
# build on macOS only
[[ $(uname -s) == 'Darwin' ]] || exit 0
#---
source "$(dirname "$0")/librecipes.bash"
#---
# configure
mkdir -p "${BUILD_DIR}" && cd "$_" || exit ${PB_ERR_SYSTEM}
loadablesdir="${PREFIX}/${UTILBIN_DIR}/builtins" \
"${SRC_DIR}/configure" \
--prefix="${PREFIX}" \
--bindir="${PREFIX}/${UTILBIN_DIR}" \
|| exit ${PB_ERR_CONFIGURE}
#---
# compile & install
make -j ${NJOBS} || exit ${PB_ERR_MAKE}
make install || exit ${PB_ERR_INSTALL}
#---
# post-install
rm -vf "${PREFIX}/share/man/man5/locatedb.5"
rm -vf "${PREFIX}/share/man/man1/updatedb.1"
rm -vf "${PREFIX}/share/man/man1/xargs.1"
rm -vf "${PREFIX}/share/man/man1/locate.1"
rm -vf "${PREFIX}/share/man/man1/find.1"
#---
# Local Variables:
# mode: shell-script-mode
# sh-basic-offset: 8
# End:
+91
View File
@@ -0,0 +1,91 @@
#!/bin/bash
set -x
set -o errexit
set -o pipefail
shopt -s nullglob
if (( $# == 0 )); then
echo "Usage: $0 <dest-dir>" 1>&2
exit 1
fi
PREFIX="$1"
if [[ ! -d ${PREFIX} ]]; then
echo "Destinstion directory '${PREFIX}' does not exist! Aborting..." 1>&2
exit 2
fi
TMP_DIR="${PMODULES_TMPDIR:-/var/tmp/${USER}}"
DOWNLOADS_DIR="${PMODULES_DISTFILESDIR:-${TMP_DIR}/Downloads}"
SRC_DIR="${TMP_DIR}/$P-$V/src"
BUILD_DIR="${TMP_DIR}/$P-$V/build"
SRC_FILE="${DOWNLOADS_DIR}/${FNAME}"
declare -ix PB_ERR_ARG=1
declare -ix PB_ERR_SETUP=2
declare -ix PB_ERR_SYSTEM=3
declare -ix PB_ERR_DOWNLOAD=4
declare -ix PB_ERR_UNTAR=5
declare -ix PB_ERR_CONFIGURE=6
declare -ix PB_ERR_MAKE=7
declare -ix PB_ERR_PRE_INSTALL=8
declare -ix PB_ERR_INSTALL=9
declare -ix PB_ERR_POST_INSTALL=10
declare -ix PB_ERR=255
declare -ix NJOBS=4
pb_exit() {
local -i ec=$?
if [[ -n "${BASH_VERSION}" ]]; then
local -i n=${#BASH_SOURCE[@]}
local -r recipe_name="${BASH_SOURCE[n]}"
else
local -r recipe_name="${ZSH_ARGZERO}"
fi
echo -n "${recipe_name}: "
if (( ec == 0 )); then
echo "done!"
elif (( ec == PB_ERR_ARG )); then
echo "argument error!"
elif (( ec == PB_ERR_SETUP )); then
echo "error in setting everything up!"
elif (( ec == PB_ERR_SYSTEM )); then
echo "unexpected system error!"
elif (( ec == PB_ERR_DOWNLOAD )); then
echo "error in downloading the source file!"
elif (( ec == PB_ERR_UNTAR )); then
echo "error in un-taring the source file!"
elif (( ec == PB_ERR_CONFIGURE )); then
echo "error in configuring the software!"
elif (( ec == PB_ERR_MAKE )); then
echo "error in compiling the software!"
elif (( ec == PB_ERR_PRE_INSTALL )); then
echo "error in pre-installing the software!"
elif (( ec == PB_ERR_INSTALL )); then
echo "error in installing the software!"
elif (( ec == PB_ERR_POST_INSTALL )); then
echo "error in post-installing the software!"
else
echo "oops, unknown error!!!"
fi
exit ${ec}
}
#export -f pb_exit > /dev/null
trap "pb_exit" EXIT
#---
# download
mkdir -p "${DOWNLOADS_DIR}" || exit ${PB_ERR_SYSTEM}
test -r "${SRC_FILE}" || curl -L --output "$_" "${DOWNLOAD_URL}" || exit ${PB_ERR_DOWNLOAD}
#---
# unpack
mkdir -p "${SRC_DIR}" && cd "$_" || exit ${PB_ERR_SYSTEM}
tar --directory "${SRC_DIR}" --strip-components 1 -xv -f "${SRC_FILE}" || exit ${PB_ERR_UNTAR}
#---
# Local Variables:
# mode: shell-script-mode
# sh-basic-offset: 8
# End: