From f9d11071e35ad872f198f9f60e9277b071ed7e2a Mon Sep 17 00:00:00 2001 From: Alberto Garcia Illera Date: Sun, 21 Jun 2020 20:10:22 -0700 Subject: [PATCH] strip symbols in OSX and Linux builds --- .github/workflows/ci-linux.yml | 6 +++--- .github/workflows/ci-macos.yml | 6 +++--- .github/workflows/ci-windows.yml | 6 +++--- CMakeLists.txt | 23 +++++++++++++++++++---- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 6bb15729..f7bc5cd0 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -166,7 +166,7 @@ jobs: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | cd my_artifacts - zip -r ../ponce-linux-$RELEASE_VERSION.zip * + zip -r ../ponce-$RELEASE_VERSION-linux.zip * - name: Upload Linux artifacts @@ -175,8 +175,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./ponce-linux-${{ steps.vars.outputs.tag }}.zip - asset_name: ponce-linux-${{ steps.vars.outputs.tag }}.zip + asset_path: ./ponce-${{ steps.vars.outputs.tag }}-linux.zip + asset_name: ponce-${{ steps.vars.outputs.tag }}-linux.zip asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index bd26d0b7..216986cd 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -155,7 +155,7 @@ jobs: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | cd my_artifacts - zip -r ../ponce-osx-$RELEASE_VERSION.zip * + zip -r ../ponce-$RELEASE_VERSION-osx.zip * - name: Upload OSX artifacts @@ -164,8 +164,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./ponce-osx-${{ steps.vars.outputs.tag }}.zip - asset_name: ponce-osx-${{ steps.vars.outputs.tag }}.zip + asset_path: ./ponce-${{ steps.vars.outputs.tag }}-osx.zip + asset_name: ponce-${{ steps.vars.outputs.tag }}-osx.zip asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 78df2feb..08b2656a 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -157,7 +157,7 @@ jobs: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | cd my_artifacts - zip -r ../ponce-win-$RELEASE_VERSION.zip * + zip -r ../ponce-$RELEASE_VERSION-win.zip * - name: Upload Windows artifacts @@ -166,8 +166,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./ponce-win-${{ steps.vars.outputs.tag }}.zip - asset_name: ponce-win-${{ steps.vars.outputs.tag }}.zip + asset_path: ./ponce-${{ steps.vars.outputs.tag }}-win.zip + asset_name: ponce-${{ steps.vars.outputs.tag }}-win.zip asset_content_type: application/zip \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e10c09d..205e2a45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,10 +31,6 @@ file(GLOB PONCE_HEADER_FILES add_library(${PROJECT_NAME} SHARED ${PONCE_SOURCE_FILES} ${PONCE_HEADER_FILES}) add_library(${PROJECT_NAME}64 SHARED ${PONCE_SOURCE_FILES} ${PONCE_HEADER_FILES}) -# Prevent creating ponce binaries as libPonce.so but do Ponce.so -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -SET_TARGET_PROPERTIES(${PROJECT_NAME}64 PROPERTIES PREFIX "") - # # # Look for dependencies # # # @@ -188,14 +184,33 @@ if(WIN32) elseif (APPLE) target_compile_definitions(${PROJECT_NAME} PRIVATE __MAC__ USE_DANGEROUS_FUNCTIONS USE_STANDARD_FILE_FUNCTIONS) target_compile_definitions(${PROJECT_NAME}64 PRIVATE __MAC__ USE_DANGEROUS_FUNCTIONS USE_STANDARD_FILE_FUNCTIONS) + # Prevent creating ponce binaries as libPonce.so but do Ponce.so + SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(${PROJECT_NAME}64 PROPERTIES PREFIX "") set(PLUGIN_EXTENSION dylib) elseif (UNIX AND NOT APPLE) target_compile_definitions(${PROJECT_NAME} PRIVATE __LINUX__ USE_DANGEROUS_FUNCTIONS) target_compile_definitions(${PROJECT_NAME}64 PRIVATE __LINUX__ USE_DANGEROUS_FUNCTIONS) + # Prevent creating ponce binaries as libPonce.so but do Ponce.so + SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(${PROJECT_NAME}64 PROPERTIES PREFIX "") set(PLUGIN_EXTENSION so) endif() +# Clean as much symbols as we can in OSX and Linux +if(NOT WIN32) + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE -s) + set_target_properties(${PROJECT_NAME}64 PROPERTIES LINK_FLAGS_RELEASE -s) + if(EXISTS "/usr/bin/strip") + # Strip binary for release builds + if (CMAKE_BUILD_TYPE STREQUAL Release) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND "/usr/bin/strip" -s ${PROJECT_NAME}) + endif () + endif() +endif() + if(IDA_INSTALLED_DIR) message(STATUS "[-] Ponce built plugin and pdb file will be moved to '${IDA_INSTALLED_DIR}/plugins/'. The build system should have permisions to write there or it will error.") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD