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