Skip to content

[ios-xray] Build Xray support #228

[ios-xray] Build Xray support

[ios-xray] Build Xray support #228

name: macos-openvpn
on: [push]
jobs:
macos:
strategy:
fail-fast: false
matrix:
ssllib: [ openssl11 ]
build: [ normal, asan ]
os: [macos-11, macos-12]
arch: [x86_64] #, arm64]
include:
- build: asan
cflags: "-fsanitize=address -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"
ldflags: -fsanitize=address
# Our build system ignores LDFLAGS for plugins
configureflags: --disable-plugin-auth-pam --disable-plugin-down-root
- build: normal
cflags: "-O2 -g"
ldflags: ""
configureflags: ""
- ssllib: openssl11
libdir: [email protected]
configuressllib: ""
runs-on: ${{matrix.os}}
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[macos]') ||
contains(github.event.head_commit.message, '[macos-openvpn]') ||
contains(github.event.head_commit.message, '[openvpn]')
name: "${{matrix.os}} - ${{matrix.arch}} - ${{matrix.libdir}} - ${{matrix.build}}"
env:
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}
UBSAN_OPTIONS: print_stacktrace=1
BUILD_DIR: ${{ github.workspace }}/../_deps/openvpn_build
INSTALL_DIR: ${{ github.workspace }}/../openvpn_inst
OPEN_SSL_VER: "1.1.1t"
_ARCH: ${{matrix.arch}}
OPENSSL_LIBS: "-L${INSTALL_DIR}/lib -lssl -lcrypto"
OPENSSL_CFLAGS: "-I${INSTALL_DIR}include"
LZO_LIBS: "-L${INSTALL_DIR}/lib -llzo2"
LZO_CFLAGS: "-I${INSTALL_DIR}/include"
LZ4_LIBS: "-L${INSTALL_DIR}/lib -llz4"
LZ4_CFLAGS: "-I${INSTALL_DIR}/include"
steps:
- name: Install dependencies
run: brew install man2html cmocka libtool automake autoconf
- name: Creating work-folder
run: |
mkdir -pv ${BUILD_DIR}
mkdir -pv ${INSTALL_DIR}
mkdir -pv ${INSTALL_DIR}/include
mkdir -pv ${INSTALL_DIR}/lib
- name: Build OpenSSL
run: |
cd ${BUILD_DIR}
curl https://www.openssl.org/source/openssl-${OPEN_SSL_VER}.tar.gz | tar zx
cd ${BUILD_DIR}/openssl-${OPEN_SSL_VER}
if [ ${_ARCH} = "arm64" ]; then
./Configure darwin64-arm64-cc shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-arm64
else
./Configure darwin64-x86_64-cc shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-x86_64
fi
echo "************************************************"
echo "******** Compiling OpenSSL..."
echo "************************************************"
make
echo "************************************************"
echo "******** Copying OpenSSL include folder and static libraries..."
# if you want to use OS-default SHARED openssl libraries - not necessary to compile it.
# Just copy required headers of OpenSSL (include folder)
cp -r ${BUILD_DIR}/openssl-${OPEN_SSL_VER}/include/openssl ${INSTALL_DIR}/include/
# if you want to use OS-default SHARED openssl libraries - skip copying this static libraries
cp ${BUILD_DIR}/openssl-${OPEN_SSL_VER}/libcrypto.a ${INSTALL_DIR}/lib/
cp ${BUILD_DIR}/openssl-${OPEN_SSL_VER}/libssl.a ${INSTALL_DIR}/lib/
- name: Build LZO
run: |
echo "************************************************"
echo "******** Downloading LZO sources..."
echo "************************************************"
cd ${BUILD_DIR}
curl https://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz | tar zx
cd lzo-2.10
echo "************************************************"
echo "******** Compiling LZO..."
echo "************************************************"
CLFAGS="-mmacosx-version-min=10.6" ./configure --prefix="${INSTALL_DIR}" && make && make install
- name: Build LZ4
run: |
cd ${BUILD_DIR}
git clone https://github.com/lz4/lz4
cd lz4
git checkout release
CLFAGS="-mmacosx-version-min=10.6" sudo make install PREFIX="${INSTALL_DIR}"
cd ${INSTALL_DIR}/lib
sudo rm *.dylib
- name: 'Get openvpn'
uses: actions/checkout@v3
with:
repository: OpenVPN/openvpn
ref: release/2.6
path: openvpn
- name: autoconf
working-directory: openvpn
run: autoreconf -fvi
- name: configure
working-directory: openvpn
run: ./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --enable-static --with-crypto-library=openssl
- name: make all
working-directory: openvpn
run: make -j4
- name: make check
working-directory: openvpn
run: make check
- name: copy libs
working-directory: openvpn
run: |
mkdir buildOvpn
mkdir buildOvpn/${{matrix.os}}_${{matrix.arch}}_${{matrix.build}}
cp src/openvpn/openvpn buildOvpn/${{matrix.os}}_${{matrix.arch}}_${{matrix.build}}/openvpn
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: openvpn-macos
path: openvpn/buildOvpn/*
Build-OpenVPN3-MacOS:
strategy:
fail-fast: false
matrix:
os: [macos-12]
arch: [x86_64] #, arm64]
runs-on: ${{matrix.os}}
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[macos]') ||
contains(github.event.head_commit.message, '[macos-openvpn]') ||
contains(github.event.head_commit.message, '[openvpn]')
name: "${{matrix.os}} - ${{matrix.arch}}"
env:
BUILD_DIR: ${{ github.workspace }}/build
OPEN_SSL_VER: "1.1.1t"
steps:
- name: Install dependencies
run: brew install asio cmake jsoncpp pkg-config
- name: Creating work-folder
run: |
mkdir -p ${{ github.workspace }}/src
- name: 'Get openvpn'
uses: actions/checkout@v3
with:
repository: amnezia-vpn/openvpn3
ref: win-amezia
path: ${{ github.workspace }}/src/openvpn3
- name: Build OpenSSL
run: |
curl https://www.openssl.org/source/openssl-${OPEN_SSL_VER}.tar.gz | tar zx
cd openssl-${OPEN_SSL_VER}
if [ ${_ARCH} = "arm64" ]; then
./Configure darwin64-arm64-cc no-shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-arm64
else
./Configure darwin64-x86_64-cc no-shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-x86_64
fi
echo "************************************************"
echo "******** Compiling OpenSSL..."
echo "************************************************"
make
echo "************************************************"
echo "******** Copying OpenSSL include folder and static libraries..."
sudo make install
- name: Build LZ4
run: |
git clone https://github.com/lz4/lz4
cd lz4
git checkout release
CLFAGS="-mmacosx-version-min=10.6" make
CLFAGS="-mmacosx-version-min=10.6" sudo make install
sudo rm /usr/local/lib/liblz*.dylib
- name: Build MacOS OpenVPN3
run: |
cd ${{ github.workspace }}/src/
mkdir build-openvpn3
cd build-openvpn3
cp -rf ${{ github.workspace }}/src/openvpn3/openvpn/plugin/darwin/ck-ovpn-plugin.h ${{ github.workspace }}/src/openvpn3/openvpn/transport/client/pluggable/ck-ovpn-plugin.h
cmake -DOPENSSL_ROOT_DIR=${{ github.workspace }}/openssl-${OPEN_SSL_VER} -DCMAKE_PREFIX_PATH=/usr/local/opt ${{ github.workspace }}/src/openvpn3
cmake --build . --config Release --target ovpncli
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: openvpn3-macos
path: ${{ github.workspace }}/src/build-openvpn3
github-release:
name: GitHub Release
needs: macos
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in $(find ./ -name 'o*' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn-macos.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn3-macos.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true