<commit_before>import Data.List                          (foldl', intercalate, nub)
import Data.Maybe                         (fromJust)
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo, localPkgDescr)
import Distribution.Simple.Setup          (ConfigFlags)
import System.Cmd                         (system)
import System.FilePath.Posix              ((</>), (<.>))
import System.Directory                   (createDirectoryIfMissing)
import System.Info                        (os)
import System.Process                     (readProcess)

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

main :: IO ()
main = defaultMainWithHooks simpleUserHooks { confHook = myConfHook }

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

sourceDirectory  :: FilePath
eiffelDirectory  :: FilePath
includeDirectory :: FilePath
wxcoreDirectory  :: FilePath

sourceDirectory  = "src"
eiffelDirectory  = sourceDirectory </> "eiffel"
includeDirectory = sourceDirectory </> "include"
wxcoreDirectory  = sourceDirectory </> "haskell/Graphics/UI/WXCore"

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

wxcoreIncludeFile :: FilePath
wxcoreIncludeFile = includeDirectory </> "wxc.h"

eiffelFiles :: [FilePath]
eiffelFiles =
    map ((<.> "e") . (eiffelDirectory </>)) names
  where
    names = ["wxc_defs", "wx_defs", "stc"]

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- Comment out type signature because of a Cabal API change from 1.6 to 1.7
myConfHook (pkg0, pbi) flags = do
    createDirectoryIfMissing True wxcoreDirectory
    system $ "wxdirect -t --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    system $ "wxdirect -i --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    system $ "wxdirect -c --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    system $ "wxdirect -d --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ intercalate " " eiffelFiles

    ver <- fmap (head . drop 1 . splitBy (== '.')) (readProcess "wx-config" ["--version"] "")
    let extra_wx_libs = if os == "mingw32"
                        then [ "-lwxmsw28ud_media", "-lwxmsw28ud_richtext", "-lwxmsw28ud_aui"<commit_msg>Comment out unused ver variable in wxcore/Setup.hs<commit_after>import Data.List                          (foldl', intercalate, nub)
import Data.Maybe                         (fromJust)
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo, localPkgDescr)
import Distribution.Simple.Setup          (ConfigFlags)
import System.Cmd                         (system)
import System.FilePath.Posix              ((</>), (<.>))
import System.Directory                   (createDirectoryIfMissing)
import System.Info                        (os)
import System.Process                     (readProcess)

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

main :: IO ()
main = defaultMainWithHooks simpleUserHooks { confHook = myConfHook }

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

sourceDirectory  :: FilePath
eiffelDirectory  :: FilePath
includeDirectory :: FilePath
wxcoreDirectory  :: FilePath

sourceDirectory  = "src"
eiffelDirectory  = sourceDirectory </> "eiffel"
includeDirectory = sourceDirectory </> "include"
wxcoreDirectory  = sourceDirectory </> "haskell/Graphics/UI/WXCore"

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

wxcoreIncludeFile :: FilePath
wxcoreIncludeFile = includeDirectory </> "wxc.h"

eiffelFiles :: [FilePath]
eiffelFiles =
    map ((<.> "e") . (eiffelDirectory </>)) names
  where
    names = ["wxc_defs", "wx_defs", "stc"]

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- Comment out type signature because of a Cabal API change from 1.6 to 1.7
myConfHook (pkg0, pbi) flags = do
    createDirectoryIfMissing True wxcoreDirectory
    system $ "wxdirect -t --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    system $ "wxdirect -i --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    system $ "wxdirect -c --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    system $ "wxdirect -d --wxc " ++ sourceDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ intercalate " " eiffelFiles

    -- ver <- fmap (head . drop 1 . splitBy (== '.')) (readProcess "wx-config" ["--version"] "")
    let extra_wx_libs = if os == "mingw32"
                        then [ "-lwxmsw28ud_media", "-lwxmsw28ud_richtext", "-lwxmsw28ud_aui"
{'fraction_non_alphanumeric': 0.18286445012787725, 'fraction_numerical': 0.005967604433077579, 'mean_word_length': 2.043450064850843, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, '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': '4069941', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1402, 'n_words': 303}