Linux shell scripts refactored
Unified · Split
| @@ -1,19 +1,20 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | |
| 3 | −usage="this file must located in ../testbin/ based on our code structure " | |
| 4 | −echo $usage | |
| 3 | +CurDir="${PWD}" | |
| 5 | 4 | |
| 6 | −CurDir=`pwd` | |
| 7 | −EncoderMakeDir="../codec/build/linux/enc/" | |
| 8 | −DecoderMakeDir="../codec/build/linux/dec/" | |
| 9 | −VPMakeDir="../processing/build/linux/" | |
| 5 | +if [ "$(basename ${CurDir})" != "testbin" ]; then | |
| 6 | + usage="This file must located in ../testbin/ based on our code structure" | |
| 7 | + echo ${usage} | |
| 8 | + exit 1 | |
| 9 | +fi | |
| 10 | + | |
| 11 | +EncoderMakeDir="../codec/build/linux/enc" | |
| 12 | +DecoderMakeDir="../codec/build/linux/dec" | |
| 13 | +VPMakeDir="../processing/build/linux" | |
| 10 | 14 | |
| 11 | −CodecBinDir="../codec/build/linux/bin/" | |
| 15 | +CodecBinDir="../codec/build/linux/bin" | |
| 12 | 16 | VPBinDir="../bin/linux" |
| 13 | 17 | |
| 14 | −let "EncoderBuildFlag=1" | |
| 15 | −let "DecoderBuildFlag=1" | |
| 16 | −let "VPBuildFlag=1" | |
| 17 | 18 | MakefileLogFile="${CurDir}/CodecVPBuild.log" |
| 18 | 19 | |
| 19 | 20 | #************************************************ |
| @@ -25,26 +26,10 @@ make >>${MakefileLogFile} · 5 unmodified lines | ||
| 25 | 26 | |
| 26 | 27 | cd ${CurDir} |
| 27 | 28 | cd ${CodecBinDir} |
| 28 | −if [ ! -e welsenc.a ] | |
| 29 | −then | |
| 30 | − let "EncoderBuildFlag=0" | |
| 31 | −fi | |
| 32 | − | |
| 33 | −if [ ! -e welsenc.so ] | |
| 34 | −then | |
| 35 | − let "EncoderBuildFlag=0" | |
| 36 | −fi | |
| 37 | − | |
| 38 | −if [ ! -e welsenc.exe ] | |
| 39 | −then | |
| 40 | − let "EncoderBuildFlag=0" | |
| 41 | −fi | |
| 42 | − | |
| 43 | −if [ "$EncoderBuildFlag" -eq 1 ] | |
| 44 | −then | |
| 45 | − echo "encoder build success!" | |
| 29 | +if [[ ! -e welsenc.a ]] || [[ ! -e welsenc.so ]] || [[ ! -e welsenc.exe ]]; then | |
| 30 | + echo "encoder build failed!" | |
| 46 | 31 | else |
| 47 | − echo "encoder build failed!" | |
| 32 | + echo "encoder build success!" | |
| 48 | 33 | fi |
| 49 | 34 | |
| 50 | 35 | #************************************************ |
| @@ -57,26 +42,10 @@ make >>${MakefileLogFile} · 6 unmodified lines | ||
| 57 | 42 | |
| 58 | 43 | cd ${CurDir} |
| 59 | 44 | cd ${CodecBinDir} |
| 60 | −if [ ! -e welsdec.a ] | |
| 61 | −then | |
| 62 | − let "DecoderBuildFlag=0" | |
| 63 | −fi | |
| 64 | − | |
| 65 | −if [ ! -e welsdec.so ] | |
| 66 | −then | |
| 67 | − let "DecoderBuildFlag=0" | |
| 68 | −fi | |
| 69 | − | |
| 70 | −if [ ! -e welsdec.exe ] | |
| 71 | −then | |
| 72 | − let "DecoderBuildFlag=0" | |
| 73 | −fi | |
| 74 | − | |
| 75 | −if [ "$DecoderBuildFlag" -eq 1 ] | |
| 76 | −then | |
| 77 | − echo "decoder build success!" | |
| 45 | +if [[ ! -e welsdec.a ]] || [[ ! -e welsdec.so ]] || [[ ! -e welsdec.exe ]]; then | |
| 46 | + echo "decoder build failed!" | |
| 78 | 47 | else |
| 79 | − echo "decoder build failed!" | |
| 48 | + echo "decoder build success!" | |
| 80 | 49 | fi |
| 81 | 50 | |
| 82 | 51 | #************************************************ |
| @@ -89,40 +58,12 @@ make >>${MakefileLogFile} · 6 unmodified lines | ||
| 89 | 58 | |
| 90 | 59 | cd ${CurDir} |
| 91 | 60 | cd ${VPBinDir} |
| 92 | −if [ ! -e libwelsvp.so ] | |
| 93 | −then | |
| 94 | − let "VPBuildFlag=0" | |
| 95 | −fi | |
| 96 | − | |
| 97 | −if [ "$VPBuildFlag" -eq 1 ] | |
| 98 | −then | |
| 99 | − echo "VP build success!" | |
| 61 | +if [ ! -e libwelsvp.so ]; then | |
| 62 | + echo "VP build failed!" | |
| 100 | 63 | else |
| 101 | − echo "VP build failed!" | |
| 64 | + echo "VP build success!" | |
| 102 | 65 | fi |
| 103 | 66 | |
| 104 | − | |
| 105 | −#**************************** | |
| 106 | 67 | cd ${CurDir} |
| 107 | −rm -f *.a *.exe *.so | |
| 108 | − | |
| 109 | −for file in ${CodecBinDir}/* | |
| 110 | −do | |
| 111 | − cp ${file} ./ | |
| 112 | − echo "file ${file} under ../openh264/bin/" | |
| 113 | −done | |
| 114 | − | |
| 115 | −for file in ${VPBinDir}/* | |
| 116 | −do | |
| 117 | − cp ${file} ./ | |
| 118 | − echo "file ${file} under ../openh264/bin/" | |
| 119 | −done | |
| 120 | − | |
| 121 | − | |
| 122 | − | |
| 123 | − | |
| 124 | − | |
| 125 | − | |
| 126 | − | |
| 127 | − | |
| 128 | − | |
| 68 | +echo "executables available in ../bin/linux" | |
| 69 | +echo "log file stored in ./CodecVPBuild.log" | |
| @@ -1,53 +1,41 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | |
| 3 | −usage="this file must located in ../testbin/ based on our code structure " | |
| 4 | −echo $usage | |
| 3 | +CurDir="${PWD}" | |
| 5 | 4 | |
| 6 | −CurDir=`pwd` | |
| 7 | −EncoderMakeDir="../codec/build/linux/enc/" | |
| 8 | −DecoderMakeDir="../codec/build/linux/dec/" | |
| 9 | −VPMakeDir="../processing/build/linux/" | |
| 5 | +if [ "$(basename ${CurDir})" != "testbin" ]; then | |
| 6 | + usage="This file must located in ../testbin/ based on our code structure" | |
| 7 | + echo ${usage} | |
| 8 | + exit 1 | |
| 9 | +fi | |
| 10 | 10 | |
| 11 | −CodecBinDir="../codec/build/linux/bin/" | |
| 11 | +EncoderMakeDir="../codec/build/linux/enc" | |
| 12 | +DecoderMakeDir="../codec/build/linux/dec" | |
| 13 | +VPMakeDir="../processing/build/linux" | |
| 14 | + | |
| 15 | +CodecBinDir="../codec/build/linux/bin" | |
| 12 | 16 | VPBinDir="../bin/linux" |
| 13 | 17 | |
| 14 | −let "EncoderBuildFlag=1" | |
| 15 | −let "DecoderBuildFlag=1" | |
| 16 | −let "VPBuildFlag=1" | |
| 17 | 18 | MakefileLogFile="${CurDir}/CodecVPBuild.log" |
| 18 | 19 | |
| 19 | 20 | #************************************************ |
| 20 | 21 | #call Encoder make file |
| 21 | −echo "encoder cleanning....." | |
| 22 | +echo "encoder cleaning....." | |
| 22 | 23 | cd ${EncoderMakeDir} |
| 23 | −make clean >${MakefileLogFile} | |
| 24 | −#make >>${MakefileLogFile} | |
| 25 | − | |
| 26 | − | |
| 24 | +make clean | |
| 27 | 25 | |
| 28 | 26 | #************************************************ |
| 29 | 27 | #call Decoder make file |
| 30 | −echo "decoder cleanning....." | |
| 28 | +echo "decoder cleaning....." | |
| 31 | 29 | cd ${CurDir} |
| 32 | 30 | cd ${DecoderMakeDir} |
| 33 | −make clean >>${MakefileLogFile} | |
| 34 | −#make >>${MakefileLogFile} | |
| 35 | − | |
| 36 | − | |
| 31 | +make clean | |
| 37 | 32 | |
| 38 | 33 | #************************************************ |
| 39 | 34 | #call VP make file |
| 40 | −echo "VP cleanning....." | |
| 35 | +echo "VP cleaning....." | |
| 41 | 36 | cd ${CurDir} |
| 42 | 37 | cd ${VPMakeDir} |
| 43 | −make clean >>${MakefileLogFile} | |
| 44 | −#make >>${MakefileLogFile} | |
| 38 | +make clean | |
| 45 | 39 | |
| 46 | 40 | cd ${CurDir} |
| 47 | − | |
| 48 | −rm -f *.exe *.so *.a *.log | |
| 49 | −rm -fr ../bin # remove the bin directory | |
| 50 | − | |
| 51 | − | |
| 52 | − | |
| 53 | − | |
| 41 | +rm -f *.exe *.so *.a *.log ../bin | |