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

name                            mingw-w64-wine-gecko
categories                      cross
maintainers                     {@Gcenx gmail.com:gcenx83}
homepage                        https://gitlab.winehq.org/wine/wine-gecko
license                         MPL
platforms                       any
supported_archs                 noarch
use_xz                          yes
description                     Wine's built-in replacement for Microsoft's Internet Explorer
long_description                ${name} ${description}

use_configure                   no
build {}

if {${subport} eq ${name}} {
    PortGroup                   stub 1.0
    version                     2.47.4
    revision                    0
    depends_run                 port:mingw-w64-wine-gecko-${version}

    post-deactivate {
        # When this port is deactivated, mingw-w64-wine-gecko-${version} should also be.
        if {![catch {set installed [lindex [registry_active mingw-w64-wine-gecko-${version}] 0]}]} {
            registry_deactivate_composite mingw-w64-wine-gecko-${version} "" [list ports_nodepcheck 1]
        }
    }
}

# wine-stable/wine-devel/wine-staging (9.0+)
subport ${name}-2.47.4 {
    version                     2.47.4
    revision                    0

    distname                    wine-gecko-${version}
    set wine_gecko_distfile     ${distname}-x86.tar.xz
    set wine_gecko64_distfile   ${distname}-x86_64.tar.xz

    master_sites                http://dl.winehq.org/wine/wine-gecko/${version}/:winegecko

    distfiles                   ${wine_gecko_distfile}:winegecko \
                                ${wine_gecko64_distfile}:winegecko

    extract.only                ${wine_gecko_distfile} \
                                ${wine_gecko64_distfile}

    checksums                   ${wine_gecko_distfile} \
                                rmd160  4d2e02818520ab24c9ead1ec7c9098a217b17ece \
                                sha256  2cfc8d5c948602e21eff8a78613e1826f2d033df9672cace87fed56e8310afb6 \
                                size    43025064 \
                                ${wine_gecko64_distfile} \
                                rmd160  73ca5f2c80dad6998491d04d831e13e2e63606e7 \
                                sha256  fd88fc7e537d058d7a8abf0c1ebc90c574892a466de86706a26d254710a82814 \
                                size    41935496
}

# wine-devel-7.22
subport ${name}-2.47.3 {
    version                     2.47.3
    revision                    0

    distname                    wine-gecko-${version}
    set wine_gecko_distfile     ${distname}-x86.tar.xz
    set wine_gecko64_distfile   ${distname}-x86_64.tar.xz

    master_sites                http://dl.winehq.org/wine/wine-gecko/${version}/:winegecko

    distfiles                   ${wine_gecko_distfile}:winegecko \
                                ${wine_gecko64_distfile}:winegecko

    extract.only                ${wine_gecko_distfile} \
                                ${wine_gecko64_distfile}

    checksums                   ${wine_gecko_distfile} \
                                rmd160  7b456b3b58d5116429eae1c0db78024eb46a88d6 \
                                sha256  08d318f3dd6440a8a777cf044ccab039b0d9c8809991d2180eb3c9f903135db3 \
                                size    43291212 \
                                ${wine_gecko64_distfile} \
                                rmd160  e7ed01bbfbf9dca6df471bc90fc233151ead790e \
                                sha256  0beac419c20ee2e68a1227b6e3fa8d59fec0274ed5e82d0da38613184716ef75 \
                                size    42325312
}

# game-porting-toolkit/wine-stable-6.0.4/wine-devel-6.8/wine-stable-7.0.2
subport ${name}-2.47.2 {
    version                     2.47.2
    revision                    0

    distname                    wine-gecko-${version}
    set wine_gecko_distfile     ${distname}-x86.tar.xz
    set wine_gecko64_distfile   ${distname}-x86_64.tar.xz

    master_sites                http://dl.winehq.org/wine/wine-gecko/${version}/:winegecko

    distfiles                   ${wine_gecko_distfile}:winegecko \
                                ${wine_gecko64_distfile}:winegecko

    extract.only                ${wine_gecko_distfile} \
                                ${wine_gecko64_distfile}

    checksums                   ${wine_gecko_distfile} \
                                rmd160  2a148648e523fba9f68913d458da5242b1e52a11 \
                                sha256  8fab46ea2110b2b0beed414e3ebb4e038a3da04900e7a28492ca3c3ccf9fea94 \
                                size    45556880 \
                                ${wine_gecko64_distfile} \
                                rmd160  1853836ef0868383259c201542a7345d0ffcf77f \
                                sha256  b4476706a4c3f23461da98bed34f355ff623c5d2bb2da1e2fa0c6a310bc33014 \
                                size    43025348
}

destroot {
    file mkdir  ${destroot}${prefix}/share/wine/gecko
    file copy   ${workpath}/wine-gecko-${version}-x86 ${destroot}${prefix}/share/wine/gecko
    file copy   ${workpath}/wine-gecko-${version}-x86_64 ${destroot}${prefix}/share/wine/gecko
}
