From 2ed7c0da92b244ea1a15058851cc0cc0dc150da9 Mon Sep 17 00:00:00 2001 From: Vladislav Navrocky Date: Mon, 20 Jan 2025 15:59:43 +0300 Subject: [PATCH] Pack binary with upx --- .gitignore | 1 + Dockerfile.uclibc | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dd4d1df..35a00bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /dist +/build /CMakeLists.txt.user /CMakeUserPresets.json diff --git a/Dockerfile.uclibc b/Dockerfile.uclibc index f63e0e2..13671c5 100644 --- a/Dockerfile.uclibc +++ b/Dockerfile.uclibc @@ -2,9 +2,16 @@ FROM navrocky/buildroot-uclibc-toolchain:i686-2023.11.1 RUN set -x && \ apt-get update && \ - apt-get -y install cmake make python3-pip && \ + apt-get -y install --no-install-recommends cmake make python3-pip curl libmpc3 && \ pip install conan --break-system-packages +ENV UPX_VER=4.2.4 +RUN set -x && \ + curl -LO https://github.com/upx/upx/releases/download/v${UPX_VER}/upx-${UPX_VER}-amd64_linux.tar.xz && \ + xzdec upx-${UPX_VER}-amd64_linux.tar.xz | tar xf - && \ + install upx-${UPX_VER}-amd64_linux/upx /usr/bin/upx && \ + rm -rf upx-${UPX_VER}-amd64_linux upx-${UPX_VER}-amd64_linux.tar.xz + RUN conan profile detect --force && sed -i 's/x86_64/x86/g' ~/.conan2/profiles/default COPY conanfile.txt /sources/ @@ -19,4 +26,5 @@ COPY . /sources/ RUN set -x && \ cd /build && \ cmake /sources -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release && \ - cmake --build . + cmake --build . && \ + upx -9 --brute muenvsubst