Skip to content
  • Thomas Miedema's avatar
    Strip libraries at install/copy time. Never strip libraries in build directory. · 7ef72b31
    Thomas Miedema authored
    Two changes:
    
      * strip static libraries (.a files) at install/copy time, instead of
        at build time. Note that Cabal strips shared libraries (.so files)
        and executables at install/copy time also.
    
        This is needed for GHC, because it uses Cabal (via ghc-cabal copy)
        to install the boot libraries, and relies on Cabal to take of
        library stripping. Currently .so files indeed get properly stripped,
        but .a files do not.
    
        (Stripping static libraries at build time was introduced in
        60409cb9, with the explanation:
        "Call 'stripLib' from createLibArchive so that it's done only
        once.")
    
        This bug (if you want to call it that) partially explains the
        difference in size of a GHC installation before and after manual
        stripping, reported in
        https://github.com/haskell/cabal/issues/1622#issuecomment-62076817
        (The other parts are that the GHC build system currently doesn't
        strip executables on installation:
        https://ghc.haskell.org/trac/ghc/ticket/9087, and neither are the
        RTS library stripped, since they don't go through Cabal).
    
      * never strip the copy of a library in the build directory. Only
        strip the copy that is installed. Note that Cabal never strips
        executables in the build directory either.
    
        This might speed up compilation of a package under development,
        since stripping won't be performed for every 'cabal build'. It is
        also consistent with the GNU coding standards for 'install-strip':
    
          "install-strip should not strip the executables in the build
          directory which are being copied for installation. It should only
          strip the copies that are installed."
    
        Source:
        http://www.gnu.org/prep/standards/html_node/Standard-Targets.html
    7ef72b31