blob: 4d00fea6d453afdb3a09b3034881d378f2b1eeac [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "A TCP/IP Daemon simplifying the communication with GPS devices"
2SECTION = "console/network"
3LICENSE = "BSD"
4LIC_FILES_CHKSUM = "file://COPYING;md5=d217a23f408e91c94359447735bc1800"
5DEPENDS = "dbus dbus-glib ncurses python libusb1 chrpath-replacement-native pps-tools"
6PROVIDES = "virtual/gpsd"
7
8EXTRANATIVEPATH += "chrpath-native"
9
10SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \
11 file://0001-SConstruct-respect-sysroot-also-in-SPLINTOPTS.patch \
12 file://0002-SConstruct-remove-rpath.patch \
13 file://0001-SConstruct-prefix-includepy-with-sysroot-and-drop-sy.patch \
14 file://0004-SConstruct-disable-html-and-man-docs-building-becaus.patch \
15 file://0001-Check-for-__STDC_NO_ATOMICS__-before-using-stdatomic.patch \
16 file://0002-Add-a-test-for-C11-and-check-we-have-C11-before-usin.patch \
17 file://0003-Whoops-check-for-C11-not-for-not-C11-in-stdatomic.h-.patch \
18 file://0001-Include-stdatomic.h-only-in-C-mode.patch \
19 file://0001-libgpsd-core-Fix-issue-with-ACTIVATE-hook-not-being-.patch \
Patrick Williamsddad1a12017-02-23 20:36:32 -060020 file://0001-include-sys-ttydefaults.h.patch \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050021 file://gpsd-default \
22 file://gpsd \
23 file://60-gpsd.rules \
24 file://gpsd.service \
25"
26SRC_URI[md5sum] = "bc7467009b99e07ba461377b5da6c039"
27SRC_URI[sha256sum] = "504fc812f3c1525a1a48e04bf4d77f9a8066c201448d98089df89d58ef53a8cb"
28
29inherit scons update-rc.d python-dir pythonnative systemd bluetooth
30
31INITSCRIPT_NAME = "gpsd"
32INITSCRIPT_PARAMS = "defaults 35"
33
34SYSTEMD_OESCONS = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false',d)}"
35
36export STAGING_INCDIR
37export STAGING_LIBDIR
38
39PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)}"
40PACKAGECONFIG[bluez] = "bluez='true',bluez='false',${BLUEZ}"
41PACKAGECONFIG[qt] = "qt='yes',qt='no',qt4-x11-free"
42EXTRA_OESCONS = " \
43 sysroot=${STAGING_DIR_TARGET} \
44 libQgpsmm='false' \
45 debug='true' \
46 strip='false' \
47 chrpath='yes' \
48 systemd='${SYSTEMD_OESCONS}' \
Patrick Williamsddad1a12017-02-23 20:36:32 -060049 libdir='${libdir}' \
50 ${PACKAGECONFIG_CONFARGS} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050051"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050052# this cannot be used, because then chrpath is not found and only static lib is built
53# target=${HOST_SYS}
54
55do_compile_prepend() {
56 export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
57 export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
58 export STAGING_PREFIX="${STAGING_DIR_HOST}/${prefix}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060059 export LINKFLAGS="${LDFLAGS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050060}
61
62do_install() {
63 export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
64 export PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=\"${PKG_CONFIG_SYSROOT_DIR}\" pkg-config"
65 export STAGING_PREFIX="${STAGING_DIR_HOST}/${prefix}"
Patrick Williamsddad1a12017-02-23 20:36:32 -060066 export LINKFLAGS="${LDFLAGS}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050067
68 export DESTDIR="${D}"
69 # prefix is used for RPATH and DESTDIR/prefix for instalation
70 ${STAGING_BINDIR_NATIVE}/scons prefix=${prefix} install ${EXTRA_OESCONS}|| \
71 bbfatal "scons install execution failed."
72}
73
74do_install_append() {
75 install -d ${D}/${sysconfdir}/init.d
76 install -m 0755 ${WORKDIR}/gpsd ${D}/${sysconfdir}/init.d/
77 install -d ${D}/${sysconfdir}/default
78 install -m 0644 ${WORKDIR}/gpsd-default ${D}/${sysconfdir}/default/gpsd.default
79
80 #support for udev
81 install -d ${D}/${sysconfdir}/udev/rules.d
82 install -m 0644 ${WORKDIR}/60-gpsd.rules ${D}/${sysconfdir}/udev/rules.d
83 install -d ${D}${base_libdir}/udev/
84 install -m 0755 ${S}/gpsd.hotplug ${D}${base_libdir}/udev/
85
86 #support for python
87 install -d ${D}/${PYTHON_SITEPACKAGES_DIR}/gps
88 install -m 755 ${S}/gps/*.py ${D}/${PYTHON_SITEPACKAGES_DIR}/gps
89
90 #support for systemd
91 install -d ${D}${systemd_unitdir}/system/
92 install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_unitdir}/system/${BPN}.service
93 install -m 0644 ${S}/systemd/${BPN}.socket ${D}${systemd_unitdir}/system/${BPN}.socket
94}
95
96pkg_postinst_${PN}-conf() {
97 update-alternatives --install ${sysconfdir}/default/gpsd gpsd-defaults ${sysconfdir}/default/gpsd.default 10
98}
99
100pkg_postrm_${PN}-conf() {
101 update-alternatives --remove gpsd-defaults ${sysconfdir}/default/gpsd.default
102}
103
104PACKAGES =+ "libgps libgpsd python-pygps-dbg python-pygps gpsd-udev gpsd-conf gpsd-gpsctl gps-utils"
105
106FILES_${PN}-dev += "${libdir}/pkgconfdir/libgpsd.pc ${libdir}/pkgconfdir/libgps.pc \
107 ${libdir}/libQgpsmm.prl"
108
109FILES_python-pygps-dbg += " ${libdir}/python*/site-packages/gps/.debug"
110
111RDEPENDS_${PN} = "gpsd-gpsctl"
112RRECOMMENDS_${PN} = "gpsd-conf gpsd-udev gpsd-machine-conf"
113
114SUMMARY_gpsd-udev = "udev relevant files to use gpsd hotplugging"
115FILES_gpsd-udev = "${base_libdir}/udev ${sysconfdir}/udev/*"
116RDEPENDS_gpsd-udev += "udev gpsd-conf"
117
118SUMMARY_libgpsd = "C service library used for communicating with gpsd"
119FILES_libgpsd = "${libdir}/libgpsd.so.*"
120
121SUMMARY_libgps = "C service library used for communicating with gpsd"
122FILES_libgps = "${libdir}/libgps.so.*"
123
124SUMMARY_gpsd-conf = "gpsd configuration files and init scripts"
125FILES_gpsd-conf = "${sysconfdir}"
126CONFFILES_gpsd-conf = "${sysconfdir}/default/gpsd.default"
127
128SUMMARY_gpsd-gpsctl = "Tool for tweaking GPS modes"
129FILES_gpsd-gpsctl = "${bindir}/gpsctl"
130
131SUMMARY_gps-utils = "Utils used for simulating, monitoring,... a GPS"
132FILES_gps-utils = "${bindir}/*"
133RDEPENDS_gps-utils = "python-pygps"
134
135SUMMARY_python-pygps = "Python bindings to gpsd"
136FILES_python-pygps = "${PYTHON_SITEPACKAGES_DIR}/*"
137RDEPENDS_python-pygps = "python-core python-curses gpsd python-json"
138
139RPROVIDES_${PN} += "${PN}-systemd"
140RREPLACES_${PN} += "${PN}-systemd"
141RCONFLICTS_${PN} += "${PN}-systemd"
142SYSTEMD_SERVICE_${PN} = "${PN}.socket"