do away with config.h (all in config.mk)

This commit is contained in:
Jan-Piet Mens
2015-09-11 11:07:01 +02:00
parent 81844d4da8
commit 1ae1acf72f
12 changed files with 42 additions and 36 deletions
+11 -8
View File
@@ -39,6 +39,10 @@ else
CFLAGS += -DJSON_INDENT=NULL
endif
ifneq ($(APIKEY),)
CFLAGS += -DAPIKEY="\"$(APIKEY)\""
endif
CFLAGS += -DSTORAGEDEFAULT=\"$(STORAGEDEFAULT)\"
@@ -63,20 +67,19 @@ ghash2lmdb: ghash2lmdb.o $(OTR_OBJS)
$(CC) $(CFLAGS) -o ghash2lmdb ghash2lmdb.o $(OTR_OBJS) $(LIBS)
ot-recorder.o: ot-recorder.c storage.h util.h Makefile geo.h udata.h config.h json.h http.h gcache.h
geo.o: geo.h geo.c udata.h Makefile config.mk config.h
ot-recorder.o: ot-recorder.c storage.h util.h Makefile geo.h udata.h json.h http.h gcache.h config.mk
geo.o: geo.h geo.c udata.h Makefile config.mk
geohash.o: geohash.h geohash.c udata.h Makefile config.mk
base64.o: base64.h base64.c
gcache.o: gcache.c gcache.h json.h
jget.o: jget.c jget.h json.h Makefile config.mk
gcache.o: gcache.c gcache.h json.h config.mk
misc.o: misc.c misc.h udata.h Makefile config.mk
http.o: http.c mongoose.h util.h http.h storage.h
http.o: http.c mongoose.h util.h http.h storage.h config.mk
util.o: util.c util.h Makefile config.mk
ghashfind.o: ghashfind.c util.h
ghashfind.o: ghashfind.c util.h config.mk
mongoose.o: mongoose.c mongoose.h
ocat.o: ocat.c storage.h util.h config.mk version.h
storage.o: storage.c storage.h config.h util.h gcache.h
ghash2lmdb.o: ghash2lmdb.c gcache.h
storage.o: storage.c storage.h util.h gcache.h config.mk
ghash2lmdb.o: ghash2lmdb.c gcache.h config.mk
clean:
-1
View File
@@ -57,7 +57,6 @@ As mentioned earlier, data is stored in files, and these files are relative to `
## Installation
1. Copy `config.mk.in` to `config.mk` and select the features you want (defaults should be ok).
2. Copy `config.h.example` to `config.h` and edit.
3. Type `make`
## Reverse Geo
-8
View File
@@ -1,8 +0,0 @@
/*
* Google Maps reverse geocoding URL.
* If you need to use an API KEY, change the scheme to "https:"
* and add "&key=xxxxx" to the end of this URL
*/
#define GURL "http://maps.googleapis.com/maps/api/geocode/json?latlng=%lf,%lf&sensor=false&language=EN"
+23 -8
View File
@@ -1,16 +1,20 @@
# Select features
# Select features you want. Default is fine for most installations
# Do you want recorder's built-in HTTP REST API?
HAVE_HTTP ?= yes
# Do you want to use reverse-geo caching? (Highly recommended)
HAVE_LMDB ?= yes
# Do you want support for the `pingping' monitoring feature?
HAVE_PING ?= yes
STORAGEDEFAULT = "./store"
# Optionally specify the path to the Mosquitto libs, include here
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
# Where should the recorder store its data? This directory must
# exist and be writeable by recorder (and readable by ocat)
STORAGEDEFAULT = "/var/spool/owntracks/recorder/store"
# Define the precision for reverse-geo lookups. The higher
# the number, the more granular reverse-geo will be.
# the number, the more granular reverse-geo will be:
#
# 1 => 5,009.4km x 4,992.6km
# 2 => 1,252.3km x 624.1km
@@ -27,4 +31,15 @@ GHASHPREC = 7
# Should the JSON emitted by recorder be indented? (i.e. beautified)
# yes or no
JSON_INDENT ?= yes
JSON_INDENT ?= no
# If you do more than 2500 (currently) reverse-geo requests per day,
# you'll need an API key for Google's geocoding service. Specify
# that here
# APIKEY ?= YYYYYYYYYY
APIKEY ?=
# Optionally specify the path to the Mosquitto libs, include here
MOSQUITTO_INC = -I/usr/include
MOSQUITTO_LIB = -L/usr/lib
+8 -2
View File
@@ -25,10 +25,11 @@
#include <time.h>
#include <curl/curl.h>
#include "utstring.h"
#include "config.h"
#include "geo.h"
#include "json.h"
#define GURL "%s://maps.googleapis.com/maps/api/geocode/json?latlng=%lf,%lf&sensor=false&language=EN"
static CURL *curl;
static size_t writemem(void *contents, size_t size, size_t nmemb, void *userp)
@@ -144,7 +145,12 @@ JsonNode *revgeo(double lat, double lon, UT_string *addr, UT_string *cc)
utstring_renew(url);
utstring_renew(cbuf);
utstring_printf(url, GURL, lat, lon);
#ifdef APIKEY
utstring_printf(url, GURL, "https", lat, lon);
utstring_printf(url, "&key=%s", APIKEY);
#else
utstring_printf(url, GURL, "http", lat, lon);
#endif
curl_easy_setopt(curl, CURLOPT_URL, utstring_body(url));
curl_easy_setopt(curl, CURLOPT_USERAGENT, "ot-recorder-agent/1.0");
-1
View File
@@ -26,7 +26,6 @@
#include <string.h>
#include <ctype.h>
#include "json.h"
#include "config.h"
#include "util.h"
#include "misc.h"
#include "storage.h"
-3
View File
@@ -1,3 +0,0 @@
#include "json.h"
JsonNode *jget(JsonNode *json, char *args);
-1
View File
@@ -35,7 +35,6 @@
#include "utstring.h"
#include "utarray.h"
#include "geo.h"
#include "config.h"
#include "geohash.h"
#include "base64.h"
#include "misc.h"
-1
View File
@@ -32,7 +32,6 @@
#include <ctype.h>
#include <sys/stat.h>
#include "utstring.h"
#include "config.h"
#include "storage.h"
#include "geohash.h"
#include "util.h"
-1
View File
@@ -1,7 +1,6 @@
#ifndef UDATA_H_INCLUDED
# define UDATA_H_INCLUDED
#include "config.h"
#include "utarray.h"
#ifdef HAVE_HTTP
-1
View File
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include "config.h"
#include "util.h"
#include "misc.h"
#include <sys/types.h>
-1
View File
@@ -7,7 +7,6 @@
#endif
#include <time.h>
#include "config.h"
#include <syslog.h>
#include "json.h"
#include "utstring.h"