diff --git a/.github/actions/build-native-binary/action.yaml b/.github/actions/build-native-binary/action.yaml index cd8e185..e1ae26c 100644 --- a/.github/actions/build-native-binary/action.yaml +++ b/.github/actions/build-native-binary/action.yaml @@ -68,7 +68,19 @@ runs: -DSUA_MEASURE_CODE_COVERAGE=NO \ .. make -j - make install + make install/strip + shell: bash + + - name: Strip binaries for amd64 + if: ${{ inputs.arch == 'amd64' }} + run: | + strip dist_${{ inputs.arch }}/lib/lib* + shell: bash + + - name: Strip binaries for arm64 + if: ${{ inputs.arch == 'arm64' }} + run: | + aarch64-linux-gnu-strip dist_${{ inputs.arch }}/lib/lib* shell: bash - name: Build for amd64 with code-coverage enabled diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index af10d74..0653360 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -51,7 +51,16 @@ RUN cd /work \ RUN cd /work \ && cd build_amd64 \ - && make install + && make install/strip + +RUN cd /work \ + && strip dist_amd64/lib/lib* \ + && strip /work/build_amd64/glib/gio/libgio-2.0.so.0 \ + && strip /work/build_amd64/glib/gobject/libgobject-2.0.so.0 \ + && strip /work/build_amd64/glib/glib/libglib-2.0.so.0 \ + && strip /work/build_amd64/glib/gmodule/libgmodule-2.0.so.0 \ + && strip /work/build_amd64/glib/subprojects/libffi/src/libffi.so.7 \ + && strip /work/build_amd64/glib/subprojects/zlib-1.2.11/libz.so #Define RUNTIME environment, the final image FROM --platform=${TARGETPLATFORM} scratch as runtime diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index cadf3fe..ca843cd 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -51,7 +51,16 @@ RUN cd /work \ RUN cd /work \ && cd build_arm64 \ - && make install + && make install/strip + +RUN cd /work \ + && aarch64-linux-gnu-strip dist_arm64/lib/lib* \ + && aarch64-linux-gnu-strip /work/build_arm64/glib/gio/libgio-2.0.so.0 \ + && aarch64-linux-gnu-strip /work/build_arm64/glib/gobject/libgobject-2.0.so.0 \ + && aarch64-linux-gnu-strip /work/build_arm64/glib/glib/libglib-2.0.so.0 \ + && aarch64-linux-gnu-strip /work/build_arm64/glib/gmodule/libgmodule-2.0.so.0 \ + && aarch64-linux-gnu-strip /work/build_arm64/glib/subprojects/libffi/src/libffi.so.7 \ + && aarch64-linux-gnu-strip /work/build_arm64/glib/subprojects/zlib-1.2.11/libz.so #Define RUNTIME environment, the final image FROM --platform=${TARGETPLATFORM} scratch as runtime diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef8ba13..11819d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -41,7 +41,10 @@ list(FILTER SRCS EXCLUDE REGEX "main.cpp" ) list(APPEND SRCS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) add_library(sua SHARED ${SRCS}) +set_target_properties(sua PROPERTIES LINK_FLAGS -s) + add_executable(${PROJECT_NAME} ${SRCS} main.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS -s) link_directories(${CMAKE_BINARY_DIR}/3rdparty/curl/lib)