@cryptotaxi247 / kubo / commits / 66e0f8a1d

build(Makefile): set supported platforms by go-version

Set supported platforms correctly by go version (no darwin-386 for >=1.15, no darwin-arm64 unless >=1.16), make check-go-version work on mac License: MIT Signed-off-by: hannahhoward <hannah@hannahhoward.net>

hannahhoward committed Feb 18, 2021 at 20:28 UTC 66e0f8a1d9e811596e66062198637007b5bded99
2 files changed +10 -6
bin/check_version
+4 -4
@@ -34,27 +34,27 @@ check_at_least_version() {
34 # We expect a version to be of form X.X.X
35 # if the second dot doesn't match, we consider it a prerelease
36
37 - if MIN_MIN=$(expr "$MIN_VERS" : "[^.]*\.\([0-9]\+\)"); then
37 + if MIN_MIN=$(expr "$MIN_VERS" : "[^.]*\.\([0-9][0-9]*\)"); then
38 # this captured digit is necessary, since expr returns code 1 if the output is empty
39 if expr "$MIN_VERS" : "[^.]*\.[0-9]*\([0-9]\.\|[0-9]\$\)" >/dev/null; then
40 MIN_PRERELEASE="0"
41 else
42 MIN_PRERELEASE="1"
43 fi
44 - MIN_FIX=$(expr "$MIN_VERS" : "[^.]*\.[0-9]\+[^0-9]\+\([0-9]\+\)") || MIN_FIX="0"
44 + MIN_FIX=$(expr "$MIN_VERS" : "[^.]*\.[0-9][0-9]*[^0-9][^0-9]*\([0-9][0-9]*\)") || MIN_FIX="0"
45 else
46 MIN_MIN="0"
47 MIN_PRERELEASE="0"
48 MIN_FIX="0"
49 fi
50 - if CUR_MIN=$(expr "$CUR_VERS" : "[^.]*\.\([0-9]\+\)"); then
50 + if CUR_MIN=$(expr "$CUR_VERS" : "[^.]*\.\([0-9][0-9]*\)"); then
51 # this captured digit is necessary, since expr returns code 1 if the output is empty
52 if expr "$CUR_VERS" : "[^.]*\.[0-9]*\([0-9]\.\|[0-9]\$\)" >/dev/null; then
53 CUR_PRERELEASE="0"
54 else
55 CUR_PRERELEASE="1"
56 fi
57 - CUR_FIX=$(expr "$CUR_VERS" : "[^.]*\.[0-9]\+[^0-9]\+\([0-9]\+\)") || CUR_FIX="0"
57 + CUR_FIX=$(expr "$CUR_VERS" : "[^.]*\.[0-9][0-9]*[^0-9][^0-9]*\([0-9][0-9]*\)") || CUR_FIX="0"
58 else
59 CUR_MIN="0"
60 CUR_PRERELEASE="0"
mk/util.mk
+6 -2
@@ -17,9 +17,13 @@ SUPPORTED_PLATFORMS += linux-arm64
17 SUPPORTED_PLATFORMS += linux-386
18 SUPPORTED_PLATFORMS += linux-amd64
19
20 -SUPPORTED_PLATFORMS += darwin-386
20 SUPPORTED_PLATFORMS += darwin-amd64
22 -
21 +ifeq ($(shell bin/check_go_version "1.15.0" 2>/dev/null; echo $$?),1)
22 +SUPPORTED_PLATFORMS += darwin-386
23 +endif
24 +ifeq ($(shell bin/check_go_version "1.16.0" 2>/dev/null; echo $$?),0)
25 +SUPPORTED_PLATFORMS += darwin-arm64
26 +endif
27 SUPPORTED_PLATFORMS += freebsd-386
28 SUPPORTED_PLATFORMS += freebsd-amd64
29