summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ca4ab7bd9894bb7afa9216a8907bccccf18f1f4f (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
# Maintainer:
# Contributor: dreieck
# Contributor: éclairevoyant

## useful links
# https://rinigus.github.io/pure-maps
# https://github.com/rinigus/pure-maps

## options
: ${_build_git:=true}

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

## basic info
_pkgname="pure-maps"
pkgname="$_pkgname${_pkgtype:-}"
pkgver=3.3.0.r0.g1b577ea
pkgrel=1
pkgdesc="Display vector and raster maps, places, routes, etc."
url="https://github.com/rinigus/pure-maps"
license=('GPL-3.0-or-later')
arch=('x86_64')

# main package
_main_package() {
  depends=(
    kirigami2
    python-lxml
    python-pyotherside
    qt5-declarative
    qt5-location
    qt5-multimedia
    qt5-quickcontrols2
    qt5-sensors

    # AUR
    mapbox-gl-qml
      # maplibre-native
    nemo-qml-plugin-dbus
    s2geometry
  )
  makedepends=(
    'cmake'
    'git'
    'qt5-tools'
  )

  if [ "${_build_git::1}" != "t" ] ; then
    _main_stable
  else
    _main_git
  fi

  _source_pure_maps
}

# stable package
_main_stable() {
  : ${_pkgver:=${pkgver%%.r*}}

  _pkgsrc="$_pkgname"
  source+=("$_pkgsrc"::"git+$url.git#tag=$_pkgver")
  sha256sums+=('SKIP')

  pkgver() {
    echo "${_pkgver:?}"
  }
}

# git package
_main_git() {
  provides+=("$_pkgname=${pkgver%%.r*}")
  conflicts+=("$_pkgname")

  _pkgsrc="$_pkgname"
  source+=("$_pkgsrc"::"git+$url.git")
  sha256sums+=('SKIP')

  pkgver() {
    cd "$_pkgsrc"
    git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*' \
      | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
  }
}

# submodules
_source_pure_maps() {
  source+=(
    'rinigus.geomag'::'git+https://github.com/rinigus/geomag.git'
    'tkrajina.gpxpy'::'git+https://github.com/tkrajina/gpxpy.git'
    'heremaps.flexible-polyline'::'git+https://github.com/heremaps/flexible-polyline.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
    'SKIP'
  )

  _prepare_pure_maps() (
    cd "$_pkgsrc"
    local -A _submodules=(
      ['rinigus.geomag']='thirdparty/geomag'
      ['tkrajina.gpxpy']='thirdparty/gpxpy'
      ['heremaps.flexible-polyline']='thirdparty/flexible-polyline'
    )
    _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}]}"
    done
  }

  _prepare_pure_maps
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX='/usr'
    -DCMAKE_INSTALL_LIBDIR='lib'

    -Wno-dev

    -DUSE_BUNDLED_GEOCLUE2=ON
    -DUSE_BUNDLED_GEOMAG=ON
    -DUSE_BUNDLED_GPXPY=ON

    -DCMAKE_CXX_STANDARD=17
  )

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

package() {
  depends+=(
    hicolor-icon-theme
  )

  DESTDIR="$pkgdir" cmake --install build
}

# execute
_main_package