From cf4bd76396c4c96840af25a068d36f113bb1d8ef Mon Sep 17 00:00:00 2001 From: Louis Gombert Date: Fri, 22 Nov 2024 18:58:18 +0100 Subject: [PATCH] Interpose: build as shared library again; patchelf in CI build --- .github/workflows/build.yml | 15 +++++++++++++-- interpose/CMakeLists.txt | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index adfd5d8..dfba677 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: gptokeyb2 Build on: workflow_dispatch: push: - branches: [ "*" ] + branches: [ "master" ] paths-ignore: - '**/README.md' pull_request: @@ -23,8 +23,10 @@ jobs: arch: - name: arm64 cross: aarch64-linux-gnu + executable: - name: armhf cross: arm-linux-gnueabihf + executable: armhf steps: - name: Install ${{ matrix.arch.name }} dependencies @@ -42,10 +44,19 @@ jobs: mkdir build && cd build cmake ../ -GNinja -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/debian-${{ matrix.arch.name }}-gcc-toolchain.cmake -DCMAKE_BUILD_TYPE=Release cmake --build . + + - name: Prepare export + run: | + patchelf --replace-needed libinterpose.so libinterpose.${{ matrix.arch.executable }}.so gptokeyb2 + patchelf --set-soname libinterpose.${{ matrix.arch.executable }}.so lib/libinterpose.so + mv lib/libinterpose.so libinterpose.${{ matrix.arch.executable }}.so /usr/${{ matrix.arch.cross }}/bin/strip gptokeyb2 + mv gptokeyb2 gptokeyb2.${{ matrix.arch.executable }} - name: Upload Artifacts uses: actions/upload-artifact@v4 with: name: gptokeyb2_${{ matrix.arch.name }} - path: ${{ github.workspace }}/build/gptokeyb2 + path: | + ${{ github.workspace }}/build/gptokeyb2.${{ matrix.arch.executable }} + ${{ github.workspace }}/build/libinterpose.${{ matrix.arch.executable }} diff --git a/interpose/CMakeLists.txt b/interpose/CMakeLists.txt index 1dd88d0..9c0c18c 100644 --- a/interpose/CMakeLists.txt +++ b/interpose/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(interpose STATIC interpose.c interpose.h) +add_library(interpose SHARED interpose.c interpose.h) set_target_properties(interpose PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") # Link with pthread & dl