Open twilwa opened 5 months ago
Did some rerigging, script i'm working with currently is:
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
## Enable for script debugging
# set -x
SCRIPT_HOME=$(dirname "$(realpath "$0")")
CMAKE_PREFIX_PATH=~/Qt/6.7.2/gcc_64
function trap_exit {
local return_value=$?
if [[ -n ${CI:-} ]]; then unset NSUnbufferedIO; fi
return ${return_value}
}
trap trap_exit EXIT
function trap_err {
echo "Script execution error occurred!" >&2
echo "Callstack:" >&2
for line in "${BASH_SOURCE[@]}"; do
echo "$line" >&2
done
exit 2
}
trap trap_err ERR
function check_linux {
echo "Checking Linux dependencies..."
if ! command -v ninja &> /dev/null; then
echo "Ninja build system is not installed. Installing..."
sudo apt-get update && sudo apt-get install -y ninja-build
fi
if ! command -v gcc &> /dev/null; then
echo "GCC compiler is not installed. Installing..."
sudo apt-get update && sudo apt-get install -y build-essential
fi
if ! dpkg -l | grep -q libobs-dev; then
echo "libobs-dev is not installed. Installing..."
sudo apt-get update && sudo apt-get install -y libobs-dev
fi
if ! dpkg -l | grep -q qtbase5-dev; then
echo "Qt base development packages are not installed. Installing..."
sudo apt-get update && sudo apt-get install -y qtbase5-dev qt5-qmake qttools5-dev-tools
fi
}
function setup_ccache {
echo "Setting up ccache..."
if ! command -v ccache &> /dev/null; then
echo "ccache is not installed. Installing..."
sudo apt-get update && sudo apt-get install -y ccache
fi
}
function build {
local host_os=$(uname | tr '[:upper:]' '[:lower:]')
local project_root=$(dirname "$(dirname "$SCRIPT_HOME")")
local buildspec_file="${project_root}/buildspec.json"
if [[ ! -r "$buildspec_file" ]]; then
echo 'No buildspec.json found. Please create a build specification for your project.' >&2
return 2
fi
local target="${host_os}-${HOSTTYPE}"
local config='RelWithDebInfo'
local verbosity=1
check_linux
setup_ccache
if [[ ! -d "$CMAKE_PREFIX_PATH/include/QtWidgets" ]]; then
echo "QtWidgets not found. Please verify your Qt installation." >&2
exit 2
fi
local build_dir="${project_root}/build"
mkdir -p "$build_dir"
pushd "$project_root"
echo "Configuring project..."
local cmake_args=(
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH"
-DCMAKE_BUILD_TYPE="$config"
-G "Ninja"
)
echo "CMake arguments: ${cmake_args[*]}"
cmake -S "$project_root" -B "$build_dir" "${cmake_args[@]}"
echo "Building project..."
cmake --build "$build_dir"
echo "Installing project..."
cmake --install "$build_dir"
popd
}
build "$@"
is the current error, i beleive i got a different one on one run of the script but it seems to have landed here. will tweak it a bit more later, but i'm presuming i'm missing something about the bash/zsh thing that may save me much more trouble lol
Ended up installing zsh -- I'm still failing on Pop! OS with the following error: which now occurs after re-running the script, the first script erroring out on the GPG key step:
i'm using the build scripts from https://github.com/obsproject/obs-plugintemplate they use zsh but zsh should be available or installable in all *nix OSs frankly
i don't have capacity to translate to bash. unfortunately
hey, not sure if i'm missing something -- it looks to me like the scripts are only built for zsh rather than bash in the .github folder. I replaced a few of the variables but I'm still getting errors -- is there a for-bash-not-zsh script somewhere or is the script intended to handle both types of shell?