Update build-with-docker.sh

Improve the bash script by taking user input straight to a variable with read -p. 
Clean the code up.
This commit is contained in:
Kenta
2023-01-30 21:50:29 +00:00
committed by Christoffer Lerno
parent 61cc8163f9
commit dbb759713f

View File

@@ -1,15 +1,13 @@
#!/bin/bash
## build-with-docker.sh
## @author gdm85
## @modified by Kenta
##
## Script to build c3c for Ubuntu 22
##
#
if [ $# -ne 1 -a $# -ne 2 ]; then
echo "Usage: build-with-docker.sh [Debug|Release]" 1
exit 1
fi
read -p "Select Build Type: Debug/Release: " config
set -e
@@ -22,10 +20,11 @@ if type podman 2>/dev/null >/dev/null; then
IMAGE="localhost/$IMAGE"
fi
if [ -z "$1" ]; then
if [ $config == "Debug" ]; then
echo "debug???"
CMAKE_BUILD_TYPE=Debug
else
CMAKE_BUILD_TYPE="$1"
CMAKE_BUILD_TYPE="$config"
fi
UBUNTU_VERSION="22.10"
@@ -42,4 +41,4 @@ rm -rf build bin
mkdir -p build bin
exec $DOCKER run -ti --rm --tmpfs=/tmp $DOCKER_RUN -v "$PWD":/home/c3c/source -w /home/c3c/source $IMAGE bash -c \
"cd build && cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DC3_LLVM_VERSION=$LLVM_VERSION .. && cmake --build . && mv c3c lib ../bin/"
"cd build && cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DC3_LLVM_VERSION=$LLVM_VERSION .. && cmake --build . && mv c3c lib ../bin/"