From ec586d7258d45e8df6e61aa31f39e46d6fee4679 Mon Sep 17 00:00:00 2001 From: Nick Chan Date: Wed, 18 Jan 2023 01:30:20 +0800 Subject: [PATCH] generate debug symbols --- .github/workflows/build.yml | 8 +++++++- .gitignore | 1 + Makefile | 20 ++++++++++++++++++-- src/Makefile | 2 +- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5ab402..c595cb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,14 @@ jobs: run: | make -j$(sysctl -n hw.ncpu) macos-dist - - name: Upload artifact + - name: Upload macOS build uses: actions/upload-artifact@v3.1.0 with: name: palera1n-macOS path: palera1n-macos + + - name: Upload macOS debug symbols + uses: actions/upload-artifact@v2 + with: + name: palera1n-macos.dSYM + path: palera1n-macos.dSYM diff --git a/.gitignore b/.gitignore index 2da1762..8f4453d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ palera1n* !checkra1n.h src/binpack.dmg src/ramdisk.dmg +.DS_Store diff --git a/Makefile b/Makefile index 5b16784..216b0bd 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,19 @@ SRC = $(shell pwd) DEP = $(SRC)/dep_root +STRIP = strip CC = cc -CFLAGS += -mmacosx-version-min=10.8 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -O0 -g -Wall -Wextra +CFLAGS += -mmacosx-version-min=10.8 -I$(DEP)/include -I/opt/procursus/include -I$(SRC)/include -I$(SRC) -Wall -Wextra LIBS = $(DEP)/lib/libimobiledevice-1.0.a $(DEP)/lib/libirecovery-1.0.a $(DEP)/lib/libusbmuxd-2.0.a $(DEP)/lib/libplist-2.0.a $(DEP)/lib/libimobiledevice-glue-1.0.a -pthread LIBS += $(DEP)/lib/libcrypto.35.tbd $(DEP)/lib/libssl.35.tbd $(DEP)/lib/libusb-1.0.a LIBS += -framework CoreFoundation -framework SystemConfiguration -framework IOKit -framework Security LDFLAGS = $(LIBS) +ifeq ($(DEV_BUILD),1) +CFLAGS += -O0 -g +else +CFLAGS += -Os -g +endif + export SRC DEP CC CFLAGS LDFLAGS LIBS all: palera1n @@ -21,13 +28,22 @@ macos-dist: $(MAKE) clean $(MAKE) all CFLAGS='-arch arm64 $(CFLAGS)' cp src/palera1n palera1n-arm64 + dsymutil src/palera1n + cp -a src/palera1n.dSYM palera1n-arm64.dSYM $(MAKE) clean $(MAKE) all CFLAGS='-arch x86_64 $(CFLAGS)' cp src/palera1n palera1n-x86_64 + dsymutil src/palera1n + cp -a src/palera1n.dSYM palera1n-x86_64.dSYM $(MAKE) clean lipo -create -arch arm64 palera1n-arm64 -arch x86_64 palera1n-x86_64 -output palera1n-macos + mkdir -p palera1n-macos.dSYM/Contents/Resources/DWARF + cp palera1n-arm64.dSYM/Contents/Info.plist palera1n-macos.dSYM/Contents + lipo -create -arch arm64 palera1n-arm64.dSYM/Contents/Resources/DWARF/palera1n -arch x86_64 palera1n-x86_64.dSYM/Contents/Resources/DWARF/palera1n -output palera1n-macos.dSYM/Contents/Resources/DWARF/palera1n-macos + $(STRIP) palera1n-macos + codesign -s - --force palera1n-macos distclean: clean - rm -f palera1n-* + rm -rf palera1n-* palera1n*.dSYM .PHONY: all palera1n clean diff --git a/src/Makefile b/src/Makefile index c54b73f..71b3507 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,6 +25,6 @@ palera1n: $(OBJECTS) $(CC) $(OBJECTS) $(CFLAGS) $(LDFLAGS) -o palera1n clean: - rm -f *.o palera1n checkra1n + rm -rf *.o palera1n checkra1n palera1n.dSYM .PHONY: all clean