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

github.setup        tycho cpuid 1.8.2
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball

categories          sysutils
description         A simple CPUID decoder/dumper for x86/x86_64
long_description    "cpuid" is a very simple C program, designed to dump and extract information \
                    from the x86 CPUID instruction.\
                    cpuid is capable of dumping all CPUID leaves (except any unknown leaves which \
                    require special ECX values to dump all information). cpuid can only decode \
                    certain leaves, but this functionality will be expanded as the CPUID \
                    specifications provided by AMD and Intel change.

maintainers         {gmail.com:rjvbertin @RJVB} openmaintainer
license             ISC
supported_archs     i386 x86_64
installs_libs       no

checksums           rmd160  036bcc55d4d5812d2aa0b13c5cf7afdc3d5351fd \
                    sha256  3ed7167b70109fe0fd45d45a4e965eb0894890e68cd18446ef5fe83ff19d0423 \
                    size    63092

patchfiles-append   patch-makefile.diff

compiler.blacklist-append \
                    gcc-3.3 *gcc-4.0 *gcc-4.2

configure {
    # no configure script, just a few changes that need to be made to the Makefile
    # for it to be configured correctly. Doing these reinplaces in configure{} instead
    # of in post-patch{} maintains support for +universal.
    reinplace "s|-Os|${configure.cppflags} ${configure.cflags} [get_canonical_archflags cc]|g" ${worksrcpath}/GNUmakefile
    reinplace "s|LDFLAGS := -lm|LDFLAGS := -lm ${configure.ldflags} [get_canonical_archflags ld]|g" ${worksrcpath}/GNUmakefile
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/GNUmakefile
}

build.args-append   CC=${configure.cc} LD=${configure.cc} V=1
destroot.args-append \
                    CC=${configure.cc} LD=${configure.cc}
