diff --git a/srcpkgs/clj-kondo/template b/srcpkgs/clj-kondo/template new file mode 100644 index 00000000000..19a469f1a07 --- /dev/null +++ b/srcpkgs/clj-kondo/template @@ -0,0 +1,63 @@ +# Template file for 'clj-kondo' +pkgname=clj-kondo +version=2024.11.14 +revision=1 +hostmakedepends="clojure leiningen mandrel" +makedepends="zlib-devel" +checkdepends="git" +short_desc="Static analyzer and linter for Clojure code that sparks joy" +maintainer="Andy Weidenbaum " +license="EPL-1.0" +homepage="https://github.com/clj-kondo/clj-kondo" +changelog="https://github.com/clj-kondo/clj-kondo/raw/master/CHANGELOG.md" +distfiles="https://github.com/clj-kondo/clj-kondo/archive/v${version}.tar.gz" +checksum=07745d19b29d2bcd895b1bdb073eee6848cda9ec09037fea583748fab814c9a4 +nocross="mandrel" + +export JAVA_HOME=/usr/lib/jvm/mandrel21 +export GRAALVM_HOME=/usr/lib/jvm/mandrel21 +export PATH="${PATH}:${GRAALVM_HOME}/bin" + +do_build() { + local _args + + export CLJ_KONDO_NATIVE=true + export CLJ_KONDO_STATIC=true + lein with-profiles +clojure-1.10.2 "do" clean, uberjar + + _args+=" --static" + # necessary for compatibility with older machines, e.g. see: + # https://github.com/borkdude/deps.clj/actions/runs/6337277754/job/17212028399 + _args+=" -march=compatibility" + _args+=" -O1" + + if [ "$XBPS_TARGET_LIBC" = musl ]; then + export CLJ_KONDO_MUSL=true + _args+=" --libc=musl" + # see: https://github.com/oracle/graal/issues/3398 + _args+=" -H:CCompilerOption=-Wl,-z,stack-size=2097152" + else + # see: https://github.com/oracle/graal/issues/3737 + _args+=" -H:+StaticExecutableWithDynamicLibC" + fi + + LC_ALL=C.UTF-8 \ + ${GRAALVM_HOME}/bin/native-image \ + -J-Xss$(ulimit -s)K \ + -J-Xmx3G \ + -J-Xms2G \ + -jar target/clj-kondo-$version-standalone.jar \ + $_args \ + -H:+ReportExceptionStackTraces \ + --verbose \ + --no-fallback +} + +do_check() { + CLJ_KONDO_TEST_ENV=native script/test +} + +do_install() { + vbin clj-kondo + vlicense LICENSE +}