summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin <colin@uninsane.org>2023-12-21 00:56:11 +0000
committerColin <colin@uninsane.org>2023-12-21 00:56:13 +0000
commit8114d5dabbf5f4f1e8c370b889d4f2986b63998b (patch)
tree0cf901ef2a5f7e7d6d64b0184af9345cf5717e28
parent7c33cd6bf01cf09f77bfdf6741cddfffa2cd5640 (diff)
argyllcms: support cross compilation
this could probably be done without an emulator -- by injecting the buildPackages cc wherever argyllcms uses the "GenFile" pattern, but this would require much more involved patching.
-rw-r--r--pkgs/tools/graphics/argyllcms/default.nix10
-rw-r--r--pkgs/tools/graphics/argyllcms/jam-cross.patch22
2 files changed, 31 insertions, 1 deletions
diff --git a/pkgs/tools/graphics/argyllcms/default.nix b/pkgs/tools/graphics/argyllcms/default.nix
index 941e4cfec22c..a966b11382aa 100644
--- a/pkgs/tools/graphics/argyllcms/default.nix
+++ b/pkgs/tools/graphics/argyllcms/default.nix
@@ -1,7 +1,7 @@
{ stdenv, fetchzip, jam, unzip, libX11, libXxf86vm, libXrandr, libXinerama
, libXrender, libXext, libtiff, libjpeg, libpng, libXScrnSaver, writeText
, libXdmcp, libXau, lib, openssl
-, writeScript
+, buildPackages, substituteAll, writeScript
}:
stdenv.mkDerivation rec {
@@ -17,6 +17,14 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ jam unzip ];
+ patches = lib.optional (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) (
+ # Build process generates files by compiling and then invoking an executable.
+ substituteAll {
+ src = ./jam-cross.patch;
+ emulator = stdenv.hostPlatform.emulator buildPackages;
+ }
+ );
+
postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
substituteInPlace Jambase \
--replace "-m64" ""
diff --git a/pkgs/tools/graphics/argyllcms/jam-cross.patch b/pkgs/tools/graphics/argyllcms/jam-cross.patch
new file mode 100644
index 000000000000..86a51ed83110
--- /dev/null
+++ b/pkgs/tools/graphics/argyllcms/jam-cross.patch
@@ -0,0 +1,22 @@
+diff --git a/Jambase b/Jambase
+--- a/Jambase
++++ b/Jambase
+@@ -4247,7 +4247,7 @@
+
+ actions GenFileND1
+ {
+- $(>)
++ @emulator@ $(>)
+ }
+
+ actions GenFileNND1
+@@ -4410,7 +4410,7 @@
+ actions GenFile1
+ {
+ PATH="$PATH:."
+- $(>[1]) $(<) $(>[2-])
++ @emulator@ $(>[1]) $(<) $(>[2-])
+ }
+
+ actions CreateCatFile_
+