From 1aed9ba41894d2bbe3c8df101adb50719d4c236e Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 5 Jul 2013 14:15:23 -0400 Subject: [PATCH] Missing mac-tap makefiles due to bad gitignore, fixed! --- .gitignore | 2 +- mac-tap/tuntap/Makefile | 66 +++++++++++++++++++++++++++++++++ mac-tap/tuntap/src/tap/Makefile | 58 +++++++++++++++++++++++++++++ mac-tap/tuntap/src/tun/Makefile | 59 +++++++++++++++++++++++++++++ 4 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 mac-tap/tuntap/Makefile create mode 100644 mac-tap/tuntap/src/tap/Makefile create mode 100644 mac-tap/tuntap/src/tun/Makefile diff --git a/.gitignore b/.gitignore index f2c98b452..aa93132b2 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ zerotier-* -Makefile +/Makefile *.o .DS_Store .Apple* diff --git a/mac-tap/tuntap/Makefile b/mac-tap/tuntap/Makefile new file mode 100644 index 000000000..1bac05e13 --- /dev/null +++ b/mac-tap/tuntap/Makefile @@ -0,0 +1,66 @@ +# Lets have a version, at last! +TUNTAP_VERSION = 20111101 + +# BASE install directory +BASE= + +all: tap.kext tun.kext + +pkg: all + /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker \ + -d pkg/tuntap.pmdoc -o tuntap_$(TUNTAP_VERSION).pkg -v + tar czf tuntap_$(TUNTAP_VERSION).tar.gz \ + README.installer README tuntap_$(TUNTAP_VERSION).pkg + +# Install targets +# They are provided for the gentoo ebuild, but should work just fine for other people as well. +install_kext: tap.kext tun.kext + mkdir -p ${BASE}/Library/Extensions + cp -pR tap.kext ${BASE}/Library/Extensions/ + chown -R root:wheel ${BASE}/Library/Extensions/tap.kext + cp -pR tun.kext ${BASE}/Library/Extensions/ + chown -R root:wheel ${BASE}/Library/Extensions/tun.kext + +install_scripts: + mkdir -p ${BASE}/Library/StartupItems + cp -pR startup_item/tap ${BASE}/Library/StartupItems/ + chown -R root:wheel ${BASE}/Library/StartupItems/tap + cp -pR startup_item/tun ${BASE}/Library/StartupItems/ + chown -R root:wheel ${BASE}/Library/StartupItems/tun + +install: install_kext install_scripts + +tarball: clean + touch tuntap_$(TUNTAP_VERSION)_src.tar.gz + tar czf tuntap_$(TUNTAP_VERSION)_src.tar.gz \ + -C .. \ + --exclude "tuntap/tuntap_$(TUNTAP_VERSION)_src.tar.gz" \ + --exclude "tuntap/tuntap_$(TUNTAP_VERSION).tar.gz" \ + --exclude "tuntap/tuntap_$(TUNTAP_VERSION).pkg" \ + --exclude "*/.*" \ + tuntap + +clean: + cd src/tap && make -f Makefile clean + cd src/tun && make -f Makefile clean + -rm -rf tuntap_$(TUNTAP_VERSION).pkg + -rm -f tuntap_$(TUNTAP_VERSION).tar.gz + -rm -f tuntap_$(TUNTAP_VERSION)_src.tar.gz + +tap.kext: + cd src/tap && make TUNTAP_VERSION=$(TUNTAP_VERSION) -f Makefile all + +tun.kext: + cd src/tun && make TUNTAP_VERSION=$(TUNTAP_VERSION) -f Makefile all + +test: + # configd messes with interface flags, issuing SIOCSIFFLAGS ioctls upon receiving kernel + # events indicating protocols have been attached and detached. Unfortunately, configd does + # this asynchronously, making the SIOCSIFFLAGS changes totally unpredictable when we bring + # our interfaces up and down in rapid succession during our tests. I haven't found a good + # way to suppress or handle this mess other than disabling configd temporarily. + killall -STOP configd + -PYTHONPATH=test python test/tuntap/tuntap_tests.py --tests='$(TESTS)' + killall -CONT configd + +.PHONY: test diff --git a/mac-tap/tuntap/src/tap/Makefile b/mac-tap/tuntap/src/tap/Makefile new file mode 100644 index 000000000..8207101d7 --- /dev/null +++ b/mac-tap/tuntap/src/tap/Makefile @@ -0,0 +1,58 @@ +# +# ethertap driver for MacOSX +# +# Makefile +# +# (c) 2004, 2005, 2006, 2007, 2008 Mattias Nissler +# + +OBJS = ../tuntap.o ../tuntap_mgr.o ../lock.o ../mem.o kmod.o tap.o +KMOD_BIN = tap +BUNDLE_DIR = ../.. +BUNDLE_NAME = tap.kext + +TAP_KEXT_VERSION = $(TUNTAP_VERSION) + +BUNDLE_REGION = English +BUNDLE_IDENTIFIER = com.zerotier.tap +BUNDLE_SIGNATURE = ???? +BUNDLE_PACKAGETYPE = KEXT +BUNDLE_VERSION = $(TAP_KEXT_VERSION) + +INCLUDE = -I.. -I/System/Library/Frameworks/Kernel.framework/Headers +CFLAGS = -Wall -mkernel -force_cpusubtype_ALL \ + -fno-builtin -fno-stack-protector -arch i386 -arch x86_64 \ + -DKERNEL -D__APPLE__ -DKERNEL_PRIVATE -DTUNTAP_VERSION=\"$(TUNTAP_VERSION)\" \ + -DTAP_KEXT_VERSION=\"$(TAP_KEXT_VERSION)\" +CCFLAGS = $(CFLAGS) +LDFLAGS = -Wall -mkernel -nostdlib -r -lcc_kext -arch i386 -arch x86_64 -Xlinker -kext + +CCP = g++ +CC = gcc + +all: $(KMOD_BIN) bundle + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ +.cc.o: + $(CCP) $(CCFLAGS) $(INCLUDE) -c $< -o $@ + +$(KMOD_BIN): $(OBJS) + $(CCP) $(LDFLAGS) -o $(KMOD_BIN) $(OBJS) + +bundle: $(KMOD_BIN) + rm -rf $(BUNDLE_DIR)/$(BUNDLE_NAME) + mkdir -p $(BUNDLE_DIR)/$(BUNDLE_NAME)/Contents/MacOS + cp $(KMOD_BIN) $(BUNDLE_DIR)/$(BUNDLE_NAME)/Contents/MacOS + sed -e "s/@@CFBUNDLEEXECUTABLE@@/$(KMOD_BIN)/" \ + -e "s/@@CFBUNDLEDEVELOPMENTREGION@@/$(BUNDLE_REGION)/" \ + -e "s/@@CFBUNDLEIDENTIFIER@@/$(BUNDLE_IDENTIFIER)/" \ + -e "s/@@CFBUNDLESIGNATURE@@/$(BUNDLE_SIGNATURE)/" \ + -e "s/@@CFBUNDLEPACKAGETYPE@@/$(BUNDLE_PACKAGETYPE)/" \ + -e "s/@@CFBUNDLEVERSION@@/$(BUNDLE_VERSION)/" \ + Info.plist > $(BUNDLE_DIR)/$(BUNDLE_NAME)/Contents/Info.plist + +clean: + -rm -f $(OBJS) $(KMOD_BIN) + -rm -rf $(BUNDLE_DIR)/$(BUNDLE_NAME) + diff --git a/mac-tap/tuntap/src/tun/Makefile b/mac-tap/tuntap/src/tun/Makefile new file mode 100644 index 000000000..9ca6794d2 --- /dev/null +++ b/mac-tap/tuntap/src/tun/Makefile @@ -0,0 +1,59 @@ +# +# ip tunnel/ethertap driver for MacOSX +# +# Makefile +# +# (c) 2004, 2005, 2006, 2007, 2008 Mattias Nissler +# + +OBJS = ../tuntap.o ../tuntap_mgr.o ../lock.o ../mem.o \ + kmod.o tun_inet_proto.o tun_inet6_proto.o tun.o +KMOD_BIN = tun +BUNDLE_DIR = ../.. +BUNDLE_NAME = tun.kext + +TUN_KEXT_VERSION = $(TUNTAP_VERSION) + +BUNDLE_REGION = English +BUNDLE_IDENTIFIER = foo.tun +BUNDLE_SIGNATURE = ???? +BUNDLE_PACKAGETYPE = KEXT +BUNDLE_VERSION = $(TUN_KEXT_VERSION) + +INCLUDE = -I.. -I/System/Library/Frameworks/Kernel.framework/Headers +CFLAGS = -Wall -mkernel -force_cpusubtype_ALL \ + -fno-builtin -fno-stack-protector -arch i386 -arch x86_64 \ + -DKERNEL -D__APPLE__ -DKERNEL_PRIVATE -DTUNTAP_VERSION=\"$(TUNTAP_VERSION)\" \ + -DTUN_KEXT_VERSION=\"$(TUN_KEXT_VERSION)\" +CCFLAGS = $(CFLAGS) +LDFLAGS = -Wall -mkernel -nostdlib -r -lcc_kext -arch i386 -arch x86_64 -Xlinker -kext + +CCP = g++ +CC = gcc + +all: $(KMOD_BIN) bundle + +.c.o: + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ +.cc.o: + $(CCP) $(CCFLAGS) $(INCLUDE) -c $< -o $@ + +$(KMOD_BIN): $(OBJS) + $(CCP) $(LDFLAGS) -o $(KMOD_BIN) $(OBJS) + +bundle: $(KMOD_BIN) + rm -rf $(BUNDLE_DIR)/$(BUNDLE_NAME) + mkdir -p $(BUNDLE_DIR)/$(BUNDLE_NAME)/Contents/MacOS + cp $(KMOD_BIN) $(BUNDLE_DIR)/$(BUNDLE_NAME)/Contents/MacOS + sed -e "s/@@CFBUNDLEEXECUTABLE@@/$(KMOD_BIN)/" \ + -e "s/@@CFBUNDLEDEVELOPMENTREGION@@/$(BUNDLE_REGION)/" \ + -e "s/@@CFBUNDLEIDENTIFIER@@/$(BUNDLE_IDENTIFIER)/" \ + -e "s/@@CFBUNDLESIGNATURE@@/$(BUNDLE_SIGNATURE)/" \ + -e "s/@@CFBUNDLEPACKAGETYPE@@/$(BUNDLE_PACKAGETYPE)/" \ + -e "s/@@CFBUNDLEVERSION@@/$(BUNDLE_VERSION)/" \ + Info.plist > $(BUNDLE_DIR)/$(BUNDLE_NAME)/Contents/Info.plist + +clean: + -rm -f $(OBJS) $(KMOD_BIN) + -rm -rf $(BUNDLE_DIR)/$(BUNDLE_NAME) +