mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-03-28 20:03:08 +00:00
fix arch on macos builds
This commit is contained in:
parent
665ca2fb0c
commit
94b9a71251
5
Makefile
5
Makefile
@ -159,7 +159,6 @@ deps: | nimble
|
||||
|
||||
LIBRLN_BUILDDIR := $(CURDIR)/vendor/zerokit
|
||||
LIBRLN_VERSION := v0.9.0
|
||||
HOST_ARCH := $(shell uname -m)
|
||||
|
||||
ifeq ($(detected_OS),Windows)
|
||||
LIBRLN_FILE ?= rln.lib
|
||||
@ -408,10 +407,10 @@ else ifeq ($(detected_OS),Linux)
|
||||
endif
|
||||
|
||||
libwaku: | librln $(NIMBLEDEPS_STAMP)
|
||||
ARCH=$(HOST_ARCH) nimble --verbose libwaku$(BUILD_COMMAND) $(NIM_PARAMS) waku.nimble
|
||||
nimble --verbose libwaku$(BUILD_COMMAND) $(NIM_PARAMS) waku.nimble
|
||||
|
||||
liblogosdelivery: | librln $(NIMBLEDEPS_STAMP)
|
||||
ARCH=$(HOST_ARCH) nimble --verbose liblogosdelivery$(BUILD_COMMAND) $(NIM_PARAMS) waku.nimble
|
||||
nimble --verbose liblogosdelivery$(BUILD_COMMAND) $(NIM_PARAMS) waku.nimble
|
||||
|
||||
logosdelivery_example: | build liblogosdelivery
|
||||
@echo -e $(BUILD_MSG) "build/$@"
|
||||
|
||||
24
waku.nimble
24
waku.nimble
@ -120,12 +120,6 @@ proc buildLibrary(outLibNameAndExt: string, libName: string, extra_params = "",
|
||||
" --nimMainPrefix:libwaku -d:discv5_protocol_id=d5waku " &
|
||||
extra_params & " " & libName & "/" & libName & ".nim"
|
||||
|
||||
proc getArch(): string =
|
||||
let arch = getEnv("ARCH")
|
||||
if arch.len > 0: return arch
|
||||
let (archFromUname, _) = gorgeEx("uname -m")
|
||||
return archFromUname.strip()
|
||||
|
||||
proc buildLibDynamicWindows(libName: string) =
|
||||
buildLibrary libName & ".dll", libName,
|
||||
"""-d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE """,
|
||||
@ -137,10 +131,13 @@ proc buildLibDynamicLinux(libName: string) =
|
||||
"dynamic"
|
||||
|
||||
proc buildLibDynamicMac(libName: string) =
|
||||
let arch = getArch()
|
||||
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
|
||||
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
|
||||
when defined(arm64):
|
||||
let archFlags = "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||
elif defined(amd64):
|
||||
let archFlags = "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||
else:
|
||||
{.error: "Unsupported macOS architecture".}
|
||||
buildLibrary libName & ".dylib", libName,
|
||||
archFlags & " -d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE",
|
||||
"dynamic"
|
||||
@ -156,10 +153,13 @@ proc buildLibStaticLinux(libName: string) =
|
||||
"static"
|
||||
|
||||
proc buildLibStaticMac(libName: string) =
|
||||
let arch = getArch()
|
||||
let sdkPath = staticExec("xcrun --show-sdk-path").strip()
|
||||
let archFlags = (if arch == "arm64": "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||
else: "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\"")
|
||||
when defined(arm64):
|
||||
let archFlags = "--cpu:arm64 --passC:\"-arch arm64\" --passL:\"-arch arm64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||
elif defined(amd64):
|
||||
let archFlags = "--cpu:amd64 --passC:\"-arch x86_64\" --passL:\"-arch x86_64\" --passC:\"-isysroot " & sdkPath & "\" --passL:\"-isysroot " & sdkPath & "\""
|
||||
else:
|
||||
{.error: "Unsupported macOS architecture".}
|
||||
buildLibrary libName & ".a", libName,
|
||||
archFlags & " -d:chronicles_line_numbers --warning:Deprecated:off --warning:UnusedImport:on -d:chronicles_log_level=TRACE",
|
||||
"static"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user