buildroot/package/gpsd/gpsd.mk

244 lines
5.8 KiB
Makefile
Raw Normal View History

################################################################################
#
# gpsd
#
################################################################################
GPSD_VERSION = 3.24
GPSD_SITE = http://download-mirror.savannah.gnu.org/releases/gpsd
GPSD_LICENSE = BSD-2-Clause
GPSD_LICENSE_FILES = COPYING
GPSD_CPE_ID_VENDOR = gpsd_project
GPSD_SELINUX_MODULES = gpsd
GPSD_INSTALL_STAGING = YES
GPSD_DEPENDENCIES = host-scons host-pkgconf
GPSD_LDFLAGS = $(TARGET_LDFLAGS)
GPSD_CFLAGS = $(TARGET_CFLAGS)
package/gpsd: fix workaround for gcc bug 68485 Workaround for gcc bug 68485 doesn't work anymore since bump to version 3.21 in commit 5b3e72139952e0c953c8649cca55571cec5f3836 because CXXFLAGS is appended after CFLAGS and does not contain -O0: /tmp/instance-7/output-1/host/bin/microblazeel-linux-gcc -o rtcm2_json.os -c --sysroot=/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot -pthread -Wall -Wcast-align -Wextra -Wimplicit-fallthrough -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wno-uninitialized -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wvla -O0 -Os -g0 -pthread -fPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/usr/include/dbus-1.0 -I/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/usr/lib/dbus-1.0/include rtcm2_json.c during RTL pass: reload rtcm2_json.c: In function ‘json_rtcm2_read’: rtcm2_json.c:267:1: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1155 267 | } | ^ It should be noted that GPSD_CXXFLAGS was added 5 years ago with commit b4c050e9afed7a8dc302e6e1014cc4ffb508590d but was not actually used in that commit or any later. Fixes: - http://autobuild.buildroot.org/results/fab33f25b08fa218af91640fdbd8c0dcf1d07228 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-08-03 06:07:14 -06:00
GPSD_CXXFLAGS = $(TARGET_CXXFLAGS)
GPSD_SCONS_ENV = $(TARGET_CONFIGURE_OPTS)
GPSD_SCONS_OPTS = \
arch=$(ARCH) \
manbuild=no \
prefix=/usr \
sysroot=$(STAGING_DIR) \
strip=no \
qt=no \
systemd=$(if $(BR2_INIT_SYSTEMD),yes,no)
ifeq ($(BR2_PACKAGE_NCURSES),y)
GPSD_DEPENDENCIES += ncurses
else
GPSD_SCONS_OPTS += ncurses=no
endif
# Build libgpsmm if we've got C++
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
GPSD_LDFLAGS += -lstdc++
gpsd: Fix building with gcc 6.x When building C++ parts of gpsd (for example Qt bindings) with gcc 6.x following failure happens, see [1]: ------------------------------>8------------------------------- <command-line>:0:0: warning: "_LARGEFILE_SOURCE" redefined <command-line>:0:0: note: this is the location of the previous definition In file included from clock_gettime.c:10:0: compiler.h: In function 'void memory_barrier()': compiler.h:93:25: error: 'memory_order_seq_cst' was not declared in this scope atomic_thread_fence(memory_order_seq_cst); ^~~~~~~~~~~~~~~~~~~~ compiler.h:93:25: note: suggested alternative: In file included from .../output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/atomic:41:0, from compiler.h:75, from clock_gettime.c:10: .../output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/atomic_base.h:62:7: note: 'memory_order_seq_cst' memory_order_seq_cst ^~~~~~~~~~~~~~~~~~~~ In file included from clock_gettime.c:10:0: compiler.h:93:45: error: 'atomic_thread_fence' was not declared in this scope atomic_thread_fence(memory_order_seq_cst); ^ compiler.h:93:45: note: suggested alternative: In file included from .../output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/atomic:41:0, from compiler.h:75, from clock_gettime.c:10: .../output/host/usr/arc-buildroot-linux-uclibc/include/c++/6.2.1/bits/atomic_base.h:101:3: note: 'std::atomic_thread_fence' atomic_thread_fence(memory_order __m) noexcept ^~~~~~~~~~~~~~~~~~~ scons: *** [qt-clock_gettime.os] Error 1 scons: building terminated because of errors. ------------------------------>8------------------------------- As discussed on gpsd mailng list here [2] the only work-around as of today is to add "-std=gnu++98" to both CFLAGS and CXXFLAGS which we implement here. Fixes: http://autobuild.buildroot.net/results/e8593a8ebf2f05cc93235a8129a2ba8b839d6d90 http://autobuild.buildroot.net/results/ff766f4f514c9cb4891873167f4e9b7870051883 http://autobuild.buildroot.net/results/1a4/1a4dbd9ee5e0c7255843228731beab030ca005ca http://autobuild.buildroot.net/results/1a4/1a4dbd9ee5e0c7255843228731beab030ca005ca and many others, see http://autobuild.buildroot.net/?reason=gpsd-3.16 [1] http://autobuild.buildroot.net/results/e85/e8593a8ebf2f05cc93235a8129a2ba8b839d6d90/build-end.log [2] http://lists.nongnu.org/archive/html/gpsd-dev/2016-09/msg00082.html Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Bernd Kuhls <bernd.kuhls@t-online.de> Cc: Sergio Prado <sergio.prado@e-labworks.com> Cc: James Knight <james.knight@rockwellcollins.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-11-25 04:00:42 -07:00
GPSD_CFLAGS += -std=gnu++98
GPSD_CXXFLAGS += -std=gnu++98
GPSD_SCONS_OPTS += libgpsmm=yes
else
GPSD_SCONS_OPTS += libgpsmm=no
endif
ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
GPSD_CFLAGS += -O0
package/gpsd: fix workaround for gcc bug 68485 Workaround for gcc bug 68485 doesn't work anymore since bump to version 3.21 in commit 5b3e72139952e0c953c8649cca55571cec5f3836 because CXXFLAGS is appended after CFLAGS and does not contain -O0: /tmp/instance-7/output-1/host/bin/microblazeel-linux-gcc -o rtcm2_json.os -c --sysroot=/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot -pthread -Wall -Wcast-align -Wextra -Wimplicit-fallthrough -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wno-uninitialized -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wvla -O0 -Os -g0 -pthread -fPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/usr/include/dbus-1.0 -I/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/usr/lib/dbus-1.0/include rtcm2_json.c during RTL pass: reload rtcm2_json.c: In function ‘json_rtcm2_read’: rtcm2_json.c:267:1: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1155 267 | } | ^ It should be noted that GPSD_CXXFLAGS was added 5 years ago with commit b4c050e9afed7a8dc302e6e1014cc4ffb508590d but was not actually used in that commit or any later. Fixes: - http://autobuild.buildroot.org/results/fab33f25b08fa218af91640fdbd8c0dcf1d07228 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-08-03 06:07:14 -06:00
GPSD_CXXFLAGS += -O0
endif
# If libusb is available build it before so the package can use it
ifeq ($(BR2_PACKAGE_LIBUSB),y)
GPSD_DEPENDENCIES += libusb
else
GPSD_SCONS_OPTS += usb=no
endif
# If bluetooth is available build it before so the package can use it
ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS),y)
GPSD_DEPENDENCIES += bluez5_utils
else
GPSD_SCONS_OPTS += bluez=no
endif
# If pps-tools is available, build it before so the package can use it
# (HAVE_SYS_TIMEPPS_H).
ifeq ($(BR2_PACKAGE_PPS_TOOLS),y)
GPSD_DEPENDENCIES += pps-tools
endif
ifeq ($(BR2_PACKAGE_DBUS_GLIB),y)
GPSD_SCONS_OPTS += dbus_export=yes
GPSD_DEPENDENCIES += dbus-glib
endif
# Protocol support
ifneq ($(BR2_PACKAGE_GPSD_ASHTECH),y)
GPSD_SCONS_OPTS += ashtech=no
endif
ifneq ($(BR2_PACKAGE_GPSD_AIVDM),y)
GPSD_SCONS_OPTS += aivdm=no
endif
ifneq ($(BR2_PACKAGE_GPSD_EARTHMATE),y)
GPSD_SCONS_OPTS += earthmate=no
endif
ifneq ($(BR2_PACKAGE_GPSD_EVERMORE),y)
GPSD_SCONS_OPTS += evermore=no
endif
ifneq ($(BR2_PACKAGE_GPSD_FURY),y)
GPSD_SCONS_OPTS += fury=no
endif
ifneq ($(BR2_PACKAGE_GPSD_FV18),y)
GPSD_SCONS_OPTS += fv18=no
endif
ifneq ($(BR2_PACKAGE_GPSD_GARMIN),y)
GPSD_SCONS_OPTS += garmin=no
endif
ifneq ($(BR2_PACKAGE_GPSD_GARMIN_SIMPLE_TXT),y)
GPSD_SCONS_OPTS += garmintxt=no
endif
ifneq ($(BR2_PACKAGE_GPSD_GEOSTAR),y)
GPSD_SCONS_OPTS += geostar=no
endif
ifneq ($(BR2_PACKAGE_GPSD_GPSCLOCK),y)
GPSD_SCONS_OPTS += gpsclock=no
endif
ifneq ($(BR2_PACKAGE_GPSD_GREIS),y)
GPSD_SCONS_OPTS += greis=no
endif
ifneq ($(BR2_PACKAGE_GPSD_ISYNC),y)
GPSD_SCONS_OPTS += isync=no
endif
ifneq ($(BR2_PACKAGE_GPSD_ITRAX),y)
GPSD_SCONS_OPTS += itrax=no
endif
ifneq ($(BR2_PACKAGE_GPSD_NAVCOM),y)
GPSD_SCONS_OPTS += navcom=no
endif
ifneq ($(BR2_PACKAGE_GPSD_NMEA2000),y)
GPSD_SCONS_OPTS += nmea2000=no
endif
ifneq ($(BR2_PACKAGE_GPSD_OCEANSERVER),y)
GPSD_SCONS_OPTS += oceanserver=no
endif
ifneq ($(BR2_PACKAGE_GPSD_ONCORE),y)
GPSD_SCONS_OPTS += oncore=no
endif
ifneq ($(BR2_PACKAGE_GPSD_RTCM104V2),y)
GPSD_SCONS_OPTS += rtcm104v2=no
endif
ifneq ($(BR2_PACKAGE_GPSD_RTCM104V3),y)
GPSD_SCONS_OPTS += rtcm104v3=no
endif
ifneq ($(BR2_PACKAGE_GPSD_SIRF),y)
GPSD_SCONS_OPTS += sirf=no
endif
ifneq ($(BR2_PACKAGE_GPSD_SKYTRAQ),y)
GPSD_SCONS_OPTS += skytraq=no
endif
ifneq ($(BR2_PACKAGE_GPSD_SUPERSTAR2),y)
GPSD_SCONS_OPTS += superstar2=no
endif
ifneq ($(BR2_PACKAGE_GPSD_TRIMBLE_TSIP),y)
GPSD_SCONS_OPTS += tsip=no
endif
ifneq ($(BR2_PACKAGE_GPSD_TRIPMATE),y)
GPSD_SCONS_OPTS += tripmate=no
endif
ifneq ($(BR2_PACKAGE_GPSD_TRUE_NORTH),y)
GPSD_SCONS_OPTS += tnt=no
endif
ifneq ($(BR2_PACKAGE_GPSD_UBX),y)
GPSD_SCONS_OPTS += ublox=no
endif
# Features
ifeq ($(BR2_PACKAGE_GPSD_SQUELCH),y)
GPSD_SCONS_OPTS += squelch=yes
endif
ifeq ($(BR2_PACKAGE_GPSD_PROFILING),y)
GPSD_SCONS_OPTS += profiling=yes
endif
ifneq ($(BR2_PACKAGE_GPSD_CLIENT_DEBUG),y)
GPSD_SCONS_OPTS += clientdebug=no
endif
ifeq ($(BR2_PACKAGE_GPSD_USER),y)
GPSD_SCONS_OPTS += gpsd_user=$(BR2_PACKAGE_GPSD_USER_VALUE)
endif
ifeq ($(BR2_PACKAGE_GPSD_GROUP),y)
GPSD_SCONS_OPTS += gpsd_group=$(BR2_PACKAGE_GPSD_GROUP_VALUE)
endif
ifeq ($(BR2_PACKAGE_GPSD_MAX_CLIENT),y)
GPSD_SCONS_OPTS += max_clients=$(BR2_PACKAGE_GPSD_MAX_CLIENT_VALUE)
endif
ifeq ($(BR2_PACKAGE_GPSD_MAX_DEV),y)
GPSD_SCONS_OPTS += max_devices=$(BR2_PACKAGE_GPSD_MAX_DEV_VALUE)
endif
ifeq ($(BR2_PACKAGE_PYTHON3),y)
GPSD_SCONS_OPTS += \
python=yes \
python_libdir="/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages"
else
GPSD_SCONS_OPTS += python=no
endif
GPSD_SCONS_ENV += \
LDFLAGS="$(GPSD_LDFLAGS)" \
CFLAGS="$(GPSD_CFLAGS)" \
package/gpsd: fix workaround for gcc bug 68485 Workaround for gcc bug 68485 doesn't work anymore since bump to version 3.21 in commit 5b3e72139952e0c953c8649cca55571cec5f3836 because CXXFLAGS is appended after CFLAGS and does not contain -O0: /tmp/instance-7/output-1/host/bin/microblazeel-linux-gcc -o rtcm2_json.os -c --sysroot=/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot -pthread -Wall -Wcast-align -Wextra -Wimplicit-fallthrough -Wmissing-declarations -Wmissing-prototypes -Wno-missing-field-initializers -Wno-uninitialized -Wpointer-arith -Wreturn-type -Wstrict-prototypes -Wvla -O0 -Os -g0 -pthread -fPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/usr/include/dbus-1.0 -I/tmp/instance-7/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/usr/lib/dbus-1.0/include rtcm2_json.c during RTL pass: reload rtcm2_json.c: In function ‘json_rtcm2_read’: rtcm2_json.c:267:1: internal compiler error: in gen_reg_rtx, at emit-rtl.c:1155 267 | } | ^ It should be noted that GPSD_CXXFLAGS was added 5 years ago with commit b4c050e9afed7a8dc302e6e1014cc4ffb508590d but was not actually used in that commit or any later. Fixes: - http://autobuild.buildroot.org/results/fab33f25b08fa218af91640fdbd8c0dcf1d07228 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2021-08-03 06:07:14 -06:00
CCFLAGS="$(GPSD_CFLAGS)" \
CXXFLAGS="$(GPSD_CXXFLAGS)"
define GPSD_BUILD_CMDS
(cd $(@D); \
$(GPSD_SCONS_ENV) \
$(SCONS) \
$(GPSD_SCONS_OPTS))
endef
define GPSD_INSTALL_TARGET_CMDS
(cd $(@D); \
$(GPSD_SCONS_ENV) \
DESTDIR=$(TARGET_DIR) \
$(SCONS) \
$(GPSD_SCONS_OPTS) \
$(if $(BR2_PACKAGE_HAS_UDEV),udev-install,install))
endef
define GPSD_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D package/gpsd/S50gpsd $(TARGET_DIR)/etc/init.d/S50gpsd
$(SED) 's,^DEVICES=.*,DEVICES=$(BR2_PACKAGE_GPSD_DEVICES),' $(TARGET_DIR)/etc/init.d/S50gpsd
endef
package/gpsd: actually wait for after chrony We use gpsd's upstream systemd service unit files, which define a dependency on chronyd.service. And indeed, upstream chrony does provide an example service unit file chronyd.service. However, in Buildroot, we are not using chrony's upstream unit, we are providing our own, much simplified as compared to upstream. We install that unit file as chrony.service. Notice that subtle difference in the name: upstream's is chronyd, with a trailing 'd', while ours just chrony, without the trailing 'd'. As a consequence, in a Buildroot-built system, gpsd does not wait for after chrony is started, which causes all kind of mayhem when gpsd actually needs to talk to chrony. We have multiple options: 1. use chrony's upstream unit file; 2 rename the chrony service file as installed by Buildroot, to match what chrony would actually do; 3. tweak gpsd's unit file to refer to chrony.service, not chronyd.service; 4. leverage systemd's flexibility in how units are defined, and provide a drop-in to complement gpsd's unit to also wait for chrony.service. For 1. it is totally unknown why we do have our unit file to begin with, rather than use upstream's. Since upstream's is much more complex than ours, using it might have unforetold consequences. Going with 2. seems the easiest at first sight, but then it would break systems where users provide their own drop-ins for chrony, as they would no longer match. 3. is relatively easy, but running sed is not entirely nice. Besides, it semantically should be a post-install hook, rather than a systemd-init command, but again that makes things a bit more ugly. Also, some people may have their own gpsd.service in an overlay or whatever, which would break our fixup. Solution 4. is pretty straightforward, although it is not ideal either. To be noted: some distributions, like Ubuntu 20.04 at least, do install the chrony unit file as chrony.service, like Buildroot does. However, there does not appear to be any fixup in gpsd for this discrepancy, as their gpsd install still refers to chronyd.service. So that does not help us decide what to do. So, eventually, we decided to go with solution 4, which has the least impact on the system, and keeps the status-quo for all other use-cases. Signed-off-by: Yann E. MORIN <yann.morin@orange.com> Cc: Bernd Kuhls <bernd.kuhls@t-online.de> Cc: Alex Suykov <alex.suykov@gmail.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2022-09-20 06:45:01 -06:00
# When using chrony, wait for after Buildroot's chrony.service
ifeq ($(BR2_PACKAGE_CHRONY),y)
define GPSD_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 0644 $(GPSD_PKGDIR)/br-chrony.conf \
$(TARGET_DIR)/usr/lib/systemd/system/gpsd.service.d/br-chrony.conf
endef
endif
define GPSD_INSTALL_STAGING_CMDS
(cd $(@D); \
$(GPSD_SCONS_ENV) \
DESTDIR=$(STAGING_DIR) \
$(SCONS) \
$(GPSD_SCONS_OPTS) \
install)
endef
# After the udev rule is installed, make it writable so that this
# package can be re-built/re-installed.
ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
define GPSD_INSTALL_UDEV_RULES
chmod u+w $(TARGET_DIR)/lib/udev/rules.d/25-gpsd.rules
endef
GPSD_POST_INSTALL_TARGET_HOOKS += GPSD_INSTALL_UDEV_RULES
endif
$(eval $(generic-package))