summaryrefslogtreecommitdiff
path: root/HACKING.md
blob: c8d2905c8201b8a1d30cce92f9670e1e7688d14e (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
# Building Geoclue

- The following are the dependencies needed to build Geoclue2. But If Geoclue2
  is already included in your distro/OS, you should be able to use the
  package manager's command to install all build depedndancies.

  * gio (>= 2.44.0)
  * gobject-introspection
  * json-glib
  * libsoup3.0
  * pkg-config

  Fedora:

  ```shell
  sudo dnf builddep geoclue2
  ```

  Debian and Ubuntu:

  ```shell
  sudo apt build-dep geoclue-2.0
  ```

- For a full-fledged build, you also want ModemManager (mm-glib), 
  avahi-client and avahi-glib. You want the latter two if you want to use the 
  [geoclue-share app](https://wiki.gnome.org/Apps/GeoclueShare). You also need 
  libnotify if you want to build the demo agent.

  Fedora:

  ```shell
  sudo dnf install ModemManager-devel
  sudo dnf install avahi-devel
  sudo dnf install avahi-glib-devel
  sudo dnf install libnotify-devel
  ```

  Debian and Ubuntu:

  ```shell
  sudo apt install modemmanager-dev
  sudo apt install libavahi-client-dev
  sudo apt install libavahi-glib-dev
  sudo apt install libnotify-dev
  ```

- [Install meson](https://mesonbuild.com/Getting-meson.html).

- Ensure you have a `geoclue` user on your system. If it already exists, you may
  need to modify `/etc/passwd` file to make it a login user account by replacing
  `/sbin/nologin` with `/bin/bash` (or the path to your preferred shell).

- Build and install geoclue.

  ```shell
  meson --prefix=/usr --sysconfdir /etc -Ddbus-srv-user=geoclue build
  # you may need to pass --libdir=/usr/lib64 on some systems (eg. Fedora)
  ninja -C build
  sudo ninja -C build install
  ```

- Then you can run it as:

  ```shell
  sudo su geoclue # Starts a new shell as `geoclue` user
  G_MESSAGES_DEBUG=Geoclue /usr/libexec/geoclue
  ```

  If you get the following error, make sure `geoclue` process is not already
  running:

  ```
  > Failed to acquire name 'org.freedesktop.GeoClue2' on system bus or lost it
  ```

- Now you can test if Geoclue is running and working:

  ```shell
  /usr/libexec/geoclue-2.0/demos/where-am-i
  ```

  It will give your current location.