+ccnx-trace
diff --git a/net/ccnx-trace/Portfile b/net/ccnx-trace/Portfile
new file mode 100644
index 0000000..7e798bc
--- /dev/null
+++ b/net/ccnx-trace/Portfile
@@ -0,0 +1,48 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem          1.0
+
+name                ccnx-trace
+homepage            http://code.google.com/p/ccnx-trace/
+license             GPL-3+
+version             1.1
+revision            0
+
+categories          net ccnx
+platforms           darwin
+maintainers         ucla.edu:alexander.afanasyev
+
+description         traceroute-like functionality for CCNx
+
+long_description    The CCNx Trace is a tool with traceroute like functionality for CCNx. \
+                    The CCNx code can be obtained at http://www.ccnx.org. This tools is \
+                    written for troubleshooting problems in a network of ccnx nodes. This \
+                    tool can trace to a certain CCN URI, e.g, ccnx:/ndn/csu/netsec/index. \
+                    The tool displays all routes to the namespace and problems at each route, \
+                    if any. In this process, the tool bypasses the intermediate ccnx caches. 
+
+master_sites        http://ccnx-trace.googlecode.com/files/
+checksums           rmd160  31d1b240cff0450c61acf7ca8884bd8121b4310e \
+                    sha256  2c04ad0a109c5f40f7ab11ee12193ce116a3e29c6e98a3d31e44620626430a53
+
+use_configure       false
+depends_lib-append  port:ccnx
+
+# # User should be already created by ccnx port
+# set ccnxuser        ccnx
+# set ccnxgroup       ccnx
+# set ccnxdir         ${prefix}/etc/ccnx
+
+patchfiles          patch-Makefiles.diff
+
+set worksrcpath     ${workpath}/ccnx-trace
+
+build.env-append    CFLAGS=-I${prefix}/include \
+                    LDFLAGS=-L${prefix}/lib \
+                    CC=${configure.cc}
+
+destroot {
+    xinstall ${worksrcpath}/source/trace ${destroot}${prefix}/bin/ccntrace
+    xinstall ${worksrcpath}/source/ccn_traced ${destroot}${prefix}/bin/ccn_traced
+}
diff --git a/net/ccnx-trace/files/patch-Makefiles.diff b/net/ccnx-trace/files/patch-Makefiles.diff
new file mode 100644
index 0000000..3956988
--- /dev/null
+++ b/net/ccnx-trace/files/patch-Makefiles.diff
@@ -0,0 +1,51 @@
+diff --git Makefile Makefile
+new file mode 100644
+index 0000000..2836550
+--- /dev/null
++++ Makefile
+@@ -0,0 +1,5 @@
++
++all install clean uninstall: .always
++	(cd source; make $@)
++
++.always:
+diff --git source/Makefile source/Makefile
+index f6fba70..8531b0a 100644
+--- source/Makefile
++++ source/Makefile
+@@ -1,31 +1,27 @@
+-CC = gcc
+-CFLAGS = -g -Wall -Wpointer-arith -Wreturn-type -Wstrict-prototypes
+ LIBS = -lccn -lcrypto
+ 
+ PROGRAM_CL = trace
+ PROGRAM_SR = ccn_traced
+ 
+-INSTALL_DIR=/usr/local/bin
+-
+ all: $(PROGRAM_CL) $(PROGRAM_SR)
+ 
+ trace: trace_client.o
+-	$(CC) $(CFLAGS) -o trace trace_client.o $(LIBS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o trace trace_client.o $(LIBS)
+ 
+ trace_client.o:
+ 	$(CC) $(CFLAGS) -c trace_client.c
+ 
+ ccn_traced: trace_server.o
+-	$(CC) $(CFLAGS) -o ccn_traced trace_server.o $(LIBS)
++	$(CC) $(CFLAGS) $(LDFLAGS) -o ccn_traced trace_server.o $(LIBS)
+ 
+ trace_server.o:
+ 	$(CC) $(CFLAGS) -c trace_server.c
+ 
+ install: 
+-	install -m 0755 $(PROGRAM_CL) $(PROGRAM_SR) $(INSTALL_DIR)
++	install -m 0755 $(PROGRAM_CL) $(PROGRAM_SR) $(DESTDIR)$(INSTALL_DIR)/bin
+ 
+ uninstall: 
+-	rm -f $(INSTALL_DIR)/$(PROGRAM_CL) $(INSTALL_DIR)/$(PROGRAM_SR)
++	rm -f $(DESTDIR)$(INSTALL_DIR)/bin/$(PROGRAM_CL) $(DESTDIR)$(INSTALL_DIR)/bin/$(PROGRAM_SR)
+ 
+ clean:
+ 	rm -f *.o