diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/appstream')
5 files changed, 248 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/appstream/default.nix b/nixpkgs/pkgs/development/libraries/appstream/default.nix new file mode 100644 index 000000000000..9b07697a6a9a --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/appstream/default.nix @@ -0,0 +1,106 @@ +{ lib +, stdenv +, substituteAll +, fetchFromGitHub +, meson +, ninja +, pkg-config +, gettext +, xmlto +, docbook-xsl-nons +, docbook_xml_dtd_45 +, libxslt +, libstemmer +, glib +, xapian +, libxml2 +, libxmlb +, libyaml +, gobject-introspection +, pcre +, itstool +, gperf +, vala +, curl +, nixosTests +}: + +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" ]; + + src = fetchFromGitHub { + owner = "ximion"; + repo = "appstream"; + rev = "v${version}"; + sha256 = "sha256-/JZ49wjtcInbGUOVVjevVSrLCHcA60FMT165rhfb78Q="; + }; + + patches = [ + # Fix hardcoded paths + (substituteAll { + src = ./fix-paths.patch; + libstemmer_includedir = "${lib.getDev libstemmer}/include"; + }) + + # Allow installing installed tests to a separate output. + ./installed-tests-path.patch + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + gettext + libxslt + xmlto + docbook-xsl-nons + docbook_xml_dtd_45 + gobject-introspection + itstool + vala + ]; + + buildInputs = [ + libstemmer + pcre + glib + xapian + libxml2 + libxmlb + libyaml + gperf + curl + ]; + + mesonFlags = [ + "-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/"; + longDescription = '' + AppStream is a cross-distro effort for building Software-Center applications + and enhancing metadata provided by software components. It provides + specifications for meta-information which is shipped by upstream projects and + can be consumed by other software. + ''; + license = licenses.lgpl21Plus; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch b/nixpkgs/pkgs/development/libraries/appstream/fix-build-for-qt-olderthan-514.patch new file mode 100644 index 000000000000..35db2bec914e --- /dev/null +++ b/nixpkgs/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/nixpkgs/pkgs/development/libraries/appstream/fix-paths.patch b/nixpkgs/pkgs/development/libraries/appstream/fix-paths.patch new file mode 100644 index 000000000000..2f1249daef41 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/appstream/fix-paths.patch @@ -0,0 +1,32 @@ +diff --git a/data/meson.build b/data/meson.build +index 53f31cb4..90f40e77 100644 +--- a/data/meson.build ++++ b/data/meson.build +@@ -68,7 +68,7 @@ test('as-validate_metainfo.cli', + ) + + 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 2efe86b7..9dc79e28 100644 +--- a/meson.build ++++ b/meson.build +@@ -107,12 +107,12 @@ if get_option ('gir') + dependency('gobject-introspection-1.0', version: '>=1.56') + endif + +-stemmer_inc_dirs = include_directories(['/usr/include']) ++stemmer_inc_dirs = include_directories(['@libstemmer_includedir@']) + if get_option('stemming') + stemmer_lib = cc.find_library('stemmer', required: true) + if not cc.has_header('libstemmer.h') + if cc.has_header('libstemmer/libstemmer.h') +- stemmer_inc_dirs = include_directories('/usr/include/libstemmer') ++ stemmer_inc_dirs = include_directories('@libstemmer_includedir@/libstemmer') + else + error('Unable to find Snowball header "libstemmer.h". Please ensure libstemmer/Snowball is installed properly in order to continue.') + endif diff --git a/nixpkgs/pkgs/development/libraries/appstream/installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/appstream/installed-tests-path.patch new file mode 100644 index 000000000000..188c1e525890 --- /dev/null +++ b/nixpkgs/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'), + ) diff --git a/nixpkgs/pkgs/development/libraries/appstream/qt.nix b/nixpkgs/pkgs/development/libraries/appstream/qt.nix new file mode 100644 index 000000000000..3704332119e2 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/appstream/qt.nix @@ -0,0 +1,40 @@ +{ 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; + + outputs = [ "out" "dev" "installedTests" ]; + + buildInputs = appstream.buildInputs ++ [ appstream qtbase ]; + + nativeBuildInputs = appstream.nativeBuildInputs ++ [ qttools ]; + + 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@" + ''; + + passthru = appstream.passthru // { + tests = { + installed-tests = nixosTests.installed-tests.appstream-qt; + }; + }; + + meta = appstream.meta // { + description = "Software metadata handling library - Qt"; + }; +} |