diff --git a/Scripts/install-dependencies.sh b/Scripts/install-dependencies.sh index d8d4f13..e72ab05 100644 --- a/Scripts/install-dependencies.sh +++ b/Scripts/install-dependencies.sh @@ -47,10 +47,9 @@ then yum install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm yum install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm yum install -y libjpeg-devel libjpeg-turbo-devel libpng-devel libgeotiff-devel libdc1394-devel ffmpeg-devel tbb-devel mesa-libGL libgdiplus wget +else + echo "Error: Base operative system / package manager not identified, nothing was installed" + exit -1 fi -if [ "$osVariant" == "" ]; then - echo "Error: Base operative system / package manager not identified, nothing was installed" -else - echo "Completed: You can now run UVtools" -fi +echo "Completed: You can now run UVtools" diff --git a/Scripts/install-uvtools.sh b/Scripts/install-uvtools.sh index 5bc30ee..e1b38c3 100644 --- a/Scripts/install-uvtools.sh +++ b/Scripts/install-uvtools.sh @@ -5,6 +5,7 @@ # Then run this script # usage 1: ./install-uvtools.sh # + cd "$(dirname "$0")" arch_name="$(uname -m)" # x86_64 or arm64 osVariant="" # osx, linux, arch, rhel @@ -34,7 +35,7 @@ if [ "${OSTYPE:0:6}" == "darwin" ]; then echo "Error: Unable to install, UVtools requires at least macOS $macOS_least_version." exit -1 fi - + 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 @@ -56,15 +57,22 @@ if [ "${OSTYPE:0:6}" == "darwin" ]; then # arm64: Create script on user desktop to run UVtools if [ "$arch_name" == "arm64" ]; then run_script="$HOME/Desktop/run-uvtools.sh" - echo "#!/bin/bash -bash '$appPath/Contents/MacOS/UVtools.sh' &" > "$run_script" + echo '#!/bin/bash +if [ -f "$appPath/Contents/MacOS/UVtools.sh" ]; then + bash "$appPath/Contents/MacOS/UVtools.sh" & +elif [ -f "UVtools.app/Contents/MacOS/UVtools.sh" ]; then + bash "UVtools.app/Contents/MacOS/UVtools.sh" & +else + echo "Error: UVtools.app not found on known paths" +fi +' > "$run_script" chmod a+x "$run_script" echo "Note: Always run 'bash run-uvtools.sh' from desktop to run UVtools on your mac arm64!" fi if [ -f "$appPath/Contents/MacOS/UVtools.sh" ]; then bash "$appPath/Contents/MacOS/UVtools.sh" & - else + elif [ -d "$appPath" ]; then open "$appPath" fi fi @@ -72,19 +80,19 @@ bash '$appPath/Contents/MacOS/UVtools.sh' &" > "$run_script" exit 1 elif command -v apt-get &> /dev/null then - osVariant="linux" + osVariant="linux" [ -z "$(command -v wget)" ] && sudo apt-get install -y wget - [ -z "$(command -v curl)" ] && sudo apt-get install -y curl + [ -z "$(command -v curl)" ] && sudo apt-get install -y curl elif command -v pacman &> /dev/null then - osVariant="arch" - [ -z "$(command -v wget)" ] && sudo pacman -S wget - [ -z "$(command -v curl)" ] && sudo pacman -S curl + osVariant="arch" + [ -z "$(command -v wget)" ] && sudo pacman -S wget + [ -z "$(command -v curl)" ] && sudo pacman -S curl elif command -v yum &> /dev/null then - osVariant="rhel" - [ -z "$(command -v wget)" ] && sudo yum install -y wget - [ -z "$(command -v curl)" ] && sudo yum install -y curl + osVariant="rhel" + [ -z "$(command -v wget)" ] && sudo yum install -y wget + [ -z "$(command -v curl)" ] && sudo yum install -y curl fi if [ -z "$osVariant" ]; then @@ -95,7 +103,7 @@ fi echo "- Detected: $osVariant $arch_name" if [ -z "$(ldconfig -p | grep libpng)" -o -z "$(ldconfig -p | grep libgdiplus)" -o -z "$(ldconfig -p | grep libavcodec)" ]; then - echo "- Missing dependencies found, installing..." + echo "- Missing dependencies found, installing..." sudo bash -c "$(curl -fsSL $dependencies_url)" fi @@ -128,10 +136,10 @@ if [ -d "$HOME/Applications" ]; then rm -f "$HOME/Applications/UVtools_*.AppImage" echo "- Moving $filename to $HOME/Applications" - mv -f "$tmpfile" "$HOME/Applications" + mv -f "$tmpfile" "$HOME/Applications" - "$HOME/Applications/$filename" & - echo "If prompt for 'Desktop integration', click 'Integrate and run'" + "$HOME/Applications/$filename" & + echo "If prompt for 'Desktop integration', click 'Integrate and run'" else echo "- Removing old versions" rm -f UVtools_*.AppImage diff --git a/build/libcvextern.sh b/build/libcvextern.sh index 5b4ee65..0c0dbac 100644 --- a/build/libcvextern.sh +++ b/build/libcvextern.sh @@ -12,8 +12,9 @@ cd "$(dirname "$0")" directory="emgucv" arch_name="$(uname -m)" osVariant="" +$build_package="mini" # mini, micro, full -if [[ "$arch_name" != "x86_64" && "$arch_name" != "arm64" ]]; then +if [ "$arch_name" != "x86_64" -a "$arch_name" != "arm64" ]; then echo "Error: Unsupported host arch: $arch_name" exit -1 fi @@ -42,12 +43,19 @@ echo "Script to build libcvextern.so|dylib on $(uname -a) $arch_name" echo "- Detecting OS" [ "$installDependencies" == true ] && echo "- Installing all the dependencies" -if [[ $OSTYPE == 'darwin'* ]]; then +if [ "${OSTYPE:0:6}" == "darwin" ]; then osVariant="macOS" if [ installDependencies == true ]; then - [[ ! "$(command -v brew)" ]] && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - brew install git cmake - brew install --cask dotnet + 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 + 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 @@ -77,12 +85,16 @@ then fi echo "- Checks" -if ! command -v git &> /dev/null -then +if [ -z "$(command -v git)" ]; then echo "Error: git not installed. Please re-run this script with -i flag." exit -1 fi +if [ -z "$(command -v cmake)" ]; then + echo "Error: cmake not installed. Please re-run this script with -i flag." + exit -1 +fi + if [ -z "$osVariant" ]; then echo "Error: Unable to detect your Operative System." exit -1 @@ -102,15 +114,15 @@ cd "$directory" echo "- Bulding" if [ osVariant == "macOS" ]; then - cd platforms/macos + cd "platforms/macos" if [ "${arch_name}" = "x86_64" ]; then - ./configure x86_64 mini + ./configure x86_64 $build_package elif [ "${arch_name}" = "arm64" ]; then - ./configure arm64 mini + ./configure arm64 $build_package fi else - cd platforms/ubuntu/22.04 - ./cmake_configure mini + cd "platforms/ubuntu/22.04" + ./cmake_configure $build_package fi echo "Completed - Check for errors but also for libcvextern presence on $directory/libs"