Small update and adding README.md with a note for creation of macOS app bundle
Change-Id: I272d0e22ac6edaadfdd39a2e922ea030d60bd5d2
diff --git a/.waf-tools/boost.py b/.waf-tools/boost.py
index 6b27bce..9b9395e 100644
--- a/.waf-tools/boost.py
+++ b/.waf-tools/boost.py
@@ -71,12 +71,16 @@
PTHREAD_CODE = '''
#include <pthread.h>
+static void* f(void*) { return 0; }
int main() {
pthread_t th;
- pthread_create(&th, 0, 0, 0);
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_create(&th, &attr, &f, 0);
pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+ pthread_cleanup_push(0, 0);
+ pthread_cleanup_pop(0);
+ pthread_attr_destroy(&attr);
}
'''
@@ -361,7 +365,7 @@
# we'll just look for -pthreads and -lpthread first:
boost_pthread_flags = ["-pthreads", "-lpthread", "-mt", "-pthread"]
else:
- boost_pthread_flags = ["-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread",
+ boost_pthread_flags = ["", "-lpthreads", "-Kthread", "-kthread", "-llthread", "-pthread",
"-pthreads", "-mthreads", "-lpthread", "--thread-safe", "-mt"]
for boost_pthread_flag in boost_pthread_flags:
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..f45417d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,33 @@
+NFD Control Center
+==================
+
+NFD Control Center is a helper application to manager local instance of NFD. In addition to that, on macOS NFD Control Center also bundles an internal version of NFD.
+
+## Notes
+
+As of November 14, 2016, to successfully build the macOS app bundle with HomeBrew version of QT libraries, it is necessary to apply the following patch to HomeBrew formula and build qt5 from source (`brew install qt5 --build-from-source`):
+
+```patch
+diff --git a/Formula/qt5.rb b/Formula/qt5.rb
+index 8f2a408..302f4fa 100644
+--- a/Formula/qt5.rb
++++ b/Formula/qt5.rb
+@@ -115,6 +115,11 @@ class Qt5 < Formula
+ sha256 "48ff18be2f4050de7288bddbae7f47e949512ac4bcd126c2f504be2ac701158b"
+ end
+
++ patch do
++ url "https://gist.githubusercontent.com/cawka/3025baecf3b05e14311b82210a15320f/raw/7ac6a2696f19630df5d02ccc0e48aec733da1364/qt5-patch"
++ sha256 "b18e4715fcef2992f051790d3784a54900508c93350c25b0f2228cb058567142"
++ end
++
+ def install
+ args = %W[
+ -verbose
+```
+
+For more information, see https://github.com/Homebrew/homebrew-core/issues/3219 and https://bugreports.qt.io/browse/QTBUG-56814
+
+* * *
+
+The code cannot be compiled with the official version of QT libraries, as they are currently missing .pc file for pkg-config detection of libraries. This relates to the upstream [QT commit](https://codereview.qt-project.org/#/c/140954/) that disabled generation of .pc file. HomeBrew partially reverts this commit in a [patch](https://raw.githubusercontent.com/Homebrew/formula-patches/e8fe6567/qt5/restore-pc-files.patch).
diff --git a/make-osx-bundle.py b/make-osx-bundle.py
index 91a578b..300f36e 100755
--- a/make-osx-bundle.py
+++ b/make-osx-bundle.py
@@ -10,6 +10,8 @@
from subprocess import Popen, PIPE
from optparse import OptionParser
+os.environ['PATH'] += ":/usr/local/opt/qt5/bin:/opt/qt5/5.8/clang_64/bin"
+
import platform
if platform.system () != 'Darwin':
diff --git a/wscript b/wscript
index b67adb4..edb991d 100644
--- a/wscript
+++ b/wscript
@@ -3,6 +3,7 @@
APPNAME='nfd-control-center'
from waflib import Logs, Utils, Task, TaskGen
+import os
def options(opt):
opt.load('compiler_c compiler_cxx qt5 gnu_dirs')
@@ -11,7 +12,16 @@
# grp = opt.add_option_group('NFD Control Center options')
def configure(conf):
- conf.load('compiler_c compiler_cxx qt5 default-compiler-flags boost')
+ conf.load('compiler_c compiler_cxx default-compiler-flags boost')
+
+ if 'PKG_CONFIG_PATH' not in os.environ:
+ os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
+
+ # add homebrew path, as qt5 is no longer linked
+ os.environ['PKG_CONFIG_PATH'] += ":/usr/local/opt/qt5/lib/pkgconfig:/opt/qt5/5.8/clang_64/lib/pkgconfig"
+ os.environ['PATH'] += ":/usr/local/opt/qt5/bin:/opt/qt5/5.8/clang_64/bin"
+
+ conf.load('qt5')
conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
uselib_store='NDN_CXX', mandatory=True)