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

name                subversion-rubybindings
version             1.14.3
revision            0

categories          devel ruby
platforms           darwin
license             Apache-2
maintainers         nomaintainer

description         Ruby bindings for the subversion version control system (svn)
long_description    Subversion (svn) is a version control system designed to be \
                    as similar to cvs(1) as possible, while fixing many \
                    outstanding problems with cvs(1). The ruby bindings \
                    provide access to subversion API from ruby.

homepage            https://subversion.apache.org/

master_sites        apache:subversion
use_bzip2           yes

checksums           rmd160  18fb11f2e65213a2878b57ef807864b245f57cc5 \
                    sha256  949efd451a09435f7e8573574c71c7b71b194d844890fa49cd61d2262ea1a440 \
                    size    8569985

distname            subversion-${version}
dist_subdir         subversion

depends_build-append \
                    port:pkgconfig \
                    port:gettext \
                    port:swig

depends_lib-append  port:apr \
                    port:apr-util \
                    port:cyrus-sasl2 \
                    port:db48 \
                    port:expat \
                    port:gettext-runtime \
                    port:libmagic \
                    port:libutf8proc \
                    port:lz4 \
                    port:ruby \
                    port:serf1 \
                    port:subversion \
                    port:sqlite3 \
                    port:zlib

configure.env       RUBY=${prefix}/bin/ruby1.8
configure.args      --with-berkeley-db=:${prefix}/include/db48:${prefix}/lib/db48:db-4.8 \
                    --without-gnome-keyring \
                    --without-apxs \
                    --without-boost

build.target        swig-rb
destroot.target     install-swig-rb

test.run            yes
test.target         check-swig-rb

pre-test {
    set x {}
    fs-traverse dir ${worksrcpath}/subversion {
        if {[file tail ${dir}] == ".libs" && [file isdirectory ${dir}]} {
                lappend x ${dir}
                continue
        }
    }
    test.env-append DYLD_LIBRARY_PATH=[join ${x} ":"]
}

pre-configure {
    reinplace "s|hardcode_direct=yes|hardcode_direct=no|g" \
        ${worksrcpath}/configure
}

post-configure {
    reinplace "s|need_relink=yes|need_relink=no|g" \
        ${worksrcpath}/libtool
}

variant no_bdb description {Build without support for BerkeleyDB repositories} {
        depends_lib-delete      port:db48
        configure.args-delete   --with-berkeley-db=:${prefix}/include/db48:${prefix}/lib/db48:db-4.8
        configure.args-append   --without-berkeley-db
}

# CarbonCore/MacTypes.h: No such file or directory
platform puredarwin {
    configure.args-append   --disable-keychain
}

livecheck.type      regex
livecheck.url       https://svn.apache.org/repos/asf/subversion/tags/
livecheck.regex     "(\\d+\\.\\d+\\.\\d+)/"
