summary refs log tree commit diff
path: root/pkgs/development/libraries/appstream
diff options
context:
space:
mode:
authorBobby Rong <rjl931189261@126.com>2022-02-25 23:58:50 +0800
committerBobby Rong <rjl931189261@126.com>2022-03-02 11:28:29 +0800
commit2bfd5cee8160576e0ceb92a55898aff3b696ae34 (patch)
tree927e340f0bd23d28bc1dcfbf6e4a0ce9aa519daa /pkgs/development/libraries/appstream
parentb3d4c1d48f4bb8ac17ff5252707f960c0a06a07f (diff)
downloadnixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.tar
nixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.tar.gz
nixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.tar.bz2
nixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.tar.lz
nixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.tar.xz
nixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.tar.zst
nixpkgs-2bfd5cee8160576e0ceb92a55898aff3b696ae34.zip
libsForQt5.appstream-qt: fix darwin build
Diffstat (limited to 'pkgs/development/libraries/appstream')
-rw-r--r--pkgs/development/libraries/appstream/default.nix3
-rw-r--r--pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch43
-rw-r--r--pkgs/development/libraries/appstream/qt.nix13
3 files changed, 57 insertions, 2 deletions
diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix
index d1d6ddcaf20..9b07697a6a9 100644
--- a/pkgs/development/libraries/appstream/default.nix
+++ b/pkgs/development/libraries/appstream/default.nix
@@ -28,6 +28,9 @@
 stdenv.mkDerivation rec {
   pname = "appstream";
   version = "0.15.2";
+  # When bumping this package, please also check whether
+  # fix-build-for-qt-olderthan-514.patch still applies by
+  # building libsForQt512.appstream-qt.
 
   outputs = [ "out" "dev" "installedTests" ];
 
diff --git a/pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch b/pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch
new file mode 100644
index 00000000000..35db2bec914
--- /dev/null
+++ b/pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch
@@ -0,0 +1,43 @@
+diff --git a/qt/component.h b/qt/component.h
+index 47abd1f3..74de943c 100644
+--- a/qt/component.h
++++ b/qt/component.h
+@@ -90,7 +90,7 @@ class APPSTREAMQT_EXPORT Component {
+             UrlKindContact,
+ 
+             // deprecated
+-            UrlTranslate   [[deprecated]] = UrlKindTranslate,
++            UrlTranslate    = UrlKindTranslate,
+         };
+         Q_ENUM(UrlKind)
+ 
+diff --git a/qt/pool.h b/qt/pool.h
+index b59829b7..5237f613 100644
+--- a/qt/pool.h
++++ b/qt/pool.h
+@@ -70,9 +70,9 @@ public:
+         FlagMonitor            = 1 << 7,
+ 
+         // deprecated
+-        FlagReadCollection   [[deprecated]] = FlagLoadOsCollection,
+-        FlagReadMetainfo     [[deprecated]] = FlagLoadOsMetainfo,
+-        FlagReadDesktopFiles [[deprecated]] = FlagLoadOsDesktopFiles,
++        FlagReadCollection    = FlagLoadOsCollection,
++        FlagReadMetainfo      = FlagLoadOsMetainfo,
++        FlagReadDesktopFiles  = FlagLoadOsDesktopFiles,
+     };
+ 
+     /**
+@@ -84,9 +84,9 @@ public:
+      * Flags on how caching should be used.
+      **/
+     enum CacheFlags {
+-        CacheFlagNone      [[deprecated]] = 0,
+-        CacheFlagUseUser   [[deprecated]] = 1 << 0,
+-        CacheFlagUseSystem [[deprecated]] = 1 << 1,
++        CacheFlagNone       = 0,
++        CacheFlagUseUser    = 1 << 0,
++        CacheFlagUseSystem  = 1 << 1,
+     };
+ 
+     /**
diff --git a/pkgs/development/libraries/appstream/qt.nix b/pkgs/development/libraries/appstream/qt.nix
index 6a673a0a264..3704332119e 100644
--- a/pkgs/development/libraries/appstream/qt.nix
+++ b/pkgs/development/libraries/appstream/qt.nix
@@ -1,10 +1,10 @@
-{ mkDerivation, appstream, qtbase, qttools, nixosTests }:
+{ lib, mkDerivation, appstream, qtbase, qttools, nixosTests }:
 
 # TODO: look into using the libraries from the regular appstream derivation as we keep duplicates here
 
 mkDerivation {
   pname = "appstream-qt";
-  inherit (appstream) version src patches;
+  inherit (appstream) version src;
 
   outputs = [ "out" "dev" "installedTests" ];
 
@@ -14,6 +14,15 @@ mkDerivation {
 
   mesonFlags = appstream.mesonFlags ++ [ "-Dqt=true" ];
 
+  patches = (appstream.patches or []) ++ lib.optionals (lib.versionOlder qtbase.version "5.14") [
+    # Fix darwin build for libsForQt5.appstream-qt
+    # Old Qt moc doesn't know about fancy C++14 features
+    # ../qt/component.h:93: Parse error at "UrlTranslate"
+    # Remove both this patch and related comment in default.nix
+    # once Qt 5.14 or later becomes default on darwin
+    ./fix-build-for-qt-olderthan-514.patch
+  ];
+
   postFixup = ''
     sed -i "$dev/lib/cmake/AppStreamQt/AppStreamQtConfig.cmake" \
       -e "/INTERFACE_INCLUDE_DIRECTORIES/ s@\''${PACKAGE_PREFIX_DIR}@$dev@"