haskell/GLUT: fix "unkown GLUT entry glutInit"

This fixes #17547
This commit is contained in:
Benno Fünfstück 2016-08-06 17:19:18 +02:00
parent 51aee89740
commit 22281009b7
2 changed files with 22 additions and 0 deletions

View File

@ -961,4 +961,14 @@ self: super: {
sha256 = "0xa5b7i9wx32ji0zzlh1a1pws677iffby3bg39kv3c9srdb4by1g";
})];
});
# GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for
# it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config
# depend on freeglut, which provides GHC to necessary information to generate a correct RPATH.
#
# Note: Simply patching the dynamic library (.so) of the GLUT build will *not* work, since the
# RPATH also needs to be propagated when using static linking. GHC automatically handles this for
# us when we patch the cabal file (Link options will be recored in the ghc package registry).
GLUT = addPkgconfigDepend (appendPatch super.GLUT ./patches/GLUT.patch) pkgs.freeglut;
}

View File

@ -0,0 +1,12 @@
diff --git a/GLUT.cabal b/GLUT.cabal
index f370d6c..a404e1e 100644
--- a/GLUT.cabal
+++ b/GLUT.cabal
@@ -103,6 +103,7 @@ library
else
cpp-options: "-DCALLCONV=ccall"
cc-options: "-DUSE_DLSYM"
+ pkgconfig-depends: freeglut
executable BOGLGP01-OnYourOwn1
if !flag(BuildExamples)