2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, fetchzip, jam, unzip, libX11, libXxf86vm, libXrandr, libXinerama
|
|
|
|
, libXrender, libXext, libtiff, libjpeg, libpng, libXScrnSaver, writeText
|
2023-11-16 04:20:00 +00:00
|
|
|
, libXdmcp, libXau, lib, openssl
|
2024-02-29 20:09:43 +00:00
|
|
|
, buildPackages, substituteAll, writeScript
|
2023-11-16 04:20:00 +00:00
|
|
|
}:
|
2021-07-17 21:14:59 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "argyllcms";
|
2024-10-11 05:15:48 +00:00
|
|
|
version = "3.3.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
# Kind of flacky URL, it was reaturning 406 and inconsistent binaries for a
|
|
|
|
# while on me. It might be good to find a mirror
|
|
|
|
url = "https://www.argyllcms.com/Argyll_V${version}_src.zip";
|
2024-10-11 05:15:48 +00:00
|
|
|
hash = "sha256-xpbj15GzpGS0d1UjzvYiZ1nmmTjNIyv0ST2blmi7ZSk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [ jam unzip ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
|
|
|
substituteInPlace Jambase \
|
|
|
|
--replace "-m64" ""
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
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" ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Keep this DESTDIR anchored to Jamtop. PREFIX is used literally
|
|
|
|
ANCHORED_PATH_VARS = DESTDIR ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Tell standalone libraries that they are part of Argyll:
|
|
|
|
DEFINES += ARGYLLCMS ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable serial instruments & support
|
|
|
|
USE_SERIAL = true ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable fast serial instruments & support
|
|
|
|
USE_FAST_SERIAL = true ; # (Implicit in USE_SERIAL too)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable USB instruments & support
|
|
|
|
USE_USB = true ;
|
2021-09-23 15:35:13 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable dummy Demo Instrument (only if code is available)
|
|
|
|
USE_DEMOINST = true ;
|
2021-09-23 15:35:13 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable Video Test Patch Generator and 3DLUT device support
|
|
|
|
# (V2.0.0 and above)
|
|
|
|
USE_VTPGLUT = false ;
|
2021-09-23 15:35:13 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable Printer device support
|
|
|
|
USE_PRINTER = false ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# enable CMF Measurement device and accessory support (if present)
|
|
|
|
USE_CMFM = false ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Use ArgyllCMS version of libusb (deprecated - don't use)
|
|
|
|
USE_LIBUSB = false ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Compile in graph plotting code (Not fully implemented)
|
|
|
|
USE_PLOT = true ; # [true]
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
JPEGLIB = ;
|
|
|
|
JPEGINC = ;
|
|
|
|
HAVE_JPEG = true ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
TIFFLIB = ;
|
|
|
|
TIFFINC = ;
|
|
|
|
HAVE_TIFF = true ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
PNGLIB = ;
|
|
|
|
PNGINC = ;
|
|
|
|
HAVE_PNG = true ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
ZLIB = ;
|
|
|
|
ZINC = ;
|
|
|
|
HAVE_Z = true ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
SSLLIB = ;
|
|
|
|
SSLINC = ;
|
|
|
|
HAVE_SSL = true ;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
LINKFLAGS +=
|
|
|
|
${lib.concatStringsSep " " (map (x: "-L${x}/lib") buildInputs)}
|
2023-02-16 17:41:37 +00:00
|
|
|
-lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss
|
2021-12-06 16:07:01 +00:00
|
|
|
-ljpeg -ltiff -lpng -lssl ;
|
|
|
|
'';
|
|
|
|
in ''
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
export AR="$AR rusc"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libtiff libjpeg libpng libX11 libXxf86vm libXrandr libXinerama libXext
|
|
|
|
libXrender libXScrnSaver libXdmcp libXau openssl
|
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [ "all" ];
|
|
|
|
|
|
|
|
makeFlags = [
|
2021-02-05 17:12:51 +00:00
|
|
|
"PREFIX=${placeholder "out"}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# Install udev rules, but remove lines that set up the udev-acl
|
|
|
|
# stuff, since that is handled by udev's own rules (70-udev-acl.rules)
|
|
|
|
postInstall = ''
|
|
|
|
rm -v $out/bin/License.txt
|
|
|
|
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/
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
sed -i -e 's/^CREATED .*/CREATED "'"$(date -d @$SOURCE_DATE_EPOCH)"'"/g' $out/share/argyllcms/RefMediumGamut.gam
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = writeScript "update-argyllcms" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# Expect the text in format of 'Current Version 3.0.1 (19th October 2023)'
|
|
|
|
new_version="$(curl -s https://www.argyllcms.com/ |
|
|
|
|
pcregrep -o1 '>Current Version ([0-9.]+) ')"
|
|
|
|
update-source-version ${pname} "$new_version"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-11-16 04:20:00 +00:00
|
|
|
homepage = "https://www.argyllcms.com/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Color management system (compatible with ICC)";
|
|
|
|
license = licenses.gpl3;
|
2024-07-31 10:19:44 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|