# -*- 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

name                    i2pj
github.setup            i2p i2p.i2p 2.9.0-8 i2p-
revision                0
categories              security net java
maintainers             {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
license                 Restrictive
# See: https://github.com/i2p/i2p.i2p/blob/master/LICENSE.txt
description             Reference Java implementation of I2P
long_description        {*}${description}. !Experimental!
homepage                https://geti2p.net
checksums               rmd160  909e20f59fea7bad859758957f18e7fad3fbcc04 \
                        sha256  1df7a2142122078973f6878fea48029fdae4fb4dd9d452e8ff91fca3a63e986a \
                        size    38550311
github.tarball_from     archive

depends_build-append    path:bin/ant:apache-ant-1.9 \
                        port:gettext

set java_v              8

depends_lib-append      port:openjdk${java_v}
set java_home           ${prefix}/Library/Java/JavaVirtualMachines/openjdk${java_v}/Contents/Home

use_configure           no

build.cmd               ant
build.target            installer-osx
build.env-append        JAVA_HOME=${java_home}
build.args              -Djava.path=${java_home}/bin/java

# FIXME: macOS-specific wrapper has to be fixed.
# Until then use runplain.sh after installation to launch the service.

# TODO: add updater target.

destroot {
    xinstall -d ${destroot}${prefix}/${name}/share
    copy ${worksrcpath}/i2pinstall_${version}_osx-only.jar ${destroot}${prefix}/${name}/share/
}

notes "
    ${name} port builds the i2p installer and places it in ${prefix}/${name}/share directory.\
    You may copy it from there and run interactive installation:\
    \
    export PATH=/Library/Java/JavaVirtualMachines/openjdk${java_v}/Contents/Home/bin:\$PATH\
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk${java_v}/Contents/Home\
    java -jar i2pinstall_${version}_osx-only.jar -console\
    \
    run i2p with `sh runplain.sh`.\
    \
    i2p status page: http://127.0.0.1:7657/home
"
