Skip to content

Commit

Permalink
Merge pull request #384 from ivpn/task/liboqs-build-script
Browse files Browse the repository at this point in the history
Build script for liboqs library
  • Loading branch information
jurajhilje authored Nov 14, 2023
2 parents e2ce503 + 8c63f3f commit bd0ade2
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 6 deletions.
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 openssl@1.1 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.

0 comments on commit bd0ade2

Please sign in to comment.