-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update preparation.sh to support specify the zbar_home and work dir
Signed-off-by: wqh17101 <597935261@qq.com>
- Loading branch information
Showing
1 changed file
with
71 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,83 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
mkdir -p src/zbar/ | ||
if [[ $1 = "--help" ]] || [[ $1 = "-h" ]] | ||
then | ||
echo "this is a script to prepare for zbar_lite build" | ||
help="Usage: $0 [ZBAR_SOURCE_HOME] [WORKDIR] | ||
-h, --help print this help, then exit | ||
ZBAR_SOURCE_HOME the zbar source code home dir which should contain dir zbar and include | ||
WORKDIR the work dir,default is the dir which this script in | ||
" | ||
echo "${help}" | ||
exit 0 | ||
fi | ||
|
||
DEFAULT_WORKDIR=$(dirname $(readlink -f "$0")) | ||
WORKDIR=${2:-$DEFAULT_WORKDIR} | ||
ZBAR_SOURCE_HOME=${1:-$WORKDIR} | ||
|
||
|
||
mkdir -p src/zbar/video | ||
cp ../zbar/video/null.c src/zbar/video/ | ||
echo " WORKDIR is $WORKDIR" | ||
echo " ZBAR_SOURCE_HOME is $ZBAR_SOURCE_HOME" | ||
|
||
cp -r ../zbar/decoder src/zbar/ | ||
cp -r ../zbar/qrcode src/zbar/ | ||
cp -r ../zbar/processor src/zbar/ | ||
cp -r ../zbar/window src/zbar/ | ||
echo "copy zbar source code" | ||
mkdir -p ${WORKDIR}/src/zbar | ||
|
||
cp ../python/*.c zbar/ | ||
cp ../python/*.h zbar/ | ||
mkdir -p ${WORKDIR}/src/zbar/video | ||
cp ${ZBAR_SOURCE_HOME}/zbar/video/null.c ${WORKDIR}/src/zbar/video/ | ||
|
||
cp ../include/zbar.h src/ | ||
cp -r ${ZBAR_SOURCE_HOME}/zbar/decoder ${WORKDIR}/src/zbar/ | ||
cp -r ${ZBAR_SOURCE_HOME}/zbar/qrcode ${WORKDIR}/src/zbar/ | ||
cp -r ${ZBAR_SOURCE_HOME}/zbar/processor ${WORKDIR}/src/zbar/ | ||
cp -r ${ZBAR_SOURCE_HOME}/zbar/window ${WORKDIR}/src/zbar/ | ||
|
||
|
||
if [ -f "../include/config.h" ] | ||
cp ${ZBAR_SOURCE_HOME}/include/zbar.h ${WORKDIR}/src/ | ||
|
||
|
||
if [ -f "${ZBAR_SOURCE_HOME}/include/config.h" ] | ||
then | ||
cp ../include/config.h src/ | ||
cp ${ZBAR_SOURCE_HOME}/include/config.h ${WORKDIR}/src/ | ||
fi | ||
|
||
cp ../zbar/config.c src/zbar/ | ||
cp ../zbar/convert.c src/zbar/ | ||
cp ../zbar/debug.h src/zbar/ | ||
cp ../zbar/decoder.c src/zbar/ | ||
cp ../zbar/decoder.h src/zbar/ | ||
cp ../zbar/error.c src/zbar/ | ||
cp ../zbar/error.h src/zbar/ | ||
cp ../zbar/event.h src/zbar/ | ||
cp ../zbar/image.c src/zbar/ | ||
cp ../zbar/image.h src/zbar/ | ||
cp ../zbar/img_scanner.c src/zbar/ | ||
cp ../zbar/img_scanner.h src/zbar/ | ||
cp ../zbar/mutex.h src/zbar/ | ||
cp ../zbar/qrcode.h src/zbar/ | ||
cp ../zbar/refcnt.c src/zbar/ | ||
cp ../zbar/refcnt.h src/zbar/ | ||
cp ../zbar/scanner.c src/zbar/ | ||
cp ../zbar/sqcode.c src/zbar/ | ||
cp ../zbar/sqcode.h src/zbar/ | ||
cp ../zbar/svg.h src/zbar/ | ||
cp ../zbar/symbol.c src/zbar/ | ||
cp ../zbar/symbol.h src/zbar/ | ||
cp ../zbar/thread.h src/zbar/ | ||
cp ../zbar/timer.h src/zbar/ | ||
cp ../zbar/video.c src/zbar/ | ||
cp ../zbar/video.h src/zbar/ | ||
cp ../zbar/window.h src/zbar/ | ||
cp ../zbar/window.c src/zbar/ | ||
cp ../zbar/processor.c src/zbar/ | ||
cp ../zbar/processor.h src/zbar/ | ||
|
||
|
||
sed -i 's/"ISO8859-1"/"UTF-8"/g' ./src/zbar/qrcode/qrdectxt.c | ||
sed -i 's/"BIG-5"/"UTF-8"/g' ./src/zbar/qrcode/qrdectxt.c | ||
sed -i 's/"SJIS"/"UTF-8"/g' ./src/zbar/qrcode/qrdectxt.c | ||
cp ${ZBAR_SOURCE_HOME}/zbar/config.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/convert.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/debug.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/decoder.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/decoder.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/error.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/error.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/event.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/image.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/image.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/img_scanner.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/img_scanner.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/mutex.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/qrcode.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/refcnt.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/refcnt.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/scanner.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/sqcode.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/sqcode.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/svg.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/symbol.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/symbol.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/thread.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/timer.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/video.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/video.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/window.h ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/window.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/processor.c ${WORKDIR}/src/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/zbar/processor.h ${WORKDIR}/src/zbar/ | ||
|
||
echo "copy zbar python module source code" | ||
mkdir -p ${WORKDIR}/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/python/*.c ${WORKDIR}/zbar/ | ||
cp ${ZBAR_SOURCE_HOME}/python/*.h ${WORKDIR}/zbar/ | ||
|
||
echo "set output encoding to UTF-8" | ||
sed -i 's/"ISO8859-1"/"UTF-8"/g' ${WORKDIR}/src/zbar/qrcode/qrdectxt.c | ||
sed -i 's/"BIG-5"/"UTF-8"/g' ${WORKDIR}/src/zbar/qrcode/qrdectxt.c | ||
sed -i 's/"SJIS"/"UTF-8"/g' ${WORKDIR}/src/zbar/qrcode/qrdectxt.c |