From 39a64fb4e7e42216f14f0ec51ccc5fa85e651432 Mon Sep 17 00:00:00 2001 From: yhirose Date: Tue, 11 Feb 2025 18:10:27 -0500 Subject: [PATCH] Fix ABI compatibility tool on macOS --- .gitignore | 1 + test/Makefile | 2 +- .../check-shared-library-abi-compatibility.sh | 28 +++++++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 95c588784d..1ae8acf708 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ test/test.xcodeproj/*/xcuser* test/*.o test/*.pem test/*.srl +test/_build_* work/ benchmark/server* diff --git a/test/Makefile b/test/Makefile index 081feb97a2..152f9098ef 100644 --- a/test/Makefile +++ b/test/Makefile @@ -69,5 +69,5 @@ cert.pem: ./gen-certs.sh clean: - rm -f test test_split test_proxy server_fuzzer *.pem *.0 *.o *.1 *.srl httplib.h httplib.cc + rm -rf test test_split test_proxy server_fuzzer *.pem *.0 *.o *.1 *.srl httplib.h httplib.cc _build* diff --git a/test/check-shared-library-abi-compatibility.sh b/test/check-shared-library-abi-compatibility.sh index 08c403cb4d..18eb43f027 100755 --- a/test/check-shared-library-abi-compatibility.sh +++ b/test/check-shared-library-abi-compatibility.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash -CURRENT_COMMIT=$(git rev-parse HEAD) -PREVIOUS_VERSION=$(git describe --tags --abbrev=0 $CURRENT_COMMIT) - -BUILD_DIR=_build_for_is_abi_compatible +PREVIOUS_VERSION=$(git describe --tags --abbrev=0 master) +BUILD_DIR=_build_for_abi_compatibility_check # Make the build directory rm -rf $BUILD_DIR @@ -29,6 +27,7 @@ cd .. # Build the nearest vesion cd old + cmake \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_FLAGS="-g -Og" \ @@ -44,15 +43,16 @@ cmake --build . --target clean > /dev/null cd .. # Checkout the original commit -if [ "$CURRENT_COMMIT" = "$(git rev-parse master)" ]; then - git checkout -q master -else - git checkout -q "${CURRENT_COMMIT}" -fi +git checkout -q master # ABI compatibility check -../check-abi-compatibility.sh ./old/out/lib/libcpp-httplib.so ./new/out/lib/libcpp-httplib.so - -# Clean the build directory -cd .. -rm -rf $BUILD_DIR +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + ../check-abi-compatibility.sh ./old/out/lib/libcpp-httplib.so ./new/out/lib/libcpp-httplib.so + exit $? +elif [[ "$OSTYPE" == "darwin"* ]]; then + ../check-abi-compatibility.sh ./old/out/lib/libcpp-httplib.dylib ./new/out/lib/libcpp-httplib.dylib + exit $? +else + echo "Unknown OS..." + exit 1 +fi