···793as shared libraries only, i.e. there is just no static library available that
794Cabal could link!
7950000000000000000000000000000000000000000000000000000000000796797## Other resources
798
···793as shared libraries only, i.e. there is just no static library available that
794Cabal could link!
795796+### Building GHC with integer-simple
797+798+By default GHC implements the Integer type using the
799+[GNU Multiple Precision Arithmetic (GMP) library](https://gmplib.org/).
800+The implementation can be found in the
801+[integer-gmp](http://hackage.haskell.org/package/integer-gmp) package.
802+803+A potential problem with this is that GMP is licensed under the
804+[GNU Lesser General Public License (LGPL)](http://www.gnu.org/copyleft/lesser.html),
805+a kind of "copyleft" license. According to the terms of the LGPL, paragraph 5,
806+you may distribute a program that is designed to be compiled and dynamically
807+linked with the library under the terms of your choice (i.e., commercially) but
808+if your program incorporates portions of the library, if it is linked
809+statically, then your program is a "derivative"--a "work based on the
810+library"--and according to paragraph 2, section c, you "must cause the whole of
811+the work to be licensed" under the terms of the LGPL (including for free).
812+813+The LGPL licensing for GMP is a problem for the overall licensing of binary
814+programs compiled with GHC because most distributions (and builds) of GHC use
815+static libraries. (Dynamic libraries are currently distributed only for OS X.)
816+The LGPL licensing situation may be worse: even though
817+[The Glasgow Haskell Compiler License](https://www.haskell.org/ghc/license)
818+is essentially a "free software" license (BSD3), according to
819+paragraph 2 of the LGPL, GHC must be distributed under the terms of the LGPL!
820+821+To work around these problems GHC can be build with a slower but LGPL-free
822+alternative implemention for Integer called
823+[integer-simple](http://hackage.haskell.org/package/integer-simple).
824+825+To get a GHC compiler build with `integer-simple` instead of `integer-gmp` use
826+the attribute: `pkgs.haskell.compiler.integer-simple."${ghcVersion}"`.
827+For example:
828+829+ $ nix-build -E '(import <nixpkgs> {}).pkgs.haskell.compiler.integer-simple.ghc802'
830+ ...
831+ $ result/bin/ghc-pkg list | grep integer
832+ integer-simple-0.1.1.1
833+834+The following command displays the complete list of GHC compilers build with `integer-simple`:
835+836+ $ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler.integer-simple
837+ haskell.compiler.integer-simple.ghc7102 ghc-7.10.2
838+ haskell.compiler.integer-simple.ghc7103 ghc-7.10.3
839+ haskell.compiler.integer-simple.ghc722 ghc-7.2.2
840+ haskell.compiler.integer-simple.ghc742 ghc-7.4.2
841+ haskell.compiler.integer-simple.ghc763 ghc-7.6.3
842+ haskell.compiler.integer-simple.ghc783 ghc-7.8.3
843+ haskell.compiler.integer-simple.ghc784 ghc-7.8.4
844+ haskell.compiler.integer-simple.ghc801 ghc-8.0.1
845+ haskell.compiler.integer-simple.ghc802 ghc-8.0.2
846+ haskell.compiler.integer-simple.ghcHEAD ghc-8.1.20170106
847+848+To get a package set supporting `integer-simple` use the attribute:
849+`pkgs.haskell.packages.integer-simple."${ghcVersion}"`. For example
850+use the following to get the `scientific` package build with `integer-simple`:
851+852+ $ nix-build -A pkgs.haskell.packages.integer-simple.ghc802.scientific
853+854855## Other resources
856
···25 sha512 = "99cea54b553158c1e08cf19157ac2bb6822fd1fef0501d36f983e6b8d4f2143a2e6124d61297446944033d3fed9326fe0f12ca45db0b5815be71a0777e73ffb0";
26 };
270028 # New sed no longer tolerates this mistake.
29 postPatch = ''
30 for f in mozilla/{js/src,}/configure; do
···25 sha512 = "99cea54b553158c1e08cf19157ac2bb6822fd1fef0501d36f983e6b8d4f2143a2e6124d61297446944033d3fed9326fe0f12ca45db0b5815be71a0777e73ffb0";
26 };
2728+ patches = [ ./gcc6.patch ];
29+30 # New sed no longer tolerates this mistake.
31 postPatch = ''
32 for f in mozilla/{js/src,}/configure; do
···1+2+# HG changeset patch
3+# User Mike Hommey <mh+mozilla@glandium.org>
4+# Date 1457596445 -32400
5+# Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
6+# Parent 27c94617d7064d566c24a42e11cd4c7ef725923d
7+Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
8+9+Our STL wrappers do various different things, one of which is including
10+mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
11+which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
12+circles back to our STL wrapper.
13+14+But of the things our STL wrappers do, including mozalloc.h is not one
15+that is necessary for cstdlib. So skip including mozalloc.h in our
16+cstdlib wrapper.
17+18+Additionally, some C++ sources (in media/mtransport) are including
19+headers in an extern "C" block, which end up including stdlib.h, which
20+ends up including cstdlib because really, this is all C++, and our
21+wrapper pre-includes <new> for mozalloc.h, which fails because templates
22+don't work inside extern "C". So, don't pre-include <new> when we're not
23+including mozalloc.h.
24+25+26+diff --git a/mozilla/config/gcc-stl-wrapper.template.h b/mozilla/config/gcc-stl-wrapper.template.h
27+--- a/mozilla/config/gcc-stl-wrapper.template.h
28++++ b/mozilla/config/gcc-stl-wrapper.template.h
29+@@ -12,33 +12,40 @@
30+ // compiling ObjC.
31+ #if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
32+ # error "STL code can only be used with -fno-exceptions"
33+ #endif
34+35+ // Silence "warning: #include_next is a GCC extension"
36+ #pragma GCC system_header
37+38++// Don't include mozalloc for cstdlib. See bug 1245076.
39++#ifndef moz_dont_include_mozalloc_for_cstdlib
40++# define moz_dont_include_mozalloc_for_cstdlib
41++#endif
42++#ifndef moz_dont_include_mozalloc_for_${HEADER}
43+ // mozalloc.h wants <new>; break the cycle by always explicitly
44+ // including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
45+ //
46+ // `#include_next' does not distinguish between <file> and "file"
47+ // inclusion, nor does it check that the file you specify has the
48+ // same name as the current file. It simply looks for the file
49+ // named, starting with the directory in the search path after the
50+ // one where the current file was found.
51+-#include_next <new>
52++# include_next <new>
53+54+ // See if we're in code that can use mozalloc. NB: this duplicates
55+ // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
56+ // can't build with that being included before base/basictypes.h.
57+-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
58+-# include "mozilla/mozalloc.h"
59+-#else
60+-# error "STL code can only be used with infallible ::operator new()"
61++# if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
62++# include "mozilla/mozalloc.h"
63++# else
64++# error "STL code can only be used with infallible ::operator new()"
65++# endif
66++
67+ #endif
68+69+ #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
70+ // Enable checked iterators and other goodies
71+ //
72+ // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
73+ // Figure out how to resolve this with -fno-rtti. Maybe build with
74+ // -frtti in DEBUG builds?
75+
···16 makeFlagsArray+=(PREFIX="$out" LIBDIRNAME=/lib)
17 '';
1800019 meta = with stdenv.lib; {
20 description = "Report faked system time to programs without having to change the system-wide time";
21 homepage = http://www.code-wizards.com/projects/libfaketime/;
···16 makeFlagsArray+=(PREFIX="$out" LIBDIRNAME=/lib)
17 '';
1819+ # Work around "libfaketime.c:513:7: error: nonnull argument 'buf' compared to NULL [-Werror=nonnull-compare]".
20+ NIX_CFLAGS_COMPILE = "-Wno-nonnull-compare";
21+22 meta = with stdenv.lib; {
23 description = "Report faked system time to programs without having to change the system-wide time";
24 homepage = http://www.code-wizards.com/projects/libfaketime/;
···32 # This is needed, for instance, so that running "ldd" on a binary that is
33 # PaX-marked to disable mprotect doesn't fail with permission denied.
34 ./pt-pax-flags.patch
00000035 ];
3637- outputs = [ "out" "info" ] ++ (optional (cross == null) "dev");
0003839 nativeBuildInputs = [ bison ];
40 buildInputs = [ zlib ];
···32 # This is needed, for instance, so that running "ldd" on a binary that is
33 # PaX-marked to disable mprotect doesn't fail with permission denied.
34 ./pt-pax-flags.patch
35+36+ # Bfd looks in BINDIR/../lib for some plugins that don't
37+ # exist. This is pointless (since users can't install plugins
38+ # there) and causes a cycle between the lib and bin outputs, so
39+ # get rid of it.
40+ ./no-plugins.patch
41 ];
4243+ outputs = [ "out" ]
44+ ++ optional (!stdenv.isDarwin) "lib" # problems in Darwin stdenv
45+ ++ [ "info" ]
46+ ++ optional (cross == null) "dev";
4748 nativeBuildInputs = [ bison ];
49 buildInputs = [ zlib ];
···3031 # Note: we don't add elfutils to buildInputs, since it provides a
32 # bad `ld' and other stuff.
33- NIX_CFLAGS_COMPILE = "-Wno-error=cpp -Wno-error=bool-compare -Wno-error=deprecated-declarations";
0000003435 installFlags = "install install-man ASCIIDOC8=1";
36
···3031 # Note: we don't add elfutils to buildInputs, since it provides a
32 # bad `ld' and other stuff.
33+ NIX_CFLAGS_COMPILE = [
34+ "-Wno-error=cpp" "-Wno-error=bool-compare" "-Wno-error=deprecated-declarations"
35+ ]
36+ # gcc before 6 doesn't know these options
37+ ++ stdenv.lib.optionals (hasPrefix "gcc-6" stdenv.cc.cc.name) [
38+ "-Wno-error=unused-const-variable" "-Wno-error=misleading-indentation"
39+ ];
4041 installFlags = "install install-man ASCIIDOC8=1";
42