chore: Add Apple silicon support
This commit is contained in:
parent
eecaa0c7b9
commit
4ccdcdf44e
27
Makefile
27
Makefile
|
@ -78,6 +78,8 @@ ifeq ($(detected_OS),Darwin)
|
||||||
export MACOSX_DEPLOYMENT_TARGET
|
export MACOSX_DEPLOYMENT_TARGET
|
||||||
PKG_TARGET := pkg-macos
|
PKG_TARGET := pkg-macos
|
||||||
RUN_TARGET := run-macos
|
RUN_TARGET := run-macos
|
||||||
|
QMAKE_PATH := $(shell which qmake);
|
||||||
|
QT_ARCH := $(shell lipo -archs $(QMAKE_PATH))
|
||||||
else ifeq ($(detected_OS),Windows)
|
else ifeq ($(detected_OS),Windows)
|
||||||
LIBSTATUS_EXT := dll
|
LIBSTATUS_EXT := dll
|
||||||
PKG_TARGET := pkg-windows
|
PKG_TARGET := pkg-windows
|
||||||
|
@ -115,10 +117,14 @@ endif
|
||||||
ifeq ($(detected_OS),Darwin)
|
ifeq ($(detected_OS),Darwin)
|
||||||
BOTTLES_DIR := $(shell pwd)/bottles
|
BOTTLES_DIR := $(shell pwd)/bottles
|
||||||
BOTTLES := $(addprefix $(BOTTLES_DIR)/,openssl@1.1 pcre)
|
BOTTLES := $(addprefix $(BOTTLES_DIR)/,openssl@1.1 pcre)
|
||||||
|
ifeq ($(QT_ARCH),arm64)
|
||||||
|
EXCLUDE_BOTTLES := 'linux'
|
||||||
|
else
|
||||||
|
EXCLUDE_BOTTLES := 'arm|linux'
|
||||||
|
endif
|
||||||
$(BOTTLES): | $(BOTTLES_DIR)
|
$(BOTTLES): | $(BOTTLES_DIR)
|
||||||
echo -e "\033[92mFetching:\033[39m $(notdir $@) bottle"
|
echo -e "\033[92mFetching:\033[39m $(notdir $@) bottle arch $(QT_ARCH)"
|
||||||
./scripts/fetch-brew-bottle.sh $(notdir $@)
|
./scripts/fetch-brew-bottle.sh $(notdir $@) $(EXCLUDE_BOTTLES)
|
||||||
|
|
||||||
$(BOTTLES_DIR):
|
$(BOTTLES_DIR):
|
||||||
echo -e "\033[92mUpdating:\033[39m macOS Homebrew"
|
echo -e "\033[92mUpdating:\033[39m macOS Homebrew"
|
||||||
|
@ -197,11 +203,15 @@ endif
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(detected_OS),Darwin)
|
ifeq ($(detected_OS),Darwin)
|
||||||
ifeq ("$(shell sysctl -nq hw.optional.arm64)","1")
|
ifeq ("$(shell sysctl -nq hw.optional.arm64)","1")
|
||||||
# Building on M1 is still not supported, so in the meantime we crosscompile to amd64
|
ifneq ($(QT_ARCH),arm64)
|
||||||
DOTHERSIDE_CMAKE_PARAMS += -DCMAKE_OSX_ARCHITECTURES=x86_64
|
STATUSGO_MAKE_PARAMS += GOBIN_SHARED_LIB_CFLAGS="CGO_ENABLED=1 GOOS=darwin GOARCH=amd64"
|
||||||
|
STATUSKEYCARDGO_MAKE_PARAMS += CGOFLAGS="CGO_ENABLED=1 GOOS=darwin GOARCH=amd64"
|
||||||
|
DOTHERSIDE_CMAKE_PARAMS += -DCMAKE_OSX_ARCHITECTURES=x86_64
|
||||||
|
QRCODEGEN_MAKE_PARAMS += CFLAGS="-target x86_64-apple-macos10.12"
|
||||||
NIM_PARAMS += --cpu:amd64 --os:MacOSX --passL:"-arch x86_64" --passC:"-arch x86_64"
|
NIM_PARAMS += --cpu:amd64 --os:MacOSX --passL:"-arch x86_64" --passC:"-arch x86_64"
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RELEASE ?= false
|
RELEASE ?= false
|
||||||
|
@ -257,7 +267,7 @@ status-go: $(STATUSGO)
|
||||||
$(STATUSGO): | deps
|
$(STATUSGO): | deps
|
||||||
echo -e $(BUILD_MSG) "status-go"
|
echo -e $(BUILD_MSG) "status-go"
|
||||||
+ cd vendor/status-go && \
|
+ cd vendor/status-go && \
|
||||||
$(MAKE) statusgo-shared-library $(HANDLE_OUTPUT)
|
$(MAKE) statusgo-shared-library $(STATUSGO_MAKE_PARAMS) $(HANDLE_OUTPUT)
|
||||||
|
|
||||||
STATUSKEYCARDGO := vendor/status-keycard-go/build/libkeycard/libkeycard.$(LIBSTATUS_EXT)
|
STATUSKEYCARDGO := vendor/status-keycard-go/build/libkeycard/libkeycard.$(LIBSTATUS_EXT)
|
||||||
STATUSKEYCARDGO_LIBDIR := $(shell pwd)/$(shell dirname "$(STATUSKEYCARDGO)")
|
STATUSKEYCARDGO_LIBDIR := $(shell pwd)/$(shell dirname "$(STATUSKEYCARDGO)")
|
||||||
|
@ -267,7 +277,7 @@ status-keycard-go: $(STATUSKEYCARDGO)
|
||||||
$(STATUSKEYCARDGO): | deps
|
$(STATUSKEYCARDGO): | deps
|
||||||
echo -e $(BUILD_MSG) "status-keycard-go"
|
echo -e $(BUILD_MSG) "status-keycard-go"
|
||||||
+ cd vendor/status-keycard-go && \
|
+ cd vendor/status-keycard-go && \
|
||||||
$(MAKE) build-lib $(HANDLE_OUTPUT)
|
$(MAKE) build-lib $(STATUSKEYCARDGO_MAKE_PARAMS) $(HANDLE_OUTPUT)
|
||||||
|
|
||||||
QRCODEGEN := vendor/QR-Code-generator/c/libqrcodegen.a
|
QRCODEGEN := vendor/QR-Code-generator/c/libqrcodegen.a
|
||||||
|
|
||||||
|
@ -633,6 +643,7 @@ zip-windows: check-pkg-target-windows $(STATUS_CLIENT_7Z)
|
||||||
clean: | clean-common
|
clean: | clean-common
|
||||||
rm -rf bin/* node_modules bottles/* pkg/* tmp/* $(STATUSGO) $(STATUSKEYCARDGO)
|
rm -rf bin/* node_modules bottles/* pkg/* tmp/* $(STATUSGO) $(STATUSKEYCARDGO)
|
||||||
+ $(MAKE) -C vendor/DOtherSide/build --no-print-directory clean
|
+ $(MAKE) -C vendor/DOtherSide/build --no-print-directory clean
|
||||||
|
+ $(MAKE) -C vendor/QR-Code-generator/c/ --no-print-directory clean
|
||||||
|
|
||||||
clean-git:
|
clean-git:
|
||||||
./scripts/clean-git.sh
|
./scripts/clean-git.sh
|
||||||
|
|
|
@ -10,10 +10,10 @@ function get_gh_pkgs_token() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_bottle_json() {
|
function get_bottle_json() {
|
||||||
brew info --json=v1 "${1}" | jq '
|
brew info --json=v1 "${1}" | jq "
|
||||||
.[0].bottle.stable.files | to_entries
|
.[0].bottle.stable.files | to_entries
|
||||||
| map(select(.key | test("(arm|linux)") | not))
|
| map(select(.key | test(\"${2}\") | not))
|
||||||
| first.value'
|
| first.value"
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetch_bottle() {
|
function fetch_bottle() {
|
||||||
|
@ -30,11 +30,12 @@ if [[ $(uname) != "Darwin" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $# -ne 1 ]]; then
|
if [[ $# -ne 2 ]]; then
|
||||||
echo "usage: $0 <bottle_name>" >&2
|
echo "usage: $0 <bottle_name> <bottle_filter1|bottle_filter2>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
BOTTLE_NAME="${1}"
|
BOTTLE_NAME="${1}"
|
||||||
|
BOTTLE_FILTER="${2}"
|
||||||
BOTTLE_PATH="/tmp/${BOTTLE_NAME}.tar.gz"
|
BOTTLE_PATH="/tmp/${BOTTLE_NAME}.tar.gz"
|
||||||
|
|
||||||
# GitHub Packages requires authentication.
|
# GitHub Packages requires authentication.
|
||||||
|
@ -49,7 +50,9 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${BOTTLE_NAME} - Finding bottle URL"
|
echo "${BOTTLE_NAME} - Finding bottle URL"
|
||||||
BOTTLE_JSON=$(get_bottle_json "${BOTTLE_NAME}")
|
echo "Excluding: ${BOTTLE_FILTER}"
|
||||||
|
|
||||||
|
BOTTLE_JSON=$(get_bottle_json "${BOTTLE_NAME}" "${BOTTLE_FILTER}")
|
||||||
BOTTLE_URL=$(echo "${BOTTLE_JSON}" | jq -r .url)
|
BOTTLE_URL=$(echo "${BOTTLE_JSON}" | jq -r .url)
|
||||||
BOTTLE_SHA=$(echo "${BOTTLE_JSON}" | jq -r .sha256)
|
BOTTLE_SHA=$(echo "${BOTTLE_JSON}" | jq -r .sha256)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@ import constants as main_constants
|
||||||
import app/global/global_singleton
|
import app/global/global_singleton
|
||||||
import app/boot/app_controller
|
import app/boot/app_controller
|
||||||
|
|
||||||
|
when defined(macosx) and defined(arm64):
|
||||||
|
import posix
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "status-app"
|
topics = "status-app"
|
||||||
|
|
||||||
|
@ -78,6 +81,19 @@ proc setupRemoteSignalsHandling() =
|
||||||
keycard_go.setSignalEventCallback(callbackKeycardGo)
|
keycard_go.setSignalEventCallback(callbackKeycardGo)
|
||||||
|
|
||||||
proc mainProc() =
|
proc mainProc() =
|
||||||
|
|
||||||
|
when defined(macosx) and defined(arm64):
|
||||||
|
echo "Experimental support for Apple Silicon"
|
||||||
|
var signalStack: cstring = cast[cstring](allocShared(SIGSTKSZ))
|
||||||
|
var ss: ptr Stack = cast[ptr Stack](allocShared0(sizeof(Stack)))
|
||||||
|
var ss2: ptr Stack = nil
|
||||||
|
ss.ss_sp = signalStack
|
||||||
|
ss.ss_flags = 0
|
||||||
|
ss.ss_size = SIGSTKSZ
|
||||||
|
if sigaltstack(ss[], ss2[]) < 0:
|
||||||
|
echo("sigaltstack error!")
|
||||||
|
quit()
|
||||||
|
|
||||||
if main_constants.IS_MACOS and defined(production):
|
if main_constants.IS_MACOS and defined(production):
|
||||||
setCurrentDir(getAppDir())
|
setCurrentDir(getAppDir())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue