[GHC] #284: RPM doesn't support --prefix

GHC ghc-devs at haskell.org
Thu Jul 10 05:00:23 UTC 2014


#284: RPM doesn't support --prefix
-------------------------------------+------------------------------------
        Reporter:  skaller           |            Owner:  juhp
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:  ⊥
       Component:  Build System      |          Version:  None
      Resolution:  None              |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:  N/A               |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by ydewit):

 There seems to be two areas that need to be fixed to support relocatable
 installs: the shell wrappers and the .conf files. Both of these set of
 files have absolute paths.

 Regarding the shell wrappers (e.g. $GHC_HOME/bin/{ghc,ghc-
 pkg,ghci,runghc,runhaskell}), we could simply use a slightly different
 scheme. For instance, an alternative for the ghc wrapper:
 {{{
 #!/bin/sh
 GHC_HOME=$( cd $(dirname $0)/.. ; pwd )
 exedir="${GHC_HOME}/lib/ghc-7.8.2/bin"
 exeprog="ghc-stage2"
 executablename="$exedir/$exeprog"
 datadir="${GHC_HOME}/lib"
 bindir="${GHC_HOME}/bin"
 topdir="${GHC_HOME}"
 executablename="$exedir/ghc"
 exec "$executablename" -B"$topdir" ${1+"$@"}
 }}}

 The critical piece is {{{ GHC_HOME=$( cd $(dirname $0)/.. ; pwd ) }}}
 since it needs to work for all supported platforms. Other than that, it is
 pretty straight-forward.

 I see that there is support for a {{{RelocatableBuild}}} variable in
 config.mk, but it is turned on only on Windows:
 {{{
 # On Windows we normally want to make a relocatable bindist, to we
  # ignore flags like libdir
  ifeq "$(Windows_Host)" "YES"
  RelocatableBuild = YES
  else
  RelocatableBuild = NO
  endif
 }}}

 So it seems that we have two different layouts: one for Windows and one
 for everything else:
 {{{
 exec_prefix     = ${prefix}
 bindir          = ${exec_prefix}/bin
 datadir         = ${datarootdir}
 libdir          = ${exec_prefix}/lib
 includedir      = ${prefix}/include
 mandir          = ${datarootdir}/man

 docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
 $(eval $(call set_default,docdir,$${datarootdir}/doc/ghc))

 htmldir = ${docdir}
 dvidir  = ${docdir}
 pdfdir  = ${docdir}
 psdir   = ${docdir}
 $(eval $(call set_default,htmldir,$${docdir}))
 $(eval $(call set_default,dvidir,$${docdir}))
 $(eval $(call set_default,pdfdir,$${docdir}))
 $(eval $(call set_default,psdir,$${docdir}))

 ifeq "$(RelocatableBuild)" "YES"

 # Hack: our directory layouts tend to be different on Windows, so
 # hack around configure's bogus assumptions here.
 datarootdir = $(prefix)
 datadir     = $(prefix)/lib
 libdir      = $(prefix)/lib

 docdir    = $(prefix)/doc
 htmldir   = $(docdir)
 dvidir    = $(docdir)
 pdfdir    = $(docdir)
 psdir     = $(docdir)

 ghclibdir = $(libdir)
 ghcdocdir = $(datarootdir)/doc

 else

 # Unix: override libdir and datadir to put ghc-specific stuff in
 # a subdirectory with the version number included.
 #
 # datadir is set to libdir here as GHC needs package.conf and unlit
 # to be in the same place (and things like ghc-pkg need to agree on
 # where package.conf is, so we just set it globally).
 #
 ghclibdir     = $(libdir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)
 ghcdocdir     = $(datarootdir)/doc/ghc
 endif

 ghclibexecdir = $(ghclibdir)
 topdir        = $(ghclibdir)
 ghcheaderdir  = $(ghclibdir)/include
 }}}

 Why two layouts?

 I also see that the non-windows layout is accounting for cross
 compilation, which is doesn't seem supported in the Windows layout.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/284#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list