diff --git a/erlang/elp/Portfile b/erlang/elp/Portfile new file mode 100644 index 000000000000..78232b83c2ca --- /dev/null +++ b/erlang/elp/Portfile @@ -0,0 +1,37 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 + +PortSystem 1.0 +PortGroup github 1.0 +PortGroup cargo 1.0 + +name elp +github.setup WhatsApp erlang-language-platform 2024-10-08 +github.tarball_from archive +revision 0 +categories erlang devel +maintainers {pguyot @pguyot} openmaintainer +license Apache-2 + +description Erlang Language Platform +long_description Designed at WhatsApp and inspired by the success of \ + the Rust Analyzer project, ELP provides a scalable, \ + fully incremental, IDE-first library for the semantic \ + analysis of Erlang code. + +checksums rmd160 7411a2de8209c692aca05ce2c928d4efb9934abd \ + sha256 223cfedf6dd88cb0d96f3e264f174ad4b465b0235a2f0f181d64747a95adc2bc \ + size 3304069 + +depends_build-append port:erlang \ + port:eqwalizer \ + port:rebar3 + +build.env-append ELP_EQWALIZER_PATH=${prefix}/share/eqwalizer/eqwalizer.jar +build.env-append EQWALIZER_DIR=${prefix}/share/eqwalizer/eqwalizer_support +build.pre_args --release + +destroot { + set bindir ${destroot}${prefix}/bin + xinstall -m 0755 -d ${bindir} + xinstall -m 0755 {*}[glob -type x ${worksrcpath}/target/*/release/${name}] ${bindir}/${name} +} diff --git a/erlang/eqwalizer/Portfile b/erlang/eqwalizer/Portfile new file mode 100644 index 000000000000..56cf99517ea9 --- /dev/null +++ b/erlang/eqwalizer/Portfile @@ -0,0 +1,84 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 + +PortSystem 1.0 +PortGroup github 1.0 +PortGroup java 1.0 + +github.setup WhatsApp eqwalizer 0.25.3 v +github.tarball_from archive +revision 0 +categories erlang devel +maintainers {pguyot @pguyot} openmaintainer +license Apache-2 + +description A type-checker for Erlang +long_description ${description} + +checksums rmd160 f28a45aac84537f2b690cc9af88c00a1030fd51c \ + sha256 280721884157fa38ab959e87c0031910f067c3b8bf539497edd188def5edd035 \ + size 600088 + +depends_build-append port:erlang \ + port:sbt + +variant jdk17 conflicts jdk11 description {Build using JDK 17} { + depends_build-append port:openjdk17-graalvm + java.version 17 +} + +variant jdk11 conflicts jdk17 description {Build using the older JDK 11} { + depends_build-append port:openjdk11-graalvm-native-image + java.version 11 +} + +if {![variant_isset jdk11] && ![variant_isset jdk17]} { + default_variants +jdk17 +} + +pre-fetch { + if {![variant_isset jdk11] && ![variant_isset jdk17]} { + error "Either +jdk11 or +jdk17 is required" + } +} + +use_configure no + +# Use standard build to take advantage of JAVA_HOME in build.env +build.dir ${worksrcpath}/eqwalizer +build.cmd sbt +build.env-append SBT_OPTS=-Duser.home=${workpath}/.home +build.target assembly + +post-build { + # Leaving this stub since we cannot declare global variables in the scope of pre-fetch + set graalvm_home /Library/Java/JavaVirtualMachines + + if {[variant_isset jdk17]} { + set graalvm_home ${graalvm_home}/openjdk17-graalvm + } elseif {[variant_isset jdk11]} { + set graalvm_home ${graalvm_home}/openjdk11-graalvm + } + + set graalvm_home ${graalvm_home}/Contents/Home + + # https://github.com/WhatsApp/erlang-language-platform/blob/0ae9b6d76ee51c2e17a7e97e379ff2e31b631317/.github/workflows/ci.yml#L102 + set args "-H:IncludeResources=application.conf" + append args " --no-server" + append args " --no-fallback" + append args " -jar " + append args {*}[glob ${worksrcpath}/eqwalizer/target/scala-*/${name}.jar] + append args " eqwalizer" + + system -W ${worksrcpath}/eqwalizer "${graalvm_home}/bin/native-image ${args}" +} + +destroot { + set sharedir ${destroot}${prefix}/share/${name} + xinstall -m 0755 -d ${sharedir} + xinstall -m 0644 {*}[glob ${worksrcpath}/eqwalizer/target/scala-*/${name}.jar] ${sharedir}/${name}.jar + file copy ${worksrcpath}/eqwalizer_support ${sharedir}/eqwalizer_support + + set bindir ${destroot}${prefix}/bin + xinstall -m 0755 -d ${bindir} + xinstall -m 0755 ${worksrcpath}/eqwalizer/${name} ${bindir}/${name} +}