buildRT: Added -s option to define a suffix of the destination build dir, and -t to add a suffix to the version string which is shown in the window titlebar (issue 2274)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Written by DrSlony
|
||||
# buildRT version 3.8, 2014-01-23
|
||||
# buildRT version 4.0, 2014-03-06
|
||||
# Please report bugs or enhancements to http://code.google.com/p/rawtherapee/issues/list
|
||||
# www.rawtherapee.com
|
||||
# www.londonlight.org
|
||||
@@ -25,18 +25,17 @@ esac
|
||||
|
||||
#--- Set some variables
|
||||
unset choiceNumber choiceNumbers buildType buildTypes list branch branches repo
|
||||
version="3.8"
|
||||
version="4.0"
|
||||
movetoPatched=""
|
||||
repo="${HOME}/rawtherapee"
|
||||
procTarget=2
|
||||
|
||||
while getopts "bc:np:uvh?-" opt; do
|
||||
while getopts "bc:np:s:t:uvh?-" opt; do
|
||||
case "${opt}" in
|
||||
b) patched="yes"
|
||||
movetoPatched="_patched"
|
||||
printf "%s\n" "Buildonly flag detected, will not hg pull or update" ;;
|
||||
c) dCacheNameSuffix="$OPTARG"
|
||||
#sanitize
|
||||
dCacheNameSuffix=${dCacheNameSuffix//[^\.\-_a-zA-Z0-9]/};
|
||||
printf "%s\n" "Cache and config name suffix: $dCacheNameSuffix" ;;
|
||||
n) noomp="-DOPTION_OMP=OFF"
|
||||
@@ -46,6 +45,10 @@ while getopts "bc:np:uvh?-" opt; do
|
||||
printf "%s\n" "Invalid processor target value." "Use a value from 1 to 9, e.g." "./buildRT -p 1" "See ProcessorTargets.cmake" "Aborting"
|
||||
exit 1
|
||||
fi ;;
|
||||
s) movetoPatched="_${OPTARG//[^\.\-_a-zA-Z0-9]/}"
|
||||
printf "%s\n" "Suffix of destination build dir: ${movetoPatched}" ;;
|
||||
t) titleSuffix="${OPTARG//[^\.\-\ \+_a-zA-Z0-9]/}"
|
||||
printf "%s\n" "Titlebar version suffix: ${titleSuffix}" ;;
|
||||
u) gcVer="$(curl "http://rawtherapee.googlecode.com/hg/tools/buildRT" 2>/dev/null | grep "^#.*[vV]ersion.*")" || { echo "\"curl\" program not found, please install it first."; exit 1; }
|
||||
gcVer="${gcVer##*[[:alpha:]] }"
|
||||
gcVer="${gcVer%%,*}"
|
||||
@@ -60,7 +63,7 @@ while getopts "bc:np:uvh?-" opt; do
|
||||
v) verbose=yes
|
||||
printf "%s\n" "Verbose mode, I will spam your screen with warnings" ;;
|
||||
h|\?|-) printf "%s\n" "Usage:" "" \
|
||||
" $0 [-b] [-c <string>] [-n] [-p <1-9>] [-v]" "" \
|
||||
" $0 [-b] [-c <string>] [-n] [-p <1-9>] [-s <string>] [-v]" "" \
|
||||
" -b" \
|
||||
"Build-only mode. buildRT uses \"hg update -C default\" to update your source code repository to the newest revision, however doing so might destroy any uncommitted or unpushed changes you made or any patches you applied. With the -b flag the script will not update the source code, so that you can easily compile RawTherapee with whatever patches you manually applied. buildRT should automatically detect if you modified the source code, but you can use this flag to force build-only mode." "Generally when compiling patched RT versions you want to keep the cache and config folders separate, so consider using \"-b -c _testing\"" "" \
|
||||
" -c <string>" \
|
||||
@@ -69,6 +72,10 @@ while getopts "bc:np:uvh?-" opt; do
|
||||
"Disable OpenMP." "" \
|
||||
" -p <1-9>" \
|
||||
"Set which processor target to use. Takes a single digit from 1 to 9. The default is 2. See ProcessorTargets.cmake" "" \
|
||||
" -s <string>" \
|
||||
"Suffix of destination build directory, so that if you have applied a patch, say \"dustremoval-1.patch\", and want to have RawTherapee compiled to a folder whose name ends with \"_dustremoval1\", you would set \"-s dustremoval1\" (the underscore is automated)." "" \
|
||||
" -t <string>" \
|
||||
"Suffix displayed next to the RawTherapee version in the window titlebar, e.g.: -t \"+ dustremoval-1.patch + mustafa ibrahim\"" "" \
|
||||
" -u" \
|
||||
"Check for an update of buildRT on Google Code." "" \
|
||||
" -v" \
|
||||
@@ -201,14 +208,18 @@ elif [[ -z $patched ]]; then
|
||||
echo ;;
|
||||
c|C) printf "%s\n" "Retaining edited source code and compiling RT as-is." ""
|
||||
patched="yes"
|
||||
movetoPatched="_patched" ;;
|
||||
if [[ -z $movetoPatched ]]; then
|
||||
movetoPatched="_patched"
|
||||
fi ;;
|
||||
*) printf "%s\n" "User aborted" ""
|
||||
exit 0 ;;
|
||||
esac
|
||||
else
|
||||
printf "%s\n" "Retaining edited source code and compiling RT as-is." ""
|
||||
if [[ -z $movetoPatched ]]; then
|
||||
movetoPatched="_patched"
|
||||
fi
|
||||
fi
|
||||
hg parents --template 'Repository state:\n Branch: {branch}\n RawTherapee-{latesttag}.{latesttagdistance}\n Changeset: {rev}:{node|short}\n Latest tag: {latesttag}\n\n'
|
||||
|
||||
#--- Print the menu
|
||||
@@ -272,9 +283,9 @@ for choiceNumber in "${choiceNumbers[@]}"; do
|
||||
echo
|
||||
case $REPLY in
|
||||
d|D) rm -rf "${HOME}/rt_${branch}_${buildType}${movetoPatched}" || exit 1 ;;
|
||||
r|R) printf "%s\n" "The build will be saved to \"${HOME}/rt_${branch}_${buildType}${movetoPatched}X\" where \"X\" will be replaced with whatever suffix you choose next. Only alphanumerics, dashes and underscores are valid." | fold -s
|
||||
r|R) printf "%s\n" "The build will be saved to \"${HOME}/rt_${branch}_${buildType}_X\" where \"X\" will be replaced with whatever suffix you choose next. Only alphanumerics, dashes, underscores and periods are valid." | fold -s
|
||||
read -r -p "Suffix: "
|
||||
movetoPatched="${REPLY//[^\.\-_a-zA-Z0-9]/}"
|
||||
movetoPatched="_${REPLY//[^\.\-_a-zA-Z0-9]/}"
|
||||
printf "%s\n" "Build will be compiled to \"${HOME}/rt_${branch}_${buildType}${movetoPatched}\"" ;;
|
||||
a|A) printf "%s\n" "Cannot proceed if old build directory exists." "Remove it or rename it, then re-run this script." "Aborting"
|
||||
exit 0 ;;
|
||||
@@ -320,7 +331,9 @@ for choiceNumber in "${choiceNumbers[@]}"; do
|
||||
-DBUILD_BUNDLE="ON" \
|
||||
-DBINDIR="." \
|
||||
-DDATADIR="." \
|
||||
-DCACHE_NAME_SUFFIX="$dCacheNameSuffix" ../ \
|
||||
-DCACHE_NAME_SUFFIX="$dCacheNameSuffix" \
|
||||
-DVERSION_SUFFIX="$titleSuffix" \
|
||||
../ \
|
||||
|| { echo "Error during cmake, exiting."; exit 1; }
|
||||
fi
|
||||
echo
|
||||
|
Reference in New Issue
Block a user