Files
amnezia-client/client/macos/scripts/openvpn.sh
T

40 lines
1.6 KiB
Bash
Raw Normal View History

2024-10-05 11:16:57 +07:00
#!/bin/bash
2024-10-04 21:52:50 +07:00
XCODEBUILD="/usr/bin/xcodebuild"
WORKINGDIR=`pwd`
PATCH="/usr/bin/patch"
2024-10-05 11:16:57 +07:00
2024-10-09 14:58:53 +07:00
echo "Building OpenVPNAdapter for macOS Network Extension (MacNE)..."
2024-10-05 11:16:57 +07:00
2024-10-09 14:58:53 +07:00
# Copy the Project-MacNE.xcconfig settings to amnezia.xcconfig
cat $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/Project-MacNE.xcconfig > $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/amnezia.xcconfig
2024-10-04 21:52:50 +07:00
# Append macOS-specific build directory configurations to amnezia.xcconfig
cat << EOF >> $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/amnezia.xcconfig
PROJECT_TEMP_DIR = $WORKINGDIR/3rd/OpenVPNAdapter/build/OpenVPNAdapter.build
CONFIGURATION_BUILD_DIR = $WORKINGDIR/3rd/OpenVPNAdapter/build/Release-macos
BUILT_PRODUCTS_DIR = $WORKINGDIR/3rd/OpenVPNAdapter/build/Release-macos
EOF
2024-10-09 14:58:53 +07:00
# Exclude UIKit, include Cocoa for macOS
# echo "OTHER_LDFLAGS = -framework Cocoa" >> $WORKINGDIR/3rd/OpenVPNAdapter/Configuration/amnezia.xcconfig
2024-10-05 11:16:57 +07:00
2024-10-04 21:52:50 +07:00
# Fetch the current macOS SDK version dynamically
2024-10-05 11:16:57 +07:00
MACOSX_SDK=$(xcrun --sdk macosx --show-sdk-path | sed -E 's/.*MacOSX([0-9]+\.[0-9]+)\.sdk/\1/')
echo "Using macOS SDK version: $MACOSX_SDK"
2024-10-04 21:52:50 +07:00
cd 3rd/OpenVPNAdapter
# Build for macOS using the correct SDK and destination
2024-10-05 11:16:57 +07:00
if $XCODEBUILD -scheme OpenVPNAdapter -configuration Release -xcconfig Configuration/amnezia.xcconfig -sdk macosx$MACOSX_SDK -destination 'generic/platform=macOS' -project OpenVPNAdapter.xcodeproj ; then
2024-10-09 14:58:53 +07:00
echo "OpenVPNAdapter built successfully for macOS Network Extension (MacNE)"
2024-10-04 21:52:50 +07:00
else
2024-10-09 14:58:53 +07:00
echo "OpenVPNAdapter macOS Network Extension (MacNE) build failed..."
2024-10-04 21:52:50 +07:00
fi
# Remove CodeSignature if needed for macOS
rm -rf ./build/Release-macos/OpenVPNAdapter.framework/Versions/A/_CodeSignature
cd ../../