Added the buildrt Bash script to tools. Removed the .sh extensions from the other Bash scripts as Bash scripts should not have .sh extensions. Updated rtdata/languages/README accordingly.

This commit is contained in:
DrSlony
2012-02-10 17:46:59 +00:00
parent e4c01e8e81
commit e2170dbe3c
4 changed files with 267 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ Translations are loaded for a given term at three levels:
Developers who are adding a new feature should add new strings *only* to
default. This file should be comprised of basic English text. It will be used
in the event that there are no more specific languages specified. Once you
have modified default, you should run ./tools/generateTranslationDiffs.sh (bash
have modified default, you should run ./tools/generateTranslationDiffs (Bash
script) which will re-generate the localizations with commented out additions
which you have just added.
@@ -34,7 +34,7 @@ If a locale file is used, it is applied in the same manner as <Language> is to
default. The locale will override any keys present from the ones in the
language file (and in turn, the default).
After the generateTranslationDiffs.sh has been run, all untranslated terms for
After the generateTranslationDiffs has been run, all untranslated terms for
a given language/locale will exist at the end of the file, prefixed by a !
comment marker. Translators should go through this section of the file and
translate all terms which they can. After you have translated a line, just

9
tools/benchmark_rt.sh → tools/benchmark_rt Normal file → Executable file
View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Use this Bash script to test RT processing speed.
# Written by DrSlony
# 2012-02-05
# 2012-02-10
# www.seeitmyway.org
# www.rawtherapee.com
@@ -34,7 +34,8 @@ Benchmark the time it takes for a given version of RawTherapee to process a file
minsizerel
relwithdebuginfo
-e - Specify the whole path to (but excluding) the "rawtherapee" executable.
-e - Specify the whole path to (but excluding) the "rawtherapee"
executable.
e.g. "-e $HOME/rt_${branch}_${buildType}"
-h - Print this help screen.
@@ -108,7 +109,7 @@ buildRT() {
while getopts "e:h?r:i:s:m:b:" opt; do
case "$opt" in
e) customExe="$OPTARG"
e) customExeDir="$OPTARG"
;;
h|\?)
howto
@@ -196,7 +197,7 @@ else # if sidecarCustom was not specified, use the ones in sidecarDefault
sidecarFiles=("${sidecarDefault[@]}")
fi
rtExeDirs=("${customExe}" "${tmpDir}/rt_${branch}_${buildType}" "$HOME/rt_${branch}_${buildType}" "${repo}/rt_${branch}_${buildType}" "${repo}/release" "$HOME/rawtherapee/")
rtExeDirs=("${customExeDir}" "${tmpDir}/rt_${branch}_${buildType}" "$HOME/rt_${branch}_${buildType}" "${repo}/rt_${branch}_${buildType}" "${repo}/release" "$HOME/rawtherapee/")
for rtExeDir in "${rtExeDirs}"; do
#if [[ -n "$customExe"
if [[ -x "${rtExeDir}/${rtExe}" ]]; then

260
tools/buildrt Executable file
View File

@@ -0,0 +1,260 @@
#!/usr/bin/env bash
# Written by DrSlony
# Version 2.0, 2012-02-10
# Please report bugs or enhancements to http://code.google.com/p/rawtherapee/issues/list
# www.seeitmyway.org
# www.rawtherapee.com
checkDeps () {
hash hg 2>&- || { echo "Mercurial not found, install Mercurial first and then re-run this script." >&2; exit 1; }
hash curl 2>&- || { echo "Curl not found, install curl first and then re-run this script." >&2; exit 1; }
}
getBranches () {
branches=(); while read branch _; do branches+=("$branch"); done < <(curl -s 'https://rawtherapee.googlecode.com/hg/?cmd=branchmap'; echo)
}
hgClone () {
[[ -d "${repo}" ]] || { echo "${repo} not found, cloning from GoogleCode"; hg clone https://rawtherapee.googlecode.com/hg/ "${repo}"; }
cd "${repo}" || exit 1
}
menu () {
num=1
# list[0] is manually set to clone to avoid columns, so we make a bogus one and hide it so that the index will match the list entries
list[0]="im hungry omnonom"
buildTypes=(release debug)
for branch in ${branches[@]}
do
for buildType in ${buildTypes[@]}
do
list+=( "$num - ${branch} - ${buildType}" )
((num++))
done
done
((num--)) # cause of num++ in the for loop increasing a number after the last list item
printf "%s\n------------------------------------------\n# - branch - build type\n------------------------------------------\n"
printf "%s\n" "0 - only clone the repository and exit"
printf "%s\n" "${list[@]:1}" | column -t
echo -e "------------------------------------------\n\nIf you don't know which option to choose,\nthen choose the \"default\" branch,\n\"release\" build type.\n\nEnter your choices, each number\nseparated by a single space.\ne.g. 7 8\n"
echo -n "Your choices: "
read -a choiceNumbers
#sanitize
choiceNumbers=${choiceNumbers//[^0-9 ]/}
echo
}
compile () {
for choiceNumber in ${choiceNumbers[@]}
do
[[ $choiceNumber = 0 ]] && {
echo "Repository cloned."
hg parents --template 'RawTherapee-{latesttag}.{latesttagdistance} Latest tag: {latesttag}, Latest tag distance: {latesttagdistance}, Changeset: {rev}:{node|short}\n'
exit 0;
}
read _ _ branch _ buildType < <( echo ${list[$choiceNumber]} )
echo
printf "%-15b %b\n" "About to compile:" "" "\tChoice number:" "$choiceNumber" "\tBranch:" "$branch" "\tBuild type:" "$buildType" "\tTarget:" "$procTarget" "" ""
[[ -d "${repo}/${buildType}" ]] && { printf "%s\n" "Found old build directory \"$buildType\" in your repository. Removing it."; rm -rf "${repo}/${buildType}"; }
[[ -d "${HOME}/rt_${branch}_${buildType}" ]] && {
printf "%s\n" "Found old build directory ${HOME}/rt_${branch}_${buildType}" "It must be removed to proceed."
read -p "Do you want to remove it and proceed? y/n: " YN
[[ "$YN" = y ]] && rm -rf "${HOME}/rt_${branch}_${buildType}" || exit 1
}
cd "$repo" || exit 1
echo
printf "%s\n" "Cleaning out old CMake files"
make clean
./clean.sh
echo
# if you manually applied a patch, this check avoids having it undone or broken by a hg update
if [[ ! $patched = b ]]; then
printf "%s\n" "Updating the local repository."
hg pull
hg update ${branch}
else
printf "%s\n" "You ran this script with the \"b\" option (\"build-only\")." "Skipping repository update and binary zip creation."
fi
printf "%s\n" "" "Starting compilation:"
verLatesttag="`hg parents --template '{latesttag}'`"
verLatesttagdistance="`hg parents --template '{latesttagdistance}'`"
verMajor=${verLatesttag%%.*}
cmake -DCMAKE_BUILD_TYPE=${buildType} -DPROC_TARGET_NUMBER:STRING=${procTarget} -DCMAKE_C_FLAGS="-O3 -pipe" -DCMAKE_CXX_FLAGS="${CMAKE_C_FLAGS}" ${noomp} -DCMAKE_INSTALL_PREFIX=rawtherapee -DBUILD_BUNDLE=ON -DBINDIR=. -DDATADIR=. -DCACHE_NAME_SUFFIX=${verMajor} || { echo "Error during cmake, exiting." >&2; exit 1; }
time { make -j${cpuCount} install; } || { printf "%s\n" "" "Error during make, exiting."; exit 1; }
printf "%-15b %b\n" "" "" "Rawtherapee compiled:" "" "\tChoice number:" "$choiceNumber" "\tBranch:" "$branch" "\tBuild type:" "$buildType" "\tTarget:" "$procTarget" "" ""
# # branch "branch_3.0" will compile into a dir called "rawtherapee", good, no action needed.
# # branch "default" with "-DCMAKE_BUILD_TYPE=release" will compile into a dir called "release", rename to "rawtherapee"
# # branch "default" with "-DCMAKE_BUILD_TYPE=debug" will compile into a dir called "debug", rename to "rawtherapee"
# # 2012-12-28 compilng branch_3.0 fails, probably due to a requirement on outdated dependencies, and I will remove this section once RT4 goes officially stable
# if [[ -d "$repo/release" ]]
# then
# echo "Found $repo/release, moving to ${repo}/rawtherapee"
# mv -v "${repo}/release" "${repo}/rawtherapee" || { echo "Something went wrong while moving ${repo}/release to ${repo}/rawtherapee" >&2; exit 1; }
# elif [[ -d "$repo/debug" ]]
# then
# echo "Found $repo/debug, moving to ${repo}/rawtherapee"
# mv -v "${repo}/debug" "${repo}/rawtherapee" || { echo "Something went wrong while moving ${repo}/debug to ${repo}/rawtherapee" >&2; exit 1; }
# elif [[ -d "$repo/minsizerel" ]]
# then
# echo "Found $repo/minsizerel, moving to ${repo}/rawtherapee"
# mv -v "${repo}/minsizerel" "${repo}/rawtherapee" || { echo "Something went wrong while moving ${repo}/minsizerel to ${repo}/rawtherapee" >&2; exit 1; }
# fi
[[ -d "${repo}/${buildType}" ]] && { printf "%s\n" "Moving ${repo}/${buildType} to ${repo}/rawtherapee"; mv "${repo}/${buildType}" "${repo}/rawtherapee"; } || { printf "%s\n" "Could not find the directory containing the compiled RawTherapee in ${repo}" "Please notify DrSlony in the forum:" "http://rawtherapee.com/forum/viewtopic.php?f=10&t=3001#p22213" "" "Exiting"; exit 1; }
echo
cat AboutThisBuild.txt || { printf "%s\n" "${repo}/AboutThisBuild.txt not found, exiting."; exit 1; }
# AboutThisBuild.txt has a blank line at the end - 4.0.7
if [[ ! $patched = b ]]; then
printf "%s\n" "Zipping the compiled RawTherapee dir \"${repo}/rawtherapee\" and putting it in \"/tmp/RawTherapee_${branch}_${distribution}_${bits}_${verLatesttag}.${verLatesttagdistance}_${buildType}.zip\""
[[ -e "/tmp/RawTherapee_${branch}_${distribution}_${bits}_${verLatesttag}.${verLatesttagdistance}_${buildType}.zip" ]] && { rm "/tmp/RawTherapee_${branch}_${distribution}_${bits}_${verLatesttag}.${verLatesttagdistance}_${buildType}.zip" || exit 1; }
zip -Xrq "/tmp/RawTherapee_${branch}_${distribution}_${bits}_${verLatesttag}.${verLatesttagdistance}_${buildType}.zip" AboutThisBuild.txt rawtherapee
fi
printf "%s\n" "" "Moving \"${repo}/rawtherapee\" to \"${HOME}/rt_${branch}_${buildType}\""
mv "${repo}/rawtherapee" "${HOME}/rt_${branch}_${buildType}" || { printf "%s\n" "" "Could not move \"${repo}/rawtherapee\" to \"${HOME}/rt_${branch}_${buildType}\", exiting."; exit 1; }
printf "%-15b %b\n" "" "" "Build ready:" "" "\tChoice number:" "$choiceNumber" "\tBranch:" "$branch" "\tBuild type:" "$buildType" "\tTarget:" "$procTarget"
printf "%s\n" "" "To run RawTherapee, fire up a terminal and type:" "~/rt_${branch}_${buildType}/rawtherapee" "" "------------------------------------------" ""
alert "RawTherapee-${verLatesttag}.${verLatesttagdistance} ready.\nChoice number ${choiceNumber}, branch: ${branch}, type: ${buildType}, target: ${procTarget}"
done
}
checkDistro () {
# list from http://linuxmafia.com/faq/Admin/release-files.html
distributions=(
"Annvix /etc/annvix-release"
"Arch /etc/arch-release"
"Arklinux /etc/arklinux-release"
"Aurox /etc/aurox-release"
"BlackCat /etc/blackcat-release"
"Cobalt /etc/cobalt-release"
"Conectiva /etc/conectiva-release"
"Debian /etc/debian_version"
"Fedora /etc/fedora-release"
"Gentoo /etc/gentoo-release"
"Immunix /etc/immunix-release"
"Knoppix knoppix_version"
"Linux-From-Scratch /etc/lfs-release"
"Linux-PPC /etc/linuxppc-release"
"Mandrake /etc/mandrake-release"
"Mandriva_Mandrake /etc/mandriva-release /etc/mandrake-release /etc/mandrakelinux-release"
"Mint /etc/linuxmint/info"
"MkLinux /etc/mklinux-release"
"Novell /etc/nld-release"
"PLD /etc/pld-release"
"RedHat /etc/redhat-release"
"CentOS /etc/centos-release"
"Slackware /etc/slackware-version"
"SME /etc/e-smith-release"
"Solaris /etc/release"
"SunJDS /etc/sun-release"
"SUSE /etc/SuSE-release"
"TinySofa /etc/tinysofa-release"
"TurboLinux /etc/turbolinux-release"
"Ubuntu /etc/lsb-release"
"UltraPenguin /etc/ultrapenguin-release"
"United /etc/UnitedLinux-release"
"VA-Linux /etc/va-release"
"YellowDog /etc/yellowdog-release"
)
for element in "${distributions[@]}"; do
read distro loc1 loc2 loc3 <<< "$element"
for loc in $loc1 $loc2 $loc3
do
# distribution=${distro} because if none of the elements match, distro will =YellowDog (last item in the list)
# add "break 2;" to the end if we really want to, but Ubuntu gets detected as Debian first, then as Ubuntu,
# so we might want to not break the loop.
[[ -e "$loc" ]] && { distribution=${distro}; echo "Distribution detected as ${distribution}"; }
done
done
if [[ -z ${distribution} ]]
then
echo -e "\nCould not automatically detect your distribution.\nPlease enter it below followed immediately by the version\nwithout any spaces or punctuation marks and hit enter,\n.e.g. \"Ubuntu1104\", \"Mint11\" or \"Musix20\""
read distribution
#sanitize
distribution=${distribution//[^a-zA-Z0-9]/}
echo "Distribution entered manually: ${distribution}"
fi
}
checkBits () {
bits=`uname -m` || { echo -e "Is your system a 32 or 64 bit one?\nEnter 32 or 64 and hit enter."; read bits; bits=${bits//[^0-9]/}; echo "bits entered manually: ${bits}"; }
if [[ $bits = *64* ]]
then
bits=64
echo "Bits detected as ${bits}"
else
bits=32
echo "Bits detected as ${bits}"
fi
[[ $bits != 32 ]] && [[ $bits != 64 ]] && checkBits
}
setVars () {
unset choiceNumber choiceNumbers buildType buildTypes list branch branches repo patched param
checkDistro
checkBits
repo="${HOME}/rawtherapee" && echo "Repository is set to ${repo}"
cpuCount="`grep -c 'processor' /proc/cpuinfo`"
if (( "$cpuCount" >= 1 && "$cpuCount" <= 8 )); then echo "CPU count detected as ${cpuCount}"; else cpuCount="1"; echo "CPU count set to ${cpuCount}"; fi
procTarget="2" && echo "procTarget set to ${procTarget}"
if hash notify-send 2>/dev/null; then alert_type="notify-send"
elif hash kdialog 2>/dev/null; then alert_type="kdialog"
elif hash zenity 2>/dev/null; then alert_type="zenity"
elif hash xmessage 2>/dev/null; then alert_type="xmessage"
else alert_type="none"
fi
}
alert () {
case "$alert_type" in
notify-send) notify-send "RawTherapee" "$1";;
kdialog) kdialog --title "RawTherapee" --passivepopup "$1";;
zenity) zenity --notification --text="$1";;
xmessage) xmessage -nearmouse "$1";;
none) printf "%b\n" "" "Compilation complete:" "$1";;
esac
}
finishUp () {
# builds=( /tmp/RawTherapee* ); for f in ${builds[@]}; do echo ${f#/tmp/}; done
if [[ $patched != b ]]; then
printf "%s\n" "RawTherapee zipped builds read in /tmp"
ls -lh /tmp/RawTherapee*
fi
printf "%s\n" "" "Finished building all chosen versions of RawTherapee"
}
# program start
printf "%s\n" "Running the RawTherapee build script."
for param in "$@"
do
[[ $param = b ]] && { patched="b"; echo "Detected buildonly flag"; }
[[ $param = noomp ]] && { noomp="-DOPTION_OMP=OFF"; echo "Detected noomp flag"; }
done
setVars
checkDeps
getBranches
menu
hgClone
compile
finishUp