at 23.11-beta 146 lines 4.3 kB view raw
1{ stdenv, fetchzip, jam, unzip, libX11, libXxf86vm, libXrandr, libXinerama 2, libXrender, libXext, libtiff, libjpeg, libpng, libXScrnSaver, writeText 3, libXdmcp, libXau, lib, openssl 4, writeScript 5}: 6 7stdenv.mkDerivation rec { 8 pname = "argyllcms"; 9 version = "3.0.2"; 10 11 src = fetchzip { 12 # Kind of flacky URL, it was reaturning 406 and inconsistent binaries for a 13 # while on me. It might be good to find a mirror 14 url = "https://www.argyllcms.com/Argyll_V${version}_src.zip"; 15 hash = "sha256-9+rUhZVwSzAM9Ko6FYyl2OVvsOFBaUCA1PJs9kaLWaE="; 16 }; 17 18 nativeBuildInputs = [ jam unzip ]; 19 20 postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 21 substituteInPlace Jambase \ 22 --replace "-m64" "" 23 ''; 24 25 preConfigure = let 26 # The contents of this file comes from the Jamtop file from the 27 # root of the ArgyllCMS distribution, rewritten to pick up Nixpkgs 28 # library paths. When ArgyllCMS is updated, make sure that changes 29 # in that file is reflected here. 30 jamTop = writeText "argyllcms_jamtop" '' 31 DESTDIR = "/" ; 32 REFSUBDIR = "share/argyllcms" ; 33 34 # Keep this DESTDIR anchored to Jamtop. PREFIX is used literally 35 ANCHORED_PATH_VARS = DESTDIR ; 36 37 # Tell standalone libraries that they are part of Argyll: 38 DEFINES += ARGYLLCMS ; 39 40 # enable serial instruments & support 41 USE_SERIAL = true ; 42 43 # enable fast serial instruments & support 44 USE_FAST_SERIAL = true ; # (Implicit in USE_SERIAL too) 45 46 # enable USB instruments & support 47 USE_USB = true ; 48 49 # enable dummy Demo Instrument (only if code is available) 50 USE_DEMOINST = true ; 51 52 # enable Video Test Patch Generator and 3DLUT device support 53 # (V2.0.0 and above) 54 USE_VTPGLUT = false ; 55 56 # enable Printer device support 57 USE_PRINTER = false ; 58 59 # enable CMF Measurement device and accessory support (if present) 60 USE_CMFM = false ; 61 62 # Use ArgyllCMS version of libusb (deprecated - don't use) 63 USE_LIBUSB = false ; 64 65 # Compile in graph plotting code (Not fully implemented) 66 USE_PLOT = true ; # [true] 67 68 JPEGLIB = ; 69 JPEGINC = ; 70 HAVE_JPEG = true ; 71 72 TIFFLIB = ; 73 TIFFINC = ; 74 HAVE_TIFF = true ; 75 76 PNGLIB = ; 77 PNGINC = ; 78 HAVE_PNG = true ; 79 80 ZLIB = ; 81 ZINC = ; 82 HAVE_Z = true ; 83 84 SSLLIB = ; 85 SSLINC = ; 86 HAVE_SSL = true ; 87 88 LINKFLAGS += 89 ${lib.concatStringsSep " " (map (x: "-L${x}/lib") buildInputs)} 90 -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss 91 -ljpeg -ltiff -lpng -lssl ; 92 ''; 93 in '' 94 cp ${jamTop} Jamtop 95 substituteInPlace Makefile --replace "-j 3" "-j $NIX_BUILD_CORES" 96 # Remove tiff, jpg and png to be sure the nixpkgs-provided ones are used 97 rm -rf tiff jpg png 98 99 export AR="$AR rusc" 100 ''; 101 102 buildInputs = [ 103 libtiff libjpeg libpng libX11 libXxf86vm libXrandr libXinerama libXext 104 libXrender libXScrnSaver libXdmcp libXau openssl 105 ]; 106 107 buildFlags = [ "all" ]; 108 109 makeFlags = [ 110 "PREFIX=${placeholder "out"}" 111 ]; 112 113 # Install udev rules, but remove lines that set up the udev-acl 114 # stuff, since that is handled by udev's own rules (70-udev-acl.rules) 115 postInstall = '' 116 rm -v $out/bin/License.txt 117 mkdir -p $out/etc/udev/rules.d 118 sed -i '/udev-acl/d' usb/55-Argyll.rules 119 cp -v usb/55-Argyll.rules $out/etc/udev/rules.d/ 120 121 sed -i -e 's/^CREATED .*/CREATED "'"$(date -d @$SOURCE_DATE_EPOCH)"'"/g' $out/share/argyllcms/RefMediumGamut.gam 122 123 ''; 124 125 passthru = { 126 updateScript = writeScript "update-argyllcms" '' 127 #!/usr/bin/env nix-shell 128 #!nix-shell -i bash -p curl pcre common-updater-scripts 129 130 set -eu -o pipefail 131 132 # Expect the text in format of 'Current Version 3.0.1 (19th October 2023)' 133 new_version="$(curl -s https://www.argyllcms.com/ | 134 pcregrep -o1 '>Current Version ([0-9.]+) ')" 135 update-source-version ${pname} "$new_version" 136 ''; 137 }; 138 139 meta = with lib; { 140 homepage = "https://www.argyllcms.com/"; 141 description = "Color management system (compatible with ICC)"; 142 license = licenses.gpl3; 143 maintainers = []; 144 platforms = platforms.linux; 145 }; 146}