diff --git a/.gitignore b/.gitignore index 22d1350d4..f071777c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,13 @@ ## Build generated build/ DerivedData/ +Frameworks/ + +## Source / dependencies +submodules/ ## Static libraries -IVPNClient/liboqs/liboqs-iphoneos.a -IVPNClient/liboqs/liboqs-iphonesimulator.a +IVPNClient/liboqs/*.a ## Various settings *.pbxuser @@ -70,6 +73,3 @@ OpenVPNConf.swift fastlane/test_output fastlane/report.xml fastlane/Appfile - -# Frameworks -Frameworks diff --git a/IVPNClient/liboqs/liboqs.a b/IVPNClient/liboqs/liboqs.a deleted file mode 100644 index 9c6884162..000000000 Binary files a/IVPNClient/liboqs/liboqs.a and /dev/null differ diff --git a/README.md b/README.md index 98fc53cc7..2340547f5 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,22 @@ cp IVPNClient/Config/OpenVPNConf.template.swift IVPNClient/Config/OpenVPNConf.sw Build `V2RayControl.xcframework`: ```sh -./build.sh +./build-v2ray.sh +``` + +### Build liboqs.a + +To compile [liboqs](https://github.com/open-quantum-safe/liboqs), additional packages are required: + +``` +brew install cmake ninja openssl@1.1 wget doxygen graphviz astyle valgrind +pip3 install pytest pytest-xdist pyyaml +``` + +Build `liboqs.a`: + +```sh +./build-liboqs.sh ``` ### Fastlane configuration diff --git a/build-liboqs.sh b/build-liboqs.sh new file mode 100755 index 000000000..e670e93a3 --- /dev/null +++ b/build-liboqs.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +BRANCH=ivpn-ios-app +IN_LIBOQS=lib/Release/liboqs.a +OUT_LIBOQS_IPHONEOS=../../IVPNClient/liboqs/liboqs-iphoneos.a +OUT_LIBOQS_IPHONESIMULATOR=../../IVPNClient/liboqs/liboqs-iphonesimulator.a + +set -e + +# Clone liboqs +echo "=> Clone liboqs" +mkdir -p submodules +cd submodules +if [ ! -d "liboqs" ] ; then + git clone --depth 1 --branch ${BRANCH} https://github.com/ivpn/liboqs +fi +cd liboqs + +# liboqs for iphoneos +echo "=> Build liboqs-iphoneos.a" +cmake -G Xcode -DOQS_USE_OPENSSL=OFF -DOQS_BUILD_ONLY_LIB=ON -DOQS_DIST_BUILD=ON -DOQS_MINIMAL_BUILD="KEM_kyber_1024;" -DCMAKE_TOOLCHAIN_FILE=.CMake/toolchain_ios.cmake -DPLATFORM=OS64 +cmake --build . --config Release + +echo "=> Copy liboqs.a to ${OUT_LIBOQS_IPHONEOS}" +cp -f $IN_LIBOQS $OUT_LIBOQS_IPHONEOS + +echo "=> Clean files" +rm -rf $IN_LIBOQS +git clean -fd + +echo "=> Build completed for ${OUT_LIBOQS_IPHONEOS}" + +# liboqs for iphonesimulator +echo "=> Build liboqs-iphonesimulator.a" +cmake -G Xcode -DOQS_USE_OPENSSL=OFF -DOQS_BUILD_ONLY_LIB=ON -DOQS_DIST_BUILD=ON -DOQS_MINIMAL_BUILD="KEM_kyber_1024;" -DCMAKE_TOOLCHAIN_FILE=.CMake/toolchain_ios.cmake -DPLATFORM=SIMULATORARM64 +cmake --build . --config Release + +echo "=> Copy liboqs.a to ${OUT_LIBOQS_IPHONESIMULATOR}" +cp -f $IN_LIBOQS $OUT_LIBOQS_IPHONESIMULATOR + +echo "=> Clean files" +rm -rf $IN_LIBOQS +git clean -fd + +echo "=> Build completed for ${OUT_LIBOQS_IPHONESIMULATOR}" + + +echo "=> BUILD SUCCESSFUL" diff --git a/build.sh b/build-v2ray.sh similarity index 100% rename from build.sh rename to build-v2ray.sh