git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #624 - remove xdg-basedir dependency, simplify build.
commit7bad2aef096fb344c2b93d7b2a3758483fb540c0 authorPhil Freeman <paf31@cantab.net> dateTue 14 Oct 2014, 22:31 (12 years ago) parente070c0e
4 files changed+11−46
Setup.hs+1−33 psci/Main.hs+5−2 purescript.cabal+3−3 src/Language/PureScript.hs+2−8
Setup.hs+1−33
@@ -1,38 +1,6 @@
1−{-# LANGUAGE CPP #-}
2−
3−#ifndef POSIX_LIKE
4−#define POSIX_LIKE !(defined(_WIN32_HOST_OS) || defined(_WIN64_HOST_OS)) && \
5− (defined(unix_HOST_OS) || defined(__unix___HOST_OS) || \
6− defined(__unix_HOST_OS) || defined(linux_HOST_OS) || \
7− defined(__linux___HOST_OS) || defined(__linux_HOST_OS) || \
8− (defined(__APPLE___HOST_OS) && defined(__MACH___HOST_OS)))
9−#endif
10−
111module Main where
122
13−import Control.Monad
14−
15−import Distribution.PackageDescription
163import Distribution.Simple
17−import Distribution.Simple.LocalBuildInfo
18−import Distribution.Simple.Setup
19−
20−import System.Directory
21−import System.Environment.XDG.BaseDir
22−#if POSIX_LIKE
23−import System.Posix.Files
24−#endif
254
265main :: IO ()
27−main = defaultMainWithHooks $ simpleUserHooks {postInst = setupXDG}
28−
29−setupXDG :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
30−setupXDG _ _ _ _ = do
31− configDir <- getUserConfigDir "purescript"
32− configExists <- doesDirectoryExist configDir
33− unless configExists $ do
34− createDirectoryIfMissing True configDir
35−#if POSIX_LIKE
36− setFileMode configDir ownerModes
37−#endif
38−#undef POSIX_LIKE
6+main = defaultMain
psci/Main.hs+5−2
@@ -43,7 +43,6 @@ import System.Directory
4343 findExecutable, getHomeDirectory, getCurrentDirectory)
4444import System.Process (readProcessWithExitCode)
4545import System.Exit
46−import System.Environment.XDG.BaseDir
4746import System.FilePath
4847 (pathSeparator, takeDirectory, (</>), isPathSeparator)
4948import qualified System.Console.CmdTheLine as Cmd
@@ -114,7 +113,11 @@ findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
114113-- Grabs the filename where the history is stored.
115114--
116115getHistoryFilename :: IO FilePath
117−getHistoryFilename = getUserConfigFile "purescript" "psci_history"
116+getHistoryFilename = do
117+ home <- getHomeDirectory
118+ let filename = home </> ".purescript" </> "psci_history"
119+ mkdirp filename
120+ return filename
118121
119122-- |
120123-- Loads a file for use with imports.
purescript.cabal+3−3
@@ -1,7 +1,7 @@
11name: purescript
22version: 0.5.6.3
33cabal-version: >=1.8
4−build-type: Custom
4+build-type: Simple
55license: MIT
66license-file: LICENSE
77copyright: (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
@@ -30,7 +30,7 @@ library
3030 transformers >= 0.3 && < 0.5, utf8-string -any,
3131 pattern-arrows >= 0.0.2 && < 0.1,
3232 monad-unify >= 0.2.2 && < 0.3,
33− xdg-basedir -any, time -any
33+ time -any
3434 if (!os(windows))
3535 build-depends: unix -any
3636 exposed-modules: Language.PureScript
@@ -115,7 +115,7 @@ executable psci
115115 build-depends: base >=4 && <5, containers -any, directory -any, filepath -any,
116116 mtl -any, parsec -any, haskeline >= 0.7.0.0, purescript -any,
117117 transformers -any, utf8-string -any, process -any,
118− xdg-basedir -any, cmdtheline -any
118+ cmdtheline -any
119119 main-is: Main.hs
120120 buildable: True
121121 hs-source-dirs: psci
src/Language/PureScript.hs+2−8
@@ -51,7 +51,6 @@ import qualified Data.Set as S
5151
5252import System.FilePath ((</>), pathSeparator)
5353import System.Directory (getHomeDirectory, doesFileExist)
54−import System.Environment.XDG.BaseDir (getUserConfigDir)
5554
5655-- |
5756-- Compile a collection of modules
@@ -272,16 +271,11 @@ importPrelude = addDefaultImport (ModuleName [ProperName C.prelude])
272271
273272preludeFilename :: IO FilePath
274273preludeFilename = fromMaybe missingPrelude . listToMaybe <$> do
275− fs <- sequence [xdsPrelude, homePrelude, cabalPrelude]
274+ fs <- sequence [homePrelude, cabalPrelude]
276275 filterM doesFileExist fs
277276 where
278277 missingPrelude :: FilePath
279− missingPrelude = error "No Prelude found in user home, XDS user config directory or cabal path."
280−
281− xdsPrelude :: IO FilePath
282− xdsPrelude = do
283− configDir <- getUserConfigDir "purescript"
284− return $ configDir </> "prelude" </> "prelude.purs"
278+ missingPrelude = error "No Prelude found in user home or cabal path."
285279
286280 homePrelude :: IO FilePath
287281 homePrelude = do