Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build script for liboqs library #384

Merged
merged 9 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -70,6 +73,3 @@ OpenVPNConf.swift
fastlane/test_output
fastlane/report.xml
fastlane/Appfile

# Frameworks
Frameworks
Binary file removed IVPNClient/liboqs/liboqs.a
Binary file not shown.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] wget doxygen graphviz astyle valgrind
pip3 install pytest pytest-xdist pyyaml
```

Build `liboqs.a`:

```sh
./build-liboqs.sh
```

### Fastlane configuration
Expand Down
48 changes: 48 additions & 0 deletions build-liboqs.sh
Original file line number Diff line number Diff line change
@@ -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"
File renamed without changes.
Loading