diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..8f9ecd4 --- /dev/null +++ b/Android.bp @@ -0,0 +1,116 @@ +cc_library_shared { + name: "libgps", + vendor: true, + relative_install_path: "hw", + srcs: [ + "bits.c", + "gpsdclient.c", + "gpsutils.c", + "hex.c", + "json.c", + "libgps_core.c", + "libgps_dbus.c", + "libgps_json.c", + "libgps_shm.c", + "libgps_sock.c", + "netlib.c", + "os_compat.c", + "rtcm2_json.c", + "rtcm3_json.c", + "shared_json.c" + ], + cflags: [ + "-Wno-unused-variable", + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-DVERSION=\"3.18.1\"", + "-DGPSD_URL=\"http://catb.org/gpsd\"", + "-DHAVE_LIBRT=1", + "-DHAVE_LINUX_CAN_H=1", + "-DHAVE_STDATOMIC_H=1", + "-DHAVE_BUILTIN_ENDIANNESS=1", + "-DHAVE_SYS_SOCKET_H=1", + "-DHAVE_SYS_SELECT_H=1", + "-DHAVE_NETDB_H=1", + "-DHAVE_NETINET_IN_H=1", + "-DHAVE_NETINET_IP_H=1", + "-DHAVE_ARPA_INET_H=1", + "-DHAVE_SYSLOG_H=1", + "-DHAVE_TERMIOS_H=1", + "-DHAVE_DAEMON=1", + "-DHAVE_CLOCK_GETTIME=1", + "-DHAVE_STRPTIME=1", + "-DHAVE_GMTIME_R=1", + "-DHAVE_INET_NTOP=1", + "-DHAVE_FCNTL=1", + "-DHAVE_FORK=1", + "-DASHTECH_ENABLE=1", + "-DBINDIR=\"bin\"", + "-DCLIENTDEBUG_ENABLE=1", + "-DCONTROL_SOCKET_ENABLE=1", + "-DCONTROLSEND_ENABLE=1", + "-DDOCDIR=\"share/doc\"", + "-DEARTHMATE_ENABLE=1", + "-DEVERMORE_ENABLE=1", + "-DFURY_ENABLE=1", + "-DFV18_ENABLE=1", + "-DGARMIN_ENABLE=1", + "-DGARMINTXT_ENABLE=1", + "-DGEOSTAR_ENABLE=1", + "-DGPSCLOCK_ENABLE=1", + "-DGPSD_ENABLE=1", + "-DGPSD_GROUP=\"dialout\"", + "-DGPSD_USER=\"nobody\"", + "-DGPSDCLIENTS_ENABLE=1", + "-DGREIS_ENABLE=1", + "-DIMPLICIT_LINK_ENABLE=1", + "-DINCLUDEDIR=\"include\"", + "-DIPV6_ENABLE=1", + "-DISYNC_ENABLE=1", + "-DITRAX_ENABLE=1", + "-DLEAPFETCH_ENABLE=1", + "-DLIBDIR=\"lib\"", + "-DLIBGPSMM_ENABLE=1", + "-DMANBUILD_ENABLE=1", + "-DMANDIR=\"share/man\"", + "-DMAX_CLIENTS=64", + "-DMAX_DEVICES=4", + "-DMTK3301_ENABLE=1", + "-DNAVCOM_ENABLE=1", + "-DNETFEED_ENABLE=1", + "-DNMEA0183_ENABLE=1", + "-DNTP_ENABLE=1", + "-DNTPSHM_ENABLE=1", + "-DNTRIP_ENABLE=1", + "-DOCEANSERVER_ENABLE=1", + "-DONCORE_ENABLE=1", + "-DOSCILLATOR_ENABLE=1", + "-DPASSTHROUGH_ENABLE=1", + "-DPKGCONFIG=\"lib/pkgconfig\"", + "-DPPS_ENABLE=1", + "-DPREFIX=\"/usr/local\"", + "-DPYTHON_ENABLE=1", + "-DPYTHON_COVERAGE=\"coverage run\"", + "-DQT_ENABLE=1", + "-DRECONFIGURE_ENABLE=1", + "-DRTCM104V2_ENABLE=1", + "-DRTCM104V3_ENABLE=1", + "-DSBINDIR=\"sbin\"", + "-DSHARED_ENABLE=1", + "-DSHM_EXPORT_ENABLE=1", + "-DSIRF_ENABLE=1", + "-DSKYTRAQ_ENABLE=1", + "-DSOCKET_EXPORT_ENABLE=1", + "-DSUPERSTAR2_ENABLE=1", + "-DSYSCONFDIR=\"etc\"", + "-DTARGET_PYTHON=\"python\"", + "-DTNT_ENABLE=1", + "-DTRIPMATE_ENABLE=1", + "-DTSIP_ENABLE=1", + "-DUBLOX_ENABLE=1", + "-DUDEVDIR=\"/lib/udev\"", + "-DUSB_ENABLE=1", + "-DXGPS_ENABLE=1" + ], +} + diff --git a/compiler.h b/compiler.h index 71d26f6..7c5cba0 100644 --- a/compiler.h +++ b/compiler.h @@ -20,7 +20,9 @@ #define _POSIX_THREAD_SAFE_FUNCTIONS #endif +#ifndef __ANDROID__ #include "gpsd_config.h" /* is HAVE_STDATOMIC defined? */ +#endif /* Macro for declaring function with printf-like arguments. */ # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) diff --git a/gps.h b/gps.h index a844baf..2885d3d 100644 --- a/gps.h +++ b/gps.h @@ -2221,7 +2221,11 @@ extern void gps_clear_dop( struct dop_t *); extern void gps_clear_fix(struct gps_fix_t *); extern void gps_merge_fix(struct gps_fix_t *, gps_mask_t, struct gps_fix_t *); extern void gps_enable_debug(int, FILE *); +#ifndef __ANDROID__ extern const char *gps_maskdump(gps_mask_t); +#else +#define gps_maskdump(gps_mask_t) "" +#endif extern double safe_atof(const char *); extern time_t mkgmtime(register struct tm *); diff --git a/gpsd.h b/gpsd.h index 40534e7..a3fddb6 100644 --- a/gpsd.h +++ b/gpsd.h @@ -17,7 +17,9 @@ extern "C" { #include #include #include +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #ifdef HAVE_TERMIOS_H #include #endif diff --git a/gpsdclient.c b/gpsdclient.c index 218d267..dbe864b 100644 --- a/gpsdclient.c +++ b/gpsdclient.c @@ -11,7 +11,9 @@ #include #include +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #include "gps.h" #include "gpsdclient.h" #include "os_compat.h" diff --git a/libgps.h b/libgps.h index 62c3742..eddb990 100644 --- a/libgps.h +++ b/libgps.h @@ -11,7 +11,9 @@ #define DBUS_PSEUDO_FD -2 #include "gps.h" +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #include "compiler.h" #ifdef __cplusplus diff --git a/libgps_dbus.c b/libgps_dbus.c index d91bae6..c1021e3 100644 --- a/libgps_dbus.c +++ b/libgps_dbus.c @@ -14,7 +14,9 @@ #include #include "gps.h" +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #include "libgps.h" #if defined(DBUS_EXPORT_ENABLE) diff --git a/libgps_shm.c b/libgps_shm.c index e676c92..a135350 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -18,7 +18,9 @@ PERMISSIONS /* sys/ipc.h needs _XOPEN_SOURCE, 500 means X/Open 1995 */ #define _XOPEN_SOURCE 500 +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #ifdef SHM_EXPORT_ENABLE diff --git a/libgps_sock.c b/libgps_sock.c index 14811b6..2c1ccd4 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -15,7 +15,9 @@ #include #include #include +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #include "timespec.h" /* for NS_IN_SEC */ #include #include diff --git a/netlib.c b/netlib.c index b0d98b0..02dbde7 100644 --- a/netlib.c +++ b/netlib.c @@ -3,7 +3,9 @@ * SPDX-License-Identifier: BSD-2-clause */ +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif #include #include #ifdef HAVE_NETDB_H diff --git a/os_compat.h b/os_compat.h index b7b6e09..a597573 100644 --- a/os_compat.h +++ b/os_compat.h @@ -9,7 +9,9 @@ #define _GPSD_OS_COMPAT_H_ /* Determine which of these functions we need */ +#ifndef __ANDROID__ #include "gpsd_config.h" +#endif # ifdef __cplusplus extern "C" {