diff --git a/geoclue/0001-WIP-Use-Google-Maps-Platform-by-default.patch b/geoclue/0001-WIP-Use-Google-Maps-Platform-by-default.patch new file mode 100644 index 0000000000..95cdcf03f0 --- /dev/null +++ b/geoclue/0001-WIP-Use-Google-Maps-Platform-by-default.patch @@ -0,0 +1,80 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +Date: Tue, 7 May 2024 21:31:53 +0200 +Subject: [PATCH] WIP: Use Google Maps Platform by default + +--- + data/geoclue.conf.in | 12 ++++++------ + meson.build | 1 + + meson_options.txt | 3 +++ + src/gclue-config.c | 2 +- + 4 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/data/geoclue.conf.in b/data/geoclue.conf.in +index 9afb5e08f37c..fc650f2d5e68 100644 +--- a/data/geoclue.conf.in ++++ b/data/geoclue.conf.in +@@ -47,21 +47,21 @@ enable=true + # source will be used instead. + enable=true + +-# URL to the WiFi geolocation service. If not set, defaults to Mozilla's +-# Location Service with a hardcoded key. To use a custom key, uncomment this URL +-# while changing YOUR_KEY to your MLS API key. +-#url=https://location.services.mozilla.com/v1/geolocate?key=YOUR_KEY +- +-# To use the Google geolocation service instead of Mozilla's, uncomment this URL ++# URL to the WiFi geolocation service. If not set, defaults to Google's ++# Geolocation API with a hardcoded key. To use a custom key, uncomment this URL + # while changing YOUR_KEY to your Google API key. + # + # WARNING: Please make sure that you are complying with the Google's ToS and + # policies if you uncomment this: + # + # https://developers.google.com/maps/documentation/geolocation/policies + # + #url=https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_KEY + ++# To use the Mozilla's Location Service instead of Google's, uncomment this URL ++# while changing YOUR_KEY to your MLS API key. ++#url=https://location.services.mozilla.com/v1/geolocate?key=YOUR_KEY ++ + # Submit data to Mozilla Location Service + # If set to true, geoclue will automatically submit network data to Mozilla + # each time it gets a GPS lock. +diff --git a/meson.build b/meson.build +index b175096a9556..5cbcec2d9afc 100644 +--- a/meson.build ++++ b/meson.build +@@ -31,6 +31,7 @@ conf.set_quoted('TEST_SRCDIR', meson.project_source_root() + '/data/') + conf.set_quoted('LOCALEDIR', localedir) + conf.set_quoted('SYSCONFDIR', sysconfdir) + conf.set_quoted('MOZILLA_API_KEY', get_option('mozilla-api-key')) ++conf.set_quoted('GOOGLE_API_KEY', get_option('google-api-key')) + conf.set10('GCLUE_USE_3G_SOURCE', get_option('3g-source')) + conf.set10('GCLUE_USE_CDMA_SOURCE', get_option('cdma-source')) + conf.set10('GCLUE_USE_MODEM_GPS_SOURCE', get_option('modem-gps-source')) +diff --git a/meson_options.txt b/meson_options.txt +index 5b8c42d2f6b9..69e76f013241 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -43,3 +43,6 @@ option('dbus-srv-user', + option('mozilla-api-key', + type: 'string', value: 'geoclue', + description: 'Your API key for Mozilla Location Service') ++option('google-api-key', ++ type: 'string', value: 'geoclue', ++ description: 'Your API key for Google Maps Platform') +diff --git a/src/gclue-config.c b/src/gclue-config.c +index 70822ed225fd..faacfbe998b3 100644 +--- a/src/gclue-config.c ++++ b/src/gclue-config.c +@@ -265,7 +265,7 @@ load_enable_source_config (GClueConfig *config, + return enable; + } + +-#define DEFAULT_WIFI_URL "https://location.services.mozilla.com/v1/geolocate?key=" MOZILLA_API_KEY ++#define DEFAULT_WIFI_URL "https://www.googleapis.com/geolocation/v1/geolocate?key=" GOOGLE_API_KEY + #define DEFAULT_WIFI_SUBMIT_URL "https://location.services.mozilla.com/v2/geosubmit?key=" MOZILLA_API_KEY + #define DEFAULT_WIFI_SUBMIT_NICK "geoclue" + diff --git a/geoclue/0001-sources-Don-t-compute-movement-for-low-accuracy-sour.patch b/geoclue/0001-sources-Don-t-compute-movement-for-low-accuracy-sour.patch deleted file mode 100644 index dde7f132f2..0000000000 --- a/geoclue/0001-sources-Don-t-compute-movement-for-low-accuracy-sour.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: "Jan Alexander Steffens (heftig)" -Date: Fri, 9 Apr 2021 19:50:58 +0000 -Subject: [PATCH] sources: Don't compute movement for low-accuracy sources - -This avoids claiming the compass and updating the location for heading -changes when we only need to serve low-accuracy clients like the GNOME -Settings Daemon. ---- - src/gclue-3g.c | 4 +++- - src/gclue-cdma.c | 4 +++- - src/gclue-wifi.c | 1 + - 3 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/src/gclue-3g.c b/src/gclue-3g.c -index 4473102..40c10f6 100644 ---- a/src/gclue-3g.c -+++ b/src/gclue-3g.c -@@ -188,7 +188,9 @@ gclue_3g_get_singleton (void) - static GClue3G *source = NULL; - - if (source == NULL) { -- source = g_object_new (GCLUE_TYPE_3G, NULL); -+ source = g_object_new (GCLUE_TYPE_3G, -+ "compute-movement", FALSE, -+ NULL); - g_object_weak_ref (G_OBJECT (source), - on_3g_destroyed, - &source); -diff --git a/src/gclue-cdma.c b/src/gclue-cdma.c -index 8f4f129..2a26a77 100644 ---- a/src/gclue-cdma.c -+++ b/src/gclue-cdma.c -@@ -177,7 +177,9 @@ gclue_cdma_get_singleton (void) - static GClueCDMA *source = NULL; - - if (source == NULL) { -- source = g_object_new (GCLUE_TYPE_CDMA, NULL); -+ source = g_object_new (GCLUE_TYPE_CDMA, -+ "compute-movement", FALSE, -+ NULL); - g_object_weak_ref (G_OBJECT (source), - on_cdma_destroyed, - &source); -diff --git a/src/gclue-wifi.c b/src/gclue-wifi.c -index e507830..f09b40c 100644 ---- a/src/gclue-wifi.c -+++ b/src/gclue-wifi.c -@@ -968,6 +968,7 @@ gclue_wifi_get_singleton (GClueAccuracyLevel level) - wifi[i] = g_object_new (GCLUE_TYPE_WIFI, - "accuracy-level", level, - "scramble-location", scramble_location, -+ "compute-movement", i > 0, - NULL); - g_object_weak_ref (G_OBJECT (wifi[i]), - on_wifi_destroyed, diff --git a/geoclue/PKGBUILD b/geoclue/PKGBUILD index 61e81da25f..3e5643336a 100644 --- a/geoclue/PKGBUILD +++ b/geoclue/PKGBUILD @@ -4,7 +4,7 @@ pkgname=geoclue pkgver=2.7.1 -pkgrel=2 +pkgrel=3 pkgdesc="Modular geoinformation service built on the D-Bus messaging system" url="https://gitlab.freedesktop.org/geoclue/geoclue/-/wikis/home" arch=(x86_64 powerpc64le powerpc64 powerpc riscv64) @@ -20,6 +20,7 @@ depends=( ) makedepends=( git + glib2-devel gobject-introspection gtk-doc libnotify @@ -32,9 +33,18 @@ provides=("geoclue2=$pkgver-$pkgrel") conflicts=(geoclue2) replaces=(geoclue2) backup=(etc/geoclue/geoclue.conf) -_commit=8a24f60969d4c235d9918796c38a6a9c42e10131 # tags/2.7.1 -source=("git+https://gitlab.freedesktop.org/geoclue/geoclue.git#commit=$_commit") -b2sums=('SKIP') +source=( + "git+https://gitlab.freedesktop.org/geoclue/geoclue.git#tag=$pkgver" + 0001-WIP-Use-Google-Maps-Platform-by-default.patch +) +b2sums=('0e8ab05d8124598d9bd306bb2f81a9c4e47c02b710265048e19d950d8587e3ff729234b2e07847c3f0b9118c7b89153f9e59b6414a6660007203e7a831ce839b' + '192e35693aa8145ac3ad23ee0fb64a247298e57959095281614cc33be27e60ad7ce16117df043ab7bff9ca721cce3e82cea0bfaddb9c5996b24be7cb4ebd95ce') + +# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys) +# Note: These are for Arch Linux use ONLY. For your own distribution, please +# get your own set of keys. Feel free to contact foutrelis@archlinux.org for +# more information. +_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM # Mozilla API keys (see https://location.services.mozilla.com/api) # Note: These are for Arch Linux use ONLY. For your own distribution, please @@ -42,18 +52,18 @@ b2sums=('SKIP') # more information. _mozilla_api_key=e05d56db0a694edc8b5aaebda3f2db6a -pkgver() { - cd geoclue - git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g' -} - prepare() { cd geoclue + + # Use Google Maps Platform as the default geolocation service + # https://gitlab.archlinux.org/archlinux/packaging/packages/geoclue/-/issues/1 + git apply -3 ../0001-WIP-Use-Google-Maps-Platform-by-default.patch } build() { local meson_options=( -D dbus-srv-user=geoclue + -D google-api-key="$_google_api_key" -D mozilla-api-key="$_mozilla_api_key" )