1
+ #! /bin/bash
2
+
3
+ # make sure path is correct
4
+ # so that pwd points to main repo directory
5
+ [[ -e builds/macos/build.sh ]] || { echo >&2 " Please cd into fingertip repo before running this script." ; exit 1; }
6
+
7
+ min_macos_version=" 10.13"
8
+ cflags=" -mmacosx-version-min=" ${min_macos_version}
9
+ working_dir=$( pwd)
10
+ bundle_path=" ${working_dir} /builds/macos/Fingertip.app/Contents/"
11
+ hnsd_path=${bundle_path} /MacOS/hnsd
12
+ fingertip_path=${bundle_path} /MacOS/fingertip
13
+ lib_dir=${bundle_path} /Frameworks/
14
+
15
+ if [ ! -e " $hnsd_path " ]; then
16
+
17
+ echo " Cloning hnsd ..."
18
+ tmp_dir=$( mktemp -d 2> /dev/null || mktemp -d -t ' fingertip_hnsd' )
19
+ git clone https://github.com/handshake-org/hnsd " $tmp_dir "
20
+ cd " $tmp_dir " || exit
21
+
22
+ echo " Building hnsd ..."
23
+ ./autogen.sh && ./configure
24
+ make CFLAGS=$cflags -j 10
25
+ cp " ${tmp_dir} /hnsd" " $hnsd_path "
26
+
27
+ cd " $working_dir " || exit
28
+
29
+ # bundle libs
30
+ dylibbundler -od -b -x " $hnsd_path " -d " $lib_dir " -p @executable_path/../Frameworks/
31
+
32
+ fi
33
+
34
+ # build fingertip
35
+ CGO_CFLAGS=$cflags CGO_LDFLAGS=$cflags go build -trimpath -o " $fingertip_path "
36
+
37
+ get_min_version () {
38
+ otool -l $1 | grep LC_VERSION_MIN_MACOSX -A3 | grep version | xargs | sed s/version// | xargs
39
+ }
40
+
41
+ check_min_version () {
42
+ min=$( get_min_version " $1 " )
43
+ name=$( basename " $1 " )
44
+ if [ " $min " != " $min_macos_version " ] ; then
45
+ echo " Warning: ${name} got min version = ${min} , want $min_macos_version "
46
+ fi
47
+ }
48
+
49
+ check_min_version " $fingertip_path "
50
+ check_min_version " $hnsd_path "
51
+
52
+ for file in " ${lib_dir} " /*
53
+ do
54
+ check_min_version " $file "
55
+ done
0 commit comments