Skip to content

Commit

Permalink
Reduce executable file size
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed May 7, 2024
1 parent 9e107d2 commit a636b2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,28 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true

- name: Download NPCAP SDK
if: matrix.target == 'x86_64-windows-gnu'
run: |
wget https://npcap.com/dist/npcap-sdk-1.13.zip -O /tmp/sdk.zip
unzip /tmp/sdk.zip -d /tmp/sdk
mv /tmp/sdk/Lib /tmp/sdk/lib
mkdir -p /tmp/sdk/lib/x64
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib/x64
cp /tmp/sdk/Lib/x64/*lib /tmp/sdk/lib
- name: Build executable
run: |
sudo rm -rf /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc
cmake -B build -DCMAKE_BUILD_TYPE=Release -DZIG_TARGET=${{ matrix.target }} -DUSE_SYSTEM_PCAP=OFF ${{ matrix.cmake }}
cmake --build build -t pppwn
cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel -DZIG_TARGET=${{ matrix.target }} -DUSE_SYSTEM_PCAP=OFF ${{ matrix.cmake }}
cmake --build build -t pppwn -- -j$(nproc)
sudo apt-get install llvm --no-install-recommends
llvm-strip build/pppwn${{ matrix.ext }}
upx --lzma build/pppwn${{ matrix.ext }}
tar -czvf pppwn.tar.gz build/pppwn${{ matrix.ext }}
- name: Upload result
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

This is the C++ rewrite of [PPPwn](https://github.com/TheOfficialFloW/PPPwn), intended to run on small devices such as routers.

The failure rate in the first two stages is very high. I think it may be due to the different execution speeds between c++ and py.
The failure rate in the first two stages is very high. I think it may be due to the different execution speeds between c++ and python.
Therefore, some parameters need to be adjusted. So I decided to upload the code here first and wait for someone to improve it.
At the same time, I will continued to complete the other stages.

[nightly.link](https://nightly.link/xfangfang/PPPwn_cpp/workflows/ci.yaml/main?status=completed)

# Development

Expand Down
2 changes: 1 addition & 1 deletion cmake/zig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ message(STATUS "ZIG_TARGET: ${ZIG_TARGET}")
message(STATUS "OS: ${ZIG_TARGET_OS}")
message(STATUS "ARCH: ${ZIG_TARGET_ARCH}")

message(STATUS "CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT}")
if (ZIG_TARGET_OS STREQUAL "Darwin")
cmake_minimum_required(VERSION 3.14)
include(FetchContent)
message(STATUS "CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT}")
set(MACOS_SDK "${CMAKE_BINARY_DIR}/vendor/macos_sdk")
FetchContent_Populate(
vendor_macos_sdk
Expand Down

0 comments on commit a636b2b

Please sign in to comment.