Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eqwalizer & elp: new ports #26225

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions erlang/elp/Portfile
Original file line number Diff line number Diff line change
@@ -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}
}
84 changes: 84 additions & 0 deletions erlang/eqwalizer/Portfile
Original file line number Diff line number Diff line change
@@ -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
pguyot marked this conversation as resolved.
Show resolved Hide resolved
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

pguyot marked this conversation as resolved.
Show resolved Hide resolved
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}
}
Loading