Updated build-rawtherapee to 2018-01-06

This commit is contained in:
Morgan Hardwood 2018-01-11 19:17:06 +01:00
parent a748354b7b
commit fa4e07b8bb

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# By Morgan Hardwood # By Morgan Hardwood
# Version 2017-12-25 # Version 2018-01-06
# This script gets the latest source code for the given program and compiles it. # This script gets the latest source code for the given program and compiles it.
# The name of the program, used for the folder names: # The name of the program, used for the folder names:
@ -22,11 +22,14 @@ exe="${prog}"
exeRelativePath="" exeRelativePath=""
# The path to the repository: # The path to the repository:
repo="git@github.com:Beep6581/RawTherapee.git" repo="https://github.com/Beep6581/RawTherapee.git"
# No touching below this line, with the exception of the "Compile" section # No touching below this line, with the exception of the "Compile" section
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# The name of the project's standard branch, typically "master":
master="dev"
buildOnly="false" buildOnly="false"
buildType="release" buildType="release"
@ -35,8 +38,6 @@ exeRelativePath="${exeRelativePath/%\/}"
# Append forward-slash to exeRelativePath only if it is not empty. # Append forward-slash to exeRelativePath only if it is not empty.
exePath="${exeRelativePath:+${exeRelativePath}/}${exe}" exePath="${exeRelativePath:+${exeRelativePath}/}${exe}"
printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" ""
# Command-line arguments # Command-line arguments
OPTIND=1 OPTIND=1
while getopts "bdh?-" opt; do while getopts "bdh?-" opt; do
@ -59,16 +60,18 @@ done
shift $((OPTIND-1)) shift $((OPTIND-1))
[ "$1" = "--" ] && shift [ "$1" = "--" ] && shift
printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" ""
# Clone if needed # Clone if needed
cloned="false" cloned="false"
updates="false" updates="false"
if [[ ! -d "$HOME/programs/code-${prog}" ]]; then if [[ ! -d "$HOME/programs/code-${prog}" ]]; then
mkdir -p "$HOME/programs" || exit 1 mkdir -p "$HOME/programs" || exit 1
git clone "$repo" "$HOME/programs/code-${prog}" || exit 1 git clone "$repo" "$HOME/programs/code-${prog}" || exit 1
pushd "$HOME/programs/code-${prog}" || exit 1 pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1
cloned="true" cloned="true"
else else
pushd "$HOME/programs/code-${prog}" || exit 1 pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1
git fetch git fetch
if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then
updates="true" updates="true"
@ -80,8 +83,20 @@ if [[ "$updates" = "true" && "$buildOnly" = "false" ]]; then
git pull || exit 1 git pull || exit 1
fi fi
# Find out which branch git is on
branch="$(git rev-parse --abbrev-ref HEAD)"
# Set build and install folder names
if [[ $branch = $master && $buildType = release ]]; then
buildDir="$HOME/programs/code-${prog}/build"
installDir="$HOME/programs/${prog}"
else
buildDir="$HOME/programs/code-${prog}/build-${branch}-${buildType}"
installDir="$HOME/programs/${prog}-${branch}-${buildType}"
fi
existsExe="false" existsExe="false"
if [[ -e "$HOME/programs/${prog}/${exePath}" ]]; then if [[ -e "${installDir}/${exePath}" ]]; then
existsExe="true" existsExe="true"
fi fi
@ -101,9 +116,9 @@ if [[ ! ( $cpuCount -ge 1 && $cpuCount -le 64 ) ]]; then
fi fi
# Prepare folders # Prepare folders
rm -rf "$HOME/programs/${prog}" "$HOME/programs/code-${prog}/build" rm -rf "${installDir}"
mkdir -p "$HOME/programs/${prog}" "$HOME/programs/code-${prog}/build" || exit 1 mkdir -p "${buildDir}" "${installDir}" || exit 1
cd "$HOME/programs/code-${prog}/build" || exit 1 cd "${buildDir}" || exit 1
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Compile # Compile
@ -116,7 +131,7 @@ cmake \
-DCACHE_NAME_SUFFIX="5-dev" \ -DCACHE_NAME_SUFFIX="5-dev" \
-DPROC_TARGET_NUMBER="2" \ -DPROC_TARGET_NUMBER="2" \
-DBUILD_BUNDLE="ON" \ -DBUILD_BUNDLE="ON" \
-DBUNDLE_BASE_INSTALL_DIR="$HOME/programs/${prog}" \ -DBUNDLE_BASE_INSTALL_DIR="${installDir}" \
-DOPTION_OMP="ON" \ -DOPTION_OMP="ON" \
-DWITH_LTO="OFF" \ -DWITH_LTO="OFF" \
-DWITH_PROF="OFF" \ -DWITH_PROF="OFF" \
@ -127,6 +142,6 @@ cmake \
make --jobs="$cpuCount" install || exit 1 make --jobs="$cpuCount" install || exit 1
# Finished # Finished
printf '%s\n' "" "To run ${prog} type:" "~/programs/${prog}/${exePath}" "" printf '%s\n' "" "To run ${prog} type:" "${installDir}/${exePath}" ""
popd 1>/dev/null popd 1>/dev/null