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

name                liboil
version             0.3.17
revision            2
description         A library of simple functions that are optimized for various CPUs.
long_description    ${description}
maintainers         nomaintainer
categories          devel
license             BSD
platforms           darwin

homepage            https://liboil.freedesktop.org/
master_sites        https://liboil.freedesktop.org/download/

checksums           md5     47dc734f82faeb2964d97771cfd2e701 \
                    sha1    f9d7103a3a4a4089f56197f81871ae9129d229ed \
                    rmd160  de286350687a5d49868b0a45d4db007526220fec

patchfiles          patch-liboil_liboilcpu-x86.c.diff automake.patch

# /bin/sh: gtkdoc-mktmpl: command not found
# See https://trac.macports.org/ticket/54755
#variant doc description {Install documentation} {
#    depends_build-append   port:gtk-doc
#    configure.args-append  --enable-gtk-doc
#}

use_autoreconf  yes
autoreconf.args -fvi

if {[variant_isset universal]} {
    set merger_host(i386) i686-apple-${os.platform}${os.major}
    set merger_host(x86_64) x86_64-apple-${os.platform}${os.major}
} elseif {${build_arch} eq "i386"} {
    configure.args-append \
        --host=i686-apple-${os.platform}${os.major}
} elseif {${build_arch} eq "x86_64"} {
    configure.args-append \
        --host=${build_arch}-apple-${os.platform}${os.major}
}

# icky inline asm... clang doesn't want to touch it, but we can force it
if {[string match *clang* ${configure.compiler}]} {
    configure.cflags-append -fheinous-gnu-extensions
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]?C=M&O=D
livecheck.regex     ${name}-(\\d(?:\\.\\d+)*)
