VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJertzukka <Jertzukka@gmail.com>2024-07-01 23:35:31 +0300
committerGitHub <noreply@github.com>2024-07-01 22:35:31 +0200
commitca69368ba4ba238a227060d6f4406d6235792a96 (patch)
tree05e8bc064876fbdf50846727b4fd7e0143bca14a /src
parent96974169199d347172fc5d4a2924f092d602b3de (diff)
downloadVeraCrypt-ca69368ba4ba238a227060d6f4406d6235792a96.tar.gz
VeraCrypt-ca69368ba4ba238a227060d6f4406d6235792a96.zip
MacOS: Support CommandLineTools for building (#1371)
Full Xcode application which can take up-to 40GB of disk space is not necessary for building VeraCrypt, rather the CommandLineTools for XCode are sufficient which only take few gigabytes. Instead of hardcoding the SDK location, use xcrun --show-sdk-path to support also the CommandLineTools instance. The reason for switching the logic for the XCode version is because the xcodebuild will not report a correct XCode version for the CommandLineTools, thus it can't be relied for whether to use the -Wl,-ld_classic flags. Instead, we can just check the ld version in use in the active developer directory, and see whether we are using dyld (the new) or ld64 (the old).
Diffstat (limited to 'src')
-rw-r--r--src/Makefile18
-rw-r--r--src/Readme.txt2
2 files changed, 9 insertions, 11 deletions
diff --git a/src/Makefile b/src/Makefile
index 65d9a4ef..5e3c903c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -294,7 +294,10 @@ ifeq "$(shell uname -s)" "Darwin"
#check to see if XCode 3 path exists.Otherwise, use XCode 4 path
VC_OSX_SDK_PATH := /Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk
ifeq ($(wildcard $(VC_OSX_SDK_PATH)/SDKSettings.plist),)
- VC_OSX_SDK_PATH := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(VC_OSX_SDK).sdk
+ VC_OSX_SDK_PATH := $(shell xcrun --sdk macosx$(VC_OSX_SDK) --show-sdk-path)
+ ifeq ($(VC_OSX_SDK_PATH),)
+$(error Specified SDK version was not found, ensure your active developer directory is correct through xcode-select)
+ endif
endif
#----- Legacy build if OSX <= 10.8: we build both 32-bit and 64-bit ----
@@ -310,17 +313,12 @@ ifeq "$(shell uname -s)" "Darwin"
CXXFLAGS += -std=c++11
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK_PATH)
LFLAGS += -mmacosx-version-min=$(VC_OSX_TARGET) -Wl,-syslibroot $(VC_OSX_SDK_PATH)
- #Xcode 15 linker emits a warning "no platform load command found" when linking object files generated by yasm
+ # Xcode 15 linker emits a warning "no platform load command found" when linking object files generated by yasm
# To suppress this warning, we need to use -Wl,-ld_classic flag in order to use the old ld64 linker
# https://mjtsai.com/blog/2024/03/15/xcode-15-no-platform-load-command-found/
- # Check Xcode version for using specific linker flag
- XCODE_VERSION := $(shell xcodebuild -version 2>/dev/null | grep 'Xcode' | sed -E 's/Xcode ([0-9]+).*/\1/')
- ifneq ($(XCODE_VERSION),)
- ifeq "$(shell expr $(XCODE_VERSION) \>= 15)" "1"
- LFLAGS += -Wl,-ld_classic
- endif
- else
- $(error Xcode not found, please check your installation)
+ # We can check whether newer linker is in use if ld -v reports dyld instead of ld64.
+ ifeq ($(shell xcrun --sdk macosx$(VC_OSX_SDK) ld -v 2>&1 | grep -oE 'PROJECT:[^-]+' | cut -d: -f2),dyld)
+ LFLAGS += -Wl,-ld_classic
endif
WX_CONFIGURE_FLAGS += --with-macosx-version-min=$(VC_OSX_TARGET) --with-macosx-sdk=$(VC_OSX_SDK_PATH)
diff --git a/src/Readme.txt b/src/Readme.txt
index 9e6c794f..a20ab4f8 100644
--- a/src/Readme.txt
+++ b/src/Readme.txt
@@ -101,7 +101,7 @@ Requirements for Building VeraCrypt for Linux and Mac OS X:
- GNU Make
- GNU C++ Compiler 4.0 or compatible
-- Apple Xcode (Mac OS X only)
+- Apple Xcode or Xcode command line tools (Mac OS X only)
- YASM 1.3.0 or newer (Linux only, x86/x64 architecture only)
- pkg-config
- wxWidgets 3.0 shared library and header files installed or