From 7c504659c869e1ca38ce219390423fd818b4efb2 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Fri, 25 Feb 2022 22:51:08 +0800 Subject: [PATCH 1/5] libxmlb: enable darwin build --- pkgs/development/libraries/libxmlb/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libxmlb/default.nix b/pkgs/development/libraries/libxmlb/default.nix index 85fda8ddc8ed..80d6129f18a8 100644 --- a/pkgs/development/libraries/libxmlb/default.nix +++ b/pkgs/development/libraries/libxmlb/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchFromGitHub +, fetchpatch , docbook_xml_dtd_43 , docbook_xsl , glib @@ -30,6 +31,13 @@ stdenv.mkDerivation rec { patches = [ ./installed-tests-path.patch + # Fix darwin build, can be removed on next release + # `--version-script` isn't supported by the macOS linker + # https://github.com/hughsie/libxmlb/pull/119 + (fetchpatch { + url = "https://github.com/hughsie/libxmlb/commit/d83aac5bd78cfbbfa2ecd428ff54b811071dfe4d.patch"; + sha256 = "sha256-UNRMbyNzdxfTZ8xV6J8a622hPnr3mowooP1q8Dg19yw="; + }) ]; nativeBuildInputs = [ @@ -72,6 +80,6 @@ stdenv.mkDerivation rec { homepage = "https://github.com/hughsie/libxmlb"; license = licenses.lgpl21Plus; maintainers = with maintainers; [ jtojnar ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } From 33ed5aeef7c05e994760fa5882362f3d3ca31afb Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Thu, 24 Feb 2022 23:44:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?appstream:=200.14.4=20=E2=86=92=200.15.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/ximion/appstream/blob/v0.15.2/NEWS --- .../development/libraries/appstream/default.nix | 10 +++++----- .../libraries/appstream/fix-paths.patch | 17 ++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix index c39ea78a7757..767cc447d140 100644 --- a/pkgs/development/libraries/appstream/default.nix +++ b/pkgs/development/libraries/appstream/default.nix @@ -14,19 +14,19 @@ , glib , xapian , libxml2 +, libxmlb , libyaml , gobject-introspection , pcre , itstool , gperf , vala -, lmdb , curl }: stdenv.mkDerivation rec { pname = "appstream"; - version = "0.14.4"; + version = "0.15.2"; outputs = [ "out" "dev" ]; @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { owner = "ximion"; repo = "appstream"; rev = "v${version}"; - sha256 = "sha256-DJXCw50f+8c58bJw6xx0ECfkc9/KcWaeA+ne2zmTyhg="; + sha256 = "sha256-/JZ49wjtcInbGUOVVjevVSrLCHcA60FMT165rhfb78Q="; }; patches = [ @@ -65,9 +65,9 @@ stdenv.mkDerivation rec { glib xapian libxml2 + libxmlb libyaml gperf - lmdb curl ]; @@ -88,5 +88,5 @@ stdenv.mkDerivation rec { ''; license = licenses.lgpl21Plus; platforms = platforms.unix; - }; + }; } diff --git a/pkgs/development/libraries/appstream/fix-paths.patch b/pkgs/development/libraries/appstream/fix-paths.patch index 0da72a78cbcf..2f1249daef41 100644 --- a/pkgs/development/libraries/appstream/fix-paths.patch +++ b/pkgs/development/libraries/appstream/fix-paths.patch @@ -1,18 +1,21 @@ diff --git a/data/meson.build b/data/meson.build -index 1eb3dfb0..623b66ec 100644 +index 53f31cb4..90f40e77 100644 --- a/data/meson.build +++ b/data/meson.build -@@ -26,4 +26,4 @@ i18n.merge_file ( +@@ -68,7 +68,7 @@ test('as-validate_metainfo.cli', ) - install_data ('appstream.conf', -- install_dir: get_option('sysconfdir')) -+ install_dir: get_option('prefix') / 'etc') + install_data('appstream.conf', +- install_dir: get_option('sysconfdir')) ++ install_dir: get_option('prefix') / 'etc') + + if get_option('compose') + ascompose_metainfo = 'org.freedesktop.appstream.compose.metainfo.xml' diff --git a/meson.build b/meson.build -index dc1fb1a5..5ee03b73 100644 +index 2efe86b7..9dc79e28 100644 --- a/meson.build +++ b/meson.build -@@ -108,12 +108,12 @@ if get_option ('gir') +@@ -107,12 +107,12 @@ if get_option ('gir') dependency('gobject-introspection-1.0', version: '>=1.56') endif From c942cd7b2eac6e2851b7b603f46e1347bf681e10 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Fri, 25 Feb 2022 19:26:15 +0800 Subject: [PATCH 3/5] nixosTests.installed-tests.appstream: init --- nixos/tests/installed-tests/appstream.nix | 9 +++++++ nixos/tests/installed-tests/default.nix | 1 + .../libraries/appstream/default.nix | 13 ++++++++- .../appstream/installed-tests-path.patch | 27 +++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/installed-tests/appstream.nix create mode 100644 pkgs/development/libraries/appstream/installed-tests-path.patch diff --git a/nixos/tests/installed-tests/appstream.nix b/nixos/tests/installed-tests/appstream.nix new file mode 100644 index 000000000000..f71a095d4452 --- /dev/null +++ b/nixos/tests/installed-tests/appstream.nix @@ -0,0 +1,9 @@ +{ pkgs, makeInstalledTest, ... }: + +makeInstalledTest { + tested = pkgs.appstream; + + testConfig = { + appstream.enable = true; + }; +} diff --git a/nixos/tests/installed-tests/default.nix b/nixos/tests/installed-tests/default.nix index 08785e5e6669..e6e1386a3731 100644 --- a/nixos/tests/installed-tests/default.nix +++ b/nixos/tests/installed-tests/default.nix @@ -84,6 +84,7 @@ let in { + appstream = callInstalledTest ./appstream.nix {}; colord = callInstalledTest ./colord.nix {}; flatpak = callInstalledTest ./flatpak.nix {}; flatpak-builder = callInstalledTest ./flatpak-builder.nix {}; diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix index 767cc447d140..d1d6ddcaf202 100644 --- a/pkgs/development/libraries/appstream/default.nix +++ b/pkgs/development/libraries/appstream/default.nix @@ -22,13 +22,14 @@ , gperf , vala , curl +, nixosTests }: stdenv.mkDerivation rec { pname = "appstream"; version = "0.15.2"; - outputs = [ "out" "dev" ]; + outputs = [ "out" "dev" "installedTests" ]; src = fetchFromGitHub { owner = "ximion"; @@ -43,6 +44,9 @@ stdenv.mkDerivation rec { src = ./fix-paths.patch; libstemmer_includedir = "${lib.getDev libstemmer}/include"; }) + + # Allow installing installed tests to a separate output. + ./installed-tests-path.patch ]; nativeBuildInputs = [ @@ -75,8 +79,15 @@ stdenv.mkDerivation rec { "-Dapidocs=false" "-Ddocs=false" "-Dvapi=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" ]; + passthru = { + tests = { + installed-tests = nixosTests.installed-tests.appstream; + }; + }; + meta = with lib; { description = "Software metadata handling library"; homepage = "https://www.freedesktop.org/wiki/Distributions/AppStream/"; diff --git a/pkgs/development/libraries/appstream/installed-tests-path.patch b/pkgs/development/libraries/appstream/installed-tests-path.patch new file mode 100644 index 000000000000..188c1e525890 --- /dev/null +++ b/pkgs/development/libraries/appstream/installed-tests-path.patch @@ -0,0 +1,27 @@ +diff --git a/meson_options.txt b/meson_options.txt +index 8dd8e0c7..e2a30b06 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -44,6 +44,11 @@ option('install-docs', + value : true, + description : 'Install documentation for API and specification' + ) ++option('installed_test_prefix', ++ type : 'string', ++ value : '', ++ description : 'Prefix for installed tests' ++) + + # + # For development +diff --git a/tests/installed-tests/meson.build b/tests/installed-tests/meson.build +index 405820ce..f592a753 100644 +--- a/tests/installed-tests/meson.build ++++ b/tests/installed-tests/meson.build +@@ -10,5 +10,5 @@ configure_file( + output : 'metainfo-validate.test', + configuration : itconf, + install: true, +- install_dir: join_paths('share', 'installed-tests', 'appstream'), ++ install_dir: join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', 'appstream'), + ) From b3d4c1d48f4bb8ac17ff5252707f960c0a06a07f Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Fri, 25 Feb 2022 20:09:27 +0800 Subject: [PATCH 4/5] nixosTests.installed-tests.appstream-qt: init --- nixos/tests/installed-tests/appstream-qt.nix | 9 +++++++++ nixos/tests/installed-tests/default.nix | 1 + pkgs/development/libraries/appstream/qt.nix | 10 ++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 nixos/tests/installed-tests/appstream-qt.nix diff --git a/nixos/tests/installed-tests/appstream-qt.nix b/nixos/tests/installed-tests/appstream-qt.nix new file mode 100644 index 000000000000..d08187bfe466 --- /dev/null +++ b/nixos/tests/installed-tests/appstream-qt.nix @@ -0,0 +1,9 @@ +{ pkgs, makeInstalledTest, ... }: + +makeInstalledTest { + tested = pkgs.libsForQt5.appstream-qt; + + testConfig = { + appstream.enable = true; + }; +} diff --git a/nixos/tests/installed-tests/default.nix b/nixos/tests/installed-tests/default.nix index e6e1386a3731..079fd54e71e5 100644 --- a/nixos/tests/installed-tests/default.nix +++ b/nixos/tests/installed-tests/default.nix @@ -85,6 +85,7 @@ in { appstream = callInstalledTest ./appstream.nix {}; + appstream-qt = callInstalledTest ./appstream-qt.nix {}; colord = callInstalledTest ./colord.nix {}; flatpak = callInstalledTest ./flatpak.nix {}; flatpak-builder = callInstalledTest ./flatpak-builder.nix {}; diff --git a/pkgs/development/libraries/appstream/qt.nix b/pkgs/development/libraries/appstream/qt.nix index 0bcb4741ff12..6a673a0a2641 100644 --- a/pkgs/development/libraries/appstream/qt.nix +++ b/pkgs/development/libraries/appstream/qt.nix @@ -1,4 +1,4 @@ -{ mkDerivation, appstream, qtbase, qttools }: +{ mkDerivation, appstream, qtbase, qttools, nixosTests }: # TODO: look into using the libraries from the regular appstream derivation as we keep duplicates here @@ -6,7 +6,7 @@ mkDerivation { pname = "appstream-qt"; inherit (appstream) version src patches; - outputs = [ "out" "dev" ]; + outputs = [ "out" "dev" "installedTests" ]; buildInputs = appstream.buildInputs ++ [ appstream qtbase ]; @@ -19,6 +19,12 @@ mkDerivation { -e "/INTERFACE_INCLUDE_DIRECTORIES/ s@\''${PACKAGE_PREFIX_DIR}@$dev@" ''; + passthru = appstream.passthru // { + tests = { + installed-tests = nixosTests.installed-tests.appstream-qt; + }; + }; + meta = appstream.meta // { description = "Software metadata handling library - Qt"; }; From 2bfd5cee8160576e0ceb92a55898aff3b696ae34 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Fri, 25 Feb 2022 23:58:50 +0800 Subject: [PATCH 5/5] libsForQt5.appstream-qt: fix darwin build --- .../libraries/appstream/default.nix | 3 ++ .../fix-build-for-qt-olderthan-514.patch | 43 +++++++++++++++++++ pkgs/development/libraries/appstream/qt.nix | 13 +++++- 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix index d1d6ddcaf202..9b07697a6a9a 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 000000000000..35db2bec914e --- /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 6a673a0a2641..3704332119e2 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@"