From fd81a7fe637a1499eec443364cd6566c0c4265e3 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 1 Jun 2016 21:55:48 -0700 Subject: On Linux auto-detect presence of http-parser and lz4 and link against system libs instead of ext/ builtins (for RPM and DEB packaging effort) --- make-freebsd.mk | 2 +- make-linux.mk | 13 +++++++++++++ make-mac.mk | 2 +- objects.mk | 3 --- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/make-freebsd.mk b/make-freebsd.mk index 7148896e..e7bd9fd2 100644 --- a/make-freebsd.mk +++ b/make-freebsd.mk @@ -6,7 +6,7 @@ DEFS= LIBS= include objects.mk -OBJS+=osdep/BSDEthernetTap.o +OBJS+=osdep/BSDEthernetTap.o ext/lz4/lz4.o ext/json-parser/json.o ext/http-parser/http_parser.o # "make official" is a shortcut for this ifeq ($(ZT_OFFICIAL_RELEASE),1) diff --git a/make-linux.mk b/make-linux.mk index 3ead1be2..9ab2ee8e 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -38,6 +38,19 @@ LDLIBS?= include objects.mk +# On Linux we auto-detect the presence of some libraries +ifeq ($(wildcard /usr/include/lz4.h),) + OBJS+=ext/lz4/lz4.o +else + LDLIBS+=-llz4 +endif +ifeq ($(wildcard /usr/include/http_parser.h),) + OBJS+=ext/http-parser/http_parser.o +else + LDLIBS+=-lhttp_parser +endif +OBJS+=ext/json-parser/json.o + ifeq ($(ZT_OFFICIAL_RELEASE),1) DEFS+=-DZT_OFFICIAL_RELEASE ZT_USE_MINIUPNPC=1 diff --git a/make-mac.mk b/make-mac.mk index 5987aed5..96da7146 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -11,7 +11,7 @@ LIBS= ARCH_FLAGS=-arch x86_64 include objects.mk -OBJS+=osdep/OSXEthernetTap.o +OBJS+=osdep/OSXEthernetTap.o ext/lz4/lz4.o ext/json-parser/json.o ext/http-parser/http_parser.o # Disable codesign since open source users will not have ZeroTier's certs CODESIGN=echo diff --git a/objects.mk b/objects.mk index d11e2812..a281c97e 100644 --- a/objects.mk +++ b/objects.mk @@ -1,7 +1,4 @@ OBJS=\ - ext/lz4/lz4.o \ - ext/json-parser/json.o \ - ext/http-parser/http_parser.o \ node/C25519.o \ node/CertificateOfMembership.o \ node/Cluster.o \ -- cgit v1.2.3