diff options
author | Jack Lloyd <[email protected]> | 2017-01-03 17:07:05 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-01-03 17:07:05 -0500 |
commit | 34c45bc3d0874ea2bbf1d83fe235d70a8b644b42 (patch) | |
tree | f87d9f640442852bbf3e8e9bc22f22d948537c56 | |
parent | 4bc97ad2412972d3220a19d940c2770aa7c247c6 (diff) | |
parent | 1108a2e1942435b4568ed64c7d0701711a4bd13d (diff) |
Merge GH #793 Add iOS target
-rwxr-xr-x | configure.py | 2 | ||||
-rw-r--r-- | doc/manual/building.rst | 16 | ||||
-rw-r--r-- | doc/os.rst | 44 | ||||
-rw-r--r-- | src/build-data/cc/clang.txt | 1 | ||||
-rw-r--r-- | src/build-data/os/ios.txt | 26 | ||||
-rw-r--r-- | src/lib/entropy/darwin_secrandom/info.txt | 2 | ||||
-rwxr-xr-x | src/scripts/ci/travis/build.sh | 5 | ||||
-rw-r--r-- | src/tests/unit_x509.cpp | 2 |
8 files changed, 68 insertions, 30 deletions
diff --git a/configure.py b/configure.py index 7b2a822d5..979493b4f 100755 --- a/configure.py +++ b/configure.py @@ -2140,7 +2140,7 @@ def main(argv = None): options.compiler = 'gcc' else: options.compiler = 'msvc' - elif options.os == 'darwin' or options.os == 'freebsd': + elif options.os in ['darwin', 'freebsd', 'ios']: if have_program('clang++'): options.compiler = 'clang' elif options.os == 'openbsd': diff --git a/doc/manual/building.rst b/doc/manual/building.rst index a92d1c6a5..c9e8a0bbd 100644 --- a/doc/manual/building.rst +++ b/doc/manual/building.rst @@ -186,8 +186,8 @@ your documentation and/or local expert for details). For iOS using XCode ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For iOS, you typically build for 3 architectures: armv7 (32 bit, o -lder iOS devices), armv8-a (64 bit, recent iOS devices) and x86_64 for +For iOS, you typically build for 3 architectures: armv7 (32 bit, older +iOS devices), armv8-a (64 bit, recent iOS devices) and x86_64 for the iPhone simulator. You can build for these 3 architectures and then create a universal binary containing code for all of these architectures, so you can link to Botan for the simulator as well as @@ -195,20 +195,20 @@ for an iOS device. To cross compile for armv7, configure and make with:: - $ ./configure.py --prefix="iphone-32" --cpu=armv7 --cc=clang \ - --cc-abi-flags="-arch armv7 -stdlib=libc++" + $ ./configure.py --os=ios --prefix="iphone-32" --cpu=armv7 --cc=clang \ + --cc-abi-flags="-arch armv7" xcrun --sdk iphoneos make install To cross compile for armv8-a, configure and make with:: - $ ./configure.py --prefix="iphone-64" --cpu=armv8-a --cc=clang \ - --cc-abi-flags="-arch arm64 -stdlib=libc++" + $ ./configure.py --os=ios --prefix="iphone-64" --cpu=armv8-a --cc=clang \ + --cc-abi-flags="-arch arm64" xcrun --sdk iphoneos make install To compile for the iPhone Simulator, configure and make with:: - $ ./configure.py --prefix="iphone-simulator" --cpu=x86_64 --cc=clang \ - --cc-abi-flags="-arch x86_64 -stdlib=libc++" + $ ./configure.py --os=ios --prefix="iphone-simulator" --cpu=x86_64 --cc=clang \ + --cc-abi-flags="-arch x86_64" xcrun --sdk iphonesimulator make install Now create the universal binary and confirm the library is compiled diff --git a/doc/os.rst b/doc/os.rst index 83fee9351..ca98456fb 100644 --- a/doc/os.rst +++ b/doc/os.rst @@ -17,6 +17,8 @@ A summary of OS features as defined in ``src/build-data/os``. h: haiku h: hpux h: hurd + i: includeos + i: ios i: irix l: linux m: mingw @@ -28,26 +30,30 @@ A summary of OS features as defined in ``src/build-data/os``. w: windows .. csv-table:: - :header: "Feature", "a", "a", "c", "d", "d", "f", "h", "h", "h", "i", "l", "m", "n", "n", "o", "q", "s", "w" + :header: "Feature", "a", "a", "c", "d", "d", "f", "h", "h", "h", "i", "i", "i", "l", "m", "n", "n", "o", "q", "s", "w" - "clock_gettime", " ", "X", " ", " ", "X", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " " - "cryptgenrandom", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X" - "dlopen", " ", "X", " ", "X", " ", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " " - "gettimeofday", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", " ", "X", "X", "X", "X", "X", " " - "gmtime_r", " ", "X", " ", "X", " ", "X", "X", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " " - "gmtime_s", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" - "loadlibrary", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X" - "memset_s", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " " - "mkgmtime", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X" - "posix_mlock", " ", "X", " ", " ", "X", "X", " ", " ", "X", " ", "X", " ", " ", "X", "X", "X", "X", " " - "query_perf_counter", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" - "readdir", " ", "X", " ", "X", " ", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", " ", " ", " " - "rtlsecurezeromemory", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" - "stl_filesystem_msvc", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" - "timegm", " ", " ", "X", "X", " ", "X", " ", " ", " ", " ", "X", " ", " ", "X", "X", " ", " ", " " - "virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" - "win32_get_systemtime", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " " - "win32_virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " " + "clock_gettime", " ", "X", " ", " ", "X", "X", " ", " ", " ", " ", " ", " ", "X", " ", " ", "X", "X", "X", " ", " " + "cryptgenrandom", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X" + "dlopen", " ", "X", " ", "X", " ", "X", " ", " ", " ", " ", "X", " ", "X", " ", " ", "X", "X", "X", " ", " " + "filesystem", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", "X", "X", " ", "X", "X", "X", "X", "X" + "gettimeofday", "X", "X", "X", "X", "X", "X", "X", "X", " ", " ", "X", "X", "X", " ", "X", "X", "X", "X", "X", " " + "gmtime_r", " ", "X", " ", "X", " ", "X", "X", " ", " ", " ", "X", " ", "X", " ", " ", "X", "X", "X", " ", " " + "gmtime_s", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" + "includeos_rng", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", " " + "loadlibrary", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X" + "memset_s", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " " + "mkgmtime", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X" + "posix_mlock", " ", "X", " ", " ", "X", "X", " ", " ", "X", " ", " ", " ", "X", " ", " ", "X", "X", "X", "X", " " + "query_perf_counter", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" + "readdir", " ", "X", " ", "X", " ", "X", " ", " ", " ", " ", "X", " ", "X", " ", " ", "X", "X", " ", " ", " " + "rtlsecurezeromemory", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" + "sockets", " ", " ", " ", "X", "X", "X", " ", " ", " ", " ", "X", " ", "X", " ", " ", " ", "X", " ", " ", " " + "stl_filesystem_msvc", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" + "threads", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X" + "timegm", " ", " ", "X", "X", " ", "X", " ", " ", " ", " ", "X", " ", "X", " ", " ", "X", "X", " ", " ", " " + "virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" + "win32_get_systemtime", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " " + "win32_virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " " .. note:: This file is auto generated by ``src/scripts/update_docs.py``. Dont modify it manually. diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt index 055315c3b..15538307c 100644 --- a/src/build-data/cc/clang.txt +++ b/src/build-data/cc/clang.txt @@ -80,5 +80,6 @@ x86_64 -> "-m64" ppc64 -> "-m64" darwin -> "-stdlib=libc++" +ios -> "-stdlib=libc++" netbsd -> "-D_NETBSD_SOURCE" </mach_abi_linking> diff --git a/src/build-data/os/ios.txt b/src/build-data/os/ios.txt new file mode 100644 index 000000000..6f3888b8f --- /dev/null +++ b/src/build-data/os/ios.txt @@ -0,0 +1,26 @@ +os_type unix + +soname_pattern_base "libbotan-{version_major}.{version_minor}.dylib" +soname_pattern_abi "libbotan-{version_major}.{version_minor}.{abi_rev}.dylib" +soname_pattern_patch "libbotan-{version_major}.{version_minor}.{abi_rev}.{version_patch}.dylib" + +# It doesn't have the 's' option; you need to use needs ranlib +ar_command "ar cr" +ar_needs_ranlib yes + +doc_dir doc + +<target_features> +dlopen +gettimeofday +gmtime_r +memset_s +readdir +timegm +sockets +threads +filesystem +</target_features> + +<aliases> +</aliases> diff --git a/src/lib/entropy/darwin_secrandom/info.txt b/src/lib/entropy/darwin_secrandom/info.txt index 2460d8f86..554a4b3d8 100644 --- a/src/lib/entropy/darwin_secrandom/info.txt +++ b/src/lib/entropy/darwin_secrandom/info.txt @@ -6,8 +6,10 @@ darwin_secrandom.h <os> darwin +ios </os> <frameworks> darwin -> Security +ios -> Security </frameworks> diff --git a/src/scripts/ci/travis/build.sh b/src/scripts/ci/travis/build.sh index 22c3ba1ca..df80dd52e 100755 --- a/src/scripts/ci/travis/build.sh +++ b/src/scripts/ci/travis/build.sh @@ -75,8 +75,10 @@ if [ "${BUILD_MODE:0:6}" = "cross-" ]; then CFG_FLAGS+=(--disable-shared) MAKE_PREFIX=(xcrun --sdk iphoneos) if [ "$BUILD_MODE" = "cross-arm32" ]; then + CFG_FLAGS+=(--os=ios) CFG_FLAGS+=(--cpu=armv7 --cc-abi-flags="-arch armv7 -arch armv7s -stdlib=libc++") elif [ "$BUILD_MODE" = "cross-arm64" ]; then + CFG_FLAGS+=(--os=ios) CFG_FLAGS+=(--cpu=armv8-a --cc-abi-flags="-arch arm64 -stdlib=libc++") fi elif [ "$TRAVIS_OS_NAME" = "linux" ]; then @@ -105,7 +107,8 @@ if [ "${BUILD_MODE:0:6}" = "cross-" ]; then elif [ "$BUILD_MODE" = "cross-win32" ]; then CC_BIN=i686-w64-mingw32-g++ # No test prefix needed, PE executes as usual with Wine installed - CFG_FLAGS+=(--cpu=x86_32 --os=mingw --cc-abi-flags="-static" --disable-shared) + CFG_FLAGS+=(--os=mingw) + CFG_FLAGS+=(--cpu=x86_32 --cc-abi-flags="-static" --disable-shared) TEST_EXE=./botan-test.exe fi fi diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp index 28cd46db7..dbaf88cd8 100644 --- a/src/tests/unit_x509.cpp +++ b/src/tests/unit_x509.cpp @@ -772,7 +772,7 @@ Test::Result test_x509_extensions(const std::string& sig_algo, const std::string Test::rng()); /* Create the CA object */ - Botan::X509_CA ca(ca_cert, *ca_key, hash_fn); + Botan::X509_CA ca(ca_cert, *ca_key, hash_fn, Test::rng()); std::unique_ptr<Botan::Private_Key> user_key(make_a_private_key(sig_algo)); |