Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
064996dd
Commit
064996dd
authored
Jun 13, 2004
by
ijones
Browse files
fixed pathSeparator typo, moved to pathJoin (rather than ++pathSeparatorString)
parent
95380127
Changes
6
Hide whitespace changes
Inline
Side-by-side
Distribution/Package.hs
View file @
064996dd
...
...
@@ -109,7 +109,7 @@ emptyPackageDescription
allModules
=
[]
,
mainModules
=
[]
,
cSources
=
[]
,
hsSourceDir
=
"."
,
hsSourceDir
=
"."
,
-- FIX: FileUtils.currentDir
exposedModules
=
[]
,
extensions
=
[]
,
extraLibs
=
[]
,
...
...
Distribution/Simple.hs
View file @
064996dd
...
...
@@ -62,7 +62,7 @@ import Distribution.Simple.Register ( register, unregister )
import
Distribution.Simple.Configure
(
LocalBuildInfo
(
..
),
getPersistBuildConfig
,
configure
,
writePersistBuildConfig
)
import
Distribution.Simple.Install
(
install
)
import
Distribution.Simple.Utils
(
die
,
path
SeperatorStr
)
import
Distribution.Simple.Utils
(
die
,
path
Join
)
import
Distribution.Misc
(
License
(
..
))
import
Distribution.Version
(
Version
(
..
))
...
...
@@ -90,8 +90,8 @@ defaultMain :: PackageDescription -> IO ()
defaultMain
pkg_descr
=
do
args
<-
getArgs
let
distPref
=
"dist"
let
buildPref
=
distPref
++
pathSeperatorStr
++
"build"
let
srcPref
=
distPref
++
pathSeperatorStr
++
"src"
let
buildPref
=
pathJoin
[
distPref
,
"build"
]
let
srcPref
=
pathJoin
[
distPref
,
"src"
]
case
parseArgs
args
of
Right
(
HelpCmd
,
_
)
->
hPutStr
stderr
(
optionHelpString
helpprefix
)
...
...
Distribution/Simple/Build.hs
View file @
064996dd
...
...
@@ -53,8 +53,8 @@ import Distribution.Package (PackageDescription(..), showPackageId)
import
Distribution.Simple.Configure
(
LocalBuildInfo
,
compiler
)
import
Distribution.Simple.Utils
(
rawSystemExit
,
setupMessage
,
die
,
rawSystemPathExit
,
pathSeperatorStr
,
split
,
createIfNotExists
,
mkLibName
,
moveSources
split
,
createIfNotExists
,
mkLibName
,
moveSources
,
pathJoin
)
...
...
@@ -104,7 +104,7 @@ buildGHC pref pkg_descr lbi = do
-- now, build the library
let
objs
=
map
(
++
objsuffix
)
(
map
dotToSep
(
allModules
pkg_descr
))
lib
=
mkLibName
pref
(
showPackageId
(
package
pkg_descr
))
rawSystemPathExit
"ar"
([
"q"
,
lib
]
++
(
map
((
pref
++
pathSeperatorStr
)
++
)
objs
)
)
rawSystemPathExit
"ar"
([
"q"
,
lib
]
++
[
pathJoin
[
pref
,
x
]
|
x
<-
objs
]
)
constructGHCCmdLine
::
FilePath
->
PackageDescription
->
LocalBuildInfo
->
[
String
]
constructGHCCmdLine
pref
pkg_descr
_
=
...
...
@@ -130,7 +130,7 @@ objsuffix = ".o"
#
endif
dotToSep
::
String
->
String
dotToSep
s
=
concat
$
intersperse
pathSeperatorStr
(
split
'.'
s
)
dotToSep
s
=
pathJoin
(
split
'.'
s
)
-- |Copy and (possibly) preprocess sources from hsSourceDirs
preprocessSources
::
PackageDescription
...
...
Distribution/Simple/Install.hs
View file @
064996dd
...
...
@@ -53,7 +53,7 @@ module Distribution.Simple.Install (
import
Distribution.Package
(
PackageDescription
(
..
),
showPackageId
)
import
Distribution.Simple.Configure
(
LocalBuildInfo
(
..
))
import
Distribution.Simple.Utils
(
setupMessage
,
moveSources
,
pathSeperatorStr
,
mkLibName
,
pathJoin
,
mkLibName
,
pathJoin
,
copyFile
,
die
)
import
Distribution.Setup
(
CompilerFlavor
(
..
),
Compiler
(
..
))
...
...
Distribution/Simple/SrcDist.hs
View file @
064996dd
...
...
@@ -49,7 +49,7 @@ module Distribution.Simple.SrcDist (
import
Distribution.Package
(
PackageDescription
(
..
),
showPackageId
)
import
Distribution.Simple.Configure
(
LocalBuildInfo
)
import
Distribution.Simple.Utils
(
setupMessage
,
moveSources
,
pathSeperatorStr
,
die
)
import
Distribution.Simple.Utils
(
setupMessage
,
moveSources
,
die
,
pathJoin
)
import
Control.Monad
(
when
)
import
System.Cmd
(
system
)
...
...
@@ -68,10 +68,10 @@ sdist srcPref targetPref pkg_descr _ = do
setupMessage
"Building source dist for"
pkg_descr
ex
<-
doesDirectoryExist
srcPref
when
ex
(
die
$
"Source distribution already in place. please move: "
++
srcPref
)
moveSources
""
(
srcPref
++
pathSeperatorStr
++
nameVersion
pkg_descr
)
moveSources
""
(
pathJoin
[
srcPref
,
nameVersion
pkg_descr
]
)
(
allModules
pkg_descr
)
(
mainModules
pkg_descr
)
[
"lhs"
,
"hs"
]
system
$
"tar --directory="
++
srcPref
++
" -zcf "
++
targetPref
++
pathSeperatorStr
++
(
tarBallName
pkg_descr
)
system
$
"tar --directory="
++
srcPref
++
" -zcf "
++
(
pathJoin
[
targetPref
,
tarBallName
pkg_descr
]
)
++
" "
++
(
nameVersion
pkg_descr
)
system
$
"rm -rf "
++
srcPref
putStrLn
"Source tarball created."
...
...
Distribution/Simple/Utils.hs
View file @
064996dd
...
...
@@ -46,7 +46,7 @@ module Distribution.Simple.Utils (
splitFilenameDir
,
split
,
isPathSeparator
,
pathSep
e
ratorStr
,
pathSep
a
ratorStr
,
setupMessage
,
die
,
findBinary
,
...
...
@@ -179,11 +179,15 @@ rawSystemPathExit prog args = do
-- |FIX: Do we actually have to make something differnet for windows,
-- or does this work?
pathSeperator
::
Char
pathSeperator
=
'/'
pathSeparator
::
Char
#
ifdef
mingw32_TARGET_OS
pathSeparator
=
'
\\
'
#
else
pathSeparator
=
'/'
#
endif
pathSep
e
ratorStr
::
String
pathSep
e
ratorStr
=
[
pathSep
e
rator
]
pathSep
a
ratorStr
::
String
pathSep
a
ratorStr
=
[
pathSep
a
rator
]
createIfNotExists
::
Bool
-- ^Create its parents too?
->
FilePath
-- ^The path to the directory you want to make
...
...
@@ -204,8 +208,7 @@ createDirectoryParents file
-- |Get this path and all its parents.
pathInits
::
FilePath
->
[
FilePath
]
pathInits
path
=
map
(
concat
.
intersperse
pathSeperatorStr
)
(
inits
$
mySplit
pathSeperator
path
)
=
map
pathJoin
(
inits
$
mySplit
pathSeparator
path
)
-- |Give a list of lists breaking apart elements who match the given criteria
...
...
@@ -220,14 +223,14 @@ mySplit a l = let (upto, rest) = break (== a) l
-- Foo/Bar.lhs into Foo
removeFilename
::
FilePath
->
FilePath
removeFilename
path
=
case
findIndices
(
==
pathSep
e
rator
)
path
of
=
case
findIndices
(
==
pathSep
a
rator
)
path
of
[]
->
path
l
->
fst
$
splitAt
(
maximum
l
)
path
-- |If this filename doesn't end in the path separator, add it.
maybeAddSep
::
FilePath
->
FilePath
maybeAddSep
[]
=
[]
maybeAddSep
p
=
if
last
p
==
pathSep
e
rator
then
p
else
p
++
pathSep
e
ratorStr
maybeAddSep
p
=
if
last
p
==
pathSep
a
rator
then
p
else
p
++
pathSep
a
ratorStr
-- |Get the file path for this particular module. In the IO monad
-- because it looks for the actual file. Might eventually interface
...
...
@@ -255,8 +258,7 @@ moduleToPossiblePaths searchPref s possibleSuffixes
=
let
splitted
=
mySplit
'.'
s
lastElem
=
last
splitted
pref
=
if
(
not
$
null
$
init
splitted
)
then
concat
(
intersperse
pathSeperatorStr
(
init
splitted
))
++
pathSeperatorStr
then
maybeAddSep
(
pathJoin
(
init
splitted
))
else
""
in
[(
maybeAddSep
searchPref
)
++
pref
++
x
|
x
<-
map
(
lastElem
++
)
(
map
(
"."
++
)
possibleSuffixes
)]
...
...
@@ -298,11 +300,11 @@ moveSources pref _targetDir sources mains searchSuffixes
mkLibName
::
FilePath
-- ^file Prefix
->
String
-- ^library name.
->
String
mkLibName
pref
lib
=
p
ref
++
pathSeperatorStr
++
"libHS"
++
lib
++
".a"
mkLibName
pref
lib
=
p
athJoin
[
pref
,
(
"libHS"
++
lib
++
".a"
)]
-- | Create a path from a list of path elements
pathJoin
::
[
String
]
->
FilePath
pathJoin
=
concat
.
intersperse
pathSep
e
ratorStr
pathJoin
=
concat
.
intersperse
pathSep
a
ratorStr
-- FIX: does not preserve dates, does not set permissions
copyFile
::
FilePath
->
FilePath
->
IO
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment