Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shellcheck failures #70

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions bin/build-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

set -e
set -u
[ -z $BASH ] || shopt -s expand_aliases
[ -z "$BASH" ] || shopt -s expand_aliases

script_path="bin/$(basename $0)"
script_path="bin/$(basename "$0")"

if [ ! -f $script_path ] || [ $(realpath $0) != $(realpath $script_path) ]; then
if [ ! -f "$script_path" ] || [ "$(realpath "$0")" != "$(realpath "$script_path")" ]; then
echo 'This script must be run from the root of the BlazingMQ repository.'
exit 1
fi

# :: Set some initial constants :::::::::::::::::::::::::::::::::::::::::::::::
DIR_ROOT="${DIR_ROOT:-`pwd`}"
DIR_ROOT="${DIR_ROOT:-$(pwd)}"

DIR_THIRDPARTY="${DIR_ROOT}/thirdparty"
mkdir -p "${DIR_THIRDPARTY}"
Expand Down Expand Up @@ -54,11 +54,11 @@ PATH="${DIR_THIRDPARTY}/bde-tools/bin:$PATH"

if [ ! -e "${DIR_BUILD}/bde/.complete" ]; then
pushd "${DIR_THIRDPARTY}/bde"
eval `bbs_build_env -u opt_64_cpp17 -b "${DIR_BUILD}/bde"`
eval "$(bbs_build_env -u opt_64_cpp17 -b "${DIR_BUILD}/bde")"
bbs_build configure --prefix="${DIR_ROOT}"
bbs_build build --prefix="${DIR_ROOT}"
bbs_build --install_dir="/" --prefix="${DIR_ROOT}" install
eval `bbs_build_env unset`
eval "$(bbs_build_env unset)"
popd
touch "${DIR_BUILD}/bde/.complete"-DBDE_BUILD_TARGET_64=1
fi
Expand All @@ -78,7 +78,7 @@ fi
brew install flex bison google-benchmark zlib

# Determine paths based on Intel vs Apple Silicon CPU
if [ $(uname -p) == 'arm' ]; then
if [ "$(uname -p)" == 'arm' ]; then
BREW_PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/opt/homebrew/opt/zlib/lib/pkgconfig"
FLEX_ROOT="/opt/homebrew/opt/flex"
else
Expand All @@ -88,30 +88,30 @@ fi


# :: Build the BlazingMQ repo :::::::::::::::::::::::::::::::::::::::::::::::::
CMAKE_OPTIONS="\
CMAKE_OPTIONS=(\
-DBDE_BUILD_TARGET_64=1 \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_LIBDIR=${DIR_ROOT}/lib \
-DCMAKE_INSTALL_PREFIX=${DIR_ROOT} \
-DCMAKE_MODULE_PATH=${DIR_THIRDPARTY}/bde-tools/cmake;${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem \
-DCMAKE_PREFIX_PATH=${DIR_ROOT} \
-DCMAKE_TOOLCHAIN_FILE=${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem/toolchains/darwin/gcc-default.cmake \
-DCMAKE_INSTALL_LIBDIR="${DIR_ROOT}/lib" \
-DCMAKE_INSTALL_PREFIX="${DIR_ROOT}" \
-DCMAKE_MODULE_PATH="${DIR_THIRDPARTY}/bde-tools/cmake;${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem" \
-DCMAKE_PREFIX_PATH="${DIR_ROOT}" \
-DCMAKE_TOOLCHAIN_FILE="${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem/toolchains/darwin/gcc-default.cmake" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DFLEX_ROOT=${FLEX_ROOT}"
-DFLEX_ROOT="${FLEX_ROOT}")

PKG_CONFIG_PATH="${DIR_ROOT}/lib/pkgconfig:${BREW_PKG_CONFIG_PATH}" \
cmake -B "${DIR_BUILD}/blazingmq" -S "${DIR_ROOT}" ${CMAKE_OPTIONS}
cmake -B "${DIR_BUILD}/blazingmq" -S "${DIR_ROOT}" "${CMAKE_OPTIONS[@]}"
make -C "${DIR_BUILD}/blazingmq" -j 16

echo broker is here: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/bmqbrkr.tsk"
echo to run the broker: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/run"
echo tool is here: "${DIR_BUILD}/blazingmq/src/applications/bmqtool/bmqtool.tsk"

SELF_HOST_ADDRESS="127.0.0.1 `hostname`"
SELF_HOST_ADDRESS="127.0.0.1 $(hostname)"
if ! (grep -q "$SELF_HOST_ADDRESS" /etc/hosts > /dev/null);
then
echo "Warning: self hostname `hostname` not found in /etc/hosts"
echo "Warning: self hostname $(hostname) not found in /etc/hosts"
echo "It might be necessary to add it manually to launch bmqbrkr:"
echo "sudo bash -c \"echo \\\"$SELF_HOST_ADDRESS\\\" >> /etc/hosts\""
fi
29 changes: 15 additions & 14 deletions bin/build-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Before running this script, install following prerequisites, if not present
# yet, by copy-and-pasting the commands between `<<PREREQUISITES` and
# `PREREQUISITES` below:
# shellcheck disable=SC2188
<<PREREQUISITES
sudo apt update && sudo apt -y install ca-certificates
sudo apt install -y --no-install-recommends \
Expand All @@ -21,17 +22,17 @@ PREREQUISITES

set -e
set -u
[ -z $BASH ] || shopt -s expand_aliases
[ -z "$BASH" ] || shopt -s expand_aliases

script_path="bin/$(basename $0)"
script_path="bin/$(basename "$0")"

if [ ! -f $script_path ] || [ $(realpath $0) != $(realpath $script_path) ]; then
if [ ! -f "$script_path" ] || [ "$(realpath "$0")" != "$(realpath "$script_path")" ]; then
echo 'This script must be run from the root of the BlazingMQ repository.'
exit 1
fi

# :: Set some initial constants :::::::::::::::::::::::::::::::::::::::::::::::
DIR_ROOT="${DIR_ROOT:-`pwd`}"
DIR_ROOT="${DIR_ROOT:-$(pwd)}"

DIR_THIRDPARTY="${DIR_ROOT}/thirdparty"
mkdir -p "${DIR_THIRDPARTY}"
Expand Down Expand Up @@ -59,11 +60,11 @@ PATH="${DIR_THIRDPARTY}/bde-tools/bin:$PATH"

if [ ! -e "${DIR_BUILD}/bde/.complete" ]; then
pushd "${DIR_THIRDPARTY}/bde"
eval `bbs_build_env -u opt_64_cpp17 -b "${DIR_BUILD}/bde"`
eval "$(bbs_build_env -u opt_64_cpp17 -b "${DIR_BUILD}/bde")"
bbs_build configure --prefix="${DIR_ROOT}"
bbs_build build --prefix="${DIR_ROOT}"
bbs_build --install_dir="/" --prefix="${DIR_ROOT}" install
eval `bbs_build_env unset`
eval "$(bbs_build_env unset)"
popd
touch "${DIR_BUILD}/bde/.complete"
fi
Expand All @@ -79,20 +80,20 @@ if [ ! -e "${DIR_BUILD}/ntf/.complete" ]; then
fi

# :: Build the BlazingMQ repo :::::::::::::::::::::::::::::::::::::::::::::::::::::::
CMAKE_OPTIONS="\
CMAKE_OPTIONS=(\
-DBDE_BUILD_TARGET_64=1 \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_LIBDIR=${DIR_ROOT}/lib \
-DCMAKE_INSTALL_PREFIX=${DIR_ROOT} \
-DCMAKE_MODULE_PATH=${DIR_THIRDPARTY}/bde-tools/cmake;${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem \
-DCMAKE_PREFIX_PATH=${DIR_ROOT} \
-DCMAKE_TOOLCHAIN_FILE=${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake \
-DCMAKE_INSTALL_LIBDIR="${DIR_ROOT}/lib" \
-DCMAKE_INSTALL_PREFIX="${DIR_ROOT}" \
-DCMAKE_MODULE_PATH="${DIR_THIRDPARTY}/bde-tools/cmake;${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem" \
-DCMAKE_PREFIX_PATH="${DIR_ROOT}" \
-DCMAKE_TOOLCHAIN_FILE="${DIR_THIRDPARTY}/bde-tools/BdeBuildSystem/toolchains/linux/gcc-default.cmake" \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DFLEX_ROOT=/usr/lib/x86_64-linux-gnu"
-DFLEX_ROOT=/usr/lib/x86_64-linux-gnu)

PKG_CONFIG_PATH="${DIR_ROOT}/lib64/pkgconfig:$(pkg-config --variable pc_path pkg-config)" \
cmake -B "${DIR_BUILD}/blazingmq" -S "${DIR_ROOT}" ${CMAKE_OPTIONS}
cmake -B "${DIR_BUILD}/blazingmq" -S "${DIR_ROOT}" "${CMAKE_OPTIONS[@]}"
make -C "${DIR_BUILD}/blazingmq" -j 16

echo broker is here: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/bmqbrkr.tsk"
Expand Down