1SUMMARY = "A TCP/IP Daemon simplifying the communication with GPS devices"
2SECTION = "console/network"
3LICENSE = "BSD-2-Clause"
4LIC_FILES_CHKSUM = "file://COPYING;md5=7a5d174db44ec45f9638b2c747806821"
5DEPENDS = "dbus ncurses python3 pps-tools"
6PROVIDES = "virtual/gpsd"
7
8SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
9           file://gpsd.init \
10           file://fix-pps_strerror_r.patch \
11           "
12SRC_URI[sha256sum] = "b368b6a305e3f7a6382d23a0cbfc1d78923060b6b7f54cf7987a73c7b4a9afc2"
13
14inherit scons update-rc.d python3-dir python3native systemd update-alternatives pkgconfig
15
16INITSCRIPT_PACKAGES = "gpsd-conf"
17INITSCRIPT_NAME = "gpsd"
18INITSCRIPT_PARAMS = "defaults 35"
19
20SYSTEMD_OESCONS = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false',d)}"
21
22export STAGING_INCDIR
23export STAGING_LIBDIR
24
25CLEANBROKEN = "1"
26
27PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} usb"
28PACKAGECONFIG[bluez] = "bluez='true',bluez='false',bluez5"
29PACKAGECONFIG[qt] = "qt='yes' qt_versioned=5,qt='no',qtbase"
30PACKAGECONFIG[pyserial] = ""
31PACKAGECONFIG[usb] = "usb='true',usb='false',libusb1"
32EXTRA_OESCONS = " \
33    sysroot=${STAGING_DIR_TARGET} \
34    libQgpsmm='false' \
35    debug='false' \
36    nostrip='true' \
37    systemd='${SYSTEMD_OESCONS}' \
38    libdir='${libdir}' \
39    sbindir='${sbindir}' \
40    udevdir='${nonarch_base_libdir}/udev' \
41    unitdir='${systemd_system_unitdir}' \
42    manbuild='false' \
43    LINK='${CC}' \
44    ${PACKAGECONFIG_CONFARGS} \
45"
46# This cannot be used, because then chrpath is not found and only static lib is built
47# target=${HOST_SYS}
48
49do_compile:prepend() {
50    export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
51    export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
52    export STAGING_PREFIX="${STAGING_DIR_HOST}/${prefix}"
53    export CC="${CC}"
54    export LD="${CC}"
55    export LINKFLAGS="${LDFLAGS}"
56}
57
58do_install() {
59    export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
60    export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
61    export STAGING_PREFIX="${STAGING_DIR_HOST}/${prefix}"
62    export LD="${CC}"
63    export LINKFLAGS="${LDFLAGS}"
64
65    export DESTDIR="${D}"
66    # prefix is used for RPATH and DESTDIR/prefix for installation
67    ${STAGING_BINDIR_NATIVE}/scons prefix=${prefix} python_libdir=${libdir} udev-install ${EXTRA_OESCONS} || \
68      bbfatal "scons install execution failed."
69}
70
71do_install:append() {
72    install -d ${D}${sysconfdir}/init.d
73    install -m 0755 ${UNPACKDIR}/gpsd.init ${D}${sysconfdir}/init.d/gpsd
74    install -d ${D}${sysconfdir}/default
75    install -m 0644 ${S}/packaging/deb/etc_default_gpsd ${D}${sysconfdir}/default/gpsd.default
76
77    # Support for python
78    if [ -d ${D}${libdir}/gps ]; then
79        install -d ${D}${PYTHON_SITEPACKAGES_DIR}/gps
80        install -m 755 ${D}${libdir}/gps/*.py ${D}${PYTHON_SITEPACKAGES_DIR}/gps
81    fi
82}
83
84PACKAGES =+ "libgps python3-pygps gpsd-udev gpsd-conf gpsd-gpsctl gpsd-snmp gps-utils gps-utils-python"
85
86RPROVIDES:${PN}-dbg += "python-pygps-dbg"
87
88FILES:${PN}-dev += "${libdir}/libQgpsmm.prl"
89
90FILES:${PN}-doc += "${datadir}/${BPN}/doc"
91
92RDEPENDS:${PN} = "gpsd-gpsctl"
93RRECOMMENDS:${PN} = "gpsd-conf gpsd-udev gpsd-machine-conf"
94
95SUMMARY:gpsd-udev = "udev relevant files to use gpsd hotplugging"
96FILES:gpsd-udev = "${nonarch_base_libdir}/udev"
97RDEPENDS:gpsd-udev += "udev gpsd-conf"
98
99SUMMARY:libgps = "C service library used for communicating with gpsd"
100FILES:libgps = "${libdir}/libgps.so.*"
101
102SUMMARY:gpsd-conf = "gpsd configuration files and init scripts"
103FILES:gpsd-conf = "${sysconfdir}"
104CONFFILES:gpsd-conf = "${sysconfdir}/default/gpsd.default"
105
106SUMMARY:gpsd-gpsctl = "Tool for tweaking GPS modes"
107FILES:gpsd-gpsctl = "${bindir}/gpsctl"
108
109SUMMARY:gpsd-snmp = "MIB for using SNMP with gpsd"
110FILES:gpsd-snmp = "${datadir}/snmp"
111
112SUMMARY:gps-utils = "Utils used for simulating, monitoring,... a GPS"
113FILES:gps-utils = "\
114    ${bindir}/cgps         \
115    ${bindir}/gps2udp      \
116    ${bindir}/gpsctl       \
117    ${bindir}/gpsdebuginfo \
118    ${bindir}/gpsdecode    \
119    ${bindir}/gpsmon       \
120    ${bindir}/gpspipe      \
121    ${bindir}/gpsrinex     \
122    ${bindir}/gpssnmp      \
123    ${bindir}/gpxlogger    \
124    ${bindir}/lcdgps       \
125    ${bindir}/ntpshmmon    \
126    ${bindir}/ppscheck     \
127"
128RRECOMMENDS:gps-utils = "gps-utils-python"
129
130SUMMARY:gps-utils-python = "Python utils used for simulating, monitoring,... a GPS"
131FILES:gps-utils-python = "\
132    ${bindir}/gegps        \
133    ${bindir}/gpscat       \
134    ${bindir}/gpscsv       \
135    ${bindir}/gpsfake      \
136    ${bindir}/gpsplot      \
137    ${bindir}/gpsprof      \
138    ${bindir}/gpssubframe  \
139    ${bindir}/ubxtool      \
140    ${bindir}/xgps         \
141    ${bindir}/xgpsspeed    \
142    ${bindir}/zerk         \
143"
144RDEPENDS:gps-utils-python = "python3-pygps"
145
146SUMMARY:python3-pygps = "Python bindings to gpsd"
147FILES:python3-pygps = "${PYTHON_SITEPACKAGES_DIR}/* ${libdir}/gps/*.py ${libdir}/*.egg-info"
148RDEPENDS:python3-pygps = " \
149    python3-core \
150    python3-io \
151    ${@bb.utils.contains('PACKAGECONFIG', 'pyserial', 'python3-pyserial', '', d)} \
152    python3-threading \
153    python3-terminal \
154    gpsd \
155    python3-json"
156
157RPROVIDES:${PN} += "${PN}-systemd"
158RREPLACES:${PN} += "${PN}-systemd"
159RCONFLICTS:${PN} += "${PN}-systemd"
160SYSTEMD_SERVICE:${PN} = "${BPN}.socket ${BPN}ctl@.service"
161
162ALTERNATIVE:${PN} = "gpsd-defaults"
163ALTERNATIVE_LINK_NAME[gpsd-defaults] = "${sysconfdir}/default/gpsd"
164ALTERNATIVE_TARGET[gpsd-defaults] = "${sysconfdir}/default/gpsd.default"
165