about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorBenno Fünfstück <benno.fuenfstueck@gmail.com>2016-08-06 17:19:18 +0200
committerBenno Fünfstück <benno.fuenfstueck@gmail.com>2016-08-06 17:21:12 +0200
commit22281009b7af633398d3cb315321b83483f884bd (patch)
tree984748dc95f21554ed24783cafc53228659126cd /pkgs
parent51aee897403134981a5878aec2c4c7e0bcbd02bc (diff)
downloadnixlib-22281009b7af633398d3cb315321b83483f884bd.tar
nixlib-22281009b7af633398d3cb315321b83483f884bd.tar.gz
nixlib-22281009b7af633398d3cb315321b83483f884bd.tar.bz2
nixlib-22281009b7af633398d3cb315321b83483f884bd.tar.lz
nixlib-22281009b7af633398d3cb315321b83483f884bd.tar.xz
nixlib-22281009b7af633398d3cb315321b83483f884bd.tar.zst
nixlib-22281009b7af633398d3cb315321b83483f884bd.zip
haskell/GLUT: fix "unkown GLUT entry glutInit"
This fixes #17547
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix10
-rw-r--r--pkgs/development/haskell-modules/patches/GLUT.patch12
2 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 53d810372a44..4499f260d60d 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -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;
+
 }
diff --git a/pkgs/development/haskell-modules/patches/GLUT.patch b/pkgs/development/haskell-modules/patches/GLUT.patch
new file mode 100644
index 000000000000..3025812213bc
--- /dev/null
+++ b/pkgs/development/haskell-modules/patches/GLUT.patch
@@ -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)