Skip to content

Commit 57b576f

Browse files
authored
Update Makefile build_release to work around issues with static linking library dependencies and duplicate symbols (#493)
1 parent bf905a0 commit 57b576f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Makefile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
RELEASE_BUILD_FLAGS=-c release --disable-sandbox --arch x86_64 --arch arm64
2-
BIN_PATH=$(shell swift build $(RELEASE_BUILD_FLAGS) --show-bin-path)/periphery
1+
BUILD_PATH=.build
2+
SWIFT_BUILD_FLAGS=--configuration release --disable-sandbox --build-path ${BUILD_PATH}
33

4-
build_release:
5-
@swift build $(RELEASE_BUILD_FLAGS)
6-
@install_name_tool -add_rpath @loader_path ${BIN_PATH}
4+
EXECUTABLE_X86_64=$(shell swift build ${SWIFT_BUILD_FLAGS} --arch x86_64 --show-bin-path)/periphery
5+
EXECUTABLE_ARM64=$(shell swift build ${SWIFT_BUILD_FLAGS} --arch arm64 --show-bin-path)/periphery
6+
EXECUTABLE=${BUILD_PATH}/periphery
7+
8+
clean:
9+
@swift package clean
10+
11+
build_x86_64:
12+
@swift build ${SWIFT_BUILD_FLAGS} --arch x86_64
13+
14+
build_arm64:
15+
@swift build ${SWIFT_BUILD_FLAGS} --arch arm64
16+
17+
build_release: clean build_x86_64 build_arm64
18+
@lipo -create -output ${EXECUTABLE} ${EXECUTABLE_X86_64} ${EXECUTABLE_ARM64}
19+
@strip -rSTX ${EXECUTABLE}
720

821
show_bin_path:
9-
@echo ${BIN_PATH}
22+
@echo ${EXECUTABLE}

0 commit comments

Comments
 (0)