about summary refs log tree commit diff
path: root/pkgs/development/libraries/gts/default.nix
diff options
context:
space:
mode:
authorChristian Kampka <christian@kampka.net>2020-09-02 17:04:41 +0200
committerChristian Kampka <christian@kampka.net>2020-09-02 17:04:41 +0200
commitb935375becd5334720cf375d7a5773f4e343ea8e (patch)
treec9ea6e23f5fb93dadba0fae755b54bbc3f326c0f /pkgs/development/libraries/gts/default.nix
parentef55e4b525e4038419026476dfc9df36df2c821f (diff)
gts: Fix cross compilation
gts generate binaries during the build process that are used during the
build process. When building cross-platform, these binaries are not
executable as they are built with for the target platform instead of the
host platform. The boostrap build introduced here will first build gts
natively and then cross-platform, using the native binaries in the
cross-build.
Diffstat (limited to 'pkgs/development/libraries/gts/default.nix')
-rw-r--r--pkgs/development/libraries/gts/default.nix18
1 files changed, 16 insertions, 2 deletions
diff --git a/pkgs/development/libraries/gts/default.nix b/pkgs/development/libraries/gts/default.nix
index adf914369cf50..48bdfc9b5e1b2 100644
--- a/pkgs/development/libraries/gts/default.nix
+++ b/pkgs/development/libraries/gts/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, pkgconfig, autoreconfHook, gettext, glib }:
+{ fetchurl, stdenv, pkgconfig, autoreconfHook, gettext, glib, buildPackages }:
 
 
 stdenv.mkDerivation rec {
@@ -12,12 +12,26 @@ stdenv.mkDerivation rec {
     sha256 = "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705";
   };
 
-  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  nativeBuildInputs = [
+    pkgconfig
+    autoreconfHook
+    glib  # required to satisfy AM_PATH_GLIB_2_0
+  ];
   buildInputs = [ gettext ];
   propagatedBuildInputs = [ glib ];
 
   doCheck = false; # fails with "permission denied"
 
+  preBuild = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    pushd src
+    make CC=${buildPackages.stdenv.cc}/bin/cc predicates_init
+    mv predicates_init predicates_init_build
+    make clean
+    popd
+
+    substituteInPlace src/Makefile --replace "./predicates_init" "./predicates_init_build"
+  '';
+
   meta = {
     homepage = "http://gts.sourceforge.net/";
     license = stdenv.lib.licenses.lgpl2Plus;