Skip to content

Commit 233ef7e

Browse files
committed
no auto set os version in build.sh + bugfix
1 parent 06ce728 commit 233ef7e

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

.github/workflows/c-cpp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515

1616
- name: build macos libraries
17-
run: rm -rf build && ./build.sh -t macosx
17+
run: ./build.sh -t macosx -v 10.15
1818

1919
- name: upload build artifact
2020
uses: actions/upload-artifact@v4
@@ -27,7 +27,7 @@ jobs:
2727
compression-level: 9
2828

2929
- name: build ios libraries
30-
run: rm -rf build && ./build.sh -t iphoneos
30+
run: ./build.sh -t iphoneos -v 12.0
3131

3232
- name: upload build artifact
3333
uses: actions/upload-artifact@v4

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARCH ?= $(shell uname -m)
22
TARGET ?= macosx
33

4-
CFLAGS := -arch $(ARCH) -O3 -Wall -Wshadow
4+
CFLAGS := -arch $(ARCH) -Os -Wall -Wshadow
55
LDFLAGS := -flto=full -lobjc
66
ASFLAGS := -arch $(ARCH)
77

build.sh

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,31 @@ if (($#archs2build == 0)) {
4949
}
5050
}
5151

52-
if [[ $sysver == "" ]] {
53-
if [[ $target == macosx ]] {
54-
sysver=10.15
55-
} elif [[ $target == iphoneos ]] {
56-
sysver=12.0
57-
} else {
58-
echo "unknown target: $target!"
59-
exit 1
60-
}
61-
}
52+
local build_arg=(TARGET=$target)
6253

63-
local build_arg=(TARGET=$target MIN_OSVER=$sysver)
54+
if [[ $sysver != "" ]] {
55+
build_arg+=(MIN_OSVER=$sysver)
56+
}
6457

6558
if (($compact == 1)) {
6659
build_arg+=(COMPACT=1)
6760
}
6861

6962
for i ($archs2build) {
70-
mkdir -p build/$i
71-
make clean ARCH=$i && make all ARCH=$i $build_arg
72-
mv libtinyhook.a libtinyhook.dylib build/$i
63+
(set -x # print command before executing
64+
mkdir -p build/$i
65+
make clean ARCH=$i && make all ARCH=$i $build_arg
66+
cp libtinyhook.a libtinyhook.dylib build/$i
67+
)
7368
}
7469

7570
if (($#archs2build > 1)) {
76-
rm -rf build/universal
77-
mkdir -p build/universal
78-
lipo -create -o build/universal/libtinyhook.a build/*/libtinyhook.a
79-
lipo -create -o build/universal/libtinyhook.dylib build/*/libtinyhook.dylib
80-
cp build/universal/libtinyhook.a build/universal/libtinyhook.dylib .
71+
(set -x
72+
cd build
73+
mkdir -p universal
74+
rm -f universal/libtinyhook.a universal/libtinyhook.dylib
75+
lipo -create -o universal/libtinyhook.a ${archs2build/%//libtinyhook.a}
76+
lipo -create -o universal/libtinyhook.dylib ${archs2build/%//libtinyhook.dylib}
77+
cp universal/libtinyhook.a universal/libtinyhook.dylib ..
78+
)
8179
}

src/tinyhook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static inline void save_header(void **src, void **dst, int min_len) {
7878
insn = *(uint32_t *)*src;
7979
if (((insn ^ 0x90000000) & 0x9f000000) == 0) {
8080
// adrp
81-
// modify the immediate (len 4 -> 4)
81+
// modify the immediate (len: 4 -> 4)
8282
int64_t len = (insn >> 29 & 0x3) | ((insn >> 3) & 0x1ffffc);
8383
len += ((int64_t)*src >> 12) - ((int64_t)*dst >> 12);
8484
insn &= 0x9f00001f; // clean the immediate

0 commit comments

Comments
 (0)