summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5edd1da2a77d912c81873e34946d5d368baa7c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# Maintainer:

# options
#: ${_gcc_version:=12}
: ${_qt_version:=5}

: ${_build_git:=true}

unset _pkgtype
[[ "${_build_git::1}" == "t" ]] && _pkgtype+="-git"

# basic info
_pkgname=maplibre-native
pkgname="$_pkgname${_pkgtype:-}"
pkgver=2.1.0.r59.g38dde09
pkgrel=1
pkgdesc="C++ library that powers customizable vector maps in native applications"
url="https://github.com/maplibre/maplibre-native-qt"
arch=("x86_64" "aarch64")
license=(
  'BSD-2-Clause'
  'GPL-2.0-only'
  'GPL-3.0-only'
  'LGPL-3.0-only'
  'MIT'
)

# main package
_main_package() {
  depends=(
    "qt${_qt_version:-5}-base"
    "qt${_qt_version:-5}-location"
  )
  makedepends=(
    "gcc${_gcc_version:-}"

    'cmake'
    'git'
    'glfw'
    'libwebp'
  )

  provides=("$_pkgname")
  conflicts=("$_pkgname")

  _pkgsrc="maplibre.maplibre-native-qt"
  source+=("$_pkgsrc"::"git+$url.git")
  sha256sums+=('SKIP')

  _source_maplibre_native_qt
  _source_maplibre_native

  ## maplibre_native submodules
  _source_mapbox_earcut_hpp
  _source_mapbox_eternal
  _source_mapbox_polylabel
  _source_mapbox_vector_tile
  _source_mapbox_wagyu
  _source_maplibre_maplibre_native_base

  ## maplibre_native_base submodules
  _source_mapbox_geojson_hpp
  _source_mapbox_geojson_vt_cpp
  _source_mapbox_supercluster_hpp
  _source_mapbox_variant
  _source_mourner_kdbush_hpp
  _source_tencent_rapidjson

  ## vector_tile submodules
  #_source_mapbox_mvt_fixtures
}

# submodules
_source_maplibre_native_qt() {
  source+=(
    'jothepro.doxygen-awesome-css'::'git+https://github.com/jothepro/doxygen-awesome-css.git'
    'maplibre.maplibre-native'::'git+https://github.com/maplibre/maplibre-native.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
  )

  _prepare_maplibre_native_qt() (
    cd "$srcdir/$_pkgsrc"
    local -A _submodules=(
      ['jothepro.doxygen-awesome-css']='docs/doxygen-awesome-css'
      ['maplibre.maplibre-native']='vendor/maplibre-native'
    )
    _submodule_update
  )
}

_source_maplibre_native() {
  source+=(
    'google.benchmark'::'git+https://github.com/google/benchmark.git'
    'google.googletest'::'git+https://github.com/google/googletest.git'
    #'jothepro.doxygen-awesome-css'::'git+https://github.com/jothepro/doxygen-awesome-css.git'
    'mapbox.earcut.hpp'::'git+https://github.com/mapbox/earcut.hpp.git'
    'mapbox.eternal'::'git+https://github.com/mapbox/eternal.git'
    'mapbox.mapbox-gestures-android'::'git+https://github.com/mapbox/mapbox-gestures-android.git'
    'mapbox.polylabel'::'git+https://github.com/mapbox/polylabel.git'
    'mapbox.protozero'::'git+https://github.com/mapbox/protozero.git'
    'mapbox.vector-tile'::'git+https://github.com/mapbox/vector-tile.git'
    'mapbox.wagyu'::'git+https://github.com/mapbox/wagyu.git'
    'maplibre.maplibre-gl-native-boost'::'git+https://github.com/maplibre/maplibre-gl-native-boost.git'
    'maplibre.maplibre-java'::'git+https://github.com/maplibre/maplibre-java.git'
    'maplibre.maplibre-native-base'::'git+https://github.com/maplibre/maplibre-native-base.git'
    #'martinus.unordered_dense'::'git+https://github.com/martinus/unordered_dense.git'
    #'microsoft.vcpkg'::'git+https://github.com/microsoft/vcpkg.git'
    'okdshin.unique_resource'::'git+https://github.com/okdshin/unique_resource.git'
    'yhirose.cpp-httplib'::'git+https://github.com/yhirose/cpp-httplib.git'
    'ziparchive'::'git+https://github.com/ZipArchive/ZipArchive.git'
  )
  sha256sums+=(
    #'SKIP'
    #'SKIP'
    #'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
  )

  _prepare_maplibre_native() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    local -A _submodules=(
      ['google.benchmark']='vendor/benchmark'
      ['google.googletest']='vendor/googletest'
      #['jothepro.doxygen-awesome-css']='docs/doxygen/doxygen-awesome-css'
      ['mapbox.earcut.hpp']='vendor/earcut.hpp'
      ['mapbox.eternal']='vendor/eternal'
      ['mapbox.mapbox-gestures-android']='platform/android/vendor/mapbox-gestures-android'
      ['mapbox.polylabel']='vendor/polylabel'
      ['mapbox.protozero']='vendor/protozero'
      ['mapbox.vector-tile']='vendor/vector-tile'
      ['mapbox.wagyu']='vendor/wagyu'
      ['maplibre.maplibre-gl-native-boost']='vendor/boost'
      ['maplibre.maplibre-java']='platform/android/vendor/maplibre-java'
      ['maplibre.maplibre-native-base']='vendor/mapbox-base'
      #['martinus.unordered_dense']='vendor/unordered_dense'
      #['microsoft.vcpkg']='platform/windows/vendor/vcpkg'
      ['okdshin.unique_resource']='vendor/unique_resource'
      ['yhirose.cpp-httplib']='vendor/cpp-httplib'
      ['ziparchive']='vendor/zip-archive'
    )
    _submodule_update
  )
}

_source_mapbox_earcut_hpp() {
  source+=(
    'glfw'::'git+https://github.com/glfw/glfw.git'
  )
  sha256sums+=(
    'SKIP'
  )

  _prepare_mapbox_earcut_hpp() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/earcut.hpp'
    local -A _submodules=(
      ['glfw']='glfw'
    )
    _submodule_update
  )
}

_source_mapbox_eternal() {
  source+=(
    #'google.benchmark'::'git+https://github.com/google/benchmark.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_mapbox_eternal() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/eternal'
    local -A _submodules=(
      ['google.benchmark']='vendor/benchmark'
    )
    _submodule_update
  )
}

_source_mapbox_polylabel() {
  source+=(
    'mapbox.mason'::'git+https://github.com/mapbox/mason.git'
  )
  sha256sums+=(
    'SKIP'
  )

  _prepare_mapbox_polylabel() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/polylabel'
    local -A _submodules=(
      ['mapbox.mason']='.mason'
    )
    _submodule_update
  )
}

_source_mapbox_vector_tile() {
  source+=(
    'mapbox.mvt-fixtures'::'git+https://github.com/mapbox/mvt-fixtures.git'
    'mapbox.mvt-bench-fixtures'::'git+https://github.com/mapbox/mvt-bench-fixtures.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
  )

  _prepare_mapbox_vector_tile() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/vector-tile'
    local -A _submodules=(
      ['mapbox.mvt-fixtures']='test/mvt-fixtures'
      ['mapbox.mvt-bench-fixtures']='bench/mvt-bench-fixtures'
    )
    _submodule_update
  )
}

_source_mapbox_wagyu() {
  source+=(
    'mapnik.geometry-test-data'::'git+https://github.com/mapnik/geometry-test-data.git'
  )
  sha256sums+=(
    'SKIP'
  )

  _prepare_mapbox_wagyu() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/wagyu'
    local -A _submodules=(
      ['mapnik.geometry-test-data']='tests/geometry-test-data'
    )
    _submodule_update
  )
}

_source_maplibre_maplibre_native_base() {
  source+=(
    #'google.googletest'::'git+https://github.com/google/googletest.git'
    'gulrak.filesystem'::'git+https://github.com/gulrak/filesystem.git'
    'mapbox.cheap-ruler-cpp'::'git+https://github.com/mapbox/cheap-ruler-cpp.git'
    'mapbox.geojson-vt-cpp'::'git+https://github.com/mapbox/geojson-vt-cpp.git'
    'mapbox.geojson.hpp'::'git+https://github.com/mapbox/geojson.hpp.git'
    'mapbox.geometry.hpp'::'git+https://github.com/mapbox/geometry.hpp.git'
    'mapbox.jni.hpp'::'git+https://github.com/mapbox/jni.hpp.git'
    'mapbox.optional'::'git+https://github.com/mapbox/Optional.git'
    'mapbox.pixelmatch-cpp'::'git+https://github.com/mapbox/pixelmatch-cpp.git'
    'mapbox.shelf-pack-cpp'::'git+https://github.com/mapbox/shelf-pack-cpp.git'
    'mapbox.supercluster.hpp'::'git+https://github.com/mapbox/supercluster.hpp.git'
    'mapbox.variant'::'git+https://github.com/mapbox/variant.git'
    'martinmoene.expected-lite'::'git+https://github.com/martinmoene/expected-lite.git'
    'mourner.kdbush.hpp'::'git+https://github.com/mourner/kdbush.hpp.git'
    'taywee.args'::'git+https://github.com/Taywee/args.git'
    'tencent.rapidjson'::'git+https://github.com/Tencent/rapidjson.git'
  )
  sha256sums+=(
    #'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
    'SKIP'
  )

  _prepare_maplibre_maplibre_native_base() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    local -A _submodules=(
      ['google.googletest']='extras/googletest'
      ['gulrak.filesystem']='extras/filesystem'
      ['mapbox.cheap-ruler-cpp']='deps/cheap-ruler-cpp'
      ['mapbox.geojson-vt-cpp']='deps/geojson-vt-cpp'
      ['mapbox.geojson.hpp']='deps/geojson.hpp'
      ['mapbox.geometry.hpp']='deps/geometry.hpp'
      ['mapbox.jni.hpp']='deps/jni.hpp'
      ['mapbox.optional']='deps/optional'
      ['mapbox.pixelmatch-cpp']='deps/pixelmatch-cpp'
      ['mapbox.shelf-pack-cpp']='deps/shelf-pack-cpp'
      ['mapbox.supercluster.hpp']='deps/supercluster.hpp'
      ['mapbox.variant']='deps/variant'
      ['martinmoene.expected-lite']='extras/expected-lite'
      ['mourner.kdbush.hpp']='extras/kdbush.hpp'
      ['taywee.args']='extras/args'
      ['tencent.rapidjson']='extras/rapidjson'
    )
    _submodule_update
  )
}

_source_mapbox_geojson_vt_cpp() {
  source+=(
    #'mapbox.mason'::'git+https://github.com/mapbox/mason.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_mapbox_geojson_vt_cpp() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    cd 'deps/geojson-vt-cpp'
    local -A _submodules=(
      ['mapbox.mason']='.mason'
    )
    _submodule_update
  )
}

_source_mapbox_geojson_hpp() {
  source+=(
    #'mapbox.mason'::'git+https://github.com/mapbox/mason.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_mapbox_geojson_hpp() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    cd 'deps/geojson.hpp'
    local -A _submodules=(
      ['mapbox.mason']='.mason'
    )
    _submodule_update
  )
}

_source_mapbox_supercluster_hpp() {
  source+=(
    #'mapbox.mason'::'git+https://github.com/mapbox/mason.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_mapbox_supercluster_hpp() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    cd 'deps/supercluster.hpp'
    local -A _submodules=(
      ['mapbox.mason']='.mason'
    )
    _submodule_update
  )
}

_source_mapbox_variant() {
  source+=(
    #'mapbox.mason'::'git+https://github.com/mapbox/mason.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_mapbox_variant() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    cd 'deps/variant'
    local -A _submodules=(
      ['mapbox.mason']='.mason'
    )
    _submodule_update
  )
}

_source_mourner_kdbush_hpp() {
  source+=(
    #'mapbox.mason'::'git+https://github.com/mapbox/mason.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_mourner_kdbush_hpp() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    cd 'extras/kdbush.hpp'
    local -A _submodules=(
      ['mapbox.mason']='.mason'
    )
    _submodule_update
  )
}

_source_tencent_rapidjson() {
  source+=(
    #'google.googletest'::'git+https://github.com/google/googletest.git'
  )
  sha256sums+=(
    #'SKIP'
  )

  _prepare_tencent_rapidjson() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/mapbox-base'
    cd 'extras/rapidjson'
    local -A _submodules=(
      ['google.googletest']='thirdparty/gtest'
    )
    _submodule_update
  )
}

_source_mapbox_mvt_fixtures() {
  source+=(
    'mapbox.vector-tile-spec'::'git+https://github.com/mapbox/vector-tile-spec.git'
  )
  sha256sums+=(
    'SKIP'
  )

  _prepare_mapbox_mvt_fixtures() (
    cd "$srcdir/$_pkgsrc"
    cd 'vendor/maplibre-native'
    cd 'vendor/vector-tile'
    cd 'test/mvt-fixtures'
    local -A _submodules=(
      ['mapbox.vector-tile-spec']='vector-tile-spec'
    )
    _submodule_update
  )
}

# common functions
prepare() {
  _submodule_update() {
    local key;
    for key in ${!_submodules[@]} ; do
      git submodule init "${_submodules[${key}]}"
      git submodule set-url "${_submodules[${key}]}" "${srcdir}/${key}"
      git -c protocol.file.allow=always submodule update "${_submodules[${key}]}"
      echo
    done
  }

  _prepare_maplibre_native_qt
  _prepare_maplibre_native

  ## maplibre_native submodules
  _prepare_mapbox_earcut_hpp
  _prepare_mapbox_eternal
  _prepare_mapbox_polylabel
  _prepare_mapbox_vector_tile
  _prepare_mapbox_wagyu
  _prepare_maplibre_maplibre_native_base

  ## maplibre_native_base submodules
  _prepare_mapbox_geojson_hpp
  _prepare_mapbox_geojson_vt_cpp
  _prepare_mapbox_supercluster_hpp
  _prepare_mapbox_variant
  _prepare_mourner_kdbush_hpp
  _prepare_tencent_rapidjson

  ## vector_tile submodules
  #_prepare_mapbox_mvt_fixtures
}

pkgver() (
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 \
    | sed -E 's/^[^0-9]+//;s/([^-]*-g)/r\1/;s/-/./g'
)

build() {
  export CC="gcc${_gcc_version:+-$_gcc_version}"
  export CXX="g++${_gcc_version:+-$_gcc_version}"

  export LDFLAGS+="-Wl,--copy-dt-needed-entries"

  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -DCMAKE_BUILD_TYPE=Release
    -DCMAKE_INSTALL_PREFIX='/usr'
    -DBUILD_TESTING=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 "$_pkgsrc/LICENSES"/*.txt -t "$pkgdir/usr/share/licenses/$pkgname/"

  install -Dm644 /dev/stdin "$pkgdir/usr/share/licenses/$pkgname/LICENSE" <<'END'
Copyright (C) 2023 MapLibre contributors

The core library may be used under 2-Clause BSD License.
QML bindings may be used under the terms of either GNU General Public License version 2.0,
GNU General Public License version 3.0 or GNU Lesser General Public License version 3.0.
Examples are licensed under MIT.
Full texts of the licenses can be found in the [LICENSES](LICENSES) directory.

Each file contains corresponding license information with SPDX license identifiers
to clarify how it can be used.
END
}

# execute
_main_package