Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 658396 - haskell-cabal.eclass (ghc) should allow to build non-dynamic executable
Summary: haskell-cabal.eclass (ghc) should allow to build non-dynamic executable
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-18 12:23 UTC by Peter Valach
Modified: 2018-06-20 20:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Valach 2018-06-18 12:23:47 UTC
If GHC supports shared libraries, it always builds "dynamic" executable (small binary with lots of libraries in lib/ghc...), by adding --enable-shared and--enable-executable-dynamic configure flags. You can add new configure flags using CABAL_EXTRA_CONFIGURE_FLAGS but (AFAIK) these cannot be removed except by editing eclass itself - if you comment them out (lines 361 to 375 in current haskell-cabal.eclass file) it builds a standalone binary like before.

Please add some way to do this in configuration (like new variable in make.conf or use-flag).

We use only one haskell app (darcs) and since compile takes a lot of time and requires hundreds of megabytes of diskspace (ghc+deps), we do it only on one computer and copy the resulting binary to all others.
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2018-06-19 06:15:45 UTC
haskell-cabal.eclass has CABAL_EXTRA_CONFIGURE_FLAGS variable (also has a 'man haskell-cabal.eclass' entry).

You can add
    CABAL_EXTRA_CONFIGURE_FLAGS=--disable-executable-dynamic
to make.conf (or use it through package.env)

    $ CABAL_EXTRA_CONFIGURE_FLAGS=--disable-executable-dynamic ebuild darcs-2.14.0.ebuild clean install
    $ ldd /tmp/portage/dev-vcs/darcs-2.14.0/image/usr/bin/darcs 
        linux-vdso.so.1 (0x00007ffc9cbe6000)
        libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007fc73948d000)
        libz.so.1 => /lib64/libz.so.1 (0x00007fc739276000)
        libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007fc739008000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc738de8000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fc738be0000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fc7389dc000)
        libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007fc738765000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fc7383d4000)
        libffi.so.6 => /usr/lib64/libffi.so.6 (0x00007fc7381cb000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fc737e02000)
        libssl.so.1.0.0 => /usr/lib64/libssl.so.1.0.0 (0x00007fc737b94000)
        libcrypto.so.1.0.0 => /usr/lib64/libcrypto.so.1.0.0 (0x00007fc73775a000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc7396fe000)
Is it good enough?

Note: you will have to sort out transitive closure of dynamic non-haskell depends on your own.

Disabling shared libraries completely is harder as template-haskell support really needs dynamic libraries if ghc itself is linked dynamically (default in gentoo).
Comment 2 Peter Valach 2018-06-20 11:40:40 UTC
I didn't think "conflicting" configure flags are possible, but obviously the last one has priority, so your suggestion works and does what I need; thank you very much and sorry for wasting your time.

I close this as resolved/invalid, if some other status should be used please update it :).
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2018-06-20 20:42:56 UTC
INVALID status is fine.

In gentoo EXTRA* variables are for users to override default (eclass/ebuild) behaviour.

EXTRA* are never supposed to be set by ebuilds directly and always available for users. Perhaps we should advertise it a bit more in 'man haskell-cabal.eclass' with more useful examples.

Examples I modelled after are EXTRA_ECONF (-> CABAL_EXTRA_CONFIGURE_FLAGS) and EXTRA_EMAKE (-> CABAL_EXTRA_BUILD_FLAGS).