1{
2 lib,
3 mkDerivation,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 pkg-config,
8 qtbase,
9 curl,
10 libuv,
11 glfw3,
12 rapidjson,
13}:
14
15mkDerivation rec {
16 pname = "mapbox-gl-native";
17 version = "1.6.0";
18
19 src = fetchFromGitHub {
20 owner = "mapbox";
21 repo = "mapbox-gl-native";
22 rev = "maps-v${version}";
23 sha256 = "027rw23yvd5a6nl9b5hsanddc44nyb17l2whdcq9fxb9n6vcda4c";
24 fetchSubmodules = true;
25 };
26
27 patches = [
28 # https://github.com/mapbox/mapbox-gl-native/pull/16591
29 (fetchpatch {
30 name = "add-support-for-qmapboxgl-installation.patch";
31 url = "https://github.com/mapbox/mapbox-gl-native/commit/e18467d755f470b26f61f6893eddd76ecf0816e6.patch";
32 sha256 = "0gs7wmkvyhf2db4cwbsq31sprsh1avi70ggvi32bk0wn3cw4d79b";
33 })
34 (fetchpatch {
35 name = "add-support-for-using-qmapboxgl-as-a-proper-cmake-dependency.patch";
36 url = "https://github.com/mapbox/mapbox-gl-native/commit/ab27b9b8207754ef731b588d187c470ffb084455.patch";
37 sha256 = "1lr5p1g4qaizs57vjqry9aq8k1ki59ks0y975chlnrm2sffp140r";
38 })
39 (fetchpatch {
40 name = "skip-license-check.patch";
41 url = "https://git.alpinelinux.org/aports/plain/testing/mapbox-gl-native/0002-skip-license-check.patch?id=6751a93dca26b0b3ceec9eb151272253a2fe497e";
42 sha256 = "1yybwzxbvn0lqb1br1fyg7763p2h117s6mkmywkl4l7qg9daa7ba";
43 })
44 (fetchpatch {
45 name = "fix-compilation.patch";
46 url = "https://aur.archlinux.org/cgit/aur.git/plain/fix-compilation.patch?h=mapbox-gl-native";
47 hash = "sha256-KgJHyoIdKdnQo+gedns3C+mEXlaTH/UtyQsaYR1T3iI=";
48 })
49 (fetchpatch {
50 name = "fix-narrowing-conversion.patch";
51 url = "https://github.com/mapbox/mapbox-gl-native/commit/2955d0e479f57a39a0af4a0fa7ca7683455cca58.patch";
52 hash = "sha256-Jk7OLb9/mVtc2mm0AL1h9zcSiQ54jogNI+q6ojY0HEo=";
53 })
54 ];
55
56 postPatch = ''
57 # don't use vendored rapidjson
58 rm -r vendor/mapbox-base/extras/rapidjson
59 '';
60
61 nativeBuildInputs = [
62 cmake
63 pkg-config
64 ];
65 buildInputs = [
66 curl
67 libuv
68 glfw3
69 qtbase
70 rapidjson
71 ];
72
73 cmakeFlags = [
74 "-DMBGL_WITH_QT=ON"
75 "-DMBGL_WITH_QT_LIB_ONLY=ON"
76 "-DMBGL_WITH_QT_HEADLESS=OFF"
77 ];
78 env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations -Wno-error=type-limits";
79
80 meta = with lib; {
81 # Does not build against gcc-13, the repository is archived upstream.
82 broken = true;
83 description = "Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL";
84 homepage = "https://mapbox.com/mobile";
85 license = licenses.bsd2;
86 maintainers = with maintainers; [
87 Thra11
88 dotlambda
89 ];
90 platforms = platforms.linux;
91 };
92}