diff --git a/srcpkgs/joker/patches/cross_build_gh_issue_200.patch b/srcpkgs/joker/patches/cross_build_gh_issue_200.patch new file mode 100644 index 00000000000..4d2a21d07ca --- /dev/null +++ b/srcpkgs/joker/patches/cross_build_gh_issue_200.patch @@ -0,0 +1,61 @@ +diff --git core/array_map.go core/array_map.go +index 3d9b95d..6e03cfa 100644 +--- core/array_map.go ++++ core/array_map.go +@@ -21,7 +21,7 @@ type ( + ) + + var ( +- HASHMAP_THRESHOLD int = 16 ++ HASHMAP_THRESHOLD int64 = 16 + ) + + func EmptyArrayMap() *ArrayMap { +@@ -169,7 +169,7 @@ func (m *ArrayMap) Assoc(key Object, value Object) Associative { + res.arr[i+1] = value + return res + } +- if len(m.arr) >= HASHMAP_THRESHOLD { ++ if int64(len(m.arr)) >= HASHMAP_THRESHOLD { + return NewHashMap(m.arr...).Assoc(key, value) + } + res := m.Clone() +diff --git core/eval.go core/eval.go +index 42b7ff2..49ade93 100644 +--- core/eval.go ++++ core/eval.go +@@ -204,7 +204,7 @@ func (expr *VectorExpr) Eval(env *LocalEnv) Object { + } + + func (expr *MapExpr) Eval(env *LocalEnv) Object { +- if len(expr.keys) > HASHMAP_THRESHOLD/2 { ++ if int64(len(expr.keys)) > HASHMAP_THRESHOLD/2 { + res := EmptyHashMap + for i := range expr.keys { + key := Eval(expr.keys[i], env) +diff --git core/read.go core/read.go +index 199fd72..1a03ca8 100644 +--- core/read.go ++++ core/read.go +@@ -604,7 +604,7 @@ func readMapWithNamespace(reader *Reader, nsname string) Object { + if len(objs)%2 != 0 { + panic(MakeReadError(reader, "Map literal must contain an even number of forms")) + } +- if len(objs) > HASHMAP_THRESHOLD { ++ if int64(len(objs)) >= HASHMAP_THRESHOLD { + hashMap := NewHashMap() + for i := 0; i < len(objs); i += 2 { + key := resolveKey(objs[i], nsname) +diff --git main.go main.go +index 126f221..bfd1b84 100644 +--- main.go ++++ main.go +@@ -437,7 +437,7 @@ func parseArgs(args []string) { + if thresh < 0 { + HASHMAP_THRESHOLD = math.MaxInt64 + } else { +- HASHMAP_THRESHOLD = thresh ++ HASHMAP_THRESHOLD = int64(thresh) + } + } else { + missing = true diff --git a/srcpkgs/joker/template b/srcpkgs/joker/template new file mode 100644 index 00000000000..d5ffcb4c759 --- /dev/null +++ b/srcpkgs/joker/template @@ -0,0 +1,29 @@ +# Template file for 'joker' +pkgname=joker +version=0.12.1 +revision=1 +build_style=go +go_import_path="github.com/candid82/joker" +hostmakedepends="git" +short_desc="Interpreted dialect of Clojure written in Go and Clojure(Script) linter" +maintainer="Dominic Monroe " +license="EPL-1.0" +homepage="https://joker-lang.org/" +distfiles="https://github.com/candid82/joker/archive/v${version}.tar.gz" +checksum=b019b96f9a36cb88749701c8e93a3d811ee26f6c453595320a3ab3adca404c09 + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" joker" +fi + +pre_build() { + JOKER="joker" + + if [ -z "$CROSS_BUILD" ]; then + JOKER="../joker" + go generate ./... + go build + fi + + (cd std; "$JOKER" --hashmap-threshold 8192 generate-std.joke) +}