From fa4e07b8bb550155acec143b5e6edf56f8723131 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Thu, 11 Jan 2018 19:17:06 +0100 Subject: [PATCH] Updated build-rawtherapee to 2018-01-06 --- tools/build-rawtherapee | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/tools/build-rawtherapee b/tools/build-rawtherapee index 8c86ed54d..5c13df061 100755 --- a/tools/build-rawtherapee +++ b/tools/build-rawtherapee @@ -1,6 +1,6 @@ #!/usr/bin/env bash # 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. # The name of the program, used for the folder names: @@ -22,11 +22,14 @@ exe="${prog}" exeRelativePath="" # 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 # ----------------------------------------------------------------------------- +# The name of the project's standard branch, typically "master": +master="dev" + buildOnly="false" buildType="release" @@ -35,8 +38,6 @@ exeRelativePath="${exeRelativePath/%\/}" # Append forward-slash to exeRelativePath only if it is not empty. exePath="${exeRelativePath:+${exeRelativePath}/}${exe}" -printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" "" - # Command-line arguments OPTIND=1 while getopts "bdh?-" opt; do @@ -59,16 +60,18 @@ done shift $((OPTIND-1)) [ "$1" = "--" ] && shift +printf '%s\n' "" "Program name: ${prog}" "Build type: ${buildType}" "Build without updating: ${buildOnly}" "" + # Clone if needed cloned="false" updates="false" if [[ ! -d "$HOME/programs/code-${prog}" ]]; then mkdir -p "$HOME/programs" || 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" else - pushd "$HOME/programs/code-${prog}" || exit 1 + pushd "$HOME/programs/code-${prog}" 1>/dev/null || exit 1 git fetch if [[ $(git rev-parse HEAD) != $(git rev-parse '@{u}') ]]; then updates="true" @@ -80,8 +83,20 @@ if [[ "$updates" = "true" && "$buildOnly" = "false" ]]; then git pull || exit 1 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" -if [[ -e "$HOME/programs/${prog}/${exePath}" ]]; then +if [[ -e "${installDir}/${exePath}" ]]; then existsExe="true" fi @@ -101,9 +116,9 @@ if [[ ! ( $cpuCount -ge 1 && $cpuCount -le 64 ) ]]; then fi # Prepare folders -rm -rf "$HOME/programs/${prog}" "$HOME/programs/code-${prog}/build" -mkdir -p "$HOME/programs/${prog}" "$HOME/programs/code-${prog}/build" || exit 1 -cd "$HOME/programs/code-${prog}/build" || exit 1 +rm -rf "${installDir}" +mkdir -p "${buildDir}" "${installDir}" || exit 1 +cd "${buildDir}" || exit 1 # ----------------------------------------------------------------------------- # Compile @@ -116,7 +131,7 @@ cmake \ -DCACHE_NAME_SUFFIX="5-dev" \ -DPROC_TARGET_NUMBER="2" \ -DBUILD_BUNDLE="ON" \ - -DBUNDLE_BASE_INSTALL_DIR="$HOME/programs/${prog}" \ + -DBUNDLE_BASE_INSTALL_DIR="${installDir}" \ -DOPTION_OMP="ON" \ -DWITH_LTO="OFF" \ -DWITH_PROF="OFF" \ @@ -127,6 +142,6 @@ cmake \ make --jobs="$cpuCount" install || exit 1 # Finished -printf '%s\n' "" "To run ${prog} type:" "~/programs/${prog}/${exePath}" "" +printf '%s\n' "" "To run ${prog} type:" "${installDir}/${exePath}" "" popd 1>/dev/null