makedepends=(icu qtbase qtdeclarative qttools git)

description="A cross-platform application and UI framework, QtLocation files"
url="http://qt-project.org/"

packager="Great-OS Team"
maintainer="Great-OS Team"

set=(qt5-dev)
name=qtlocation
version=5.15.18
release=1
_mapboxgl_commit=5a8942b9b97db71e61be0dff9a0644bc444b7340
_name="${name}-everywhere-opensource-src"
_name2="${name}-everywhere-src"

source=(https://download.qt.io/archive/qt/${version:0:4}/$version/submodules/${_name}-${version}.tar.xz)

#Fix GCC13 compilation issue: Rrror: ‘FeatureType’ has not been declared
prepare() {
  cd ${_name2}-${version}/src/3rdparty/
  rm -rf mapbox-gl-native/
  git clone https://invent.kde.org/qt/qt/qtlocation-mapboxgl/
  cd qtlocation-mapboxgl
  git checkout ${_mapboxgl_commit}
  cd ..
  mv qtlocation-mapboxgl mapbox-gl-native
}

build() {
  cd ${_name2}-${version}

  qmake

  make
  make INSTALL_ROOT=$PKG install

  # Drop QMAKE_PRL_BUILD_DIR because reference the build dir
  find "$PKG/usr/lib" -type f -name '*.prl' \
    -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;

}
