diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-10-28 02:29:06 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2022-10-28 02:29:06 +0300 |
commit | f4961c0c7baeb801681a03aa80b339ca05feb513 (patch) | |
tree | 720cc393a5ad7d0b371a8301128ff3c51806f80c | |
parent | eb738e7e186034ee9c3a913b66044e9680eedd2a (diff) |
update build scripts
-rw-r--r-- | build/cvextern.ps1 | 2 | ||||
-rw-r--r-- | build/libcvextern.sh | 33 |
2 files changed, 16 insertions, 19 deletions
diff --git a/build/cvextern.ps1 b/build/cvextern.ps1 index d574b75..3f9a807 100644 --- a/build/cvextern.ps1 +++ b/build/cvextern.ps1 @@ -7,7 +7,7 @@ ## Visual Studio with development tools and sdk # Script working directory -Set-Location $PSScriptRoot +#Set-Location $PSScriptRoot $libFolder = 'emgucv' $buildFile = "platforms\windows\Build_Binary_x86.bat" diff --git a/build/libcvextern.sh b/build/libcvextern.sh index 5d092ae..4029c38 100644 --- a/build/libcvextern.sh +++ b/build/libcvextern.sh @@ -14,6 +14,8 @@ arch_name="$(uname -m)" osVariant="" build_package="mini" # mini, core, full +testcmd() { command -v "$1" &> /dev/null; } + if [ "$arch_name" != "x86_64" -a "$arch_name" != "arm64" ]; then echo "Error: Unsupported host arch: $arch_name" exit -1 @@ -45,20 +47,17 @@ echo "- Detecting OS" [ "$installDependencies" == true ] && echo "- Installing all the dependencies" if [ "${OSTYPE:0:6}" == "darwin" ]; then osVariant="macOS" - if [ installDependencies == true ]; then - if [ -z "$(command -v brew)" ]; then - bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - if [ -f "/opt/homebrew/bin/brew" -a -z "$(command -v brew)" ]; then - echo '# Set PATH, MANPATH, etc., for Homebrew.' >> "$HOME/.zprofile" - echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile" - eval "$(/opt/homebrew/bin/brew shellenv)" - fi + if ! testcmd brew; then + bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + if [ -f "/opt/homebrew/bin/brew" -a -z "$(command -v brew)" ]; then + echo '# Set PATH, MANPATH, etc., for Homebrew.' >> "$HOME/.zprofile" + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> "$HOME/.zprofile" + eval "$(/opt/homebrew/bin/brew shellenv)" fi - [ -z "$(command -v git)" -o -z "$(command -v cmake)" ] && brew install git cmake - [ -z "$(command -v dotnet)" ] && brew install --cask dotnet-sdk fi -elif command -v apt-get &> /dev/null -then + [ -z "$(command -v git)" -o -z "$(command -v cmake)" ] && brew install git cmake + [ -z "$(command -v dotnet)" ] && brew install --cask dotnet-sdk +elif testcmd apt-get; then osVariant="debian" if [ -z "$(ldconfig -p | grep libpng)" -o -z "$(ldconfig -p | grep libgdiplus)" -o -z "$(ldconfig -p | grep libavcodec)" -o -z "$(command -v git)" -o -z "$(command -v cmake)" -o "$installDependencies" == true ]; then sudo apt-get update @@ -67,15 +66,13 @@ then sudo apt-get update sudo apt-get install -y dotnet-sdk-6.0 fi -elif command -v pacman &> /dev/null -then +elif testcmd pacman; then osVariant="arch" if [ -z "$(ldconfig -p | grep libpng)" -o -z "$(ldconfig -p | grep libgdiplus)" -o -z "$(ldconfig -p | grep libavcodec)" -o -z "$(command -v git)" -o -z "$(command -v cmake)" -o "$installDependencies" == true ]; then sudo pacman -Syu sudo pacman -S git base-devel cmake msbuild gtk3 gstreamer ffmpeg libdc1394 v4l-utils ocl-icd freeglut libgeotiff libusb dotnet-sdk fi -elif command -v yum &> /dev/null -then +elif testcmd yum; then osVariant="rhel" if [ -z "$(ldconfig -p | grep libpng)" -o -z "$(ldconfig -p | grep libgdiplus)" -o -z "$(ldconfig -p | grep libavcodec)" -o -z "$(command -v git)" -o -z "$(command -v cmake)" -o "$installDependencies" == true ]; then sudo yum update -y @@ -85,12 +82,12 @@ then fi echo "- Checks" -if [ -z "$(command -v git)" ]; then +if ! testcmd git; then echo "Error: git not installed. Please re-run this script with -i flag." exit -1 fi -if [ -z "$(command -v cmake)" ]; then +if ! testcmd cmake; then echo "Error: cmake not installed. Please re-run this script with -i flag." exit -1 fi |