nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, mkDerivation
3, fetchFromGitHub
4, fetchpatch
5, cmake
6, pkg-config
7, qtbase
8, curl
9, libuv
10, glfw3
11, rapidjson
12, stdenv
13}:
14
15mkDerivation rec {
16 pname = "maplibre-gl-native";
17 version = "2.0.1";
18
19 src = fetchFromGitHub {
20 owner = "maplibre";
21 repo = "maplibre-gl-native";
22 rev = "qt-v${version}";
23 fetchSubmodules = true;
24 hash = "sha256-g5J873U/6mrl27iquPl3BdEGhMxkOdfP15dHr27wa48=";
25 };
26
27 patches = [
28 (fetchpatch {
29 name = "skip-license-check.patch";
30 url = "https://git.alpinelinux.org/aports/plain/testing/mapbox-gl-native/0002-skip-license-check.patch?id=6751a93dca26b0b3ceec9eb151272253a2fe497e";
31 sha256 = "1yybwzxbvn0lqb1br1fyg7763p2h117s6mkmywkl4l7qg9daa7ba";
32 })
33 ];
34
35 postPatch = ''
36 # don't use vendored rapidjson
37 rm -r vendor/mapbox-base/extras/rapidjson
38 '';
39
40 nativeBuildInputs = [
41 cmake
42 pkg-config
43 ];
44
45 buildInputs = [
46 curl
47 libuv
48 glfw3
49 qtbase
50 rapidjson
51 ];
52
53 cmakeFlags = [
54 "-DMBGL_WITH_QT=ON"
55 "-DMBGL_WITH_QT_LIB_ONLY=ON"
56 "-DMBGL_WITH_QT_HEADLESS=OFF"
57 ];
58
59 env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
60 # Needed with GCC 12 but problematic with some old GCCs
61 "-Wno-error=use-after-free"
62 ]);
63
64 meta = with lib; {
65 description = "Open-source alternative to Mapbox GL Native";
66 homepage = "https://maplibre.org/";
67 license = licenses.bsd2;
68 maintainers = with maintainers; [ dotlambda ];
69 platforms = platforms.linux;
70 };
71}