mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2026-09-19 09:51:28 +03:00
9a7d618a60
On macOS, configure exports a hardcoded OPENSSL_ROOT_DIR of /usr/local/opt/openssl/. That is the Homebrew prefix on Intel Macs; on Apple Silicon Homebrew installs to /opt/homebrew, so the directory does not exist. Nothing is broken today: CMake's FindOpenSSL treats OPENSSL_ROOT_DIR as a hint rather than an exclusive search path, so it ignores the dead directory and finds OpenSSL anyway. The problem is the log line, which confidently names a path that exists on no Apple Silicon machine and sends anyone debugging an OpenSSL pickup down a false trail. Ask brew for the real prefix, preferring openssl@3 and falling back to openssl, and keep the previous value as a last resort so behaviour is unchanged where Homebrew is absent.
67 lines
2.0 KiB
Bash
Executable File
67 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
echo '---------------------------------------------------------------------'
|
|
echo 'SoftEther VPN for Unix'
|
|
echo
|
|
echo 'Copyright (c) all contributors on SoftEther VPN project in GitHub.'
|
|
echo 'Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.'
|
|
echo
|
|
echo 'Licensed under the Apache License, Version 2.0 (the License).'
|
|
echo
|
|
echo 'Read and understand README, LICENSE and WARNING before use.'
|
|
echo '---------------------------------------------------------------------'
|
|
echo
|
|
|
|
echo 'Welcome to the corner-cutting configure script !'
|
|
echo
|
|
|
|
if [ ! -d "build" ]; then
|
|
mkdir build
|
|
fi
|
|
|
|
if [ ! -z ${CMAKE_FLAGS+x} ]; then
|
|
CMAKE_FLAGS="${CMAKE_FLAGS}"
|
|
fi
|
|
|
|
if [ ! -z ${CMAKE_INSTALL_PREFIX+x} ]; then
|
|
CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${CMAKE_FLAGS}"
|
|
fi
|
|
|
|
if [ -z ${OPENSSL_ROOT_DIR} ]; then
|
|
unameOut="$(uname -s)"
|
|
if [ "$unameOut" = "Darwin" ]; then
|
|
# Homebrew's prefix differs by architecture: /opt/homebrew on Apple
|
|
# Silicon, /usr/local on Intel. Ask brew rather than hardcoding one.
|
|
if command -v brew > /dev/null 2>&1; then
|
|
OPENSSL_ROOT_DIR="$(brew --prefix openssl@3 2>/dev/null || brew --prefix openssl 2>/dev/null)"
|
|
fi
|
|
if [ -z "${OPENSSL_ROOT_DIR}" ]; then
|
|
OPENSSL_ROOT_DIR="/usr/local/opt/openssl/"
|
|
fi
|
|
echo "Environment variable OPENSSL_ROOT_DIR not set, using ${OPENSSL_ROOT_DIR}"
|
|
export OPENSSL_ROOT_DIR
|
|
fi
|
|
fi
|
|
|
|
if [ ! -z ${CPACK_GENERATOR+x} ]; then
|
|
echo "CPACK_GENERATOR is set, CPack will generate ${CPACK_GENERATOR} packages."
|
|
CMAKE_FLAGS="-DCPACK_GENERATOR=${CPACK_GENERATOR} ${CMAKE_FLAGS}"
|
|
elif [ -x "$(command -v rpm)" ]; then
|
|
echo "'rpm' executable found, CPack will generate RPM packages."
|
|
CMAKE_FLAGS="-DCPACK_GENERATOR='RPM' ${CMAKE_FLAGS}"
|
|
else
|
|
echo "'rpm' executable not found, CPack will generate DEB packages."
|
|
CMAKE_FLAGS="-DCPACK_GENERATOR='DEB' ${CMAKE_FLAGS}"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
(cd build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${CMAKE_FLAGS} .. || exit 1)
|
|
|
|
|
|
echo ""
|
|
|
|
echo "The Makefile is generated. Run 'make -C build' to build SoftEther VPN."
|