From 9f87b6dd9c35da08a7ca59e11842dac2f717f712 Mon Sep 17 00:00:00 2001 From: The-SamminAter Date: Sat, 24 Jun 2023 17:19:46 -0700 Subject: [PATCH 1/2] Add ability to compile on iOS --- Makefile.defs | 14 +++++++++++++- client/CMakeLists.txt | 8 +++++++- client/Makefile | 8 +++++++- client/deps/hardnested/Makefile | 3 +++ client/experimental_lib/CMakeLists.txt | 8 +++++++- tools/mfd_aes_brute/Makefile | 3 +++ 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Makefile.defs b/Makefile.defs index bcbbaa67e..76409a37d 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -75,7 +75,15 @@ else endif ifeq ($(platform),Darwin) - USE_BREW ?= 1 + ifeq ($(shell uname -p),arm64) + # The platform is iOS + USE_BREW ?= 0 + # iOS refuses to compile unless this is set + export IPHONEOS_DEPLOYMENT_TARGET=11.0 + else + # M* macOS devices return arm + USE_BREW ?= 1 + endif USE_MACPORTS ?= 0 AR= /usr/bin/ar rcs RANLIB= /usr/bin/ranlib @@ -132,6 +140,10 @@ ifeq ($(shell expr $(CC_VERSION) \>= 10), 1) endif endif ifeq ($(platform),Darwin) + ifeq ($(shell uname -p),arm64) + # iOS will refuse to compile without the minimum target of iOS 11.0 + DEFCFLAGS += -mios-version-min=11.0 + endif # their readline has strict-prototype issues DEFCFLAGS += -Wno-strict-prototypes # some warnings about braced initializers on structs we want to ignore diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 3fd255997..9df0844b9 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -380,7 +380,13 @@ message(STATUS "CMAKE_SYSTEM_PROCESSOR := ${CMAKE_SYSTEM_PROCESSOR}") if (APPLE) message(STATUS "Apple device detected.") set(ADDITIONAL_SRC ${PM3_ROOT}/client/src/util_darwin.h ${PM3_ROOT}/client/src/util_darwin.m ${ADDITIONAL_SRC}) - set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit") + if (EXISTS /private/var/mobile) + message(STATUS "iOS detected.") + set(ADDITIONAL_LNK "-framework Foundation" "-framework UIKit") + else + message(STATUS "macOS detected.") + set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit") + endif (EXISTS /private/var/mobile) endif (APPLE) if ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND)) diff --git a/client/Makefile b/client/Makefile index d0cee355e..d44e67011 100644 --- a/client/Makefile +++ b/client/Makefile @@ -434,7 +434,13 @@ LDFLAGS += $(MYLDFLAGS) PM3LDFLAGS = $(LDFLAGS) ifeq ($(platform),Darwin) - PM3LDFLAGS += -framework Foundation -framework AppKit + ifeq ($(shell uname -p),arm64) + # The platform is iOS + PM3LDFLAGS += -framework Foundation -framework UIKit + else + # M* macOS devices return arm + PM3LDFLAGS += -framework Foundation -framework AppKit + endif endif ################### diff --git a/client/deps/hardnested/Makefile b/client/deps/hardnested/Makefile index 1667e036f..badace7e5 100644 --- a/client/deps/hardnested/Makefile +++ b/client/deps/hardnested/Makefile @@ -22,6 +22,9 @@ endif ifneq ($(findstring aarch64, $(cpu_arch)), ) IS_SIMD_ARCH=arm64 endif +ifneq ($(findstring iP, $(cpu_arch)), ) + IS_SIMD_ARCH=arm64 +endif ifneq ($(IS_SIMD_ARCH), ) MULTIARCHSRCS = hardnested_bf_core.c hardnested_bitarray_core.c diff --git a/client/experimental_lib/CMakeLists.txt b/client/experimental_lib/CMakeLists.txt index 2ac10f871..27ee198e1 100644 --- a/client/experimental_lib/CMakeLists.txt +++ b/client/experimental_lib/CMakeLists.txt @@ -380,7 +380,13 @@ message(STATUS "CMAKE_SYSTEM_PROCESSOR := ${CMAKE_SYSTEM_PROCESSOR}") if (APPLE) message(STATUS "Apple device detected.") set(ADDITIONAL_SRC ${PM3_ROOT}/client/src/util_darwin.h ${PM3_ROOT}/client/src/util_darwin.m ${ADDITIONAL_SRC}) - set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit") + if (EXISTS /private/var/mobile) + message(STATUS "iOS detected.") + set(ADDITIONAL_LNK "-framework Foundation" "-framework UIKit") + else + message(STATUS "macOS detected.") + set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit") + endif (EXISTS /private/var/mobile) endif (APPLE) if ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND)) diff --git a/tools/mfd_aes_brute/Makefile b/tools/mfd_aes_brute/Makefile index cf2c457c6..d0df682f6 100644 --- a/tools/mfd_aes_brute/Makefile +++ b/tools/mfd_aes_brute/Makefile @@ -9,6 +9,9 @@ MYLDLIBS = -lcrypto cpu_arch = $(shell uname -m) ifneq ($(findstring arm64, $(cpu_arch)), ) MYCFLAGS += -mcpu=native +# iOS 'fun' +else ifneq ($(findstring iP, $(cpu_arch)), ) + MYCFLAGS += -mcpu=native else MYCFLAGS += -march=native endif From 60480d16ec59b741b069029fc01c0d0bd84fbb1d Mon Sep 17 00:00:00 2001 From: Sam <48739810+The-SamminAter@users.noreply.github.com> Date: Sat, 24 Jun 2023 17:49:26 -0700 Subject: [PATCH 2/2] Update CHANGELOG.md Signed-off-by: Sam <48739810+The-SamminAter@users.noreply.github.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd302c2e8..a9a8cb1f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Added support for compiling on iOS (@The-SamminAter) - Fixed viewing MFC dump - border char is now white (@iceman1001) - Changed `data diff` - to print filenames in header if it fits (@iceman1001) - Changed viewing MFC dump files - it now colors ACL + GPB bytes (@iceman1001)