diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch b/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch index 3a813dc80074..9893fdff9a5c 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch +++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch @@ -11,15 +11,15 @@ diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h index 6f2cabd..81b9849 100644 --- a/src/serialport/qtudev_p.h +++ b/src/serialport/qtudev_p.h -@@ -105,9 +105,9 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN +@@ -105,10 +105,9 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN inline bool resolveSymbols(QLibrary *udevLibrary) { if (!udevLibrary->isLoaded()) { - udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1); -+ udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 1); ++ udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1); if (!udevLibrary->load()) { - udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0); -+ udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 0); ++ udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0); if (!udevLibrary->load()) { qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0); return false; diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix b/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix index 2bffd0a2bd61..925e8a808f25 100644 --- a/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix +++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix @@ -1,12 +1,12 @@ -{ qtSubmodule, qtbase, substituteAll, systemd }: +{ stdenv, qtSubmodule, lib, copyPathsToStore, qtbase, substituteAll, systemd }: + +let inherit (lib) getLib optional; in qtSubmodule { name = "qtserialport"; qtInputs = [ qtbase ]; - patches = [ - (substituteAll { - src = ./0001-dlopen-serialport-udev.patch; - libudev = systemd.lib; - }) - ]; + patches = copyPathsToStore (lib.readPathsFromFile ./. ./series); + NIX_CFLAGS_COMPILE = + optional stdenv.isLinux + ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"''; } diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch new file mode 100644 index 000000000000..65bb64710ebd --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch @@ -0,0 +1,22 @@ +Index: qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h +=================================================================== +--- qtserialport-opensource-src-5.8.0.orig/src/serialport/qtudev_p.h ++++ qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h +@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QL + inline bool resolveSymbols(QLibrary *udevLibrary) + { + if (!udevLibrary->isLoaded()) { ++#ifdef NIXPKGS_LIBUDEV ++ udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1); ++#else + udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1); ++#endif + if (!udevLibrary->load()) { ++#ifdef NIXPKGS_LIBUDEV ++ udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0); ++#else + udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0); ++#endif + if (!udevLibrary->load()) { + qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0); + return false; diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/series b/pkgs/development/libraries/qt-5/5.6/qtserialport/series new file mode 100644 index 000000000000..83f4abf094e9 --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/series @@ -0,0 +1 @@ +qtserialport-dlopen-udev.patch