<commit_before>module Settings.Packages.Rts (
    rtsPackageArgs, rtsConfIn, rtsConf, rtsLibffiLibraryName
    ) where

import Base
import Expression
import GHC (rts)
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates (builder, builderGcc, builderGhc, package, file)
import Settings
import Settings.Builders.Common

rtsConfIn :: FilePath
rtsConfIn = pkgPath rts -/- "package.conf.in"

-- TODO: move to buildRootPath, see #113
rtsConf :: FilePath
rtsConf = pkgPath rts -/- targetDirectory Stage1 rts -/- "package.conf.inplace"

rtsLibffiLibraryName :: Action FilePath
rtsLibffiLibraryName = do
    use_system_ffi <- flag UseSystemFfi
    windows <- windowsHost
    case (use_system_ffi, windows) of
      (True, False) -> return "ffi"
      (False, False) -> return "Cffi"
      (_, True) -> return "Cffi-6"
      (_, _) -> error "Unsupported FFI library configuration case"


rtsPackageArgs :: Args
rtsPackageArgs = package rts ? do
    let yesNo = lift . fmap (\x -> if x then "YES" else "NO")
    projectVersion <- getSetting ProjectVersion
    hostPlatform   <- getSetting HostPlatform
    hostArch       <- getSetting HostArch
    hostOs         <- getSetting HostOs
    hostVendor     <- getSetting HostVendor
    buildPlatform  <- getSetting BuildPlatform
    buildArch      <- getSetting BuildArch
    buildOs        <- getSetting BuildOs
    buildVendor    <- getSetting BuildVendor
    targetPlatform <- getSetting TargetPlatform
    targetArch     <- getSetting TargetArch
    targetOs       <- getSetting TargetOs
    targetVendor   <- getSetting TargetVendor
    ghcUnreg       <- yesNo $ flag GhcUnregisterised
    ghcEnableTNC   <- yesNo ghcEnableTablesNextToCode
    way            <- getWay
    path           <- getTargetPath
    top            <- getTopDirectory
    libffiName     <- lift $ rtsLibffiLibraryName
    ffiIncludeDir  <- getSetting FfiIncludeDir
    ffiLibraryDir  <- getSetting FfiLibDir
    mconcat
        [ builderGcc ? mconcat
          [ arg "-Irts"<commit_msg>Drop redundant case.<commit_after>module Settings.Packages.Rts (
    rtsPackageArgs, rtsConfIn, rtsConf, rtsLibffiLibraryName
    ) where

import Base
import Expression
import GHC (rts)
import Oracles.Config.Flag
import Oracles.Config.Setting
import Predicates (builder, builderGcc, builderGhc, package, file)
import Settings
import Settings.Builders.Common

rtsConfIn :: FilePath
rtsConfIn = pkgPath rts -/- "package.conf.in"

-- TODO: move to buildRootPath, see #113
rtsConf :: FilePath
rtsConf = pkgPath rts -/- targetDirectory Stage1 rts -/- "package.conf.inplace"

rtsLibffiLibraryName :: Action FilePath
rtsLibffiLibraryName = do
    use_system_ffi <- flag UseSystemFfi
    windows <- windowsHost
    case (use_system_ffi, windows) of
      (True , False) -> return "ffi"
      (False, False) -> return "Cffi"
      (_    , True ) -> return "Cffi-6"

rtsPackageArgs :: Args
rtsPackageArgs = package rts ? do
    let yesNo = lift . fmap (\x -> if x then "YES" else "NO")
    projectVersion <- getSetting ProjectVersion
    hostPlatform   <- getSetting HostPlatform
    hostArch       <- getSetting HostArch
    hostOs         <- getSetting HostOs
    hostVendor     <- getSetting HostVendor
    buildPlatform  <- getSetting BuildPlatform
    buildArch      <- getSetting BuildArch
    buildOs        <- getSetting BuildOs
    buildVendor    <- getSetting BuildVendor
    targetPlatform <- getSetting TargetPlatform
    targetArch     <- getSetting TargetArch
    targetOs       <- getSetting TargetOs
    targetVendor   <- getSetting TargetVendor
    ghcUnreg       <- yesNo $ flag GhcUnregisterised
    ghcEnableTNC   <- yesNo ghcEnableTablesNextToCode
    way            <- getWay
    path           <- getTargetPath
    top            <- getTopDirectory
    libffiName     <- lift $ rtsLibffiLibraryName
    ffiIncludeDir  <- getSetting FfiIncludeDir
    ffiLibraryDir  <- getSetting FfiLibDir
    mconcat
        [ builderGcc ? mconcat
          [ arg "-Irts"
{'fraction_non_alphanumeric': 0.07667251315459785, 'fraction_numerical': 0.0025056376847907794, 'mean_word_length': 2.8274209012464047, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3923700', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1185, 'n_words': 323}