geohash.c and geohash_helper.c are part of Redis.
They were under /deps since they originate from a different source tree, however at this point they are very modified and we took ownership of both the files making changes, fixing bugs, so there is no upgrade path from the original code tree. Given that, better to move the code under /src with proper dependencies and with a more simpler editing experience.
This commit is contained in:
parent
78236ec554
commit
cd2e6c1fb1
7
deps/Makefile
vendored
7
deps/Makefile
vendored
@ -36,7 +36,6 @@ distclean:
|
|||||||
-(cd hiredis && $(MAKE) clean) > /dev/null || true
|
-(cd hiredis && $(MAKE) clean) > /dev/null || true
|
||||||
-(cd linenoise && $(MAKE) clean) > /dev/null || true
|
-(cd linenoise && $(MAKE) clean) > /dev/null || true
|
||||||
-(cd lua && $(MAKE) clean) > /dev/null || true
|
-(cd lua && $(MAKE) clean) > /dev/null || true
|
||||||
-(cd geohash-int && $(MAKE) clean) > /dev/null || true
|
|
||||||
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
|
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
|
||||||
-(rm -f .make-*)
|
-(rm -f .make-*)
|
||||||
|
|
||||||
@ -82,9 +81,3 @@ jemalloc: .make-prerequisites
|
|||||||
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
|
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
|
||||||
|
|
||||||
.PHONY: jemalloc
|
.PHONY: jemalloc
|
||||||
|
|
||||||
geohash-int: .make-prerequisites
|
|
||||||
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
|
||||||
cd geohash-int && $(MAKE)
|
|
||||||
|
|
||||||
.PHONY: geohash-int
|
|
||||||
|
23
deps/geohash-int/Makefile
vendored
23
deps/geohash-int/Makefile
vendored
@ -1,23 +0,0 @@
|
|||||||
STD=
|
|
||||||
WARN= -Wall
|
|
||||||
OPT= -O2
|
|
||||||
|
|
||||||
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
|
|
||||||
R_LDFLAGS= $(LDFLAGS)
|
|
||||||
DEBUG= -g
|
|
||||||
|
|
||||||
R_CC=$(CC) $(R_CFLAGS)
|
|
||||||
R_LD=$(CC) $(R_LDFLAGS)
|
|
||||||
|
|
||||||
all: geohash.o geohash_helper.o
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
|
|
||||||
geohash.o: geohash.h geohash.c
|
|
||||||
geohash_helper.o: geohash.h geohash_helper.h geohash_helper.c
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(R_CC) -c $<
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o
|
|
11
src/Makefile
11
src/Makefile
@ -15,12 +15,12 @@
|
|||||||
release_hdr := $(shell sh -c './mkreleasehdr.sh')
|
release_hdr := $(shell sh -c './mkreleasehdr.sh')
|
||||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||||
OPTIMIZATION?=-O2
|
OPTIMIZATION?=-O2
|
||||||
DEPENDENCY_TARGETS=hiredis linenoise lua geohash-int
|
DEPENDENCY_TARGETS=hiredis linenoise lua
|
||||||
NODEPS:=clean distclean
|
NODEPS:=clean distclean
|
||||||
|
|
||||||
# Default settings
|
# Default settings
|
||||||
STD=-std=c99 -pedantic -DREDIS_STATIC=''
|
STD=-std=c99 -pedantic -DREDIS_STATIC=''
|
||||||
WARN=-Wall -W
|
WARN=-Wall -W -Wno-missing-field-initializers
|
||||||
OPT=$(OPTIMIZATION)
|
OPT=$(OPTIMIZATION)
|
||||||
|
|
||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
@ -54,7 +54,7 @@ endif
|
|||||||
# Override default settings if possible
|
# Override default settings if possible
|
||||||
-include .make-settings
|
-include .make-settings
|
||||||
|
|
||||||
FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS) -I../deps/geohash-int
|
FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS)
|
||||||
FINAL_LDFLAGS=$(LDFLAGS) $(REDIS_LDFLAGS) $(DEBUG)
|
FINAL_LDFLAGS=$(LDFLAGS) $(REDIS_LDFLAGS) $(DEBUG)
|
||||||
FINAL_LIBS=-lm
|
FINAL_LIBS=-lm
|
||||||
DEBUG=-g -ggdb
|
DEBUG=-g -ggdb
|
||||||
@ -128,8 +128,7 @@ endif
|
|||||||
|
|
||||||
REDIS_SERVER_NAME=redis-server
|
REDIS_SERVER_NAME=redis-server
|
||||||
REDIS_SENTINEL_NAME=redis-sentinel
|
REDIS_SENTINEL_NAME=redis-sentinel
|
||||||
REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o geo.o lazyfree.o module.o evict.o expire.o
|
REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o
|
||||||
REDIS_GEOHASH_OBJ=../deps/geohash-int/geohash.o ../deps/geohash-int/geohash_helper.o
|
|
||||||
REDIS_CLI_NAME=redis-cli
|
REDIS_CLI_NAME=redis-cli
|
||||||
REDIS_CLI_OBJ=anet.o adlist.o redis-cli.o zmalloc.o release.o anet.o ae.o crc64.o
|
REDIS_CLI_OBJ=anet.o adlist.o redis-cli.o zmalloc.o release.o anet.o ae.o crc64.o
|
||||||
REDIS_BENCHMARK_NAME=redis-benchmark
|
REDIS_BENCHMARK_NAME=redis-benchmark
|
||||||
@ -182,7 +181,7 @@ endif
|
|||||||
|
|
||||||
# redis-server
|
# redis-server
|
||||||
$(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ)
|
$(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ)
|
||||||
$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a $(REDIS_GEOHASH_OBJ) $(FINAL_LIBS)
|
$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a $(FINAL_LIBS)
|
||||||
|
|
||||||
# redis-sentinel
|
# redis-sentinel
|
||||||
$(REDIS_SENTINEL_NAME): $(REDIS_SERVER_NAME)
|
$(REDIS_SENTINEL_NAME): $(REDIS_SERVER_NAME)
|
||||||
|
@ -111,7 +111,7 @@ int geohashBoundingBox(double longitude, double latitude, double radius_meters,
|
|||||||
GeoHashRadius geohashGetAreasByRadius(double longitude, double latitude, double radius_meters) {
|
GeoHashRadius geohashGetAreasByRadius(double longitude, double latitude, double radius_meters) {
|
||||||
GeoHashRange long_range, lat_range;
|
GeoHashRange long_range, lat_range;
|
||||||
GeoHashRadius radius = {{0}};
|
GeoHashRadius radius = {{0}};
|
||||||
GeoHashBits hash = { 0 };
|
GeoHashBits hash = {0,0};
|
||||||
GeoHashNeighbors neighbors = {{0}};
|
GeoHashNeighbors neighbors = {{0}};
|
||||||
GeoHashArea area = {{0}};
|
GeoHashArea area = {{0}};
|
||||||
double min_lon, max_lon, min_lat, max_lat;
|
double min_lon, max_lon, min_lat, max_lat;
|
Loading…
x
Reference in New Issue
Block a user