From 6e8819c740a8d66f4762801530e180acb56799f3 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sun, 10 Mar 2024 13:34:48 -0300 Subject: [PATCH 01/16] downloader in parallel --- scripts/dev/downloader.sh | 41 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index c2fe46c3d48..2f11618da56 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -13,24 +13,37 @@ EOF } downloader() { - if [ -z "$1" ] then printDownloaderHelp; fi - SILENTARGS=""; - if [ $# -ge 2 ]; then - SILENTARGS=$2 - fi - if [[ "${SILENTARGS}" == "-s" ]]; then - if command -v curl 2>/dev/null; then - curl -LO --retry 20 -O -s $@; - else - wget -q $@ 2> /dev/null; fi; + SILENTARGS=""; + if [ $# -ge 2 ]; then + SILENTARGS=$2 + fi + if [[ "${SILENTARGS}" == "-s" ]]; then + if command -v wget2 2>/dev/null; then + wget2 -q $@; + elif command -v curl 2>/dev/null; then + for PKG in $@; do + curl -LO --retry 20 -O -s $PKG; + done + else + for PKG in $@; do + wget -q $PKG@ 2> /dev/null; + done + fi; else - if command -v curl 2>/dev/null; then - curl -LO --retry 20 -O --progress-bar $@; - else - wget $@ 2> /dev/null; fi; + if command -v wget2 2>/dev/null; then + wget2 $@; + elif command -v curl 2>/dev/null; then + for PKG in $@; do + curl -LO --retry 20 -O --progress-bar $PKG; + done + else + for PKG in $@; do + wget $PKG 2> /dev/null; + done + fi; fi From 2391c4ff62f1f6d003b0492c7257ba4b82692062 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sun, 10 Mar 2024 13:36:15 -0300 Subject: [PATCH 02/16] Update download_libs.sh - parallel downloads --- scripts/dev/download_libs.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index 11c6ca8bdbc..5605cd3f551 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -33,15 +33,21 @@ if [[ ! -d "$SCRIPT_DIR" ]]; then SCRIPT_DIR="$PWD"; fi . "$SCRIPT_DIR/downloader.sh" download(){ + echo '-----' echo "Downloading $1" # downloader ci.openframeworks.cc/libs/$1 $SILENT_ARGS + + COMMAND=" " + REPO="nightly" if [[ $BLEEDING_EDGE = 1 ]] ; then - echo downloader https://github.com/openframeworks/apothecary/releases/download/bleeding/$1 $SILENT_ARGS - downloader https://github.com/openframeworks/apothecary/releases/download/bleeding/$1 $SILENT_ARGS - else - echo downloader https://github.com/openframeworks/apothecary/releases/download/nightly/$1 $SILENT_ARGS - downloader https://github.com/openframeworks/apothecary/releases/download/nightly/$1 $SILENT_ARGS + REPO="bleeding" fi + + for PKG in $1; do + COMMAND+="https://github.com/openframeworks/apothecary/releases/download/$REPO/$PKG " + done + echo $COMMAND; + downloader $COMMAND $SILENT_ARGS } # trap any script errors and exit @@ -223,9 +229,11 @@ else # Linux fi fi -for PKG in $PKGS; do - download $PKG -done +# for PKG in $PKGS; do +# download $PKG +# done +# echo $PKGS +download "${PKGS[@]}" cd ../../ mkdir -p libs From f3595f8541fcf13fce43f6eda1176306947ed4b6 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:20:44 -0300 Subject: [PATCH 03/16] up --- scripts/dev/downloader.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index 2f11618da56..dc15771c7cc 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -ev printDownloaderHelp(){ cat << EOF From b073b0ae354f5d804a1fdc796a39775badd75605 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:24:43 -0300 Subject: [PATCH 04/16] up --- scripts/dev/download_libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index 5605cd3f551..d153ef4f62b 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -ev VER=master PLATFORM="" ARCH="" From 7c94344ce08ee23f2b34ab84763f0ad7407f9033 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:26:38 -0300 Subject: [PATCH 05/16] up --- scripts/dev/download_libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index d153ef4f62b..347cb56b866 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -46,7 +46,7 @@ download(){ for PKG in $1; do COMMAND+="https://github.com/openframeworks/apothecary/releases/download/$REPO/$PKG " done - echo $COMMAND; + echo "COMMAND = $COMMAND" downloader $COMMAND $SILENT_ARGS } From f899f27c7eaebcb94ee602f0779e443fcdeab5f2 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:28:53 -0300 Subject: [PATCH 06/16] up --- scripts/dev/downloader.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index dc15771c7cc..bc7808fc48e 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -21,19 +21,19 @@ downloader() { if [ $# -ge 2 ]; then SILENTARGS=$2 fi - if [[ "${SILENTARGS}" == "-s" ]]; then - if command -v wget2 2>/dev/null; then - wget2 -q $@; - elif command -v curl 2>/dev/null; then - for PKG in $@; do - curl -LO --retry 20 -O -s $PKG; - done - else - for PKG in $@; do - wget -q $PKG@ 2> /dev/null; - done - fi; - else + # if [[ "${SILENTARGS}" == "-s" ]]; then + # if command -v wget2 2>/dev/null; then + # wget2 -q $@; + # elif command -v curl 2>/dev/null; then + # for PKG in $@; do + # curl -LO --retry 20 -O -s $PKG; + # done + # else + # for PKG in $@; do + # wget -q $PKG@ 2> /dev/null; + # done + # fi; + # else if command -v wget2 2>/dev/null; then wget2 $@; elif command -v curl 2>/dev/null; then @@ -45,7 +45,7 @@ downloader() { wget $PKG 2> /dev/null; done fi; - fi + # fi } From 570a44e71d90cf3e4c98978b6ebad472ae0ed3cb Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:42:44 -0300 Subject: [PATCH 07/16] up --- scripts/ci/msys2/install.sh | 0 scripts/dev/download_libs.sh | 3 +++ scripts/dev/downloader.sh | 6 ++++-- scripts/msys2/buildAllExamples.sh | 0 scripts/msys2/cleanAllExamples.sh | 0 scripts/msys2/compileOF.sh | 0 scripts/msys2/install_dependencies.sh | 0 7 files changed, 7 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/ci/msys2/install.sh mode change 100644 => 100755 scripts/msys2/buildAllExamples.sh mode change 100644 => 100755 scripts/msys2/cleanAllExamples.sh mode change 100644 => 100755 scripts/msys2/compileOF.sh mode change 100644 => 100755 scripts/msys2/install_dependencies.sh diff --git a/scripts/ci/msys2/install.sh b/scripts/ci/msys2/install.sh old mode 100644 new mode 100755 diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index 347cb56b866..f05dd917c3c 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -182,6 +182,7 @@ if [ "$PLATFORM" == "linux" ] && [ "$ARCH" == "64" ]; then fi fi +# if [ "$PLATFORM" == "osx" ]; then if [ "$PLATFORM" == "msys2" ]; then PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}.zip" elif [ "$ARCH" == "" ] && [ "$PLATFORM" == "vs" ]; then @@ -249,6 +250,8 @@ if [ $OVERWRITE -eq 1 ]; then done fi +echo "PKGS $PKGS" + for PKG in $PKGS; do echo "Uncompressing libraries ${PLATFORM}${ARCH} from $PKG" if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index bc7808fc48e..d3eb858eab7 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -36,9 +36,11 @@ downloader() { # else if command -v wget2 2>/dev/null; then wget2 $@; - elif command -v curl 2>/dev/null; then + elif + command -v curl 2>/dev/null; then for PKG in $@; do - curl -LO --retry 20 -O --progress-bar $PKG; + echo "curl -LO --progress-bar $PKG" + curl -L --retry 20 --progress-bar -O $PKG done else for PKG in $@; do diff --git a/scripts/msys2/buildAllExamples.sh b/scripts/msys2/buildAllExamples.sh old mode 100644 new mode 100755 diff --git a/scripts/msys2/cleanAllExamples.sh b/scripts/msys2/cleanAllExamples.sh old mode 100644 new mode 100755 diff --git a/scripts/msys2/compileOF.sh b/scripts/msys2/compileOF.sh old mode 100644 new mode 100755 diff --git a/scripts/msys2/install_dependencies.sh b/scripts/msys2/install_dependencies.sh old mode 100644 new mode 100755 From 837d034b7ad96e410583fcf76abc9dd4fc2fa54a Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:46:03 -0300 Subject: [PATCH 08/16] up --- scripts/dev/downloader.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index d3eb858eab7..c0be152487e 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -39,8 +39,10 @@ downloader() { elif command -v curl 2>/dev/null; then for PKG in $@; do - echo "curl -LO --progress-bar $PKG" - curl -L --retry 20 --progress-bar -O $PKG + if [[-z "$PKG"]]; then + echo "curl -LO --progress-bar $PKG" + curl -L --retry 20 --progress-bar -O $PKG + fi done else for PKG in $@; do From 8b7f24141188a6b98cfd7038dfe3da21c251977d Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:48:01 -0300 Subject: [PATCH 09/16] up --- scripts/dev/download_libs.sh | 2 +- scripts/dev/downloader.sh | 37 ++++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index f05dd917c3c..f372c068ce9 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -ev +set -e VER=master PLATFORM="" ARCH="" diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index c0be152487e..3fa187664e4 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ev +# set -ev printDownloaderHelp(){ cat << EOF @@ -21,32 +21,37 @@ downloader() { if [ $# -ge 2 ]; then SILENTARGS=$2 fi - # if [[ "${SILENTARGS}" == "-s" ]]; then - # if command -v wget2 2>/dev/null; then - # wget2 -q $@; - # elif command -v curl 2>/dev/null; then - # for PKG in $@; do - # curl -LO --retry 20 -O -s $PKG; - # done - # else - # for PKG in $@; do - # wget -q $PKG@ 2> /dev/null; - # done - # fi; - # else + if [[ "${SILENTARGS}" == "-s" ]]; then + if command -v wget2 2>/dev/null; then + wget2 -q $@; + elif command -v curl 2>/dev/null; then + for PKG in $@; do + if [[-z "$PKG"]]; then + curl -LO --retry 20 -s $PKG + fi + done + else + for PKG in $@; do + if [[-z "$PKG"]]; then + wget -q $PKG@ 2> /dev/null + fi + done + fi; + else if command -v wget2 2>/dev/null; then wget2 $@; elif command -v curl 2>/dev/null; then for PKG in $@; do if [[-z "$PKG"]]; then - echo "curl -LO --progress-bar $PKG" curl -L --retry 20 --progress-bar -O $PKG fi done else for PKG in $@; do - wget $PKG 2> /dev/null; + if [[-z "$PKG"]]; then + wget $PKG 2> /dev/null + fi done fi; # fi From e7cd0cb1c5ccc41368607d2242a2ed7d1a5538ff Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 19:52:44 -0300 Subject: [PATCH 10/16] correct downloader --- scripts/dev/download_libs.sh | 2 -- scripts/dev/downloader.sh | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index f372c068ce9..a4fabfcd929 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -182,7 +182,6 @@ if [ "$PLATFORM" == "linux" ] && [ "$ARCH" == "64" ]; then fi fi -# if [ "$PLATFORM" == "osx" ]; then if [ "$PLATFORM" == "msys2" ]; then PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}.zip" elif [ "$ARCH" == "" ] && [ "$PLATFORM" == "vs" ]; then @@ -250,7 +249,6 @@ if [ $OVERWRITE -eq 1 ]; then done fi -echo "PKGS $PKGS" for PKG in $PKGS; do echo "Uncompressing libraries ${PLATFORM}${ARCH} from $PKG" diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index 3fa187664e4..2d24fef888f 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -54,8 +54,5 @@ downloader() { fi done fi; - # fi - - + fi } - From cda3ac81706d5acaf0813ed79358d807012ae50e Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 20:35:54 -0300 Subject: [PATCH 11/16] -z --- scripts/dev/downloader.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index 2d24fef888f..0af7f5e0b67 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -26,13 +26,13 @@ downloader() { wget2 -q $@; elif command -v curl 2>/dev/null; then for PKG in $@; do - if [[-z "$PKG"]]; then + if [[ -z "$PKG" ]]; then curl -LO --retry 20 -s $PKG fi done else for PKG in $@; do - if [[-z "$PKG"]]; then + if [[ -z "$PKG" ]]; then wget -q $PKG@ 2> /dev/null fi done @@ -43,13 +43,13 @@ downloader() { elif command -v curl 2>/dev/null; then for PKG in $@; do - if [[-z "$PKG"]]; then + if [[ -z "$PKG" ]]; then curl -L --retry 20 --progress-bar -O $PKG fi done else for PKG in $@; do - if [[-z "$PKG"]]; then + if [[ -z "$PKG" ]]; then wget $PKG 2> /dev/null fi done From 15c988e78f2fcca20eff9e1c6589137167d55503 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 20:40:43 -0300 Subject: [PATCH 12/16] up --- scripts/dev/downloader.sh | 41 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh index 0af7f5e0b67..f35f60d75f2 100755 --- a/scripts/dev/downloader.sh +++ b/scripts/dev/downloader.sh @@ -1,5 +1,5 @@ #!/bin/bash -# set -ev +set -ev printDownloaderHelp(){ cat << EOF @@ -21,27 +21,26 @@ downloader() { if [ $# -ge 2 ]; then SILENTARGS=$2 fi - if [[ "${SILENTARGS}" == "-s" ]]; then - if command -v wget2 2>/dev/null; then - wget2 -q $@; - elif command -v curl 2>/dev/null; then - for PKG in $@; do - if [[ -z "$PKG" ]]; then - curl -LO --retry 20 -s $PKG - fi - done - else - for PKG in $@; do - if [[ -z "$PKG" ]]; then - wget -q $PKG@ 2> /dev/null - fi - done - fi; - else + # if [[ "${SILENTARGS}" == "-s" ]]; then + # if command -v wget2 2>/dev/null; then + # wget2 -q $@; + # elif command -v curl 2>/dev/null; then + # for PKG in $@; do + # if [[ -z "$PKG" ]]; then + # curl -LO --retry 20 -s $PKG + # fi + # done + # else + # for PKG in $@; do + # if [[ -z "$PKG" ]]; then + # wget -q $PKG@ 2> /dev/null + # fi + # done + # fi; + # else if command -v wget2 2>/dev/null; then wget2 $@; - elif - command -v curl 2>/dev/null; then + elif command -v curl 2>/dev/null; then for PKG in $@; do if [[ -z "$PKG" ]]; then curl -L --retry 20 --progress-bar -O $PKG @@ -54,5 +53,5 @@ downloader() { fi done fi; - fi + # fi } From 39fd24d4dd38c2da715bccd001e1cb25d33ce961 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 21:14:30 -0300 Subject: [PATCH 13/16] up --- scripts/dev/download_libs.sh | 430 +++++++++++++++++------------------ scripts/dev/downloader.sh | 57 ----- 2 files changed, 215 insertions(+), 272 deletions(-) delete mode 100755 scripts/dev/downloader.sh diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index a4fabfcd929..9cdbff822f4 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash -set -e +# set -ev +# shopt -s nullglob +# set -o nullglob + VER=master PLATFORM="" ARCH="" @@ -9,161 +12,143 @@ BLEEDING_EDGE=0 printHelp(){ cat << EOF - Usage: download_libs.sh [OPTIONS] + Usage: download_libs.sh [OPTIONS] - Options: + Options: - -v, --version VERSION OF version to download the libraries for. Defaults to master - -p, --platform PLATFORM Platorm among: android, emscritpen, ios, linux, linux64, linuxarmv6l, linuxarmv7l, msys2, osx, tvos, vs - If not specified tries to autodetect the platform. - -a, --arch ARCH Architecture: - vs: 64 - msys2: 64 - android: armv7, arm64, and x86 (if not specified will download all) - linux: 64gcc6, armv6l or armv7l - -n, --no-overwrite Merge new libraries with existing ones, use only to download same version for different platforms - If not set deletes any existing libraries - -s, --silent Silent download progress - -h, --help Shows this message + -v, --version VERSION OF version to download the libraries for. Defaults to master + -p, --platform PLATFORM Platorm among: android, emscritpen, ios, linux, linux64, linuxarmv6l, linuxarmv7l, msys2, osx, tvos, vs + If not specified tries to autodetect the platform. + -a, --arch ARCH Architecture: + vs: 64 + msys2: 64 + android: armv7, arm64, and x86 (if not specified will download all) + linux: 64gcc6, armv6l or armv7l + -n, --no-overwrite Merge new libraries with existing ones, use only to download same version for different platforms + If not set deletes any existing libraries + -s, --silent Silent download progress + -h, --help Shows this message EOF } SCRIPT_DIR="${BASH_SOURCE%/*}" if [[ ! -d "$SCRIPT_DIR" ]]; then SCRIPT_DIR="$PWD"; fi -. "$SCRIPT_DIR/downloader.sh" - -download(){ - echo '-----' - echo "Downloading $1" - # downloader ci.openframeworks.cc/libs/$1 $SILENT_ARGS - - COMMAND=" " - REPO="nightly" - if [[ $BLEEDING_EDGE = 1 ]] ; then - REPO="bleeding" - fi - - for PKG in $1; do - COMMAND+="https://github.com/openframeworks/apothecary/releases/download/$REPO/$PKG " - done - echo "COMMAND = $COMMAND" - downloader $COMMAND $SILENT_ARGS -} +# . "$SCRIPT_DIR/downloader.sh" # trap any script errors and exit trap 'trapError ${LINENO}' ERR trap "trapError" SIGINT SIGTERM trapError() { - local parent_lineno="$1" - if [[ "$#" = "3" ]] ; then - local message="$2" - local code="${3:-1}" - echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}" - else - local code="${2:-1}" - echo "Error on or near line ${parent_lineno}; exiting with status ${code}" - fi + local parent_lineno="$1" + if [[ "$#" = "3" ]] ; then + local message="$2" + local code="${3:-1}" + echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}" + else + local code="${2:-1}" + echo "Error on or near line ${parent_lineno}; exiting with status ${code}" + fi - if [ -e openFrameworksLibs* ]; then - echo "removing packages" - rm openFrameworksLibs* - fi - exit "${code}" + if [ -e openFrameworksLibs* ]; then + echo "removing packages" + rm openFrameworksLibs* + fi + exit "${code}" } while [[ $# -gt 0 ]]; do - key="$1" - case $key in - -v|--version) - VER="$2" - shift # past argument - ;; - -p|--platform) - PLATFORM="$2" - shift # past argument - ;; - -a|--arch) - ARCH="$2" - shift # past argument - ;; - -n|--no-overwrite) - OVERWRITE=0 - ;; - -b|--bleeding-edge) - BLEEDING_EDGE=1 - ;; - -s|--silent) - SILENT_ARGS=-nv - ;; - -h|--help) - printHelp - exit 0 - ;; - *) - echo "Error: invalid argument: $key" - printHelp - exit 1 - ;; - esac - shift # past argument or value + key="$1" + case $key in + -v|--version) + VER="$2" + shift # past argument + ;; + -p|--platform) + PLATFORM="$2" + shift # past argument + ;; + -a|--arch) + ARCH="$2" + shift # past argument + ;; + -n|--no-overwrite) + OVERWRITE=0 + ;; + -b|--bleeding-edge) + BLEEDING_EDGE=1 + ;; + -s|--silent) + SILENT_ARGS=-nv + ;; + -h|--help) + printHelp + exit 0 + ;; + *) + echo "Error: invalid argument: $key" + printHelp + exit 1 + ;; + esac + shift # past argument or value done if [ "$PLATFORM" == "" ]; then - OS=$(uname) - if [ "$OS" == "Linux" ]; then - PLATFORM="linux" - elif [ "$OS" == "Darwin" ]; then - PLATFORM="osx" - elif [ "${OS:0:5}" == "MINGW" ]; then - PLATFORM="msys2" - else - # otherwise we are on windows and will download 32bit msys2 - PLATFORM="msys2" - fi + OS=$(uname) + if [ "$OS" == "Linux" ]; then + PLATFORM="linux" + elif [ "$OS" == "Darwin" ]; then + PLATFORM="osx" + elif [ "${OS:0:5}" == "MINGW" ]; then + PLATFORM="msys2" + else + # otherwise we are on windows and will download 32bit msys2 + PLATFORM="msys2" + fi fi if [ "$ARCH" == "" ]; then - if [ "$PLATFORM" == "linux" ]; then - ARCH=$(uname -m) - if [ "$ARCH" == "x86_64" ]; then - GCC_VERSION=$(gcc -dumpversion | cut -f1 -d.) - if [ $GCC_VERSION -eq 4 ]; then - ARCH=64gcc6 - elif [ $GCC_VERSION -eq 5 ]; then - ARCH=64gcc6 - else - ARCH=64gcc6 - fi - elif [ "$ARCH" == "armv7l" ]; then - # Check for Raspberry Pi - if [ -f /opt/vc/include/bcm_host.h ]; then - ARCH=armv6l - fi - elif [ "$ARCH" == "i686" ] || [ "$ARCH" == "i386" ]; then - cat << EOF + if [ "$PLATFORM" == "linux" ]; then + ARCH=$(uname -m) + if [ "$ARCH" == "x86_64" ]; then + GCC_VERSION=$(gcc -dumpversion | cut -f1 -d.) + if [ $GCC_VERSION -eq 4 ]; then + ARCH=64gcc6 + elif [ $GCC_VERSION -eq 5 ]; then + ARCH=64gcc6 + else + ARCH=64gcc6 + fi + elif [ "$ARCH" == "armv7l" ]; then + # Check for Raspberry Pi + if [ -f /opt/vc/include/bcm_host.h ]; then + ARCH=armv6l + fi + elif [ "$ARCH" == "i686" ] || [ "$ARCH" == "i386" ]; then + cat << EOF 32bit linux is not officially supported anymore but compiling the libraries using the build script in apothecary/scripts should compile all the dependencies without problem EOF - exit 1 - fi - elif [ "$PLATFORM" == "msys2" ]; then - if [ "$MSYSTEM" == "MINGW64" ]; then - ARCH=mingw64 - elif [ "$MSYSTEM" == "MINGW32" ]; then - ARCH=mingw32 - elif [ "$MSYSTEM" == "UCRT64" ]; then - ARCH=ucrt64 - elif [ "$MSYSTEM" == "CLANG64" ]; then - ARCH=clang64 - fi - fi + exit 1 + fi + elif [ "$PLATFORM" == "msys2" ]; then + if [ "$MSYSTEM" == "MINGW64" ]; then + ARCH=mingw64 + elif [ "$MSYSTEM" == "MINGW32" ]; then + ARCH=mingw32 + elif [ "$MSYSTEM" == "UCRT64" ]; then + ARCH=ucrt64 + elif [ "$MSYSTEM" == "CLANG64" ]; then + ARCH=clang64 + fi + fi - if [ "$PLATFORM" == "osx" ]; then - ARCH=x86_64 - fi + if [ "$PLATFORM" == "osx" ]; then + ARCH=x86_64 + fi fi @@ -171,125 +156,140 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" if [[ $BLEEDING_EDGE = 1 ]] ; then - VER=bleeding + VER=bleeding fi if [ "$PLATFORM" == "linux" ] && [ "$ARCH" == "64" ]; then - if [[ $BLEEDING_EDGE = 1 ]] ; then - ARCH=64_gcc6 - else - ARCH=64gcc6 - fi + if [[ $BLEEDING_EDGE = 1 ]] ; then + ARCH=64_gcc6 + else + ARCH=64gcc6 + fi fi if [ "$PLATFORM" == "msys2" ]; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}.zip" + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}.zip" elif [ "$ARCH" == "" ] && [ "$PLATFORM" == "vs" ]; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}_64_1.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_64_2.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_64_3.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_64_4.zip" + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_64_1.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_64_2.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_64_3.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_64_4.zip" elif [ "$PLATFORM" == "vs" ]; then - if [[ $BLEEDING_EDGE = 1 ]] ; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_1.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_2.zip" - else - PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_1.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_2.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_3.zip \ - openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_4.zip" - fi + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_1.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_2.zip" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_1.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_2.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_3.zip \ + openFrameworksLibs_${VER}_${PLATFORM}_${ARCH}_4.zip" + fi elif [[ "$PLATFORM" =~ ^(osx|ios|tvos|xros|catos|watchos)$ ]]; then - if [[ $BLEEDING_EDGE = 1 ]] ; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}_1.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}_2.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}_3.tar.bz2" - else - PKGS="openFrameworksLibs_${VER}_${PLATFORM}1.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}2.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}3.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}4.tar.bz2" - fi + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_1.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_2.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_3.tar.bz2" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}1.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}2.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}3.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}4.tar.bz2" + fi elif [ "$ARCH" == "" ] && [ "$PLATFORM" == "android" ]; then - if [[ $BLEEDING_EDGE = 1 ]] ; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}_armv7.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}_arm64.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}_x86_64.tar.bz2 - openFrameworksLibs_${VER}_${PLATFORM}_x86.tar.bz2" - else - PKGS="openFrameworksLibs_${VER}_${PLATFORM}armv7.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}arm64.tar.bz2 \ - openFrameworksLibs_${VER}_${PLATFORM}x86.tar.bz2" - fi + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}_armv7.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_arm64.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}_x86_64.tar.bz2 + openFrameworksLibs_${VER}_${PLATFORM}_x86.tar.bz2" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}armv7.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}arm64.tar.bz2 \ + openFrameworksLibs_${VER}_${PLATFORM}x86.tar.bz2" + fi else # Linux - if [[ $BLEEDING_EDGE = 1 ]] ; then - PKGS="openFrameworksLibs_${VER}_${PLATFORM}${ARCH}.tar.bz2" - else - PKGS="openFrameworksLibs_${VER}_${PLATFORM}${ARCH}.tar.bz2" - fi + if [[ $BLEEDING_EDGE = 1 ]] ; then + PKGS="openFrameworksLibs_${VER}_${PLATFORM}${ARCH}.tar.bz2" + else + PKGS="openFrameworksLibs_${VER}_${PLATFORM}${ARCH}.tar.bz2" + fi fi -# for PKG in $PKGS; do -# download $PKG -# done -# echo $PKGS -download "${PKGS[@]}" + +REPO="nightly" +if [[ $BLEEDING_EDGE = 1 ]] ; then + REPO="bleeding" +fi + +PARAMS="" +for PKG in $PKGS; do + PARAMS+="https://github.com/openframeworks/apothecary/releases/download/$REPO/$PKG " +done +# echo " PARAMS $PARAMS" + + +if command -v wget2 2>/dev/null; then + wget2 $PARAMS +elif command -v curl 2>/dev/null; then + curl --parallel -L --progress-bar -OOOO $PARAMS +else + wget $PARAMS 2> /dev/null +fi; cd ../../ mkdir -p libs cd libs if [ $OVERWRITE -eq 1 ]; then - echo "Removing old libraries" - libs=("boost" "cairo" "curl" "FreeImage" "freetype" "glew" "glfw" "json" "libpng" "openssl" "pixman" "poco" "rtAudio" "tess2" "uriparser" "utf8" "videoInput" "zlib" "opencv" "ippicv" "assimp" "libxml2" "svgtiny" "README.md") - for lib in $libs; do - if [ -e $lib ]; then - rm -rf $lib - fi - done + echo "Removing old libraries" + libs=("boost" "cairo" "curl" "FreeImage" "freetype" "glew" "glfw" "json" "libpng" "openssl" "pixman" "poco" "rtAudio" "tess2" "uriparser" "utf8" "videoInput" "zlib" "opencv" "ippicv" "assimp" "libxml2" "svgtiny" "README.md") + for lib in $libs; do + if [ -e $lib ]; then + rm -rf $lib + fi + done fi for PKG in $PKGS; do - echo "Uncompressing libraries ${PLATFORM}${ARCH} from $PKG" - if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then - unzip -qo ../scripts/dev/$PKG - rm ../scripts/dev/$PKG - else - tar xjf ../scripts/dev/$PKG - rm ../scripts/dev/$PKG - fi + echo "Uncompressing libraries ${PLATFORM}${ARCH} from $PKG" + if [ "$PLATFORM" == "msys2" ] || [ "$PLATFORM" == "vs" ]; then + unzip -qo ../scripts/dev/$PKG + rm ../scripts/dev/$PKG + else + tar xjf ../scripts/dev/$PKG + rm ../scripts/dev/$PKG + fi done if [ "$PLATFORM" == "osx" ]; then - addonslibs=("opencv" "ippicv" "libusb" "assimp" "libxml2" "svgtiny" "poco" "openssl") - addons=("ofxOpenCv" "ofxOpenCv" "ofxKinect" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco" "ofxPoco") + addonslibs=("opencv" "ippicv" "libusb" "assimp" "libxml2" "svgtiny" "poco" "openssl") + addons=("ofxOpenCv" "ofxOpenCv" "ofxKinect" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco" "ofxPoco") elif [ "$PLATFORM" == "vs" ]; then - addonslibs=("opencv" "ippicv" "libusb" "assimp" "libxml2" "svgtiny" "poco") - addons=("ofxOpenCv" "ofxOpenCv" "ofxKinect" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco") + addonslibs=("opencv" "ippicv" "libusb" "assimp" "libxml2" "svgtiny" "poco") + addons=("ofxOpenCv" "ofxOpenCv" "ofxKinect" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco") elif [ "$PLATFORM" == "ios" ] || [ "$PLATFORM" == "tvos" ]; then - addonslibs=("opencv" "ippicv" "assimp" "libxml2" "svgtiny" "poco" "openssl") - addons=("ofxOpenCv" "ofxOpenCv" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco" "ofxPoco") + addonslibs=("opencv" "ippicv" "assimp" "libxml2" "svgtiny" "poco" "openssl") + addons=("ofxOpenCv" "ofxOpenCv" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco" "ofxPoco") else - addonslibs=("opencv" "ippicv" "assimp" "libxml2" "svgtiny" "poco") - addons=("ofxOpenCv" "ofxOpenCv" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco") + addonslibs=("opencv" "ippicv" "assimp" "libxml2" "svgtiny" "poco") + addons=("ofxOpenCv" "ofxOpenCv" "ofxAssimpModelLoader" "ofxSvg" "ofxSvg" "ofxPoco") fi for ((i=0;i<${#addonslibs[@]};++i)); do - if [ -e ${addonslibs[i]} ]; then - echo "Copying ${addonslibs[i]} to ${addons[i]}" - if [ $OVERWRITE -eq 1 ] && [ -e ../addons/${addons[i]}/libs/${addonslibs[i]} ]; then - echo "Removing old opencv libraries" - rm -rf ../addons/${addons[i]}/libs/${addonslibs[i]} - fi - mkdir -p ../addons/${addons[i]}/libs/${addonslibs[i]} - if ! command -v rsync &> /dev/null - then - cp -a ${addonslibs[i]}/* ../addons/${addons[i]}/libs/${addonslibs[i]} - else - rsync -a ${addonslibs[i]}/ ../addons/${addons[i]}/libs/${addonslibs[i]}/ - fi - rm -rf ${addonslibs[i]} - fi + if [ -e ${addonslibs[i]} ]; then + echo "Copying ${addonslibs[i]} to ${addons[i]}" + if [ $OVERWRITE -eq 1 ] && [ -e ../addons/${addons[i]}/libs/${addonslibs[i]} ]; then + echo "Removing old opencv libraries" + rm -rf ../addons/${addons[i]}/libs/${addonslibs[i]} + fi + mkdir -p ../addons/${addons[i]}/libs/${addonslibs[i]} + if ! command -v rsync &> /dev/null + then + cp -a ${addonslibs[i]}/* ../addons/${addons[i]}/libs/${addonslibs[i]} + else + rsync -a ${addonslibs[i]}/ ../addons/${addons[i]}/libs/${addonslibs[i]}/ + fi + rm -rf ${addonslibs[i]} + fi done diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh deleted file mode 100755 index f35f60d75f2..00000000000 --- a/scripts/dev/downloader.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -ev - -printDownloaderHelp(){ -cat << EOF - Usage: download.sh [URL] [OPTIONS] - - Example: download.sh http://ci.openframeworks.cc/libs/file.zip -s - - Options: - -s, --silent Silent download progress - -h, --help Shows this message -EOF -} - -downloader() { - if [ -z "$1" ] - then printDownloaderHelp; fi - - SILENTARGS=""; - if [ $# -ge 2 ]; then - SILENTARGS=$2 - fi - # if [[ "${SILENTARGS}" == "-s" ]]; then - # if command -v wget2 2>/dev/null; then - # wget2 -q $@; - # elif command -v curl 2>/dev/null; then - # for PKG in $@; do - # if [[ -z "$PKG" ]]; then - # curl -LO --retry 20 -s $PKG - # fi - # done - # else - # for PKG in $@; do - # if [[ -z "$PKG" ]]; then - # wget -q $PKG@ 2> /dev/null - # fi - # done - # fi; - # else - if command -v wget2 2>/dev/null; then - wget2 $@; - elif command -v curl 2>/dev/null; then - for PKG in $@; do - if [[ -z "$PKG" ]]; then - curl -L --retry 20 --progress-bar -O $PKG - fi - done - else - for PKG in $@; do - if [[ -z "$PKG" ]]; then - wget $PKG 2> /dev/null - fi - done - fi; - # fi -} From 579675433969687c81fb07dd62c1a5425ca2a6c4 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Sat, 11 May 2024 21:20:14 -0300 Subject: [PATCH 14/16] up --- scripts/dev/downloader.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 scripts/dev/downloader.sh diff --git a/scripts/dev/downloader.sh b/scripts/dev/downloader.sh new file mode 100755 index 00000000000..c2fe46c3d48 --- /dev/null +++ b/scripts/dev/downloader.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +printDownloaderHelp(){ +cat << EOF + Usage: download.sh [URL] [OPTIONS] + + Example: download.sh http://ci.openframeworks.cc/libs/file.zip -s + + Options: + -s, --silent Silent download progress + -h, --help Shows this message +EOF +} + +downloader() { + + if [ -z "$1" ] + then printDownloaderHelp; fi + + SILENTARGS=""; + if [ $# -ge 2 ]; then + SILENTARGS=$2 + fi + if [[ "${SILENTARGS}" == "-s" ]]; then + if command -v curl 2>/dev/null; then + curl -LO --retry 20 -O -s $@; + else + wget -q $@ 2> /dev/null; fi; + else + if command -v curl 2>/dev/null; then + curl -LO --retry 20 -O --progress-bar $@; + else + wget $@ 2> /dev/null; fi; + fi + + +} + From 976e4e6c31ae551d3b57514cf6e70b3fd6e9d324 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Thu, 16 May 2024 13:05:57 -0300 Subject: [PATCH 15/16] changes --- scripts/ci/msys2/install.sh | 0 scripts/dev/download_libs.sh | 2 +- scripts/msys2/cleanAllExamples.sh | 0 scripts/msys2/compileOF.sh | 0 scripts/msys2/install_dependencies.sh | 0 5 files changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 scripts/ci/msys2/install.sh mode change 100755 => 100644 scripts/msys2/cleanAllExamples.sh mode change 100755 => 100644 scripts/msys2/compileOF.sh mode change 100755 => 100644 scripts/msys2/install_dependencies.sh diff --git a/scripts/ci/msys2/install.sh b/scripts/ci/msys2/install.sh old mode 100755 new mode 100644 diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index 9cdbff822f4..e41574043d7 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -229,7 +229,7 @@ done if command -v wget2 2>/dev/null; then wget2 $PARAMS -elif command -v curl 2>/dev/null; then +else command -v curl 2>/dev/null; then curl --parallel -L --progress-bar -OOOO $PARAMS else wget $PARAMS 2> /dev/null diff --git a/scripts/msys2/cleanAllExamples.sh b/scripts/msys2/cleanAllExamples.sh old mode 100755 new mode 100644 diff --git a/scripts/msys2/compileOF.sh b/scripts/msys2/compileOF.sh old mode 100755 new mode 100644 diff --git a/scripts/msys2/install_dependencies.sh b/scripts/msys2/install_dependencies.sh old mode 100755 new mode 100644 From 1b45b09eb2c72f12fdd544f15bd5da996f843bc8 Mon Sep 17 00:00:00 2001 From: Dimitre Date: Thu, 16 May 2024 13:13:52 -0300 Subject: [PATCH 16/16] elif --- scripts/dev/download_libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index e41574043d7..9cdbff822f4 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -229,7 +229,7 @@ done if command -v wget2 2>/dev/null; then wget2 $PARAMS -else command -v curl 2>/dev/null; then +elif command -v curl 2>/dev/null; then curl --parallel -L --progress-bar -OOOO $PARAMS else wget $PARAMS 2> /dev/null