# -*- 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       cmake 1.1
PortGroup       github 1.0

github.setup    open-simh simh c064bb6676d248b1e29ce3d8d19c0221c2823932
name            opensimh

version         20250828
revision        0

categories      emulators

# Note: pmetzger explicitly authorizes all maintainers to make any
# reasonable changes to this port without a three day wait.
maintainers     {pmetzger @pmetzger} openmaintainer

license         X11

description     A highly portable, multi-system simulator.

long_description    SIMH is a framework and family of computer simulators, \
                    with the primary goal of enabling the preservation \
                    of knowledge contained in, and providing the ability \
                    to execute and experience, old and historic software \
                    via simulation of the hardware on which it ran.

homepage        http://opensimh.org

checksums       rmd160  b9a014321360462e552b5470d66a58ffc9c5e51a \
                sha256  8331eba3564f93fbfcaca78463714b28ee19c691d18288cbd5c75cb1bf828cbd \
                size    31361360
github.tarball_from archive

conflicts       simh

depends_lib     port:brotli \
                port:bzip2 \
                port:freetype \
                port:libedit \
                port:libpcap \
                port:libpng \
                port:libsdl2 \
                port:libsdl2_ttf \
                port:ncurses \
                port:pcre \
                port:zlib

depends_build-append   path:bin/pkg-config:pkgconfig

# ___builtin_bswap16
compiler.blacklist-append \
                *gcc-4.0 *gcc-4.2

patchfiles      zlib-not-static.diff

set bindir      ${worksrcpath}/BIN

configure.cflags-append    -fwrapv -fno-strict-overflow

pre-build {
    file mkdir ${bindir}
}

destroot {
    foreach binary [glob -tails -directory ${bindir} *] {
        xinstall -c -m 755 ${bindir}/${binary} ${destroot}${prefix}/bin/simh-${binary}
    }
}

test.run        yes
test.cmd        ctest

notes "
open-simh executables have been installed with a 'simh-' prefix, for example:
   simh-microvax3900
"

livecheck.type  none
