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