[Hackage] #116: Odd paths on Windows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Aug 24 10:18:08 EDT 2007

On Fri, 2007-08-24 at 13:35 +0000, Hackage wrote:
> #116: Odd paths on Windows

>  We should fix this.
>  It's easy to move "\Haskell" into the $prefix rather than where it is
>  currently in the $bindir and $libdir defaults.
>  It's now really easy to change it's all specified clearly in
>  Distribution.Simple.InstallDirs.defaultInstallDirs, we just need to decide
>  what defaults we actually want on Windows.

So the current scheme on windows is:

  windowsProgramFilesDir <- getWindowsProgramFilesDir
  windowsCommonFilesDir  <- getWindowsCommonFilesDir
  let prefixDir    = windowsProgramFilesDir
      binDir       = "$prefix" </> "Haskell" </> "bin"
      libDir       = "$prefix" </> "Haskell"
      libSubdir    = case comp of
           Hugs   -> "hugs" </> "packages" </> "$pkg"
           JHC    -> "$compiler"
           _other -> "$pkgid" </> "$compiler"
      libexecDir   = "$prefix" </> "$pkgid"
      includeDir   = "$libdir" </> "$libsubdir" </> "include"
      dataDir      = if hasLibs then windowsCommonFilesDir
                                else "$prefix" </> "Haskell"
      dataSubdir   = "$pkgid"
      docDir       = "$datadir" </> "doc" </> "$pkgid"
      htmlDir      = "$docdir"  </> "html"

So I'd suggest the following changes:
"Haskell" should be part of the prefix rather than part of the bindir
and libdir. So we'd still get C:\program file\Haskell by default, but if
someone specified --prefix=c:\foobar\ then they'd really get c:\foobar\
not c:\foobar\haskell.

I'd also change the doc dir to be independent of the data dir on windows
(though leave it relative to datadir on unix). This is because on
windows for libraries, the data dir is not relocatable, we use the
windows common files dir. However we don't need to do that for
documentation. However I'm not sure what directory it should go in.

Here's the layout of a standard binary package:

C:\program files\haskell\bin\foo.exe
C:\program files\haskell\foo-1.0\myprogdata.txt

Here's the layout of a standard library package:

C:\program files\haskell\foo-1.0\ghc-6.6.1\libHSfoo.a
C:\program files\haskell\foo-1.0\ghc-6.6.1\HSfoo.o
C:\program files\haskell\foo-1.0\ghc-6.6.1\imports\{lots of hi files}
C:\program files\common files\foo-1.0\mylibdata.txt

where should documentation go?

C:\program files\haskell\doc\html\foo\index.html
C:\program files\haskell\doc\html\foo\foo.haddock

(the \html\foo\foo.haddock subdir bit is not changable, that's where we
put haddock docs relative to the docdir)

and if I were to override the prefix I'd get:


or for a lib

C:\MyPrefix\foo-1.0\ghc-6.6.1\imports\{lots of hi files}
C:\program files\common files\foo-1.0\mylibdata.txt

and docs in:


I think Neil suggested we make it actually the same as unix, so like:

C:\MyPrefix\lib\foo-1.0\ghc-6.6.1\imports\{lots of hi files}
C:\program files\common files\foo-1.0\mylibdata.txt

As I've said, it's easy to change the code in
Distribution.Simple.InstallDirs.defaultInstallDirs we just need to
decide what we want to do.

However, making libraries data files relocatable is not a simple task,
so don't complain about the C:\program files\common files\foo-1.0
\mylibdata.txt anomaly unless you have a good suggestion :-). Also, in
practise few library packages have data files, it's only docs we need to
treat as not being data files on windows.


More information about the cabal-devel mailing list