git.iko.soy/typeable/nixpkgs
on master help sign in
haskell/GLUT: fix "unkown GLUT entry glutInit"

This fixes #17547

commit22281009b7af633398d3cb315321b83483f884bd authorBenno Fünfstück <benno.fuenfstueck@gmail.com> dateSat 6 Aug 2016, 17:19 (10 years ago) parent51aee89
2 files changed+22
pkgs/development/haskell-modules/configuration-common.nix+10 pkgs/development/haskell-modules/patches/GLUT.patch+12
pkgs/development/haskell-modules/configuration-common.nix+10
@@ -961,4 +961,14 @@ self: super: {
961961 sha256 = "0xa5b7i9wx32ji0zzlh1a1pws677iffby3bg39kv3c9srdb4by1g";
962962 })];
963963 });
964+
965+ # GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for
966+ # it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config
967+ # depend on freeglut, which provides GHC to necessary information to generate a correct RPATH.
968+ #
969+ # Note: Simply patching the dynamic library (.so) of the GLUT build will *not* work, since the
970+ # RPATH also needs to be propagated when using static linking. GHC automatically handles this for
971+ # us when we patch the cabal file (Link options will be recored in the ghc package registry).
972+ GLUT = addPkgconfigDepend (appendPatch super.GLUT ./patches/GLUT.patch) pkgs.freeglut;
973+
964974}
pkgs/development/haskell-modules/patches/GLUT.patchnew file+12
@@ -0,0 +1,12 @@
1+diff --git a/GLUT.cabal b/GLUT.cabal
2+index f370d6c..a404e1e 100644
3+--- a/GLUT.cabal
4++++ b/GLUT.cabal
5+@@ -103,6 +103,7 @@ library
6+ else
7+ cpp-options: "-DCALLCONV=ccall"
8+ cc-options: "-DUSE_DLSYM"
9++ pkgconfig-depends: freeglut
10+
11+ executable BOGLGP01-OnYourOwn1
12+ if !flag(BuildExamples)