From 5252edcd0e75189bc433ef1d348ea50fdb096ae9 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Mon, 30 Nov 2015 00:58:40 -0500 Subject: [PATCH 1/3] Properly handle spaces in the build path Ex: /usr/local/Console Emulators/pcsx2/ --- build.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index be3f2c60fe..d1b0b3d3d3 100755 --- a/build.sh +++ b/build.sh @@ -85,8 +85,8 @@ for ARG in "$@"; do done root=$PWD/$(dirname "$0") -log=$root/install_log.txt -build=$root/build +log="$root/install_log.txt" +build="$root/build" coverity_dir=cov-int coverity_result=pcsx2-coverity.xz @@ -103,7 +103,7 @@ elif [[ "$useCross" -ne 1 ]]; then useCross=0 fi -echo "Building pcsx2 with ${flags[*]}" | tee $log +echo "Building pcsx2 with ${flags[*]}" | tee "$log" # Resolve the symlink otherwise cmake is lost # Besides, it allows 'mkdir' to create the real destination directory @@ -117,12 +117,12 @@ cd $build if [[ "$useClang" -eq 1 ]]; then if [[ "$useCross" -eq 0 ]]; then - CC=clang CXX=clang++ cmake "${flags[@]}" $root 2>&1 | tee -a $log + CC=clang CXX=clang++ cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log" else - CC="clang -m32" CXX="clang++ -m32" cmake "${flags[@]}" $root 2>&1 | tee -a $log + CC="clang -m32" CXX="clang++ -m32" cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log" fi else - cmake "${flags[@]}" $root 2>&1 | tee -a $log + cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log" fi if [[ $(uname -s) == 'Darwin' ]]; then @@ -149,11 +149,11 @@ if [[ "$cppcheck" -eq 1 ]] && [[ -x `which cppcheck` ]]; then do flat_d=`echo $d | sed -e 's@/@_@'` log=cpp_check__${flat_d}.log - rm -f $log + rm -f "$log" - cppcheck $check -j $ncpu --platform=unix32 $define $root/$d |& tee $log + cppcheck $check -j $ncpu --platform=unix32 $define "$root/$d" |& tee "$log" # Create a small summary (warning it might miss some issues) - fgrep -e "(warning)" -e "(error)" -e "(style)" -e "(performance)" -e "(portability)" $log >> $summary + fgrep -e "(warning)" -e "(error)" -e "(style)" -e "(performance)" -e "(portability)" "$log" >> $summary done exit 0 fi @@ -187,7 +187,7 @@ fi # Coverity build ############################################################ if [[ "$CoverityBuild" -eq 1 ]] && [[ -x `which cov-build` ]]; then - cov-build --dir $coverity_dir make -j"$ncpu" 2>&1 | tee -a $log + cov-build --dir $coverity_dir make -j"$ncpu" 2>&1 | tee -a "$log" # Warning: $coverity_dir must be the root directory (cd $build; tar caf $coverity_result $coverity_dir) exit 0 @@ -196,7 +196,7 @@ fi ############################################################ # Real build ############################################################ -make -j"$ncpu" 2>&1 | tee -a $log -make install 2>&1 | tee -a $log +make -j"$ncpu" 2>&1 | tee -a "$log" +make install 2>&1 | tee -a "$log" exit 0 From 9f87fb16a244e13f767015fc35acf23a4734ed4c Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Thu, 17 Dec 2015 19:45:23 -0500 Subject: [PATCH 2/3] Quote all uses of the build directory --- build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index d1b0b3d3d3..3d875f7c6b 100755 --- a/build.sh +++ b/build.sh @@ -93,7 +93,7 @@ coverity_result=pcsx2-coverity.xz if [[ "$cleanBuild" -eq 1 ]]; then echo "Doing a clean build." # allow to keep build as a symlink (for example to a ramdisk) - rm -fr $build/* + rm -fr "$build"/* fi if [[ "$useCross" -eq 2 ]] && [[ "$(getconf LONG_BIT 2> /dev/null)" != 32 ]]; then @@ -107,13 +107,13 @@ echo "Building pcsx2 with ${flags[*]}" | tee "$log" # Resolve the symlink otherwise cmake is lost # Besides, it allows 'mkdir' to create the real destination directory -if [[ -L $build ]]; then - build=`readlink $build` +if [[ -L "$build" ]]; then + build=`readlink "$build"` fi -mkdir -p $build +mkdir -p "$build" # Cmake will generate file inside $CWD. It would be nicer if an option to cmake can be provided. -cd $build +cd "$build" if [[ "$useClang" -eq 1 ]]; then if [[ "$useCross" -eq 0 ]]; then @@ -189,7 +189,7 @@ fi if [[ "$CoverityBuild" -eq 1 ]] && [[ -x `which cov-build` ]]; then cov-build --dir $coverity_dir make -j"$ncpu" 2>&1 | tee -a "$log" # Warning: $coverity_dir must be the root directory - (cd $build; tar caf $coverity_result $coverity_dir) + (cd "$build"; tar caf $coverity_result $coverity_dir) exit 0 fi From 6698c5760bccfe338f712853347c4912e57076cc Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Thu, 17 Dec 2015 19:47:48 -0500 Subject: [PATCH 3/3] Quote all uses of coverity_dir --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 3d875f7c6b..a7b9a34a6d 100755 --- a/build.sh +++ b/build.sh @@ -87,7 +87,7 @@ done root=$PWD/$(dirname "$0") log="$root/install_log.txt" build="$root/build" -coverity_dir=cov-int +coverity_dir="`cov-int`" coverity_result=pcsx2-coverity.xz if [[ "$cleanBuild" -eq 1 ]]; then @@ -187,9 +187,9 @@ fi # Coverity build ############################################################ if [[ "$CoverityBuild" -eq 1 ]] && [[ -x `which cov-build` ]]; then - cov-build --dir $coverity_dir make -j"$ncpu" 2>&1 | tee -a "$log" + cov-build --dir "$coverity_dir" make -j"$ncpu" 2>&1 | tee -a "$log" # Warning: $coverity_dir must be the root directory - (cd "$build"; tar caf $coverity_result $coverity_dir) + (cd "$build"; tar caf $coverity_result "$coverity_dir") exit 0 fi