about summary refs log tree commit diff
path: root/pkgs/tools/graphics
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2021-10-30 16:31:52 +0300
committerGitHub <noreply@github.com>2021-10-30 16:31:52 +0300
commitf1f86cc6930a10169edf70e1e339680e30353517 (patch)
tree2d3336dd175e85c8e8e5d2238d36229c0352cffb /pkgs/tools/graphics
parent07f6ceafd6887f782453f9d99dc62a89ef6c6019 (diff)
parente7a05e90da04e806b3002ef5817c031fcc973b97 (diff)
Merge pull request #143203 from Artturin/argyllreprod
Diffstat (limited to 'pkgs/tools/graphics')
-rw-r--r--pkgs/tools/graphics/argyllcms/default.nix114
1 files changed, 61 insertions, 53 deletions
diff --git a/pkgs/tools/graphics/argyllcms/default.nix b/pkgs/tools/graphics/argyllcms/default.nix
index ceca22eca35d5..294a403d7ea5b 100644
--- a/pkgs/tools/graphics/argyllcms/default.nix
+++ b/pkgs/tools/graphics/argyllcms/default.nix
@@ -13,83 +13,88 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-umY3wQfG26Okqnw+MCUnlwWTAyJ6MR/FHe5oe61KBh0=";
   };
 
-  # The contents of this file comes from the Jamtop file from the
-  # root of the ArgyllCMS distribution, rewritten to pick up Nixpkgs
-  # library paths. When ArgyllCMS is updated, make sure that changes
-  # in that file is reflected here.
-  jamTop = writeText "argyllcms_jamtop" ''
-    DESTDIR = "/" ;
-    REFSUBDIR = "share/argyllcms" ;
+  nativeBuildInputs = [ jam unzip ];
 
-    # Keep this DESTDIR anchored to Jamtop. PREFIX is used literally
-    ANCHORED_PATH_VARS = DESTDIR ;
+  postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    substituteInPlace Jambase \
+      --replace "-m64" ""
+  '';
 
-    # Tell standalone libraries that they are part of Argyll:
-    DEFINES += ARGYLLCMS ;
+  preConfigure = let
+    # The contents of this file comes from the Jamtop file from the
+    # root of the ArgyllCMS distribution, rewritten to pick up Nixpkgs
+    # library paths. When ArgyllCMS is updated, make sure that changes
+    # in that file is reflected here.
+    jamTop = writeText "argyllcms_jamtop" ''
+      DESTDIR = "/" ;
+      REFSUBDIR = "share/argyllcms" ;
 
-    # enable serial instruments & support
-    USE_SERIAL = true ;
+      # Keep this DESTDIR anchored to Jamtop. PREFIX is used literally
+      ANCHORED_PATH_VARS = DESTDIR ;
 
-    # enable fast serial instruments & support
-    USE_FAST_SERIAL = true ;                # (Implicit in USE_SERIAL too)
+      # Tell standalone libraries that they are part of Argyll:
+      DEFINES += ARGYLLCMS ;
 
-    # enable USB instruments & support
-    USE_USB = true ;
+      # enable serial instruments & support
+      USE_SERIAL = true ;
 
-    # enable dummy Demo Instrument (only if code is available)
-    USE_DEMOINST = true ;
+      # enable fast serial instruments & support
+      USE_FAST_SERIAL = true ;                # (Implicit in USE_SERIAL too)
 
-    # enable Video Test Patch Generator and 3DLUT device support
-    # (V2.0.0 and above)
-    USE_VTPGLUT = false ;
+      # enable USB instruments & support
+      USE_USB = true ;
 
-    # enable Printer device support
-    USE_PRINTER = false ;
+      # enable dummy Demo Instrument (only if code is available)
+      USE_DEMOINST = true ;
 
-    # enable CMF Measurement device and accessory support (if present)
-    USE_CMFM = false ;
+      # enable Video Test Patch Generator and 3DLUT device support
+      # (V2.0.0 and above)
+      USE_VTPGLUT = false ;
 
-    # Use ArgyllCMS version of libusb (deprecated - don't use)
-    USE_LIBUSB = false ;
+      # enable Printer device support
+      USE_PRINTER = false ;
 
-    # Compile in graph plotting code (Not fully implemented)
-    USE_PLOT = true ;		# [true]
+      # enable CMF Measurement device and accessory support (if present)
+      USE_CMFM = false ;
 
-    JPEGLIB = ;
-    JPEGINC = ;
-    HAVE_JPEG = true ;
+      # Use ArgyllCMS version of libusb (deprecated - don't use)
+      USE_LIBUSB = false ;
 
-    TIFFLIB = ;
-    TIFFINC = ;
-    HAVE_TIFF = true ;
+      # Compile in graph plotting code (Not fully implemented)
+      USE_PLOT = true ;		# [true]
 
-    PNGLIB = ;
-    PNGINC = ;
-    HAVE_PNG = true ;
+      JPEGLIB = ;
+      JPEGINC = ;
+      HAVE_JPEG = true ;
 
-    ZLIB = ;
-    ZINC = ;
-    HAVE_Z = true ;
+      TIFFLIB = ;
+      TIFFINC = ;
+      HAVE_TIFF = true ;
 
-    SSLLIB = ;
-    SSLINC = ;
-    HAVE_SSL = true ;
+      PNGLIB = ;
+      PNGINC = ;
+      HAVE_PNG = true ;
 
-    LINKFLAGS +=
-      ${lib.concatStringsSep " " (map (x: "-L${x}/lib") buildInputs)}
-      -ldl -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss
-      -ljpeg -ltiff -lpng -lssl ;
-  '';
+      ZLIB = ;
+      ZINC = ;
+      HAVE_Z = true ;
 
-  nativeBuildInputs = [ jam unzip ];
+      SSLLIB = ;
+      SSLINC = ;
+      HAVE_SSL = true ;
 
-  preConfigure = ''
+      LINKFLAGS +=
+        ${lib.concatStringsSep " " (map (x: "-L${x}/lib") buildInputs)}
+        -ldl -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss
+        -ljpeg -ltiff -lpng -lssl ;
+    '';
+  in ''
     cp ${jamTop} Jamtop
     substituteInPlace Makefile --replace "-j 3" "-j $NIX_BUILD_CORES"
     # Remove tiff, jpg and png to be sure the nixpkgs-provided ones are used
     rm -rf tiff jpg png
 
-    unset AR
+    export AR="$AR rusc"
   '';
 
   buildInputs = [
@@ -110,6 +115,9 @@ stdenv.mkDerivation rec {
     mkdir -p $out/etc/udev/rules.d
     sed -i '/udev-acl/d' usb/55-Argyll.rules
     cp -v usb/55-Argyll.rules $out/etc/udev/rules.d/
+
+    sed -i -e 's/^CREATED .*/CREATED "'"$(date -d @$SOURCE_DATE_EPOCH)"'"/g' $out/share/argyllcms/RefMediumGamut.gam
+
   '';
 
   meta = with lib; {