11#! /usr/bin/env bash
22
3- # ObjectBox libraries are hosted in a Conan repository on Bintray:
3+ # ObjectBox libraries are available as GitHub release artifacts.
44# This script downloads the current version of the library and extracts/installs it locally.
55# The download happens in a "download" directory.
66# After download and extraction, the script asks if the lib should be installed in /usr/local/lib.
@@ -39,10 +39,9 @@ tty -s || quiet=true
3939
4040# Note: optional arguments like "--quiet" shifts argument positions in the case block above
4141
42- version=${1:- 0.12.0}
43- repoType=${2:- testing}
44- os=${3:- $(uname)}
45- arch=${4:- $(uname -m)}
42+ version=${1:- 0.13.0}
43+ os=${2:- $(uname)}
44+ arch=${3:- $(uname -m)}
4645echo " Base config: OS ${os} and arch ${arch} "
4746
4847if [[ " $os " == MINGW* ]] || [[ " $os " == CYGWIN* ]]; then
@@ -51,22 +50,21 @@ if [[ "$os" == MINGW* ]] || [[ "$os" == CYGWIN* ]]; then
5150fi
5251
5352if [[ " $os " == " Darwin" ]]; then
54- echo " Adjusted OS to Macos "
55- os=Macos
53+ echo " Adjusted OS to Mac "
54+ os=Mac
5655fi
5756
58- if [[ $arch == " aarch64" ]]; then
59- arch=armv8
60- echo " Selected ${arch} architecture for download"
61- elif [[ $arch == armv7* ]] && [[ $arch != " armv7" ]]; then
62- arch=armv7
57+ if [[ $arch == " x86_64" ]]; then
58+ arch=x64
59+ elif [[ $arch == armv7* ]]; then
60+ arch=armv7hf
6361 echo " Selected ${arch} architecture for download (hard FP only!)"
64- elif [[ $arch == armv6* ]] && [[ $arch != " armv6 " ]] ; then
65- arch=armv6
62+ elif [[ $arch == armv6* ]]; then
63+ arch=armv6hf
6664 echo " Selected ${arch} architecture for download (hard FP only!)"
6765fi
6866
69- conf=" ${os} :: ${arch} "
67+ conf=$( echo " ${os} - ${arch} " | tr ' [:upper:] ' ' [:lower:] ' ) # convert to lowercase
7068echo " Using configuration ${conf} "
7169
7270# sudo might not be defined (e.g. when building a docker image)
7876# original location where we installed in previous versions of this script
7977oldLibDir=
8078
81- if [[ " $os " = " Macos " ]]; then
79+ if [[ " $os " = " Mac " ]]; then
8280 libFileName=libobjectbox.dylib
8381 libDirectory=/usr/local/lib
8482elif [[ " $os " = " Windows" ]]; then
10199
102100
103101function printUsage() {
104- echo " download.sh [\$ 1:version] [\$ 2:repo type] [ \$ 3: os] [\$ 4 :arch]"
102+ echo " download.sh [\$ 1:version] [\$ 2:os] [\$ 3 :arch]"
105103 echo
106104 echo " Options (use at front only):"
107105 echo " --quiet: skipping asking to install to ${libDirectory} "
165163 esac
166164done
167165
168- HASHES ="
169- Linux::x86_64 4db1be536558d833e52e862fd84d64d75c2b3656
170- Linux:: armv6 4a625f0bd5f477eacd9bd35e9c44c834d057524b
171- Linux:: armv7 d42930899c74345edc43f8b7519ec7645c13e4d8
172- Linux::armv8 b0bab81756b4971d42859e9b1bc6f8b3fa8e036e
173- Windows:: x86 11e6a84a7894f41df553e7c92534c3bf26896802
174- Windows::x86_64 ca33edce272a279b24f87dc0d4cf5bbdcffbc187
175- Macos::x86_64 46f53f156846659bf39ad6675fa0ee8156e859fe
176- " # END_OF_HASHES
177- hash= $( awk -v key=" ${conf} " ' $1 == key {print $NF}' <<< " $HASHES " )
178- if [ -z " $hash " ] ; then
179- echo " Error: the platform configuration ${conf} is unsupported ."
180- echo " You can select the configuration manually (use --help for details)"
166+ SUPPORTED_PLATFORMS ="
167+ linux-x64
168+ linux- armv6
169+ linux- armv7
170+ linux-aarch64
171+ windows- x86
172+ windows-x64
173+ mac-x64
174+ " # SUPPORTED_PLATFORMS
175+ if [ -z " $( awk -v key=" ${conf} " ' $1 == key {print $NF}' <<< " $SUPPORTED_PLATFORMS " ) " ] ; then
176+ echo " Warning: platform configuration ${conf} is not listed as supported. "
177+ echo " Trying to continue with the download anyway, maybe the list is out of date ."
178+ echo " If that doesn't work you can select the configuration manually (use --help for details)"
181179 echo " Possible values are:"
182- awk ' $0 {print " - " $1 }' <<< " $HASHES "
180+ awk ' $0 {print " - " $1 }' <<< " $SUPPORTED_PLATFORMS "
183181 exit 1
184182fi
185183
186- baseName=libobjectbox-${version} -${hash}
187- targetDir=" ${downloadDir} /${repoType} /${baseName} "
188- archiveFile=" ${targetDir} .tgz"
189- remoteRepo=" https://dl.bintray.com/objectbox/conan/objectbox/objectbox-c"
190- downloadUrl=" ${remoteRepo} /${version} /${repoType} /0/package/${hash} /0/conan_package.tgz"
191-
192- echo " Downloading ObjectBox library version ${version} ${repoType} (${hash} )..."
184+ targetDir=" ${downloadDir} /${version} -${conf} "
185+ archiveFile=" ${targetDir} .tar.gz"
186+ downloadUrl=" https://github.com/objectbox/objectbox-c/releases/download/v${version} /objectbox-${conf} .tar.gz"
187+ echo " Resolved URL: ${downloadUrl} "
188+ echo " Downloading ObjectBox library version v${version} for ${conf} ..."
193189mkdir -p " $( dirname " ${archiveFile} " ) "
194190
195191# Support both curl and wget because their availability is platform dependent
0 commit comments