Skip to content

Commit 0eb6d57

Browse files
committed
Fix ABI compatibility tool on macOS
1 parent d7c14b6 commit 0eb6d57

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ cert.pem:
6969
./gen-certs.sh
7070

7171
clean:
72-
rm -f test test_split test_proxy server_fuzzer *.pem *.0 *.o *.1 *.srl httplib.h httplib.cc
72+
rm -rf test test_split test_proxy server_fuzzer *.pem *.0 *.o *.1 *.srl httplib.h httplib.cc _build*
7373

test/check-shared-library-abi-compatibility.sh

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bash
2-
CURRENT_COMMIT=$(git rev-parse HEAD)
3-
PREVIOUS_VERSION=$(git describe --tags --abbrev=0 $CURRENT_COMMIT)
4-
2+
PREVIOUS_VERSION=$(git describe --tags --abbrev=0 master)
53
BUILD_DIR=_build_for_is_abi_compatible
64

75
# Make the build directory
@@ -29,6 +27,7 @@ cd ..
2927

3028
# Build the nearest vesion
3129
cd old
30+
3231
cmake \
3332
-DCMAKE_BUILD_TYPE=Debug \
3433
-DCMAKE_CXX_FLAGS="-g -Og" \
@@ -37,22 +36,25 @@ cmake \
3736
-DCMAKE_INSTALL_PREFIX=./out \
3837
../../.. > /dev/null
3938

39+
git stash -q
4040
git checkout -q "${PREVIOUS_VERSION}"
4141
cmake --build . --target install > /dev/null
4242
cmake --build . --target clean > /dev/null
4343

4444
cd ..
4545

4646
# Checkout the original commit
47-
if [ "$CURRENT_COMMIT" = "$(git rev-parse master)" ]; then
48-
git checkout -q master
49-
else
50-
git checkout -q "${CURRENT_COMMIT}"
51-
fi
47+
git checkout -q master
48+
git stash pop -q
5249

5350
# ABI compatibility check
54-
../check-abi-compatibility.sh ./old/out/lib/libcpp-httplib.so ./new/out/lib/libcpp-httplib.so
55-
56-
# Clean the build directory
57-
cd ..
58-
rm -rf $BUILD_DIR
51+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
52+
../check-abi-compatibility.sh ./old/out/lib/libcpp-httplib.so ./new/out/lib/libcpp-httplib.so
53+
exit $?
54+
elif [[ "$OSTYPE" == "darwin"* ]]; then
55+
../check-abi-compatibility.sh ./old/out/lib/libcpp-httplib.dylib ./new/out/lib/libcpp-httplib.dylib
56+
exit $?
57+
else
58+
echo "Unknown OS..."
59+
exit 1
60+
fi

0 commit comments

Comments
 (0)