From 000034a74bd306535c4c4ca715587c08142c6b55 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 12 Jun 2026 17:53:48 +0800
Subject: [PATCH] Add top build shell script

---
 opencv/build.sh |  180 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 90 insertions(+), 90 deletions(-)

diff --git a/opencv/build.sh b/opencv/build.sh
index 7710594..183963d 100755
--- a/opencv/build.sh
+++ b/opencv/build.sh
@@ -30,7 +30,7 @@
 INC_PATH=$PREFIX_PATH/include
 
 # check installed or not file
-INST_FILE=$PREFIX_PATH/lib/opencv
+INST_FILE=$PREFIX_PATH/lib/libopencv_core.so
 
 # shell script will exit once get command error
 set -e
@@ -40,158 +40,158 @@
 #+-------------------------+
 
 function pr_error() {
-	echo -e "\033[40;31m $1 \033[0m"
+    echo -e "\033[40;31m $1 \033[0m"
 }
 
 function pr_warn() {
-	echo -e "\033[40;33m $1 \033[0m"
+    echo -e "\033[40;33m $1 \033[0m"
 }
 
 function pr_info() {
-	echo -e "\033[40;32m $1 \033[0m"
+    echo -e "\033[40;32m $1 \033[0m"
 }
 
 function check_result()
 {
-	if [ $? != 0 ] ; then
-		pr_error $1
-	fi
+    if [ $? != 0 ] ; then
+        pr_error $1
+    fi
 }
+
 # decompress a packet to destination path
 function do_unpack()
 {
-	tarball=$1
-	dstpath=`pwd`
+    tarball=$1
+    dstpath=`pwd`
 
-	if [[ $# == 2 ]] ; then
-		dstpath=$2
-	fi
+    if [[ $# == 2 ]] ; then
+        dstpath=$2
+    fi
 
-	pr_info "decompress $tarball => $dstpath"
+    pr_info "decompress $tarball => $dstpath"
 
-	mkdir -p $dstpath
-	case $tarball in
-		*.tar.gz)
-			tar -xzf $tarball -C $dstpath
-			;;
+    mkdir -p $dstpath
+    case $tarball in
+        *.tar.gz)
+            tar -xzf $tarball -C $dstpath
+            ;;
 
-		*.tar.bz2)
-			tar -xjf $tarball -C $dstpath
-			;;
+        *.tar.bz2)
+            tar -xjf $tarball -C $dstpath
+            ;;
 
-		*.tar.xz)
-			tar -xJf $tarball -C $dstpath
-			;;
+        *.tar.xz)
+            tar -xJf $tarball -C $dstpath
+            ;;
 
-		*.tar.zst)
-			tar -I zstd -xf $tarball -C $dstpath
-			;;
+        *.tar.zst)
+            tar -I zstd -xf $tarball -C $dstpath
+            ;;
 
-		*.tar)
-			tar -xf $tarball -C $dstpath
-			;;
+        *.tar)
+            tar -xf $tarball -C $dstpath
+            ;;
 
-		*.zip)
-			unzip -qo $tarball -d $dstpath
-			;;
+        *.zip)
+            unzip -qo $tarball -d $dstpath
+            ;;
 
-		*)
-			pr_error "decompress Unsupport packet: $tarball"
-			return 1;
-			;;
-	esac
+        *)
+            pr_error "decompress Unsupport packet: $tarball"
+            return 1;
+            ;;
+    esac
 }
 
 function do_export()
 {
-	BUILD_ARCH=$(uname -m)
-	if [[ $BUILD_ARCH =~ "arm" ]] ; then
-		pr_error "ERROR: local($BUILD_ARCH) compile $LIB_NAME not support for it's too slow"
-		exit 0;
-	fi
+    BUILD_ARCH=$(uname -m)
+    if [[ $BUILD_ARCH =~ "arm" ]] ; then
+        pr_error "ERROR: local($BUILD_ARCH) compile $LIB_NAME not support for it's too slow"
+        exit 0;
+    fi
 
-	pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
+    pr_warn "cross(${CROSS_COMPILE}) compile $LIB_NAME"
 
-	# export cross toolchain
-	export CC=${CROSS_COMPILE}gcc
-	export CXX=${CROSS_COMPILE}g++
-	export AS=${CROSS_COMPILE}as
-	export AR=${CROSS_COMPILE}ar
-	export LD=${CROSS_COMPILE}ld
-	export NM=${CROSS_COMPILE}nm
-	export RANLIB=${CROSS_COMPILE}ranlib
-	export OBJDUMP=${CROSS_COMPILE}objdump
-	export STRIP=${CROSS_COMPILE}strip
+    # export cross toolchain
+    export CC=${CROSS_COMPILE}gcc
+    export CXX=${CROSS_COMPILE}g++
+    export AS=${CROSS_COMPILE}as
+    export AR=${CROSS_COMPILE}ar
+    export LD=${CROSS_COMPILE}ld
+    export NM=${CROSS_COMPILE}nm
+    export RANLIB=${CROSS_COMPILE}ranlib
+    export OBJDUMP=${CROSS_COMPILE}objdump
+    export STRIP=${CROSS_COMPILE}strip
 
-	# export cross configure
-	export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
+    # export cross configure
+    export CONFIG_CROSS=" --build=i686-pc-linux --host=arm-linux "
 
-	# Clear LDFLAGS and CFLAGS
-	export LDFLAGS=
-	export CFLAGS=
+    # Clear LDFLAGS and CFLAGS
+    export LDFLAGS=
+    export CFLAGS=
 }
 
 function do_fetch()
 {
-	if [ -e ${INST_FILE} ] ; then
-		pr_warn "$LIB_NAME compile and installed alredy"
-		exit ;
-	fi
+    if [ -e ${INST_FILE} ] ; then
+        pr_warn "$LIB_NAME compile and installed alredy"
+        exit ;
+    fi
 
-	if [ -d $LIB_NAME ] ; then
-		pr_warn "$LIB_NAME fetch already"
-		return ;
-	fi
+    if [ -d $LIB_NAME ] ; then
+        pr_warn "$LIB_NAME fetch already"
+        return ;
+    fi
 
-	if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
-		wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
-		check_result "ERROR: download ${LIB_NAME} failure"
-	fi
+    if [ ! -f ${LIB_NAME}.${PACK_SUFIX} ] ; then
+        wget ${LIB_URL}/${LIB_NAME}.${PACK_SUFIX}
+        check_result "ERROR: download ${LIB_NAME} failure"
+    fi
 
-	do_unpack ${LIB_NAME}.${PACK_SUFIX}
+    do_unpack ${LIB_NAME}.${PACK_SUFIX}
 }
 
 function do_build()
 {
-	cd $LIB_NAME
+    cd $LIB_NAME
 
-	do_export
+    do_export
 
-	TOOLCHAIN=armlinux.toolchain.cmake
-	rm -f platforms/linux/${TOOLCHAIN}
+    TOOLCHAIN=armlinux.toolchain.cmake
+    rm -f platforms/linux/${TOOLCHAIN}
 
-	cat >platforms/linux/${TOOLCHAIN} <<EOF
+    cat >platforms/linux/${TOOLCHAIN} <<EOF
 set(GCC_COMPILER_VERSION "" CACHE STRING "GCC Compiler version")
 set(GNU_MACHINE "${CROSS_COMPILE%*-}" CACHE STRING "GNU compiler triple")
 include("\${CMAKE_CURRENT_LIST_DIR}/arm.toolchain.cmake")
 
 EOF
 
-	mkdir -p build && cd build
+    mkdir -p build && cd build
 
-	cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_PATH \
-		-DCMAKE_TOOLCHAIN_FILE="../platforms/linux/${TOOLCHAIN}" -DSOFTFP=ON -DENABLE_PROFILING=OFF \
-		-DWITH_OPENCL=OFF -DWITH_TBB=ON  -DWITH_V4L=ON -DHAVE_CAMV4L2=ON -DBUILD_TESTS=OFF \
-		-DINSTALL_PYTHON_EXAMPLES=OFF -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF -DHAVE_FFMPEG=OFF \
-		-DBUILD_opencv_js=OFF ../
+    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX_PATH \
+        -DCMAKE_TOOLCHAIN_FILE="../platforms/linux/${TOOLCHAIN}" -DSOFTFP=ON -DENABLE_PROFILING=OFF \
+        -DWITH_OPENCL=OFF -DWITH_TBB=ON  -DWITH_V4L=ON -DHAVE_CAMV4L2=ON -DBUILD_TESTS=OFF \
+        -DINSTALL_PYTHON_EXAMPLES=OFF -DBUILD_EXAMPLES=OFF -DWITH_FFMPEG=OFF -DHAVE_FFMPEG=OFF \
+        -DBUILD_opencv_js=OFF ../
 
-	make -j ${JOBS} && make install
-	check_result "ERROR: compile ${LIB_NAME} failure"
+    make -j ${JOBS} && make install
+    check_result "ERROR: compile ${LIB_NAME} failure"
 }
 
 function do_clean()
 {
-	rm -rf *${LIB_NAME}*
+    rm -rf *${LIB_NAME}*
 }
 
 if [[ $# == 1 && $1 == -c ]] ;then
-	pr_warn "start clean ${LIB_NAME}"
-	do_clean
-	exit;
+    pr_warn "start clean ${LIB_NAME}"
+    do_clean
+    exit;
 fi
 
 do_fetch
 
-
 do_build
 

--
Gitblit v1.10.0