1
1
#! /usr/bin/env bash
2
2
3
- # ObjectBox libraries are hosted in a Conan repository on Bintray:
3
+ # ObjectBox libraries are available as GitHub release artifacts.
4
4
# This script downloads the current version of the library and extracts/installs it locally.
5
5
# The download happens in a "download" directory.
6
6
# 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
39
39
40
40
# Note: optional arguments like "--quiet" shifts argument positions in the case block above
41
41
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)}
46
45
echo " Base config: OS ${os} and arch ${arch} "
47
46
48
47
if [[ " $os " == MINGW* ]] || [[ " $os " == CYGWIN* ]]; then
@@ -51,22 +50,21 @@ if [[ "$os" == MINGW* ]] || [[ "$os" == CYGWIN* ]]; then
51
50
fi
52
51
53
52
if [[ " $os " == " Darwin" ]]; then
54
- echo " Adjusted OS to Macos "
55
- os=Macos
53
+ echo " Adjusted OS to Mac "
54
+ os=Mac
56
55
fi
57
56
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
63
61
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
66
64
echo " Selected ${arch} architecture for download (hard FP only!)"
67
65
fi
68
66
69
- conf=" ${os} :: ${arch} "
67
+ conf=$( echo " ${os} - ${arch} " | tr ' [:upper:] ' ' [:lower:] ' ) # convert to lowercase
70
68
echo " Using configuration ${conf} "
71
69
72
70
# sudo might not be defined (e.g. when building a docker image)
78
76
# original location where we installed in previous versions of this script
79
77
oldLibDir=
80
78
81
- if [[ " $os " = " Macos " ]]; then
79
+ if [[ " $os " = " Mac " ]]; then
82
80
libFileName=libobjectbox.dylib
83
81
libDirectory=/usr/local/lib
84
82
elif [[ " $os " = " Windows" ]]; then
101
99
102
100
103
101
function printUsage() {
104
- echo " download.sh [\$ 1:version] [\$ 2:repo type] [ \$ 3: os] [\$ 4 :arch]"
102
+ echo " download.sh [\$ 1:version] [\$ 2:os] [\$ 3 :arch]"
105
103
echo
106
104
echo " Options (use at front only):"
107
105
echo " --quiet: skipping asking to install to ${libDirectory} "
165
163
esac
166
164
done
167
165
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)"
181
179
echo " Possible values are:"
182
- awk ' $0 {print " - " $1 }' <<< " $HASHES "
180
+ awk ' $0 {print " - " $1 }' <<< " $SUPPORTED_PLATFORMS "
183
181
exit 1
184
182
fi
185
183
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} ..."
193
189
mkdir -p " $( dirname " ${archiveFile} " ) "
194
190
195
191
# Support both curl and wget because their availability is platform dependent
0 commit comments