# -*- 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
# $Id: Portfile 107204 2013-06-21 14:17:46Z cal@macports.org $

PortSystem      1.0

name            haskell-platform

if {$subport == $name} {
    version         2013.2.0.0
    categories      devel haskell
    maintainers     cal openmaintainer
    description     \
        The Haskell Platform is the easiest way to get started with programming \
        Haskell. It comes with all you need to get up and running. Think of it as \
        \"Haskell: batteries included\".
    long_description \
        The Haskell Platform is a comprehensive, robust development environment for \
        programming in Haskell. For new users the platform makes it trivial to get \
        up and running with a full Haskell development environment. For experienced \
        developers, the platform provides a comprehensive, standard base for \
        commercial and open source Haskell development that maximises \
        interoperability and stability of your code.

    platforms       darwin
    homepage        http://hackage.haskell.org/platform/
    master_sites    ${homepage}
    license         Permissive

    depends_run     port:ghc

    fetch {}
    checksum {}
    extract {}
    configure {}
    build {}
    destroot {
        xinstall -d ${destroot}${prefix}/share/doc/${name}
        system "echo ${long_description} > ${destroot}${prefix}/share/doc/${name}/README.txt"
    }

    use_configure       no
    universal_variant   no

    livecheck.type      regex
    livecheck.url       ${homepage}
    livecheck.regex     "Current release: <a href=\"changelog.html\">(\\d+\\.\\d\\.\\d\\.\\d)</a>"
}

##
# Helper proc containing the defaults for the haskell platform ports following
# after this block. Modeled after the subport mechanism in base, it creates
# a subport for each given port and executes Portfile code in the context of
# the newly created subport.
#
# @param[in] pkgname     the name of the haskell package, case-sensitive
# @param[in] pkgversion  the version to be packaged in haskell platform
# @param[in] pkgrevision the current revision of the port in MacPorts
# @param[in] block       a block of code to be executed in the subport, optional
proc haskell_platform_port {pkgname pkgversion pkgrevision {block {}}} {
    uplevel 1 "
        subport hs-[string tolower ${pkgname}] {
            PortGroup               haskellplatform 2.0
            haskellplatform.setup   ${pkgname} ${pkgversion}
            revision                ${pkgrevision}

            # Make sure to check this for every port!
            license                 BSD
            maintainers             cal openmaintainer
            platforms               darwin

            pre-activate {
                # deactivate hs-platform versions of these ports; they are outdated.
                # deactivate hack added 2013-06-06
                if {!\[catch {set installed \[lindex \[registry_active hs-platform-[string tolower ${pkgname}]] 0]}]} {
                    registry_deactivate_composite hs-platform-[string tolower ${pkgname}] \"\" \[list ports_nodepcheck 1] 
                }
            }

            ${block}
        }

        if {\${subport} == \${name}} {
            depends_run-append  port:hs-${pkgname}
        }
    "
}

##
# Helper proc for tools and programs in the Haskell Platform. This behaves
# exactly like \c haskell_platform_port, with the execption of passing "no" as
# third argument to \c haskellplatform.setup of the haskellplatform PortGroup.
#
# @param[in] pkgname     the name of the haskell package, case-sensitive
# @param[in] pkgversion  the version to be packaged in haskell platform
# @param[in] pkgrevision the current revision of the port in MacPorts
# @param[in] block       a block of code to be executed in the subport, optional
proc haskell_platform_tool {pkgname pkgversion pkgrevision {block {}}} {
    uplevel 1 "
        subport hs-[string tolower ${pkgname}] {
            PortGroup               haskellplatform 2.0
            haskellplatform.setup   ${pkgname} ${pkgversion} no
            revision                ${pkgrevision}

            # Make sure to check this for every port!
            license                 BSD
            maintainers             cal openmaintainer
            platforms               darwin

            pre-activate {
                # deactivate hs-platform versions of these ports; they are outdated.
                # deactivate hack added 2013-06-06
                if {!\[catch {set installed \[lindex \[registry_active hs-platform-[string tolower ${pkgname}]] 0]}]} {
                    registry_deactivate_composite hs-platform-[string tolower ${pkgname}] \"\" \[list ports_nodepcheck 1] 
                }
            }

            ${block}
        }

        if {\${subport} == \${name}} {
            depends_run-append  port:hs-${pkgname}
        }
    "
}


#################################
# Additional Platform Libraries #
#################################

haskell_platform_port async 2.0.1.4 0 {
    checksums               rmd160  8a28038e3193ee6de2212afb42f25fc444a2ef1d \
                            sha256  41ddfe012d98f3ef101651fb529753bca5bb4c804f03f9cfafc5d0cbe50224c2

    depends_lib-append      port:hs-stm

    description             Run IO operations asynchronously and wait for their results
    long_description        \
        This package provides a higher-level interface over threads, in which an \
        Async a is a concurrent thread that will eventually deliver a value of type \
        a. The package provides ways to create Async computations, wait for their \
        results, and cancel them. \
        Using Async is safer than using threads in two ways:\n\
        - When waiting for a thread to return a result, if the thread dies with an \
        exception then the caller must either re-throw the exception (wait) or \
        handle it (waitCatch)\; the exception cannot be ignored.\n\
        - The API makes it possible to build a tree of threads that are \
        automatically killed when their parent dies (see withAsync).
}

haskell_platform_port attoparsec 0.10.4.0 0 {
    checksums               rmd160  1fc9845e60fb0cddc9ffa8838c446b3046cd3522 \
                            sha256  b6b84e0dbd1c3beec1dedea578ac2f4d62afbe66b383582b7b3349406866d346

    depends_lib-append      port:hs-text

    description             Fast combinator parsing for bytestrings and text
    long_description        \
        A fast parser combinator library, aimed particularly at dealing \
        efficiently with network protocols and complicated text/binary file \
        formats.
}

haskell_platform_port case-insensitive 1.0.0.1 0 {
    checksums               rmd160  890cc0d0c3d8e0470956f7bce2da70c3adf8e90c \
                            sha256  b58f62516779580a41cdc67a979c509125adf139b8f50d415495f58d4b42e8fa

    depends_lib-append      port:hs-hashable \
                            port:hs-text

    description             Case insensitive string comparison
    long_description        \
        The module Data.CaseInsensitive provides the CI type constructor which \
        can be parameterised by a string-like type like: String, ByteString, \
        Text, etc.. Comparisons of values of the resulting type will be \
        insensitive to cases.
}

haskell_platform_port cgi 3001.1.7.5 0 {
    checksums               rmd160  76823f125e750f648d967f833a5c6a11814d8b56 \
                            sha256  5126e2eaa53cd5de59572981c00aedae5790882afda67545228eb29fe76faffd

    depends_lib-append      port:hs-mtl \
                            port:hs-parsec \
                            port:hs-network \
                            port:hs-xhtml

    description             A library for writing CGI programs
    long_description        This is a Haskell library for writing CGI programs.
}

haskell_platform_port fgl 5.4.2.4 2 {
    checksums               rmd160  e2b9e0d1d43e69b250719a34c6de9344b38264bf \
                            sha256  ce98ccb83e2d271a7b3266426a0762a0e902252f07ec09b7bef50c67d0110266

    depends_lib-append      port:hs-mtl

    description             Martin Erwig's Functional Graph Library
    long_description        ${description}
}

haskell_platform_port GLUT 2.4.0.0 0 {
    checksums               rmd160  b1f4449f2bacbbbf51ffd5146c1f7ccafd6d0348 \
                            sha256  100df2d724dfad26b0c8d47b17d4cef9dcbc12a75cce7a096046c27485b4cbbc

    depends_lib-append      port:hs-opengl

    description             A binding for the OpenGL Utility Toolkit
    long_description        \
        A Haskell binding for the OpenGL Utility Toolkit, a window system \
        independent toolkit for writing OpenGL programs.
}

haskell_platform_port GLURaw 1.3.0.0 0 {
    checksums               rmd160  2aa60cb5a779ee858a9e1bcadfe3b2bfccfbd167 \
                            sha256  e03905710043eb2e9878e5fc75f969c4f120321bc6a7709cde3a9890be3c08ea

    depends_lib-append      port:hs-openglraw

    description             A raw binding for the OpenGL graphics system
    long_description        \
        GLURaw is a raw Haskell binding for the GLU 1.3 OpenGL utility library. \
        It is basically a 1:1 mapping of GLU's C API, intended as a basis for \
        a nicer interface.
}

haskell_platform_port hashable 1.1.2.5 0 {
    checksums               rmd160  93b4faee93a046445458e9f9c67820b458242aac \
                            sha256  3fb5d430c9289ebada4991a76fd78f028aaaf17957dc666ddc7b89c98a54713d

    depends_lib-append      port:hs-text

    description             A class for types that can be converted to a hash value
    long_description        \
        This package defines a class, Hashable, for types that can be converted \
        to a hash value. This class exists for the benefit of hashing-based \
        data structures. The package provides instances for basic types and \
        a way to combine hash values.
}

haskell_platform_port haskell-src 1.0.1.5 2 {
    checksums               rmd160  32a53bab9f1e150565cbed0c926816e4089dd966 \
                            sha256  9f3726902247cc955d085997254bb58c16cc337ee83de5ccfb17dcbcb488c3ab

    depends_lib-append      port:hs-syb

    description             Support for manipulating Haskell source code
    long_description        \
        The haskell-src package provides support for manipulating Haskell \
        source code. The package provides a lexer, parser and pretty-printer, \
        and a definition of a Haskell abstract syntax tree (AST). Common uses \
        of this package are to parse or generate Haskell 98 code.
}

haskell_platform_port html 1.0.1.2 3 {
    checksums               rmd160  55d95a42c297c9c4b0b0c3bbd077a5ed59e48878 \
                            sha256  0c35495ea33d65e69c69bc7441ec8e1af69fbb43433c2aa3406c0a13a3ab3061

    description             HTML combinator library
    long_description        \
        This package contains a combinator library for constructing HTML documents.
}

haskell_platform_port HTTP 4000.2.8 3 {
    checksums               rmd160  844041fdfb257c19cf35be24976925bc9c0c43c6 \
                            sha256  086a2aa771a31845b190e2f9651ab4d8e85116aa463de5bc5e0204c1e5e70c5c

    depends_lib-append      port:hs-network \
                            port:hs-mtl \
                            port:hs-parsec

    description             A library for client-side HTTP
    long_description        \
        The HTTP package supports client-side web programming in Haskell. It \
        lets you set up HTTP connections, transmitting requests and processing \
        the responses coming back, all from within the comforts of Haskell. \
        It's dependent on the network package to operate, but other than that, \
        the implementation is all written in Haskell.
}

haskell_platform_port HUnit 1.2.5.2 0 {
    checksums               rmd160  f6ac9ac12c152609174ea80a3a0c694210c81594 \
                            sha256  0af5ad34dba27de48b94ce6d5f7ee3aa6af6183bdc4a3967b811e28520369a41

    description             A unit testing framework for Haskell
    long_description        \
        HUnit is a unit testing framework for Haskell, inspired by the JUnit \
        tool for Java, see: http://www.junit.org.
}

haskell_platform_port mtl 2.1.2 2 {
    checksums               rmd160  aa5c576c124b602a605cf3931ac42c1c1eb27cda \
                            sha256  8c775764333420a4391823f9cb9b640306a262552280ea9bbdd2ca11194a8bef

    depends_lib-append      port:hs-transformers

    description             Monad classes, using functional dependencies
    long_description        \
        Monad classes using functional dependencies, with instances for various \
        monad transformers, inspired by the paper Functional Programming with \
        Overloading and Higher-Order Polymorphism, by Mark P Jones, in Advanced \
        School of Functional Programming, 1995
}

haskell_platform_port network 2.4.1.2 1 {
    checksums               rmd160  27461d006ac9580d55a0f1377774c1ac9c20a024 \
                            sha256  b04dc56542428bc92f11263f500b3ad82e6a0787805601472d59af7e769bfe38

    depends_lib-append      port:hs-parsec

    description             Low-level networking interface
    long_description        ${description}
}

haskell_platform_port OpenGL 2.8.0.0 0 {
    checksums               rmd160  3be0a47aea270ce184da50007dd729814ef99aaa \
                            sha256  ce753d8db75b5096e030422765193c4975779b42bfffa467408a40d8c43965f1

    depends_lib-append      port:hs-gluraw \
                            port:hs-openglraw

    description             A binding for the OpenGL graphics system
    long_description        \
        A Haskell binding for the OpenGL graphics system (GL, version 3.2) and \
        its accompanying utility library (GLU, version 1.3).
}

haskell_platform_port OpenGLRaw 1.3.0.0 0 {
    checksums               rmd160  09c08ce9f45acdabdef46e397e72814f5a86e71b \
                            sha256  6228ca9ac967350fcb6abac25b8027660ad8599914a60ef0fd10919a6d2cd745

    description             A raw binding for the OpenGL graphics system
    long_description        \
        OpenGLRaw is a raw Haskell binding for the OpenGL 3.2 graphics system \
        and lots of OpenGL extensions. It is basically a 1:1 mapping of \
        OpenGL's C API, intended as a basis for a nicer interface. OpenGLRaw \
        offers access to all necessary functions, tokens and types plus \
        a general facility for loading extension entries. The module hierarchy \
        closely mirrors the naming structure of the OpenGL extensions, making \
        it easy to find the right module to import. All API entries are loaded \
        dynamically, so no special C header files are needed for building this \
        package. If an API entry is not found at runtime, a userError is \
        thrown.
}

haskell_platform_port parallel 3.2.0.3 1 {
    checksums               rmd160  a358225292a80bb4223e6ea2f6e0d502e41cab02 \
                            sha256  163a40ef3c6258c623abe690a9837c9de2bf7fe87d3fac7d0758229d7efb6dcd

    description             Parallel programming library
    long_description        This package provides a library for parallel programming.
}

haskell_platform_port parsec 3.1.3 3 {
    checksums               rmd160  b1b407b27f5642142bfa619b31abd7a8cafe11ce \
                            sha256  9f14bb4da77eb9b0e4dbe8112559ed49409b0af8e9aef5d08941dd97e37fc4a8

    depends_lib-append      port:hs-mtl \
                            port:hs-text

    description             Monadic parser combinators
    long_description        \
        Parsec is designed from scratch as an industrial-strength parser \
        library. It is simple, safe, well documented (on the package homepage), \
        has extensive libraries and good error messages, and is also fast. It \
        is defined as a monad transformer that can be stacked on arbitrary \
        monads, and it is also parametric in the input stream type.
}

haskell_platform_port QuickCheck 2.6 0 {
    checksums               rmd160  94bab2dcefdd7a6eddd5af7211db1babf39e0df8 \
                            sha256  8001c00a1892714d914e5007ba72cdd428c1ea4c6b8418c6cb5e7809753d970d

    depends_lib-append      port:hs-random

    description             Automatic testing of Haskell programs
    long_description        \
        QuickCheck is a library for random testing of program properties. The \
        programmer provides a specification of the program, in the form of \
        properties which functions should satisfy, and QuickCheck then tests \
        that the properties hold in a large number of randomly generated cases.
}

haskell_platform_port random 1.0.1.1 2 {
    checksums               rmd160  a13a4d7fefd15611cf863f11caf212efede320c3 \
                            sha256  df7c3b405de0ac27a2ee8fdc8dad87cb42e8eac01fef53861e43bc47c8111559
          
    description             random number library
    long_description        \
        This package provides a basic random number generation library, including \
        the ability to split random number generators.
}

haskell_platform_port regex-base 0.93.2 2 {
    checksums               rmd160  c009e193dd453666c7c3b585a25f3a8add7ec6b6 \
                            sha256  20dc5713a16f3d5e2e6d056b4beb9cfdc4368cd09fd56f47414c847705243278

    depends_lib-append      port:hs-mtl

    description             Replaces/Enhances Text.Regex
    long_description        Interface API for regex-posix,pcre,parsec,tdfa,dfa
}

haskell_platform_port regex-compat 0.95.1 2 {
    checksums               rmd160  b2fe02ca3c4e9027b2d433c8a265b19a85c8bd17 \
                            sha256  d57cb1a5a4d66753b18eaa37a1621246f660472243b001894f970037548d953b

    depends_lib-append      port:hs-regex-base \
                            port:hs-regex-posix

    description             Replaces/Enhances Text.Regex
    long_description        One module layer over regex-posix to replace Text.Regex
}

haskell_platform_port regex-posix 0.95.2 1 {
    checksums               rmd160  7ee59eb760bb8c0c7fe17e17d90eb0623b9fd5bb \
                            sha256  56019921cd4a4c9682b81ec614236fea816ba8ed8785a1640cd66d8b24fc703e

    depends_lib-append      port:hs-regex-base

    description             Replaces/Enhances Text.Regex
    long_description        The posix regex backend for regex-base
}

haskell_platform_port split 0.2.2 0 {
    checksums               rmd160  7d4fe221283836386807f0e73a90df1255061f6f \
                            sha256  f9cf9e571357f227aed5be9a78f5bbf78ef55c99df2edf7fdc659acc1f904375

    description             Combinator library for splitting lists.
    long_description        \
        A collection of various methods for splitting lists into parts, akin to \
        the "split" function found in several mainstream languages.
}

haskell_platform_port stm 2.4.2 0 {
    checksums               rmd160  7d49257f7e2de7cf18e02dc3ceeb4619d7980dd8 \
                            sha256  c8ee3cd64c266133902619cfff2d04e5f66206f91dbce8dd1182037fbe4858db

    description             Software Transactional Memory
    long_description        A modular composable concurrency abstraction.
}

haskell_platform_port syb 0.4.0 2 {
    checksums               rmd160  7814875c994d34b0dd11e378c3d16e009a843d4d \
                            sha256  f201089aa7e74b6cbca7fc73a259596b2a9628e31a9b54e801844ad68447bff3

    description             Scrap Your Boilerplate
    long_description        \
        This package contains the generics system described in the Scrap Your \
        Boilerplate papers (see \
        http://www.cs.uu.nl/wiki/GenericProgramming/SYB). It defines the Data \
        class of types permitting folding and unfolding of constructor \
        applications, instances of this class for primitive types, and \
        a variety of traversals.
}

haskell_platform_port text 0.11.3.1 0 {
    checksums               rmd160  544b6be80db9432dd4c149f81a2c0603e2e67205 \
                            sha256  76aad4a647cad7099b5a693eb9a4bc5263f7751392d8d1f87b14c78e2069559f

    description             An efficient packed Unicode text type
    long_description        \
        An efficient packed, immutable Unicode text type (both strict and lazy), \
        with a powerful loop fusion optimization framework.
}

haskell_platform_port transformers 0.3.0.0 2 {
    checksums               rmd160  110bd7eb44609d8db44d85f8367db323576545dc \
                            sha256  e5aa0c1ec97ad98c389e78f59aca25ab028980a7068a3e585e39564662739591

     description            Concrete functor and monad transformers
     long_description       \
        A portable library of functor and monad transformers, inspired by the \
        paper \"Functional Programming with Overloading and Higher-Order \
        Polymorphism\", by Mark P Jones, in Advanced School of Functional \
        Programming, 1995 \
        (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html).
}

haskell_platform_port unordered-containers 0.2.3.0 1 {
    checksums               rmd160  91b7d7c2138de34b3b690efe294d90022e04d8b3 \
                            sha256  edb6a442ef9fcf4ce59f66871d51df5c012345fce95970127e75b62e5396efef

    depends_lib-append      port:hs-hashable

    description             Efficient hashing-based container types
    long_description        \
        Efficient hashing-based container types. The containers have been \
        optimized for performance critical use, both in terms of large data \
        quantities and high speed.
}

haskell_platform_port vector 0.10.0.1 1 {
    checksums               rmd160  e00adaf6b4a9634df2feb1a805f4adf51d1870ae \
                            sha256  ece945058b01a77c5fff31e89bbea76ac619677041c41286a2da5e8b515508af

    depends_lib-append      port:hs-primitive

    description             Efficient Arrays
    long_description        \
        An efficient implementation of Int-indexed arrays (both mutable and \
        immutable), with a powerful loop optimisation framework.
}

haskell_platform_port xhtml 3000.2.1 2 {
    checksums               rmd160  72e1095df0a8111ea696749d219df4ea78da1b4f \
                            sha256  33020782170c1c083bc59fc3bfcb72cec2db223e02d1181c07ae23b9fa7fdcd8

    description             An XHTML combinator library
    long_description        \
        This package provides combinators for producing XHTML 1.0, including the \
        Strict, Transitional and Frameset variants.
}

haskell_platform_port zlib 0.5.4.1 1 {
    checksums               rmd160  9ed49e79e239604958a9c385cca75747fafc2713 \
                            sha256  cca365e4c52c90be41a5754943134da5ce6c60bb52fa00c128fd118e0505a550

    depends_lib-append      port:zlib

    description             Compression and decompression in the gzip and zlib formats
    long_description        \
        This package provides a pure interface for compressing and \
        decompressing streams of data represented as lazy ByteStrings. It uses \
        the zlib C library so it has high performance. It supports the \"zlib\", \
        \"gzip\" and \"raw\" compression formats.
}

######################
# Programs and Tools #
######################

haskell_platform_tool cabal-install 1.16.0.2 0 {
    checksums               rmd160  2e19f5086cbf7f4ea9c17bf804ec6da886cd2f51 \
                            sha256  66dfacc9f33e668e56904072cadb8a36bd9d6522ba5464c6a36a5de7e65c5698

    depends_lib-append      port:hs-http \
                            port:hs-mtl \
                            port:hs-network \
                            port:hs-random \
                            port:hs-zlib

    description             The command-line interface for Cabal and Hackage
    long_description        \
        The 'cabal' command-line program simplifies the process of managing Haskell \
        software by automating the fetching, configuration, compilation and \
        installation of Haskell libraries and programs.
}

haskell_platform_tool alex 3.0.5 0 {
    checksums               rmd160  3f543c6af966f6200f84f408022d62beaefb875f \
                            sha256  c3326417a0538e355e5ad1871ab931b9c8145391e8b2ff79668eb643d9b99659

    depends_lib-append      port:hs-quickcheck

    description             A lexical analyser generator for Haskell
    long_description        \
        Alex is a tool for generating lexical analysers in Haskell, given \
        a description of the tokens to be recognised in the form of regular \
        expressions. It is similar to the tool lex or flex for C/C++.
}

haskell_platform_tool happy 1.18.10 1 {
    checksums               rmd160  3c113721ccacbe33bfbc25287bfe9bf74cc365f7 \
                            sha256  c1c920f77906740252e261e2baec5b7519e584344d6080aa5a9cc0b677b9064b

    depends_lib-append      port:hs-mtl
    description             \
        Happy is a parser generator system for Haskell, similar to the tool `yacc' \
        for C. Like `yacc', it takes a file containing an annotated BNF \
        specification of a grammar and produces a Haskell module containing \
        a parser for the grammar.
    long_description        ${description} \
        Happy is flexible: you can have several Happy parsers in the same program, \
        and several entry points to a single grammar. Happy can work in conjunction \
        with a lexical analyser supplied by the user (either hand-written or \
        generated by another program), or it can parse a stream of characters \
        directly (but this isn't practical in most cases).
}
