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

# strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        OCL-dev ocl-icd 2.3.5 v
revision            0
categories          devel graphics
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
license             BSD
description         OpenCL ICD Loader
long_description    {*}${description}
checksums           rmd160  516c4edc9f914b8c5833a2059c4518c16c99b7f4 \
                    sha256  cdd7984425fa92d37273eee4180b5f57b047eda6dd8fd623e58498f844b09b75 \
                    size    117902
github.tarball_from archive

use_autoreconf      yes

set ruby_v          3.3
set ruby_v_nodot    [string map {. {}} ${ruby_v}]
configure.ruby      ${prefix}/bin/ruby${ruby_v}

post-patch {
    reinplace "s|RUBY\=ruby|RUBY\=${configure.ruby}|" ${worksrcpath}/Makefile.am
}

depends_build-append \
                    port:ruby${ruby_v_nodot}

# ocl_icd_loader.c:954: error: thread-local storage not supported for this target
# ocl_icd_loader.c:1043: error: redefinition of typedef ‘cl_icdl_info’
compiler.c_standard 2011
compiler.thread_local_storage yes

configure.args-append \
                    --disable-silent-rules \
                    --disable-update-database \
                    --enable-custom-layerdir=${prefix}/etc/OpenCL/layers \
                    --enable-custom-vendordir=${prefix}/etc/OpenCL/vendors \
                    --enable-official-khronos-headers

# FIXME: most of tests fail at the moment:
# https://github.com/OCL-dev/ocl-icd/issues/44
test.run            yes
test.target         check
