Skip to content

Commit

Permalink
Updated CI scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreibh committed Nov 4, 2024
1 parent 99ac441 commit 090138c
Show file tree
Hide file tree
Showing 5 changed files with 293 additions and 284 deletions.
66 changes: 44 additions & 22 deletions ci/ci-build
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,34 @@
# Contact: [email protected]

# Bash options:
set -e
set -eu

DIRNAME=`dirname $0`
UNAME=`uname`
if [ "${UNAME}" == "Linux" ] ; then
DISTRIBUTION=`lsb_release -is`
else
DISTRIBUTION="Unknown"
fi

# ====== Check arguments ====================================================
if [ $# -lt 1 ] ; then
echo >&2 "Usage: $0 compile|package|... ..."
exit 1
fi


# ====== Check/set environment variables ====================================
DIRNAME="$(dirname "$0")"
UNAME="$(uname)"
if [ ! -e /etc/os-release ] ; then
echo >&2 "ERROR: /etc/os-release does not exist!"
exit 1
fi
. /etc/os-release


# ###### Configure ##########################################################

# ====== Configure with CMake ===============================================
if [ -e CMakeLists.txt ] ; then
cmake .

# ====== Configure with autoconf/automake (via bootstrap script) ============
elif [ -e configure.ac -o -e configure.in ] ; then
elif [ -e configure.ac ] || [ -e configure.in ] ; then
if [ -e autogen.sh ] ; then
./autogen.sh
elif [ -e bootstrap ] ; then
Expand All @@ -55,11 +59,12 @@ else
echo >&2 "WARNING: No build system detected. Trying to just call \"make\" ..."
fi

if [ ${UNAME} == "Linux" ] ; then
cores=`getconf _NPROCESSORS_ONLN 2>/dev/null || true`
# ====== Obtain MAKEFLAGS to utilise all cores ==============================
if [ "${UNAME}" == "Linux" ] ; then
cores=$(getconf _NPROCESSORS_ONLN 2>/dev/null || true)
MAKEFLAGS="-j${cores}"
elif [ ${UNAME} == "FreeBSD" ] ; then
cores=`sysctl -a | grep 'hw.ncpu' | cut -d ':' -f2 | tr -d ' '`
elif [ "${UNAME}" == "FreeBSD" ] ; then
cores=$(sysctl -a | grep 'hw.ncpu' | cut -d ':' -f2 | tr -d ' ')
MAKEFLAGS="-j${cores}"
else
MAKEFLAGS=""
Expand All @@ -74,6 +79,7 @@ while [ $# -gt 0 ] ; do

# ====== Compile =========================================================
if [ "${TOOL}" == "compile" ] ; then

MAKEFLAGS=${MAKEFLAGS} make # VERBOSE=1


Expand Down Expand Up @@ -109,22 +115,38 @@ while [ $# -gt 0 ] ; do

# ====== Package =======================================================
elif [ "${TOOL}" == "package" ] ; then
if [ "${DISTRIBUTION}" == "Ubuntu" -o "${DISTRIBUTION}" == "Debian" ] ; then
OVERRIDE_SKIP_PACKAGE_SIGNING=1 ./build-deb ${DIST}

if [ ! -v OS ] || [ "${OS}" == "" ] ; then
OS="${ID}"
fi
if [ ! -v ARCH ] || [ "${ARCH}" == "" ] ; then
ARCH="$(uname -m)"
fi

if [ "${OS}" == "ubuntu" ] || [ "${OS}" == "debian" ] ; then
architecture="${ARCH//x86_64/amd64}"
if [ ! -v DIST ] || [ "${DIST}" == "" ] ; then
distribution="${VERSION_CODENAME}"
else
distribution="${DIST}"
fi
"${DIRNAME}"/build-tool build-deb "${distribution}" --skip-signing --architecture="${architecture}"

# ====== Fedora ==========================================================
elif [ "${DISTRIBUTION}" == "Fedora" ] ; then
release=`cat /etc/fedora-release | sed -e "s/^\(.*\) release \([0-9]*\) (\(.*\))$/\2/g" | sed -e "s/[^0-9]//g"`
if [ "${ARCH}" == "" ] ; then
arch=`uname -m | sed -e "s/[^0-9a-zA-Z_+-]//g"`
elif [ "${OS}" == "fedora" ] ; then

architecture="${ARCH}"
if [ ! -v DIST ] || [ "${DIST}" == "" ] ; then
distribution="${VERSION_ID}"
else
arch="${ARCH}"
distribution="${DIST}"
fi
LD_PRELOAD=/usr/lib64/nosync/nosync.so OVERRIDE_SKIP_PACKAGE_SIGNING=1 ./build-rpm fedora-${release}-${arch}
LD_PRELOAD=/usr/lib64/nosync/nosync.so \
"${DIRNAME}"/build-tool build-rpm "fedora-${distribution}" --skip-signing --architecture="${architecture}"

# ====== Unknown =========================================================
else
echo >&2 "ERROR: Unknown Linux distribution ${DISTRIBUTION}!"
echo >&2 "ERROR: Unsupported distribution ${ID} for packaging!"
exit 1
fi

Expand Down
45 changes: 3 additions & 42 deletions ci/ci-install
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,8 @@
# Contact: [email protected]

# Bash options:
set -e
set -eu

DIRNAME=`dirname $0`
UNAME=`uname`
if [ "${UNAME}" == "Linux" ] ; then
DISTRIBUTION=`lsb_release -is`
else
DISTRIBUTION="Unknown"
fi


# ###### Linux ##############################################################
if [ "${UNAME}" == "Linux" ] ; then

# ====== Ubuntu ==========================================================
if [ "${DISTRIBUTION}" == "Ubuntu" ] ; then
DEBIAN_FRONTEND=noninteractive ${DIRNAME}/get-dependencies ubuntu --install

# ====== Debian ==========================================================
elif [ "${DISTRIBUTION}" == "Debian" ] ; then
DEBIAN_FRONTEND=noninteractive ${DIRNAME}/get-dependencies debian --install

# ====== Fedora ==========================================================
elif [ "${DISTRIBUTION}" == "Fedora" ] ; then
${DIRNAME}/get-dependencies fedora --install

# ====== Unknown =========================================================
else
echo >&2 "ERROR: Unknown Linux distribution ${DISTRIBUTION}!"
exit 1
fi

# ###### FreeBSD ############################################################
elif [ "${UNAME}" == "FreeBSD" ] ; then

${DIRNAME}/get-dependencies freebsd --install

# ###### Unknown ############################################################
else

echo >&2 "ERROR: Unexpected system ${UNAME}!"
exit 1

fi
DIRNAME="$(dirname "$0")"
"${DIRNAME}"/get-dependencies --install
Loading

0 comments on commit 090138c

Please sign in to comment.