Enable building of ChronoShare.app

Temporarily disable integrated tests

Change-Id: I652e27f1a19dc9f5b3e0b1399e0fe015f61b3e81
diff --git a/.waf-tools/cryptopp.py b/.waf-tools/cryptopp.py
deleted file mode 100644
index 1632ab6..0000000
--- a/.waf-tools/cryptopp.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#! /usr/bin/env python
-# encoding: utf-8
-
-'''
-
-When using this tool, the wscript will look like:
-
-    def options(opt):
-        opt.load('compiler_cxx cryptopp')
-
-    def configure(conf):
-        conf.load('compiler_cxx cryptopp')
-        conf.check_cryptopp()
-
-    def build(bld):
-        bld(source='main.cpp', target='app', use='CRYPTOPP')
-
-Options are generated, in order to specify the location of cryptopp includes/libraries.
-
-
-'''
-import sys
-import re
-from waflib import Utils,Logs,Errors
-from waflib.Configure import conf
-CRYPTOPP_DIR = ['/usr', '/usr/local', '/opt/local', '/sw']
-CRYPTOPP_VERSION_FILE = 'config.h'
-
-CRYPTOPP_CHECK_FRAGMENT = '''
-#include "../../src/security/v1/cryptopp.hpp"
-#include <iostream>
-
-int
-main()
-{
-  using namespace CryptoPP;
-
-  std::string buffer = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
-  SHA256 hash;
-  StringSource(buffer, true, new HashFilter(hash, new FileSink(std::cout)));
-  StringSource(reinterpret_cast<const uint8_t*>(buffer.c_str()), buffer.size(),
-               true, new HashFilter(hash, new FileSink(std::cout)));
-}
-'''
-
-def options(opt):
-    opt.add_option('--with-cryptopp', type='string', default=None, dest='cryptopp_dir',
-                   help='''Path to where CryptoPP is installed, e.g., /usr/local''')
-
-@conf
-def __cryptopp_get_version_file(self, dir):
-    try:
-        return self.root.find_dir(dir).find_node('%s/%s' % ('include/cryptopp',
-                                                            CRYPTOPP_VERSION_FILE))
-    except:
-        return None
-
-@conf
-def __cryptopp_find_root_and_version_file(self, *k, **kw):
-    root = k and k[0] or kw.get('path', self.options.cryptopp_dir)
-
-    file = self.__cryptopp_get_version_file(root)
-    if root and file:
-        return (root, file)
-    for dir in CRYPTOPP_DIR:
-        file = self.__cryptopp_get_version_file(dir)
-        if file:
-            return (dir, file)
-
-    if root:
-        self.fatal('CryptoPP not found in %s' % root)
-    else:
-        self.fatal('CryptoPP not found, please provide a --with-cryptopp=PATH argument (see help)')
-
-@conf
-def check_cryptopp(self, *k, **kw):
-    if not self.env['CXX']:
-        self.fatal('Load a c++ compiler first, e.g., conf.load("compiler_cxx")')
-
-    var = kw.get('uselib_store', 'CRYPTOPP')
-    mandatory = kw.get('mandatory', True)
-
-    use = kw.get('use', 'PTHREAD')
-
-    self.start_msg('Checking Crypto++ lib')
-    (root, file) = self.__cryptopp_find_root_and_version_file(*k, **kw)
-
-    try:
-        txt = file.read()
-        re_version = re.compile('^#define\\s+CRYPTOPP_VERSION\\s+([0-9]+)', re.M)
-        match = re_version.search(txt)
-
-        if match:
-            self.env.CRYPTOPP_VERSION = match.group(1)
-            v = int(self.env.CRYPTOPP_VERSION)
-            (major, minor, patch) = (int(v / 100), int(v % 100 / 10), int(v % 10))
-            self.end_msg("%d.%d.%d" % (major, minor, patch))
-        else:
-            self.fatal('CryptoPP files are present, but are not recognizable')
-    except:
-        self.fatal('CryptoPP not found or is not usable')
-
-    isLibWorking = False
-    for defines in [[], ['CRYPTOPP_DISABLE_ASM']]:
-        try:
-            self.check_cxx(msg='Checking if CryptoPP library works',
-                           fragment=CRYPTOPP_CHECK_FRAGMENT,
-                           lib='cryptopp',
-                           includes="%s/include" % root,
-                           libpath="%s/lib" % root,
-                           mandatory=True,
-                           use=use,
-                           defines=defines,
-                           uselib_store=var)
-            isLibWorking = True
-            break
-        except:
-            # try another flags
-            pass
-
-    if mandatory and not isLibWorking:
-        self.fatal('CryptoPP is present, but is not usable')
diff --git a/.waf-tools/osx-frameworks.py b/.waf-tools/osx-frameworks.py
index 7830f8f..9936778 100644
--- a/.waf-tools/osx-frameworks.py
+++ b/.waf-tools/osx-frameworks.py
@@ -5,16 +5,14 @@
 from waflib.Configure import conf
 
 OSX_SECURITY_CODE='''
-#include <CoreFoundation/CoreFoundation.h>
-#include <Security/Security.h>
-#include <Security/SecRandom.h>
-#include <CoreServices/CoreServices.h>
-#include <Security/SecDigestTransform.h>
-
-int main(int argc, char **argv) {
-    (void)argc; (void)argv;
-    return 0;
-}
+#import <AppKit/AppKit.h>
+#import <Foundation/Foundation.h>
+#import <Sparkle/Sparkle.h>
+#import <CoreWLAN/CWInterface.h>
+#import <CoreWLAN/CoreWLAN.h>
+#import <CoreWLAN/CoreWLANConstants.h>
+#import <CoreWLAN/CoreWLANTypes.h>
+int main() { }
 '''
 
 @conf
@@ -25,46 +23,46 @@
         conf.check_cxx(framework_name='CoreWLAN',   uselib_store='OSX_COREWLAN',   define_name='HAVE_COREWLAN',
                        use="OSX_FOUNDATION", mandatory=False, compile_filename='test.mm')
 
-        if conf.options.autoupdate:
-            def check_sparkle(**kwargs):
-              conf.check_cxx (framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"],
-                              uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True,
-                              compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT",
-                              **kwargs
-                              )
+        def check_sparkle(**kwargs):
+          conf.check_cxx(framework_name="Sparkle", header_name=["Foundation/Foundation.h", "AppKit/AppKit.h"],
+                         uselib_store='OSX_SPARKLE', define_name='HAVE_SPARKLE', mandatory=True,
+                         compile_filename='test.mm', use="OSX_FOUNDATION OSX_APPKIT",
+                         **kwargs
+                         )
+        try:
+            # Try standard paths first
+            check_sparkle()
+        except:
             try:
-                # Try standard paths first
-                check_sparkle()
+                # Try local path
+                Logs.info ("Check local version of Sparkle framework")
+                check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(),
+                              linkflags="-F%s/osx/Frameworks/" % conf.path.abspath())
+                conf.env.HAVE_LOCAL_SPARKLE = 1
             except:
-                try:
-                    # Try local path
-                    Logs.info ("Check local version of Sparkle framework")
-                    check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(),
-                                  linkflags="-F%s/osx/Frameworks/" % conf.path.abspath())
-                    conf.env.HAVE_LOCAL_SPARKLE = 1
-                except:
-                    import urllib, subprocess, os, shutil
-                    if not os.path.exists('osx/Frameworks/Sparkle.framework'):
-                        # Download to local path and retry
-                        Logs.info ("Sparkle framework not found, trying to download it to 'build/'")
+                import urllib, subprocess, os, shutil
+                if not os.path.exists('osx/Frameworks/Sparkle.framework'):
+                    # Download to local path and retry
+                    Logs.info ("Sparkle framework not found, trying to download it to 'build/'")
 
-                        urllib.urlretrieve ("http://sparkle.andymatuschak.org/files/Sparkle%201.5b6.zip", "build/Sparkle.zip")
-                        if os.path.exists('build/Sparkle.zip'):
-                            try:
-                                subprocess.check_call (['unzip', '-qq', 'build/Sparkle.zip', '-d', 'build/Sparkle'])
-                                os.remove ("build/Sparkle.zip")
-                                if not os.path.exists("osx/Frameworks"):
-                                    os.mkdir ("osx/Frameworks")
-                                os.rename ("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework")
-                                shutil.rmtree("build/Sparkle", ignore_errors=True)
+                    urllib.urlretrieve ("https://github.com/sparkle-project/Sparkle/releases/download/1.16.0/Sparkle-1.16.0.tar.bz2", "build/Sparkle.tar.bz2")
+                    if os.path.exists('build/Sparkle.tar.bz2'):
+                        try:
+                            subprocess.check_call(['mkdir', 'build/Sparkle'])
+                            subprocess.check_call(['tar', 'xjf', 'build/Sparkle.tar.bz2', '-C', 'build/Sparkle'])
+                            os.remove("build/Sparkle.tar.bz2")
+                            if not os.path.exists("osx/Frameworks"):
+                                os.mkdir ("osx/Frameworks")
+                            os.rename("build/Sparkle/Sparkle.framework", "osx/Frameworks/Sparkle.framework")
 
-                                check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(),
-                                              linkflags="-F%s/osx/Frameworks/" % conf.path.abspath())
-                                conf.env.HAVE_LOCAL_SPARKLE = 1
-                            except subprocess.CalledProcessError as e:
-                                conf.fatal("Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (' '.join(e.cmd), e.returncode))
-                            except:
-                                conf.fatal("Unknown Error happened when auto downloading Sparkle framework")
+                            check_sparkle(cxxflags="-F%s/osx/Frameworks/" % conf.path.abspath(),
+                                          linkflags="-F%s/osx/Frameworks/" % conf.path.abspath())
+                            conf.env.HAVE_LOCAL_SPARKLE = 1
+                        except subprocess.CalledProcessError as e:
+                            conf.fatal("Cannot find Sparkle framework. Auto download failed: '%s' returned %s" % (' '.join(e.cmd), e.returncode))
+                        except:
+                            conf.fatal("Unknown Error happened when auto downloading Sparkle framework")
 
-            if conf.is_defined('HAVE_SPARKLE'):
-                conf.env.HAVE_SPARKLE = 1 # small cheat for wscript
+        conf.env['LDFLAGS_OSX_SPARKLE'] += ['-Wl,-rpath,@loader_path/../Frameworks']
+        if conf.is_defined('HAVE_SPARKLE'):
+            conf.env.HAVE_SPARKLE = 1 # small cheat for wscript