-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
293 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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="" | ||
|
@@ -74,6 +79,7 @@ while [ $# -gt 0 ] ; do | |
|
||
# ====== Compile ========================================================= | ||
if [ "${TOOL}" == "compile" ] ; then | ||
|
||
MAKEFLAGS=${MAKEFLAGS} make # VERBOSE=1 | ||
|
||
|
||
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |
Oops, something went wrong.