# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4; -*-
# vim: set fileencoding=utf-8 tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab filetype=tcl :

PortSystem              1.0
PortGroup               xcode 1.0

name                    free42
version                 2.5.20
platforms               darwin
categories              emulators
license                 GPL-2
maintainers             nomaintainer
description             a HP-42s Simulator
long_description        Free42 is a complete re-implementation of the HP-42S    \
                        calculator and the HP-82240 printer. Free42 was written \
                        from scratch, without using any HP code. You do not     \
                        need any ROM images in order to use it, yet it is fully \
                        HP-42S compatible.
supported_archs         x86_64

homepage                http://thomasokken.com/free42

master_sites            http://thomasokken.com/free42/upstream:upstream
distname                ${name}-macports-${version}
distfiles               ${distname}.tgz:upstream
checksums               ${distname}.tgz \
						rmd160  c05ef21ccab532d87370ff194926df165fb8e3a8 \
						sha256  453484ad370bbd6b0fc536a3d6b52039d6208d72f16a0dac85ca5e6daaa02139 \
						size    8938185

extract.only            ${distname}.tgz
patchfiles              patch-Free42.xcodeproj.diff
patch.pre_args-replace  -p0 -p1
build.dir               ${build.dir}/mac
xcode.configuration     'Release Decimal'

# fix build with Xcode 10
if {${os.platform} eq "darwin" && ([vercmp $xcodeversion 10.0] > 0)} {
	build.pre_args      -UseNewBuildSystem=NO
	destroot.pre_args   ${build.pre_args}
}

variant binary description {Use binary floating-point (faster but less precise)} {
    xcode.configuration 'Release Binary'
}

variant logo description {Use skin with logo} {
    global              logo
    set logo            Ehrling42sl.gif
    master_sites-append http://thomasokken.com/free42/skins/desktop:logo
    distfiles-append    ${logo}:logo
    checksums-append    ${logo} \
                        rmd160  b98c2789f6cb2a47d0b23d56ebb7a5012965f9a0 \
                        sha256  94ccfb5d581362f4f12300d909fde53545776c0f48c8507703628aa7cba43eee

    post-extract {
        copy -force ${distpath}/${logo} ${worksrcpath}/skins/${logo}
    }
}

livecheck.type          regex
livecheck.url           ${homepage}/upstream/
livecheck.regex         free42-macports-(\\d+\\.\\d+\\.\\d+)\\.tgz