xref: /OK3568_Linux_fs/buildroot/package/gpsd/gpsd.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# gpsd
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunGPSD_VERSION = 3.23.1
8*4882a593SmuzhiyunGPSD_SITE = http://download-mirror.savannah.gnu.org/releases/gpsd
9*4882a593SmuzhiyunGPSD_LICENSE = BSD-2-Clause
10*4882a593SmuzhiyunGPSD_LICENSE_FILES = COPYING
11*4882a593SmuzhiyunGPSD_CPE_ID_VENDOR = gpsd_project
12*4882a593SmuzhiyunGPSD_SELINUX_MODULES = gpsd
13*4882a593SmuzhiyunGPSD_INSTALL_STAGING = YES
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunGPSD_DEPENDENCIES = host-python3 host-scons host-pkgconf
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunGPSD_LDFLAGS = $(TARGET_LDFLAGS)
18*4882a593SmuzhiyunGPSD_CFLAGS = $(TARGET_CFLAGS)
19*4882a593SmuzhiyunGPSD_CXXFLAGS = $(TARGET_CXXFLAGS)
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunGPSD_SCONS_ENV = $(TARGET_CONFIGURE_OPTS)
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunGPSD_SCONS_OPTS = \
24*4882a593Smuzhiyun	arch=$(ARCH) \
25*4882a593Smuzhiyun	manbuild=no \
26*4882a593Smuzhiyun	prefix=/usr \
27*4882a593Smuzhiyun	sysroot=$(STAGING_DIR) \
28*4882a593Smuzhiyun	strip=no \
29*4882a593Smuzhiyun	qt=no \
30*4882a593Smuzhiyun	systemd=$(if $(BR2_INIT_SYSTEMD),yes,no)
31*4882a593Smuzhiyun
32*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_NCURSES),y)
33*4882a593SmuzhiyunGPSD_DEPENDENCIES += ncurses
34*4882a593Smuzhiyunelse
35*4882a593SmuzhiyunGPSD_SCONS_OPTS += ncurses=no
36*4882a593Smuzhiyunendif
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun# Build libgpsmm if we've got C++
39*4882a593Smuzhiyunifeq ($(BR2_INSTALL_LIBSTDCPP),y)
40*4882a593SmuzhiyunGPSD_LDFLAGS += -lstdc++
41*4882a593SmuzhiyunGPSD_CFLAGS += -std=gnu++98
42*4882a593SmuzhiyunGPSD_CXXFLAGS += -std=gnu++98
43*4882a593SmuzhiyunGPSD_SCONS_OPTS += libgpsmm=yes
44*4882a593Smuzhiyunelse
45*4882a593SmuzhiyunGPSD_SCONS_OPTS += libgpsmm=no
46*4882a593Smuzhiyunendif
47*4882a593Smuzhiyun
48*4882a593Smuzhiyunifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
49*4882a593SmuzhiyunGPSD_CFLAGS += -O0
50*4882a593SmuzhiyunGPSD_CXXFLAGS += -O0
51*4882a593Smuzhiyunendif
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun# If libusb is available build it before so the package can use it
54*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBUSB),y)
55*4882a593SmuzhiyunGPSD_DEPENDENCIES += libusb
56*4882a593Smuzhiyunelse
57*4882a593SmuzhiyunGPSD_SCONS_OPTS += usb=no
58*4882a593Smuzhiyunendif
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun# If bluetooth is available build it before so the package can use it
61*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_BLUEZ5_UTILS),y)
62*4882a593SmuzhiyunGPSD_DEPENDENCIES += bluez5_utils
63*4882a593Smuzhiyunelse
64*4882a593SmuzhiyunGPSD_SCONS_OPTS += bluez=no
65*4882a593Smuzhiyunendif
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun# If pps-tools is available, build it before so the package can use it
68*4882a593Smuzhiyun# (HAVE_SYS_TIMEPPS_H).
69*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PPS_TOOLS),y)
70*4882a593SmuzhiyunGPSD_DEPENDENCIES += pps-tools
71*4882a593Smuzhiyunendif
72*4882a593Smuzhiyun
73*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_DBUS_GLIB),y)
74*4882a593SmuzhiyunGPSD_SCONS_OPTS += dbus_export=yes
75*4882a593SmuzhiyunGPSD_DEPENDENCIES += dbus-glib
76*4882a593Smuzhiyunendif
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun# Protocol support
79*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_ASHTECH),y)
80*4882a593SmuzhiyunGPSD_SCONS_OPTS += ashtech=no
81*4882a593Smuzhiyunendif
82*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_AIVDM),y)
83*4882a593SmuzhiyunGPSD_SCONS_OPTS += aivdm=no
84*4882a593Smuzhiyunendif
85*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_EARTHMATE),y)
86*4882a593SmuzhiyunGPSD_SCONS_OPTS += earthmate=no
87*4882a593Smuzhiyunendif
88*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_EVERMORE),y)
89*4882a593SmuzhiyunGPSD_SCONS_OPTS += evermore=no
90*4882a593Smuzhiyunendif
91*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_FURY),y)
92*4882a593SmuzhiyunGPSD_SCONS_OPTS += fury=no
93*4882a593Smuzhiyunendif
94*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_FV18),y)
95*4882a593SmuzhiyunGPSD_SCONS_OPTS += fv18=no
96*4882a593Smuzhiyunendif
97*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_GARMIN),y)
98*4882a593SmuzhiyunGPSD_SCONS_OPTS += garmin=no
99*4882a593Smuzhiyunendif
100*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_GARMIN_SIMPLE_TXT),y)
101*4882a593SmuzhiyunGPSD_SCONS_OPTS += garmintxt=no
102*4882a593Smuzhiyunendif
103*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_GEOSTAR),y)
104*4882a593SmuzhiyunGPSD_SCONS_OPTS += geostar=no
105*4882a593Smuzhiyunendif
106*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_GPSCLOCK),y)
107*4882a593SmuzhiyunGPSD_SCONS_OPTS += gpsclock=no
108*4882a593Smuzhiyunendif
109*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_GREIS),y)
110*4882a593SmuzhiyunGPSD_SCONS_OPTS += greis=no
111*4882a593Smuzhiyunendif
112*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_ISYNC),y)
113*4882a593SmuzhiyunGPSD_SCONS_OPTS += isync=no
114*4882a593Smuzhiyunendif
115*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_ITRAX),y)
116*4882a593SmuzhiyunGPSD_SCONS_OPTS += itrax=no
117*4882a593Smuzhiyunendif
118*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_MTK3301),y)
119*4882a593SmuzhiyunGPSD_SCONS_OPTS += mtk3301=no
120*4882a593Smuzhiyunendif
121*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_NMEA),y)
122*4882a593SmuzhiyunGPSD_SCONS_OPTS += nmea0183=no
123*4882a593Smuzhiyunendif
124*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_NTRIP),y)
125*4882a593SmuzhiyunGPSD_SCONS_OPTS += ntrip=no
126*4882a593Smuzhiyunendif
127*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_NAVCOM),y)
128*4882a593SmuzhiyunGPSD_SCONS_OPTS += navcom=no
129*4882a593Smuzhiyunendif
130*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_NMEA2000),y)
131*4882a593SmuzhiyunGPSD_SCONS_OPTS += nmea2000=no
132*4882a593Smuzhiyunendif
133*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_OCEANSERVER),y)
134*4882a593SmuzhiyunGPSD_SCONS_OPTS += oceanserver=no
135*4882a593Smuzhiyunendif
136*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_ONCORE),y)
137*4882a593SmuzhiyunGPSD_SCONS_OPTS += oncore=no
138*4882a593Smuzhiyunendif
139*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_RTCM104V2),y)
140*4882a593SmuzhiyunGPSD_SCONS_OPTS += rtcm104v2=no
141*4882a593Smuzhiyunendif
142*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_RTCM104V3),y)
143*4882a593SmuzhiyunGPSD_SCONS_OPTS += rtcm104v3=no
144*4882a593Smuzhiyunendif
145*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_SIRF),y)
146*4882a593SmuzhiyunGPSD_SCONS_OPTS += sirf=no
147*4882a593Smuzhiyunendif
148*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_SKYTRAQ),y)
149*4882a593SmuzhiyunGPSD_SCONS_OPTS += skytraq=no
150*4882a593Smuzhiyunendif
151*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_SUPERSTAR2),y)
152*4882a593SmuzhiyunGPSD_SCONS_OPTS += superstar2=no
153*4882a593Smuzhiyunendif
154*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_TRIMBLE_TSIP),y)
155*4882a593SmuzhiyunGPSD_SCONS_OPTS += tsip=no
156*4882a593Smuzhiyunendif
157*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_TRIPMATE),y)
158*4882a593SmuzhiyunGPSD_SCONS_OPTS += tripmate=no
159*4882a593Smuzhiyunendif
160*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_TRUE_NORTH),y)
161*4882a593SmuzhiyunGPSD_SCONS_OPTS += tnt=no
162*4882a593Smuzhiyunendif
163*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_UBX),y)
164*4882a593SmuzhiyunGPSD_SCONS_OPTS += ublox=no
165*4882a593Smuzhiyunendif
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun# Features
168*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GPSD_SQUELCH),y)
169*4882a593SmuzhiyunGPSD_SCONS_OPTS += squelch=yes
170*4882a593Smuzhiyunendif
171*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_OLDSTYLE),y)
172*4882a593SmuzhiyunGPSD_SCONS_OPTS += oldstyle=no
173*4882a593Smuzhiyunendif
174*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GPSD_PROFILING),y)
175*4882a593SmuzhiyunGPSD_SCONS_OPTS += profiling=yes
176*4882a593Smuzhiyunendif
177*4882a593Smuzhiyunifneq ($(BR2_PACKAGE_GPSD_CLIENT_DEBUG),y)
178*4882a593SmuzhiyunGPSD_SCONS_OPTS += clientdebug=no
179*4882a593Smuzhiyunendif
180*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GPSD_USER),y)
181*4882a593SmuzhiyunGPSD_SCONS_OPTS += gpsd_user=$(BR2_PACKAGE_GPSD_USER_VALUE)
182*4882a593Smuzhiyunendif
183*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GPSD_GROUP),y)
184*4882a593SmuzhiyunGPSD_SCONS_OPTS += gpsd_group=$(BR2_PACKAGE_GPSD_GROUP_VALUE)
185*4882a593Smuzhiyunendif
186*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GPSD_MAX_CLIENT),y)
187*4882a593SmuzhiyunGPSD_SCONS_OPTS += max_clients=$(BR2_PACKAGE_GPSD_MAX_CLIENT_VALUE)
188*4882a593Smuzhiyunendif
189*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_GPSD_MAX_DEV),y)
190*4882a593SmuzhiyunGPSD_SCONS_OPTS += max_devices=$(BR2_PACKAGE_GPSD_MAX_DEV_VALUE)
191*4882a593Smuzhiyunendif
192*4882a593Smuzhiyun
193*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PYTHON3),y)
194*4882a593SmuzhiyunGPSD_SCONS_OPTS += \
195*4882a593Smuzhiyun	python=yes \
196*4882a593Smuzhiyun	python_libdir="/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages"
197*4882a593Smuzhiyunelse ifeq ($(BR2_PACKAGE_PYTHON),y)
198*4882a593SmuzhiyunGPSD_SCONS_OPTS += \
199*4882a593Smuzhiyun	python=yes \
200*4882a593Smuzhiyun	python_libdir="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"
201*4882a593Smuzhiyunelse
202*4882a593SmuzhiyunGPSD_SCONS_OPTS += python=no
203*4882a593Smuzhiyunendif
204*4882a593Smuzhiyun
205*4882a593SmuzhiyunGPSD_SCONS_ENV += \
206*4882a593Smuzhiyun	LDFLAGS="$(GPSD_LDFLAGS)" \
207*4882a593Smuzhiyun	CFLAGS="$(GPSD_CFLAGS)" \
208*4882a593Smuzhiyun	CCFLAGS="$(GPSD_CFLAGS)" \
209*4882a593Smuzhiyun	CXXFLAGS="$(GPSD_CXXFLAGS)"
210*4882a593Smuzhiyun
211*4882a593Smuzhiyundefine GPSD_BUILD_CMDS
212*4882a593Smuzhiyun	(cd $(@D); \
213*4882a593Smuzhiyun		$(GPSD_SCONS_ENV) \
214*4882a593Smuzhiyun		$(HOST_DIR)/bin/python3 $(SCONS) \
215*4882a593Smuzhiyun		$(GPSD_SCONS_OPTS))
216*4882a593Smuzhiyunendef
217*4882a593Smuzhiyun
218*4882a593Smuzhiyundefine GPSD_INSTALL_TARGET_CMDS
219*4882a593Smuzhiyun	(cd $(@D); \
220*4882a593Smuzhiyun		$(GPSD_SCONS_ENV) \
221*4882a593Smuzhiyun		DESTDIR=$(TARGET_DIR) \
222*4882a593Smuzhiyun		$(HOST_DIR)/bin/python3 $(SCONS) \
223*4882a593Smuzhiyun		$(GPSD_SCONS_OPTS) \
224*4882a593Smuzhiyun		$(if $(BR2_PACKAGE_HAS_UDEV),udev-install,install))
225*4882a593Smuzhiyunendef
226*4882a593Smuzhiyun
227*4882a593Smuzhiyundefine GPSD_INSTALL_INIT_SYSV
228*4882a593Smuzhiyun	$(INSTALL) -m 0755 -D package/gpsd/S50gpsd $(TARGET_DIR)/etc/init.d/S50gpsd
229*4882a593Smuzhiyun	$(SED) 's,^DEVICES=.*,DEVICES=$(BR2_PACKAGE_GPSD_DEVICES),' $(TARGET_DIR)/etc/init.d/S50gpsd
230*4882a593Smuzhiyunendef
231*4882a593Smuzhiyun
232*4882a593Smuzhiyun# systemd unit files are installed automatically, but need to update the
233*4882a593Smuzhiyun# /usr/local path references in the provided files to /usr.
234*4882a593Smuzhiyundefine GPSD_INSTALL_INIT_SYSTEMD
235*4882a593Smuzhiyun	$(SED) 's%/usr/local%/usr%' \
236*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/gpsd.service \
237*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/gpsdctl@.service
238*4882a593Smuzhiyunendef
239*4882a593Smuzhiyun
240*4882a593Smuzhiyundefine GPSD_INSTALL_STAGING_CMDS
241*4882a593Smuzhiyun	(cd $(@D); \
242*4882a593Smuzhiyun		$(GPSD_SCONS_ENV) \
243*4882a593Smuzhiyun		DESTDIR=$(STAGING_DIR) \
244*4882a593Smuzhiyun		$(HOST_DIR)/bin/python3 $(SCONS) \
245*4882a593Smuzhiyun		$(GPSD_SCONS_OPTS) \
246*4882a593Smuzhiyun		install)
247*4882a593Smuzhiyunendef
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun# After the udev rule is installed, make it writable so that this
250*4882a593Smuzhiyun# package can be re-built/re-installed.
251*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_HAS_UDEV),y)
252*4882a593Smuzhiyundefine GPSD_INSTALL_UDEV_RULES
253*4882a593Smuzhiyun	chmod u+w $(TARGET_DIR)/lib/udev/rules.d/25-gpsd.rules
254*4882a593Smuzhiyunendef
255*4882a593Smuzhiyun
256*4882a593SmuzhiyunGPSD_POST_INSTALL_TARGET_HOOKS += GPSD_INSTALL_UDEV_RULES
257*4882a593Smuzhiyunendif
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun$(eval $(generic-package))
260