packages feed

bishbosh-0.1.1.0: bishbosh.cabal

cabal-version: 2.4

-- This file is part of BishBosh.
--
-- BishBosh is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- BishBosh is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with BishBosh.  If not, see <http://www.gnu.org/licenses/>.

Name:		bishbosh
Version:	0.1.1.0
Copyright:	(C) 2018 Dr. Alistair Ward
License:	GPL-3.0-or-later
License-file:	LICENSE
Author:		Dr. Alistair Ward
Stability:	stable
Synopsis:	Plays chess.
Build-type:	Simple
Description:	A chess-game which can be rendered in a terminal (emulator) in raw ASCII, or used as an engine by xboard.
Category:	Game
Tested-with:	GHC == 8.0, GHC == 8.4, GHC == 8.8, GHC == 8.10
Homepage:	https://functionalley.com/BishBosh/bishbosh.html
Maintainer:	mailto:bishbosh@functionalley.com
Bug-reports:	mailto:bishbosh@functionalley.com

-- Files which can be located by the application using 'Paths_bishbosh.datadir'.
Data-files:
    config/bishbosh.dtd
    config/bishbosh.rng
    config/CECP/*.xml
    config/Raw/*.xml
    config/*.xml
    pgn/*.pgn
    pgn/*.pgn.gz

-- Files which are packaged, but not required at runtime.
Extra-source-files:
    .ghci
    bishbosh.spec
    changelog.markdown
    copyright
    makefile
    man/man1/bishbosh.1
    man/man1/duel.1
    man/man5/bishbosh.5
    README.markdown

source-repository head
    type:	git
    location:	https://github.com/functionalley/BishBosh

-- Enable using: 'runhaskell Setup configure -f llvm --verbose'.
flag llvm
    Description:	Whether the 'llvm' compiler-backend has been installed and is required for code-generation.
    Manual:		True
    Default:		False

-- Automatically disabled when the required package isn't available.
-- To access Parsec's more precise error-messages, manually disable using one of:
--	runhaskell Setup configure -f -polyparse --verbose;
--	stack build --flag 'bishbosh:-polyparse' --cabal-verbose;
flag polyparse
    Description:	Link with package "polyparse" when available, rather than "parsec".
    Default:		True

-- Automatically disabled when the required package isn't available.
-- To force validation of the XML-configuration against the packaged DTD, manually disable using one of:
--	runhaskell Setup configure -f -hxtrelaxng --verbose;
--	stack build --flag 'bishbosh:-hxtrelaxng' --cabal-verbose;
flag hxtrelaxng
    Description:	Link with package "hxt-relaxng" when available, for more precise specification of the XML-configuration than a traditional DTD.
    Default:		True

-- Whether to use narrower numerical types than machine-defaults. CAVEAT: this option increases both the space allocated & the execution-time.
flag narrownumbers
    Description:	Use narrow numerical types.
    Manual:		True
    Default:		False

-- Whether, to wrap common types in 'newtype' for increased type-safety. CAVEAT: there's a ~10% performance-penalty.
flag newtypewrappers
    Description:	Wrap common types in newtype for increased type-safety.
    Manual:		True
    Default:		False

-- Concurrency is used to implement Pondering, & parallelism is used when searching through archived games.
flag threaded
    Description:	Build for parallel runtime.
    Manual:		True
    Default:		True

-- Whether to use unboxed arrays where possible.
flag unboxedarrays
    Description:	Use unboxed arrays.
    Manual:		True
    Default:		False

-- Automatically disabled when the required package isn't available.
-- CAVEAT: on MS-Windows, it may be available but won't necessarily build, so specify "-f -unix --verbose" when configuring the package.
flag unix
    Description:	Link with package "unix" when available.
    Default:		True

Library
    Default-language:	Haskell2010
    GHC-options:	-O2 -Wall -fno-warn-tabs -fno-warn-unused-top-binds -Wno-all-missed-specialisations
    Hs-source-dirs:	src-lib

    Exposed-modules:
        BishBosh.Attribute.CaptureMoveSortAlgorithm
        BishBosh.Attribute.ColourScheme
        BishBosh.Attribute.Direction
        BishBosh.Attribute.LogicalColour
        BishBosh.Attribute.LogicalColourOfSquare
        BishBosh.Attribute.MoveType
        BishBosh.Attribute.PhysicalColour
        BishBosh.Attribute.Rank
        BishBosh.Cartesian.Abscissa
        BishBosh.Cartesian.Coordinates
        BishBosh.Cartesian.Ordinate
        BishBosh.Cartesian.Vector
        BishBosh.Component.CastlingMove
        BishBosh.Component.EitherQualifiedMove
        BishBosh.Component.Move
        BishBosh.Component.Piece
        BishBosh.Component.PieceSquareByCoordinatesByRank
        BishBosh.Component.QualifiedMove
        BishBosh.Component.Turn
        BishBosh.Component.Zobrist
        BishBosh.ContextualNotation.PGN
        BishBosh.ContextualNotation.PGNComment
        BishBosh.ContextualNotation.PGNDatabase
        BishBosh.ContextualNotation.PositionHashQualifiedMoveTree
        BishBosh.ContextualNotation.QualifiedMoveForest
        BishBosh.ContextualNotation.StandardAlgebraic
        BishBosh.Data.Bool
        BishBosh.Data.Either
        BishBosh.Data.Enum
        BishBosh.Data.Exception
        BishBosh.Data.Foldable
        BishBosh.Data.Integral
        BishBosh.Data.List
        BishBosh.Data.Num
        BishBosh.Data.Ratio
        BishBosh.Data.RoseTree
        BishBosh.Evaluation.Fitness
        BishBosh.Evaluation.PositionHashQuantifiedGameTree
        BishBosh.Evaluation.QuantifiedGame
        BishBosh.Input.CategorisedCommandLineOptions
        BishBosh.Input.CECPFeatures
        BishBosh.Input.CECPOptions
        BishBosh.Input.CommandLineOption
        BishBosh.Input.CriteriaWeights
        BishBosh.Input.EvaluationOptions
        BishBosh.Input.IOOptions
        BishBosh.Input.NativeUIOptions
        BishBosh.Input.Options
        BishBosh.Input.PGNOptions
        BishBosh.Input.PieceSquareTable
        BishBosh.Input.RankValues
        BishBosh.Input.SearchOptions
        BishBosh.Input.StandardOpeningOptions
        BishBosh.Input.UIOptions
        BishBosh.Input.Verbosity
        BishBosh.Metric.CriterionValue
        BishBosh.Metric.CriterionWeight
        BishBosh.Metric.RankValue
        BishBosh.Metric.WeightedMeanAndCriterionValues
        BishBosh.Model.Game
        BishBosh.Model.GameTree
        BishBosh.Model.MoveFrequency
        BishBosh.Model.PositionHashTree
        BishBosh.Notation.ICCFNumeric
        BishBosh.Notation.MoveNotation
        BishBosh.Notation.PureCoordinate
        BishBosh.Notation.Smith
        BishBosh.Property.Arboreal
        BishBosh.Property.Empty
        BishBosh.Property.ExtendedPositionDescription
        BishBosh.Property.FixedMembership
        BishBosh.Property.ForsythEdwards
        BishBosh.Property.Null
        BishBosh.Property.Opposable
        BishBosh.Property.Orientated
        BishBosh.Property.Reflectable
        BishBosh.Property.Rotatable
        BishBosh.Property.SelfValidating
        BishBosh.Property.ShowFloat
        BishBosh.Property.Switchable
        BishBosh.Rule.DrawReason
        BishBosh.Rule.GameTerminationReason
        BishBosh.Rule.Result
        BishBosh.Search.AlphaBeta
        BishBosh.Search.DynamicMoveData
        BishBosh.Search.EphemeralData
        BishBosh.Search.KillerMoves
        BishBosh.Search.Search
        BishBosh.Search.SearchState
        BishBosh.Search.Transpositions
        BishBosh.Search.TranspositionValue
        BishBosh.State.Board
        BishBosh.State.CastleableRooksByLogicalColour
        BishBosh.State.CoordinatesByRankByLogicalColour
        BishBosh.State.EnPassantAbscissa
        BishBosh.State.InstancesByPosition
        BishBosh.State.MaybePieceByCoordinates
        BishBosh.State.Position
        BishBosh.StateProperty.Censor
        BishBosh.StateProperty.Mutator
        BishBosh.StateProperty.Seeker
        BishBosh.State.TurnsByLogicalColour
        BishBosh.Text.AutoComplete
        BishBosh.Text.Case
        BishBosh.Text.Encoding
        BishBosh.Text.ShowList
        BishBosh.Text.ShowPrefix
        BishBosh.Time.GameClock
        BishBosh.Time.StopWatch
        BishBosh.Type.Count
        BishBosh.Type.Crypto
        BishBosh.Type.Length
        BishBosh.Type.Mass
        BishBosh.UI.Command
        BishBosh.UI.PrintObject
        BishBosh.UI.ReportObject
        BishBosh.UI.SetObject

    Build-depends:
        array >= 0.5.1.1,
        base >= 4.9 && < 5.0,
        containers,
        data-default,
        deepseq >= 1.4.1,
        extra,
        factory >= 0.3.1,
        filepath,
        hxt,
        mtl,
        process >= 1.6.4,
        random,
        time,
        toolshed >= 0.18

    if impl(ghc >= 7.0)
        if flag(llvm)
            GHC-options:	-fllvm

        if impl(ghc >= 7.4.1)
            GHC-prof-options:	-fprof-auto -fprof-cafs

            if flag(threaded)
                GHC-prof-options:	-fno-prof-count-entries

            if impl(ghc >= 8.0)
                GHC-options:	-Wredundant-constraints
        else
            GHC-prof-options:	-auto-all -caf-all

    if flag(polyparse)
        Build-depends:		polyparse
        CPP-Options:		-DUSE_POLYPARSE=2
        Exposed-modules:	BishBosh.Text.Poly
    else
        Build-depends:		parsec

    if flag(narrownumbers)
        CPP-Options:		-DUSE_NARROW_NUMBERS

    if flag(newtypewrappers)
        CPP-Options:		-DUSE_NEWTYPE_WRAPPERS

    if flag(threaded)
        Build-depends:		parallel >= 3.0
        CPP-Options:		-DUSE_PARALLEL

    if flag(unboxedarrays)
        CPP-Options:		-DUSE_UNBOXED_ARRAYS

Executable bishbosh
    Default-language:	Haskell2010
    GHC-options:	-O2 -Wall -fno-warn-tabs
    Hs-source-dirs:	src-exe
    Main-is:		Main.hs
    Autogen-modules:	Paths_bishbosh

    Other-modules:
        BishBosh.Concurrent.Pondering
        BishBosh.Play
        BishBosh.State.ApplicationTerminationReason
        BishBosh.State.PlayState
        BishBosh.Text.ShowColouredPrefix
        BishBosh.UI.CECP
        BishBosh.UI.Raw
        Paths_bishbosh

    if flag(unix)
        Other-modules:	BishBosh.Concurrent.SignalHandlers

    Build-depends:
        array >= 0.5.1.1,
        base >= 4.9 && < 5.0,
        bishbosh,
        containers,
        data-default,
        deepseq >= 1.4.1,
        directory,
        extra,
        factory >= 0.3.1,
        filepath,
        hxt,
        mtl,
        random,
        toolshed >= 0.18

    if impl(ghc >= 7.0)
        if flag(llvm)
            GHC-options:	-fllvm

        if flag(threaded)
            GHC-options:	-rtsopts "-with-rtsopts=-N -H100M"

        if impl(ghc >= 7.4.1)
            GHC-prof-options:	-fprof-auto -fprof-cafs -rtsopts -with-rtsopts=-H100M

            if flag(threaded)
                GHC-prof-options:	-fno-prof-count-entries

            if impl(ghc >= 8.0)
                GHC-options:	-Wredundant-constraints
        else
            GHC-prof-options:	-auto-all -caf-all

    if flag(hxtrelaxng)
        Build-depends:	hxt-relaxng
        CPP-Options:	-DUSE_HXTRELAXNG

    if flag(narrownumbers)
        CPP-Options:	-DUSE_NARROW_NUMBERS

    if flag(threaded)
        CPP-Options:	-DUSE_PARALLEL
        GHC-options:	-threaded

    if flag(unboxedarrays)
        CPP-Options:	-DUSE_UNBOXED_ARRAYS

-- N.B.: The Haskell package 'unix' may be available on MS-Windows, but building it will probably be laborious.
    if flag(unix)
        Other-modules:	BishBosh.Concurrent.SignalHandlers
        Build-depends:	unix
        CPP-Options:	-DUSE_UNIX

-- This application coordinates a duel between two independently configured instances of 'bishbosh'.
Executable duel
    Default-language:	Haskell2010
    GHC-options:	-O2 -Wall -fno-warn-tabs
    Hs-source-dirs:	src-exe
    Main-is:		Duel.hs
    Autogen-modules:	Paths_bishbosh

    Other-modules:
        Duel.Data.Options
        Duel.IO.Logger
        Duel.Process.Handles
        Duel.Process.Intermediary
        Paths_bishbosh

    Build-depends:
        base >= 4.9 && < 5.0,
        bishbosh,
        containers,
        data-default,
        filepath,
        hxt,
        process >= 1.6.4

    CPP-Options:	-DMOVE_NOTATION='S'

    if impl(ghc >= 7.0)
        if flag(llvm)
            GHC-options:	-fllvm

        if impl(ghc >= 8.0)
            GHC-options:	-Wredundant-constraints

-- Static unit-tests of the library.
Test-Suite hunit-tests
    Default-language:	Haskell2010
    GHC-options:	-Wall -fno-warn-tabs
    Hs-source-dirs:	src-test
    Main-is:		HUnit.hs
    Type:		exitcode-stdio-1.0
    Autogen-modules:	Paths_bishbosh

    Other-modules:
        BishBosh.Test.HUnit.Attribute.Direction
        BishBosh.Test.HUnit.Attribute.LogicalColour
        BishBosh.Test.HUnit.Attribute.Rank
        BishBosh.Test.HUnit.Cartesian.Coordinates
        BishBosh.Test.HUnit.Cartesian.Vector
        BishBosh.Test.HUnit.Component.CastlingMove
        BishBosh.Test.HUnit.Component.Move
        BishBosh.Test.HUnit.Component.Piece
        BishBosh.Test.HUnit.Component.Zobrist
        BishBosh.Test.HUnit.ContextualNotation.PGN
        BishBosh.Test.HUnit.ContextualNotation.PositionHashQualifiedMoveTree
        BishBosh.Test.HUnit.ContextualNotation.StandardAlgebraic
        BishBosh.Test.HUnit.Evaluation.Fitness
        BishBosh.Test.HUnit.Input.Options
        BishBosh.Test.HUnit.Model.Game
        BishBosh.Test.HUnit.Model.GameTree
        BishBosh.Test.HUnit.Model.PositionHashTree
        BishBosh.Test.HUnit.Search.Search
        BishBosh.Test.HUnit.State.Board
        BishBosh.Test.HUnit.Text.AutoComplete
        BishBosh.Test.HUnit.Time.GameClock
        BishBosh.Test.HUnit.Time.StopWatch
        Paths_bishbosh

    Build-depends:
        array >= 0.5.1.1,
        base >= 4.9 && < 5.0,
        bishbosh,
        containers,
        data-default,
        filepath,
        HUnit,
        hxt,
        mtl,
        random,
        toolshed >= 0.18

    if impl(ghc >= 8.0)
        GHC-options:	-Wredundant-constraints

    if flag(polyparse)
        Build-depends:	polyparse
        CPP-Options:	-DUSE_POLYPARSE=2
    else
        Build-depends:	parsec

-- Random unit-tests of the library.
Test-Suite quickcheck-tests
    Default-language:	Haskell2010
    GHC-options:	-Wall -fno-warn-tabs
    Hs-source-dirs:	src-test
    Main-is:		QuickCheck.hs
    Type:		exitcode-stdio-1.0

    Other-modules:
        BishBosh.Test.QuickCheck.Attribute.CaptureMoveSortAlgorithm
        BishBosh.Test.QuickCheck.Attribute.Direction
        BishBosh.Test.QuickCheck.Attribute.LogicalColour
        BishBosh.Test.QuickCheck.Attribute.MoveType
        BishBosh.Test.QuickCheck.Attribute.Rank
        BishBosh.Test.QuickCheck.Cartesian.Coordinates
        BishBosh.Test.QuickCheck.Cartesian.Vector
        BishBosh.Test.QuickCheck.Component.Move
        BishBosh.Test.QuickCheck.Component.Piece
        BishBosh.Test.QuickCheck.Component.QualifiedMove
        BishBosh.Test.QuickCheck.Component.Turn
        BishBosh.Test.QuickCheck.Component.Zobrist
        BishBosh.Test.QuickCheck.ContextualNotation.PGN
        BishBosh.Test.QuickCheck.ContextualNotation.PGNComment
        BishBosh.Test.QuickCheck.ContextualNotation.PositionHashQualifiedMoveTree
        BishBosh.Test.QuickCheck.ContextualNotation.QualifiedMoveForest
        BishBosh.Test.QuickCheck.ContextualNotation.StandardAlgebraic
        BishBosh.Test.QuickCheck.Data.Foldable
        BishBosh.Test.QuickCheck.Data.Integral
        BishBosh.Test.QuickCheck.Evaluation.PositionHashQuantifiedGameTree
        BishBosh.Test.QuickCheck.Input.CECPFeatures
        BishBosh.Test.QuickCheck.Input.CECPOptions
        BishBosh.Test.QuickCheck.Input.CriteriaWeights
        BishBosh.Test.QuickCheck.Input.EvaluationOptions
        BishBosh.Test.QuickCheck.Input.IOOptions
        BishBosh.Test.QuickCheck.Input.NativeUIOptions
        BishBosh.Test.QuickCheck.Input.Options
        BishBosh.Test.QuickCheck.Input.PGNOptions
        BishBosh.Test.QuickCheck.Input.PieceSquareTable
        BishBosh.Test.QuickCheck.Input.RankValues
        BishBosh.Test.QuickCheck.Input.SearchOptions
        BishBosh.Test.QuickCheck.Input.StandardOpeningOptions
        BishBosh.Test.QuickCheck.Input.UIOptions
        BishBosh.Test.QuickCheck.Input.Verbosity
        BishBosh.Test.QuickCheck.Metric.CriterionWeight
        BishBosh.Test.QuickCheck.Metric.RankValue
        BishBosh.Test.QuickCheck.Model.Game
        BishBosh.Test.QuickCheck.Model.GameTree
        BishBosh.Test.QuickCheck.Model.MoveFrequency
        BishBosh.Test.QuickCheck.Notation.ICCFNumeric
        BishBosh.Test.QuickCheck.Notation.MoveNotation
        BishBosh.Test.QuickCheck.Notation.PureCoordinate
        BishBosh.Test.QuickCheck.Notation.Smith
        BishBosh.Test.QuickCheck.Rule.DrawReason
        BishBosh.Test.QuickCheck.Rule.GameTerminationReason
        BishBosh.Test.QuickCheck.Rule.Result
        BishBosh.Test.QuickCheck.Search.KillerMoves
        BishBosh.Test.QuickCheck.Search.Search
        BishBosh.Test.QuickCheck.Search.SearchState
        BishBosh.Test.QuickCheck.State.Board
        BishBosh.Test.QuickCheck.State.CastleableRooksByLogicalColour
        BishBosh.Test.QuickCheck.State.InstancesByPosition
        BishBosh.Test.QuickCheck.State.Position
        BishBosh.Test.QuickCheck.StateProperty.Censor
        BishBosh.Test.QuickCheck.State.TurnsByLogicalColour
        BishBosh.Test.QuickCheck.Text.Encoding
        BishBosh.Test.QuickCheck.Time.StopWatch
        BishBosh.Test.QuickCheck.UI.Command
        BishBosh.Test.QuickCheck.UI.PrintObject
        BishBosh.Test.QuickCheck.UI.ReportObject
        BishBosh.Test.QuickCheck.UI.SetObject

    Build-depends:
        array >= 0.5.1.1,
        base >= 4.9 && < 5.0,
        bishbosh,
        containers,
        data-default,
        deepseq >= 1.4.1,
        extra,
        filepath,
        mtl,
        QuickCheck >= 2.8.2,
        random,
        toolshed >= 0.18

    if impl(ghc >= 8.0)
        GHC-options:	-Wredundant-constraints

    if flag(polyparse)
        Build-depends:	polyparse
        CPP-Options:	-DUSE_POLYPARSE=2
    else
        Build-depends:	parsec

    if flag(threaded)
        CPP-Options:	-DUSE_PARALLEL
        GHC-options:	-threaded