sqlite_orm: 1.9 -> 1.9.1 (#379250)
[NixPkgs.git] / pkgs / by-name / li / libgweather / package.nix
bloba27aa76edcf92900937579285b7f9626773fc8f3
2   lib,
3   stdenv,
4   buildPackages,
5   fetchurl,
6   makeWrapper,
7   meson,
8   ninja,
9   pkg-config,
10   libxml2,
11   json-glib,
12   glib,
13   gettext,
14   libsoup_3,
15   gi-docgen,
16   gobject-introspection,
17   python3,
18   tzdata,
19   geocode-glib_2,
20   vala,
21   gnome,
22   withIntrospection ?
23     lib.meta.availableOn stdenv.hostPlatform gobject-introspection
24     && stdenv.hostPlatform.emulatorAvailable buildPackages,
27 stdenv.mkDerivation rec {
28   pname = "libgweather";
29   version = "4.4.4";
31   outputs = [
32     "out"
33     "dev"
34   ] ++ lib.optional withIntrospection "devdoc";
36   src = fetchurl {
37     url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
38     hash = "sha256-cBdnd1PN99H9w1Xkv82x66g2l5Oo3yTSQUJ6k5y/QoM=";
39   };
41   patches = [
42     # Headers depend on glib but it is only listed in Requires.private,
43     # which does not influence Cflags on non-static builds in nixpkgs’s
44     # pkg-config. Let’s add it to Requires to ensure Cflags are set correctly.
45     ./fix-pkgconfig.patch
46   ];
48   depsBuildBuild = [
49     makeWrapper
50     pkg-config
51   ];
53   nativeBuildInputs =
54     [
55       meson
56       ninja
57       pkg-config
58       gettext
59       glib
60       (python3.pythonOnBuildForHost.withPackages (ps: [ ps.pygobject3 ]))
61     ]
62     ++ lib.optionals withIntrospection [
63       gi-docgen
64       gobject-introspection
65       vala
66     ];
68   buildInputs = [
69     glib
70     libsoup_3
71     libxml2
72     json-glib
73     geocode-glib_2
74   ];
76   mesonFlags =
77     [
78       "-Dzoneinfo_dir=${tzdata}/share/zoneinfo"
79       (lib.mesonBool "introspection" withIntrospection)
80     ]
81     ++ lib.optionals stdenv.hostPlatform.isDarwin [
82       "-Dc_args=-D_DARWIN_C_SOURCE"
83     ];
85   postPatch = ''
86     patchShebangs --build build-aux/meson/gen_locations_variant.py
87     wrapProgram $PWD/build-aux/meson/gen_locations_variant.py \
88       --prefix GI_TYPELIB_PATH : ${lib.getLib buildPackages.glib}/lib/girepository-1.0 \
90     # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake)
91     # it should be a build-time dep for build
92     # TODO: send upstream
93     substituteInPlace doc/meson.build \
94       --replace-fail "'gi-docgen', ver" "'gi-docgen', native:true, ver" \
95       --replace-fail "'gi-docgen', req" "'gi-docgen', native:true, req"
97     # gir works for us even when cross-compiling
98     # TODO: send upstream because downstream users can use the option to disable gir if they don't have it working
99     substituteInPlace meson.build \
100       --replace-fail "g_ir_scanner.found() and not meson.is_cross_build()" "g_ir_scanner.found()"
102     substituteInPlace libgweather/meson.build --replace-fail \
103       "dependency('vapigen', required: enable_vala == 'true')" \
104       "dependency('vapigen', native: true, required: enable_vala == 'true')"
105   '';
107   postFixup = ''
108     # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
109     moveToOutput "share/doc" "$devdoc"
110   '';
112   strictDeps = true;
114   passthru = {
115     updateScript = gnome.updateScript {
116       packageName = pname;
117       versionPolicy = "odd-unstable";
118       # Version 40.alpha preceded version 4.0.
119       freeze = "40.alpha";
120     };
121   };
123   meta = with lib; {
124     description = "Library to access weather information from online services for numerous locations";
125     homepage = "https://gitlab.gnome.org/GNOME/libgweather";
126     license = licenses.gpl2Plus;
127     maintainers = teams.gnome.members;
128     platforms = platforms.unix;
129   };