Uthar / nix-cl

Utilities for packaging ASDF systems using Nix
BSD 2-Clause "Simplified" License
15 stars 6 forks source link

Qt binding packages are broken #11

Closed Uthar closed 2 years ago

Uthar commented 2 years ago

See https://github.com/NixOS/nixpkgs/pull/193754

These are broken as of 60dbe8f643eced491762bca2cf2ff5b0f998fdb3:

There's a patch to make them work:

Patch ```patch From d7ea3d708bf0a430ac7e23b4f5cbff7160d4b8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Ga=C5=82kowski?= Date: Sun, 9 Oct 2022 19:34:49 +0200 Subject: [PATCH 1/3] smokegen: init at v4.14.3 --- maintainers/maintainer-list.nix | 6 ++++++ .../libraries/smokegen/default.nix | 21 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 pkgs/development/libraries/smokegen/default.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 33b6269fcbd..4ff47316875 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -13980,6 +13980,12 @@ githubId = 928084; name = "Utku Demir"; }; + uthar = { + email = "galkowskikasper@gmail.com"; + github = "uthar"; + githubId = 15697697; + name = "Kasper Gałkowski"; + }; uvnikita = { email = "uv.nikita@gmail.com"; github = "uvNikita"; diff --git a/pkgs/development/libraries/smokegen/default.nix b/pkgs/development/libraries/smokegen/default.nix new file mode 100644 index 00000000000..643ae1064db --- /dev/null +++ b/pkgs/development/libraries/smokegen/default.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, ... }: + +pkgs.stdenv.mkDerivation rec { + pname = "smokegen"; + version = "v4.14.3"; + src = pkgs.fetchzip { + url = "https://invent.kde.org/unmaintained/${pname}/-/archive/${version}/${pname}-${version}.tar.gz"; + hash = "sha256-finsoruPeJZLawIjNUJ25Pq54eaCByfALVraNQJPk7c="; + }; + buildInputs = [ pkgs.cmake pkgs.qt4 ]; + buildPhase = '' + cmake . + ''; + meta = with lib; { + description = "A general purpose C++ parser with a plugin infrastructure"; + homepage = "https://invent.kde.org/unmaintained/smokegen"; + license = licenses.gpl2Only; + platforms = platforms.unix; + maintainers = with maintainers; [ uthar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0586a6575fd..3e40a0b4cec 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4733,6 +4733,8 @@ with pkgs; simg2img = callPackage ../tools/filesystems/simg2img { }; + smokegen = callPackage ../development/libraries/smokegen {}; + snazy = callPackage ../development/tools/snazy { }; snippetpixie = callPackage ../tools/text/snippetpixie { }; -- 2.34.1 From fd3646f5177ec74430218f1f24c1bc40be4990a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Ga=C5=82kowski?= Date: Sun, 9 Oct 2022 19:36:54 +0200 Subject: [PATCH 2/3] smokeqt: init at v4.14.3 --- .../development/libraries/smokeqt/default.nix | 21 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/development/libraries/smokeqt/default.nix diff --git a/pkgs/development/libraries/smokeqt/default.nix b/pkgs/development/libraries/smokeqt/default.nix new file mode 100644 index 00000000000..145a9f243bb --- /dev/null +++ b/pkgs/development/libraries/smokeqt/default.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, ... }: + +pkgs.stdenv.mkDerivation rec { + pname = "smokeqt"; + version = "v4.14.3"; + src = pkgs.fetchzip { + url = "https://invent.kde.org/unmaintained/${pname}/-/archive/${version}/${pname}-${version}.tar.gz"; + hash = "sha256-8FiEGF8gduVw5I/bi2wExGUWmjIjYEhWpjpXKJGBNMg="; + }; + cmakeFlags = [ + "-DCMAKE_CXX_STANDARD=98" + ]; + buildInputs = [ pkgs.cmake pkgs.qt4 pkgs.smokegen ]; + meta = with lib; { + description = "Bindings for the Qt libraries"; + homepage = "https://invent.kde.org/unmaintained/smokeqt"; + license = licenses.gpl2Only; + platforms = platforms.unix; + maintainers = with maintainers; [ uthar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3e40a0b4cec..6362b923c37 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4735,6 +4735,8 @@ with pkgs; smokegen = callPackage ../development/libraries/smokegen {}; + smokeqt = callPackage ../development/libraries/smokeqt {}; + snazy = callPackage ../development/tools/snazy { }; snippetpixie = callPackage ../tools/text/snippetpixie { }; -- 2.34.1 From 422f1c24bd9ebb0c413d74bf11f28eb82441e525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Ga=C5=82kowski?= Date: Sun, 9 Oct 2022 19:38:32 +0200 Subject: [PATCH 3/3] sbclPackages: fix build of qt, qt-libs and qtools --- .../development/lisp-modules-new/packages.nix | 91 +++++++++++++++++++ .../patches/qt-libs-dont-download.patch | 36 ++++++++ .../patches/qtools-use-nix-libs.patch | 19 ++++ 3 files changed, 146 insertions(+) create mode 100644 pkgs/development/lisp-modules-new/patches/qt-libs-dont-download.patch create mode 100644 pkgs/development/lisp-modules-new/patches/qtools-use-nix-libs.patch diff --git a/pkgs/development/lisp-modules-new/packages.nix b/pkgs/development/lisp-modules-new/packages.nix index 97c1cf0fca5..1ad06f615b5 100644 --- a/pkgs/development/lisp-modules-new/packages.nix +++ b/pkgs/development/lisp-modules-new/packages.nix @@ -11,6 +11,9 @@ let optionals hasSuffix splitString + remove + optionalString + stringLength ; # Used by builds that would otherwise attempt to write into storeDir. @@ -42,6 +45,11 @@ let # Patches are already applied in `build` patches = []; src = build; + # TODO(kasper): handle this with a setup hook + LD_LIBRARY_PATH = + build.LD_LIBRARY_PATH + + (optionalString (stringLength build.LD_LIBRARY_PATH != 0) ":") + + "${build}"; }); # A little hacky @@ -332,6 +340,89 @@ let version = "f19162e76"; }); + qt = let + rev = "dffff3ee3dbd0686c85c323f579b8bbf4881e60e"; + in build-with-compile-into-pwd rec { + pname = "commonqt"; + version = builtins.substring 0 7 rev; + + src = pkgs.fetchFromGitHub { + inherit rev; + owner = pname; + repo = pname; + hash = "sha256-GAgwT0D9mIkYPTHfCH/KxxIv7b6QGwcxwZE7ehH5xug="; + }; + + buildInputs = [ pkgs.qt4 ]; + nativeBuildInputs = [ pkgs.smokegen pkgs.smokeqt ]; + nativeLibs = [ pkgs.qt4 pkgs.smokegen pkgs.smokeqt ]; + + systems = [ "qt" ]; + + lispLibs = with ql; [ + cffi named-readtables cl-ppcre alexandria + closer-mop iterate trivial-garbage bordeaux-threads + ]; + }; + + qt-libs = build-with-compile-into-pwd { + inherit (ql.qt-libs) pname version src; + patches = [ ./patches/qt-libs-dont-download.patch ]; + prePatch = '' + substituteInPlace systems/*.asd --replace ":qt+libs" ":qt" + echo "LD Path: $LD_LIBRARY_PATH" + ''; + lispLibs = ql.qt-libs.lispLibs ++ [ qt ]; + systems = [ + "qt-libs" + "commonqt" + # "phonon" + # "qimageblitz" + # "qsci" + "qt3support" + "qtcore" + "qtdbus" + "qtdeclarative" + "qtgui" + "qthelp" + "qtnetwork" + "qtopengl" + "qtscript" + "qtsql" + "qtsvg" + "qttest" + "qtuitools" + # "qtwebkit" + "qtxml" + "qtxmlpatterns" + # "qwt" + "smokebase" + ]; + }; + commonqt = qt-libs; + qt3support = qt-libs; + qtcore = qt-libs; + qtdbus = qt-libs; + qtdeclarative = qt-libs; + qtgui = qt-libs; + qthelp = qt-libs; + qtnetwork = qt-libs; + qtopengl = qt-libs; + qtscript = qt-libs; + qtsql = qt-libs; + qtsvg = qt-libs; + qttest = qt-libs; + qtuitools = qt-libs; + qtxml = qt-libs; + qtxmlpatterns = qt-libs; + smokebase = qt-libs; + + qtools = build-with-compile-into-pwd { + inherit (ql.qtools) pname version src nativeLibs; + lispLibs = [ qt ] ++ remove ql.qt_plus_libs ql.qtools.lispLibs ++ [ qt-libs ]; + patches = [ ./patches/qtools-use-nix-libs.patch ]; + }; + }; in packages diff --git a/pkgs/development/lisp-modules-new/patches/qt-libs-dont-download.patch b/pkgs/development/lisp-modules-new/patches/qt-libs-dont-download.patch new file mode 100644 index 00000000000..e21a44c2a17 --- /dev/null +++ b/pkgs/development/lisp-modules-new/patches/qt-libs-dont-download.patch @@ -0,0 +1,36 @@ +--- a/qt-libs.asd ++++ b/qt-libs.asd +@@ -17,5 +17,4 @@ + :components ((:file "qt-libs")) + :depends-on (:qt-lib-generator + :cl-ppcre +- :cffi) +- :perform (asdf:load-op :after (op c) (uiop:symbol-call :qt-libs :ensure-standalone-libs))) ++ :cffi)) +--- a/qt-libs.lisp ++++ b/qt-libs.lisp +@@ -94,16 +94,14 @@ + standalone-dir) + + (defun %ensure-lib-loaded (file) +- (let ((file (etypecase file +- (pathname file) +- (string (installed-library-file file)))) +- (name (intern (string-upcase (pathname-name file)))) +- #+sbcl(sb-ext:*muffled-warnings* 'style-warning)) +- (cffi::register-foreign-library +- name `((T ,file)) +- :search-path (to-directory file)) +- (unless (cffi:foreign-library-loaded-p name) +- (cffi:load-foreign-library name)))) ++ (let ((name (make-pathname :name (format nil "lib~a" file) ++ :type #+unix "so" ++ #+darwin "dylib"))) ++ (or (find-if (lambda (lib) ++ (equal (cffi:foreign-library-pathname lib) ++ (namestring name))) ++ (cffi:list-foreign-libraries)) ++ (cffi:load-foreign-library name)))) + + (defun ensure-lib-loaded (file) + (cond ((pathnamep file) \ No newline at end of file diff --git a/pkgs/development/lisp-modules-new/patches/qtools-use-nix-libs.patch b/pkgs/development/lisp-modules-new/patches/qtools-use-nix-libs.patch new file mode 100644 index 00000000000..b380894b04a --- /dev/null +++ b/pkgs/development/lisp-modules-new/patches/qtools-use-nix-libs.patch @@ -0,0 +1,19 @@ +Dont use the qt+libs system for managing Qt dependencies, because Nix provides +them already. +Don't build the deploy.lisp helper file, because Nix also can handle deployment. +--- a/qtools.asd ++++ b/qtools.asd +@@ -33,10 +33,9 @@ + (:file "generate") + (:file "dynamic") + (:file "precompile") +- (:file "deploy") + (:file "fast-call") + (:file "documentation")) +- :depends-on (:qt+libs ++ :depends-on (:qt + :deploy + :cl-ppcre + :closer-mop + +Diff finished. Sun Oct 2 14:38:06 2022 \ No newline at end of file -- 2.34.1 ```
Uthar commented 2 years ago

@lukego 62 fixed jobs with patch https://hydra.nuddy.co/eval/320#tabs-now-succeed

Uthar commented 2 years ago

now merged in nixpkgs so closing https://github.com/NixOS/nixpkgs/pull/195393

Uthar commented 2 years ago

https://hydra.nixos.org/eval/1785207#tabs-now-succeed