Bundling ndn-cxx tools and NFD
Change-Id: Ib8f155f8e965482c5bc4b5800d74cb90ab496e67
diff --git a/make-deps.sh b/make-deps.sh
new file mode 100755
index 0000000..25db9d3
--- /dev/null
+++ b/make-deps.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+NDN_CXX_COMMIT=${NDN_CXX_COMMIT:-master}
+NFD_COMMIT=${NFD_COMMIT:-master}
+
+GIT=${GIT:-https://github.com/named-data}
+
+mkdir build 2>/dev/null || true
+path="$(pwd)"
+
+#######################################
+
+# rm -Rf build/ndn-cxx
+git clone ${GIT}/ndn-cxx build/ndn-cxx
+pushd build/ndn-cxx
+git checkout ${NDN_CXX_COMMIT}
+./waf configure --prefix="${path}/build/deps"
+./waf build
+./waf install
+popd
+
+####################################
+
+# rm -Rf build/NFD
+git clone ${GIT}/NFD build/NFD
+pushd build/NFD
+git checkout ${NFD_COMMIT}
+git submodule update --init
+PKG_CONFIG_PATH="${path}/build/deps/lib/pkgconfig:${PKG_CONFIG_PATH}" \
+ ./waf configure --prefix="${path}/build/deps"
+./waf build
+./waf install
+popd
diff --git a/make-osx-bundle.py b/make-osx-bundle.py
index 536d841..938c7a8 100755
--- a/make-osx-bundle.py
+++ b/make-osx-bundle.py
@@ -257,6 +257,54 @@
os.system('install_name_tool -id "%s" "%s"' % (file, abs))
self.handle_binary_libs(abs)
+ def copy_ndn_deps(self, path):
+ '''
+ Copy over NDN dependencies (NFD and related apps)
+ '''
+ print ' * Copying NDN dependencies'
+
+ src = path
+ dst = os.path.join(self.bundle, 'Contents', 'Resources', 'ndn')
+
+ shutil.copytree(src, dst, symlinks=False)
+
+ top = dst
+ files = {}
+
+ def cb(arg, dirname, fnames):
+ if dirname == top:
+ return
+ files[dirname] = fnames
+
+ os.path.walk(top, cb, None)
+
+ # Cleanup debug folders stuff
+ excludeDirs = ['include', 'pkgconfig']
+ excludeFiles = ['libndn-cxx.dylib', 'ndn-start', 'ndn-stop']
+
+ for dir, files in files.items():
+ basename = os.path.basename(dir)
+ if basename in excludeDirs:
+ shutil.rmtree(dir)
+ continue
+ for file in files:
+ if file in excludeFiles:
+ abs = dir + '/' + file
+ os.remove(abs)
+
+ top = dst
+ files = {}
+
+ os.path.walk(top, cb, None)
+
+ for dir, files in files.items():
+ for file in files:
+ abs = dir + '/' + file
+ type = Popen(['file', '-b', abs], stdout=PIPE).communicate()[0].strip()
+ if type.startswith('Mach-O'):
+ self.handle_binary_libs(abs)
+
+
def set_min_macosx_version(self, version):
'''
Set the minimum version of Mac OS X version that this App will run on.
@@ -369,26 +417,27 @@
# Do the finishing touches to our Application bundle before release
shutil.rmtree('build/%s/NDN.app' % (MIN_SUPPORTED_VERSION), ignore_errors=True)
a = AppBundle('build/%s/NDN.app' % (MIN_SUPPORTED_VERSION), ver, 'build/NFD Control Center.app')
- a.copy_qt_plugins()
- a.handle_libs()
- a.copy_resources(['qt.conf'])
- a.set_min_macosx_version('%s.0' % MIN_SUPPORTED_VERSION)
- a.done()
+ # a.copy_qt_plugins()
+ # a.handle_libs()
+ a.copy_ndn_deps("build/deps")
+ # a.copy_resources(['qt.conf'])
+ # a.set_min_macosx_version('%s.0' % MIN_SUPPORTED_VERSION)
+ # a.done()
- # Sign our binaries, etc.
- if options.codesign:
- print ' * Signing binaries with identity `%s\'' % options.codesign
- binaries = (
- 'build/%s/ChronoChat.app' % (MIN_SUPPORTED_VERSION),
- )
+ # # Sign our binaries, etc.
+ # if options.codesign:
+ # print ' * Signing binaries with identity `%s\'' % options.codesign
+ # binaries = (
+ # 'build/%s/ChronoChat.app' % (MIN_SUPPORTED_VERSION),
+ # )
- codesign(binaries)
- print ''
+ # codesign(binaries)
+ # print ''
- # Create diskimage
- title = "NDN-%s-%s" % (ver, MIN_SUPPORTED_VERSION)
- fn = "build/%s.dmg" % title
- d = DiskImage(fn, title)
- d.symlink('/Applications', '/Applications')
- d.copy('build/%s/NDN.app' % MIN_SUPPORTED_VERSION, '/NDN.app')
- d.create()
+ # # Create diskimage
+ # title = "NDN-%s-%s" % (ver, MIN_SUPPORTED_VERSION)
+ # fn = "build/%s.dmg" % title
+ # d = DiskImage(fn, title)
+ # d.symlink('/Applications', '/Applications')
+ # d.copy('build/%s/NDN.app' % MIN_SUPPORTED_VERSION, '/NDN.app')
+ # d.create()
diff --git a/res/ndn b/res/ndn
new file mode 100755
index 0000000..fd492de
--- /dev/null
+++ b/res/ndn
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/Applications/NDN.app/Contents/Resources/ndn/bin/"$@"