Updated OSX makefile
This commit is contained in:
Binary file not shown.
@@ -21,7 +21,7 @@ For more support on these integrations, or if you'd like help creating a new int
|
|||||||
|
|
||||||
##### OSX
|
##### OSX
|
||||||
- [Embedding within an app](../docs/osx_zt_sdk.md) `make osx_app_framework`
|
- [Embedding within an app](../docs/osx_zt_sdk.md) `make osx_app_framework`
|
||||||
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make `
|
- [Dynamic-linking into an app/service at runtime](../docs/osx_zt_sdk.md) `make osx_shared_lib`
|
||||||
- [Unity3D plugin](../docs/unity3d_osx_zt_sdk.md) `make osx_unity3d_bundle`
|
- [Unity3D plugin](../docs/unity3d_osx_zt_sdk.md) `make osx_unity3d_bundle`
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ depend dep: .depend
|
|||||||
include .depend
|
include .depend
|
||||||
|
|
||||||
$(LWIPLIB): $(LWIPOBJS)
|
$(LWIPLIB): $(LWIPOBJS)
|
||||||
$(CC) -g -nostartfiles -shared -o $@ $^
|
mkdir -p build/lwip
|
||||||
|
$(CC) -g -nostartfiles -shared -o build/lwip/$@ $^
|
||||||
|
|
||||||
.depend: $(LWIPFILES)
|
.depend: $(LWIPFILES)
|
||||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||||
|
|||||||
47
make-mac.mk
47
make-mac.mk
@@ -11,7 +11,6 @@ LIBS=
|
|||||||
ARCH_FLAGS=-arch x86_64
|
ARCH_FLAGS=-arch x86_64
|
||||||
|
|
||||||
include objects.mk
|
include objects.mk
|
||||||
OBJS+=osdep/OSXEthernetTap.o
|
|
||||||
|
|
||||||
# Disable codesign since open source users will not have ZeroTier's certs
|
# Disable codesign since open source users will not have ZeroTier's certs
|
||||||
CODESIGN=echo
|
CODESIGN=echo
|
||||||
@@ -19,9 +18,6 @@ PRODUCTSIGN=echo
|
|||||||
CODESIGN_APP_CERT=
|
CODESIGN_APP_CERT=
|
||||||
CODESIGN_INSTALLER_CERT=
|
CODESIGN_INSTALLER_CERT=
|
||||||
|
|
||||||
# Build with libminiupnpc by default for Mac
|
|
||||||
ZT_USE_MINIUPNPC?=1
|
|
||||||
|
|
||||||
# For internal use only -- signs everything with ZeroTier's developer cert
|
# For internal use only -- signs everything with ZeroTier's developer cert
|
||||||
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
||||||
DEFS+=-DZT_OFFICIAL_RELEASE -DZT_AUTO_UPDATE
|
DEFS+=-DZT_OFFICIAL_RELEASE -DZT_AUTO_UPDATE
|
||||||
@@ -32,27 +28,6 @@ ifeq ($(ZT_OFFICIAL_RELEASE),1)
|
|||||||
CODESIGN_INSTALLER_CERT="Developer ID Installer: ZeroTier Networks LLC (8ZD9JUCZ4V)"
|
CODESIGN_INSTALLER_CERT="Developer ID Installer: ZeroTier Networks LLC (8ZD9JUCZ4V)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Build with ZT_ENABLE_CLUSTER=1 to build with cluster support
|
|
||||||
ifeq ($(ZT_ENABLE_CLUSTER),1)
|
|
||||||
DEFS+=-DZT_ENABLE_CLUSTER
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(ZT_AUTO_UPDATE),1)
|
|
||||||
DEFS+=-DZT_AUTO_UPDATE
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(ZT_USE_MINIUPNPC),1)
|
|
||||||
DEFS+=-DMACOSX -DZT_USE_MINIUPNPC -DMINIUPNP_STATICLIB -D_DARWIN_C_SOURCE -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -DOS_STRING=\"Darwin/15.0.0\" -DMINIUPNPC_VERSION_STRING=\"1.9\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
|
|
||||||
OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o osdep/PortMapper.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Build with ZT_ENABLE_NETWORK_CONTROLLER=1 to build with the Sqlite network controller
|
|
||||||
ifeq ($(ZT_ENABLE_NETWORK_CONTROLLER),1)
|
|
||||||
DEFS+=-DZT_ENABLE_NETWORK_CONTROLLER
|
|
||||||
LIBS+=-L/usr/local/lib -lsqlite3
|
|
||||||
OBJS+=controller/SqliteNetworkController.o
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Debug mode -- dump trace output, build binary with -g
|
# Debug mode -- dump trace output, build binary with -g
|
||||||
ifeq ($(ZT_DEBUG),1)
|
ifeq ($(ZT_DEBUG),1)
|
||||||
DEFS+=-DZT_TRACE
|
DEFS+=-DZT_TRACE
|
||||||
@@ -60,7 +35,7 @@ ifeq ($(ZT_DEBUG),1)
|
|||||||
STRIP=echo
|
STRIP=echo
|
||||||
# The following line enables optimization for the crypto code, since
|
# The following line enables optimization for the crypto code, since
|
||||||
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
#ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||||
else
|
else
|
||||||
CFLAGS?=-Ofast -fstack-protector
|
CFLAGS?=-Ofast -fstack-protector
|
||||||
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
||||||
@@ -98,23 +73,25 @@ android_jni_library:
|
|||||||
|
|
||||||
# Build library for Android Unity integrations
|
# Build library for Android Unity integrations
|
||||||
|
|
||||||
sdk: $(OBJS)
|
osx_shared_lib: $(OBJS)
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
# Need to selectively rebuild one.cpp and OneService.cpp with ZT_SERVICE_NETCON and ZT_ONE_NO_ROOT_CHECK defined, and also NetconEthernetTap
|
# Need to selectively rebuild one.cpp and OneService.cpp with ZT_SERVICE_NETCON and ZT_ONE_NO_ROOT_CHECK defined, and also NetconEthernetTap
|
||||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -DZT_SDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -o zerotier-netcon-service $(OBJS) service/OneService.cpp netcon/NetconEthernetTap.cpp netcon/NetconProxy.cpp one.cpp -x c netcon/NetconRPC.c $(LDLIBS) -ldl
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -DZT_SDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -Izerotierone/osdep -Izerotierone/node -Isrc -o build/zerotier-sdk-service $(OBJS) zerotierone/service/OneService.cpp src/SDK_EthernetTap.cpp src/SDK_Proxy.cpp zerotierone/one.cpp -x c src/SDK_RPC.c $(LDLIBS) -ldl
|
||||||
# Build netcon/liblwip.so which must be placed in ZT home for zerotier-netcon-service to work
|
# Build netcon/liblwip.so which must be placed in ZT home for zerotier-netcon-service to work
|
||||||
cd netcon ; make -f make-liblwip.mk
|
make -f make-liblwip.mk
|
||||||
# Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility
|
# Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility
|
||||||
#cd netcon ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -nostdlib -shared -o libztapi.so zt_api.c common.c RPC.c -ldl
|
#cd netcon ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -nostdlib -shared -o libztapi.so zt_api.c common.c RPC.c -ldl
|
||||||
cd netcon ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -nostdlib -shared -o libztintercept.so NetconSockets.c Intercept.c NetconDebug.c NetconRPC.c -ldl
|
cd src ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -I../zerotierone/node -nostdlib -shared -o libztintercept.so SDK_Sockets.c SDK_Intercept.c SDK_Debug.c SDK_RPC.c -ldl
|
||||||
#cd netcon ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -nostdlib -shared -o libztkq.so zt_api.c kq.c Intercept.c common.c RPC.c -ldl
|
#cd netcon ; gcc $(DEFS) -O2 -Wall -std=c99 -fPIC -fno-common -dynamiclib -flat_namespace -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -nostdlib -shared -o libztkq.so zt_api.c kq.c Intercept.c common.c RPC.c -ldl
|
||||||
cp netcon/libztintercept.so libztintercept.so
|
mkdir -p build/osx_shared_lib
|
||||||
#cp netcon/libztapi.so libztapi.so
|
cp src/libztintercept.so build/osx_shared_lib/libztintercept.so
|
||||||
#cp netcon/libztkq.so libztkq.so
|
|
||||||
ln -sf zerotier-netcon-service zerotier-cli
|
ln -sf zerotier-sdk-service zerotier-cli
|
||||||
ln -sf zerotier-netcon-service zerotier-idtool
|
ln -sf zerotier-sdk-service zerotier-idtool
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
rm -rf zerotier-cli zerotier-idtool
|
||||||
|
|
||||||
rm -rf build/*
|
rm -rf build/*
|
||||||
find . -type f -name '*.o' -delete
|
find . -type f -name '*.o' -delete
|
||||||
find . -type f -name '*.so' -delete
|
find . -type f -name '*.so' -delete
|
||||||
|
|||||||
62
objects.mk
62
objects.mk
@@ -1,32 +1,32 @@
|
|||||||
OBJS=\
|
OBJS=\
|
||||||
ext/lz4/lz4.o \
|
zerotierone/ext/lz4/lz4.o \
|
||||||
ext/json-parser/json.o \
|
zerotierone/ext/json-parser/json.o \
|
||||||
ext/http-parser/http_parser.o \
|
zerotierone/ext/http-parser/http_parser.o \
|
||||||
node/C25519.o \
|
zerotierone/node/C25519.o \
|
||||||
node/CertificateOfMembership.o \
|
zerotierone/node/CertificateOfMembership.o \
|
||||||
node/Cluster.o \
|
zerotierone/node/Cluster.o \
|
||||||
node/DeferredPackets.o \
|
zerotierone/node/DeferredPackets.o \
|
||||||
node/Dictionary.o \
|
zerotierone/node/Dictionary.o \
|
||||||
node/Identity.o \
|
zerotierone/node/Identity.o \
|
||||||
node/IncomingPacket.o \
|
zerotierone/node/IncomingPacket.o \
|
||||||
node/InetAddress.o \
|
zerotierone/node/InetAddress.o \
|
||||||
node/Multicaster.o \
|
zerotierone/node/Multicaster.o \
|
||||||
node/Network.o \
|
zerotierone/node/Network.o \
|
||||||
node/NetworkConfig.o \
|
zerotierone/node/NetworkConfig.o \
|
||||||
node/Node.o \
|
zerotierone/node/Node.o \
|
||||||
node/OutboundMulticast.o \
|
zerotierone/node/OutboundMulticast.o \
|
||||||
node/Packet.o \
|
zerotierone/node/Packet.o \
|
||||||
node/Path.o \
|
zerotierone/node/Path.o \
|
||||||
node/Peer.o \
|
zerotierone/node/Peer.o \
|
||||||
node/Poly1305.o \
|
zerotierone/node/Poly1305.o \
|
||||||
node/Salsa20.o \
|
zerotierone/node/Salsa20.o \
|
||||||
node/SelfAwareness.o \
|
zerotierone/node/SelfAwareness.o \
|
||||||
node/SHA512.o \
|
zerotierone/node/SHA512.o \
|
||||||
node/Switch.o \
|
zerotierone/node/Switch.o \
|
||||||
node/Topology.o \
|
zerotierone/node/Topology.o \
|
||||||
node/Utils.o \
|
zerotierone/node/Utils.o \
|
||||||
osdep/BackgroundResolver.o \
|
zerotierone/osdep/BackgroundResolver.o \
|
||||||
osdep/Http.o \
|
zerotierone/osdep/Http.o \
|
||||||
osdep/OSUtils.o \
|
zerotierone/osdep/OSUtils.o \
|
||||||
service/ClusterGeoIpService.o \
|
zerotierone/service/ClusterGeoIpService.o \
|
||||||
service/ControlPlane.o
|
zerotierone/service/ControlPlane.o
|
||||||
|
|||||||
@@ -37,9 +37,9 @@
|
|||||||
|
|
||||||
#include "SDK_EthernetTap.hpp"
|
#include "SDK_EthernetTap.hpp"
|
||||||
|
|
||||||
#include "node/Utils.hpp"
|
#include "Utils.hpp"
|
||||||
#include "osdep/OSUtils.hpp"
|
#include "OSUtils.hpp"
|
||||||
#include "osdep/Phy.hpp"
|
#include "Phy.hpp"
|
||||||
|
|
||||||
#include "SDK_LWIPStack.hpp"
|
#include "SDK_LWIPStack.hpp"
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
#include "SDK_Debug.c"
|
#include "SDK_Debug.c"
|
||||||
#include "SDK_ServiceSetup.hpp"
|
#include "SDK_ServiceSetup.hpp"
|
||||||
|
|
||||||
#if !defined(__IOS__) && !defined(__ANDROID__) && !defined(__UNITY_3D__) && !defined(__APPLE__)
|
#if !defined(__IOS__) && !defined(__ANDROID__) && !defined(__UNITY_3D__) //&& !defined(__APPLE__)
|
||||||
const ip_addr_t ip_addr_any = { IPADDR_ANY };
|
const ip_addr_t ip_addr_any = { IPADDR_ANY };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,12 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "node/Constants.hpp"
|
#include "Constants.hpp"
|
||||||
#include "node/MulticastGroup.hpp"
|
#include "MulticastGroup.hpp"
|
||||||
#include "node/Mutex.hpp"
|
#include "Mutex.hpp"
|
||||||
#include "node/InetAddress.hpp"
|
#include "InetAddress.hpp"
|
||||||
#include "osdep/Thread.hpp"
|
#include "Thread.hpp"
|
||||||
#include "osdep/Phy.hpp"
|
#include "Phy.hpp"
|
||||||
|
|
||||||
#include "netif/etharp.h"
|
#include "netif/etharp.h"
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
|
|
||||||
#include "SDK_Debug.h"
|
#include "SDK_Debug.h"
|
||||||
#include "SDK_EthernetTap.hpp"
|
#include "SDK_EthernetTap.hpp"
|
||||||
#include "osdep/Phy.hpp"
|
#include "Phy.hpp"
|
||||||
#include "node/Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
#include "SDK_Signatures.h"
|
#include "SDK_Signatures.h"
|
||||||
#include "SDK_Debug.h"
|
#include "SDK_Debug.h"
|
||||||
#include "SDK_RPC.h"
|
#include "SDK_RPC.h"
|
||||||
#include "node/Constants.hpp" // For Tap's MTU
|
#include "Constants.hpp" // For Tap's MTU
|
||||||
|
|
||||||
void print_addr(struct sockaddr *addr);
|
void print_addr(struct sockaddr *addr);
|
||||||
void dwr(int level, const char *fmt, ... );
|
void dwr(int level, const char *fmt, ... );
|
||||||
|
|||||||
Reference in New Issue
Block a user