diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a332c92..3ed62fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,9 +91,12 @@ jobs: - target: aarch64-unknown-linux-gnu arch: arm64 linker: aarch64-linux-gnu-gcc + rustflags: '["-C", "target-feature=+crt-static"]' - target: armv7-unknown-linux-gnueabihf arch: armhf - linker: arm-linux-gnueabihf-gcc + linker: '/opt/rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc' + rustflags: '["-C", "target-feature=+crt-static"]' + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -121,6 +124,10 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install -y --no-install-recommends debhelper-compat rustup gcc-arm-linux-gnueabihf libc6-dev-armhf-cross pkg-config + mkdir -p /opt + # Download and extract Raspberry Pi cross-compilation tools + git clone https://github.com/raspberrypi/tools /opt/rpi_tools + rustup target add ${{ matrix.target }} rustup -q update - name: Install cross-compilation dependencies (for ARM64) @@ -128,6 +135,7 @@ jobs: run: | sudo apt-get update -qq sudo apt-get install -y --no-install-recommends debhelper-compat rustup gcc-aarch64-linux-gnu libc6-dev-arm64-cross pkg-config + rustup target add ${{ matrix.target }} rustup -q update - name: Configure linker for cross-compilation (for ARM) @@ -136,6 +144,7 @@ jobs: mkdir -p .cargo echo '[target.${{ matrix.target }}]' > .cargo/config.toml echo 'linker = "${{ matrix.linker }}"' >> .cargo/config.toml + echo 'rustflags = ${{ matrix.rustflags }}' >> .cargo/config.toml echo "Configured .cargo/config.toml for ${{ matrix.target }}:" cat .cargo/config.toml @@ -146,6 +155,11 @@ jobs: - name: Build Debian package for armhf if: matrix.arch == 'armhf' env: + # Set target for cross-compilation + CARGO_BUILD_TARGET: ${{ matrix.target }} + # For armhf specifically, ensure we use the right target features + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: 'arm-linux-gnueabihf-gcc' + # PKG_CONFIG settings for cross-compilation PKG_CONFIG_ALLOW_CROSS: 1 PKG_CONFIG_PATH: '/usr/lib/arm-linux-gnueabihf/pkgconfig' run: dpkg-buildpackage -b -d -uc -us --host-arch ${{ matrix.arch }} @@ -153,6 +167,11 @@ jobs: - name: Build Debian package for arm64 if: matrix.arch == 'arm64' env: + # Set target for cross-compilation + CARGO_BUILD_TARGET: ${{ matrix.target }} + # For armhf specifically, ensure we use the right target features + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: 'aarch64-linux-gnu-gcc' + # PKG_CONFIG settings for cross-compilation PKG_CONFIG_ALLOW_CROSS: 1 PKG_CONFIG_PATH: '/usr/lib/aarch64-linux-gnu/pkgconfig' run: dpkg-buildpackage -b -d -uc -us --host-arch ${{ matrix.arch }} diff --git a/.gitignore b/.gitignore index d336e7a..bec7717 100644 --- a/.gitignore +++ b/.gitignore @@ -24,9 +24,6 @@ target/ .vscode/ # Debian -debhelper-build-stamp -.DS_Store -.debhelper *.deb *.dsc *.build @@ -38,3 +35,6 @@ debhelper-build-stamp .vagrant debian/rusty-socks debian/files +debian/debhelper-build-stamp +debian/.debhelper +debian/rusty-socks.postrm.debhelper diff --git a/debian/.debhelper/generated/rusty-socks/dh_installchangelogs.dch.trimmed b/debian/.debhelper/generated/rusty-socks/dh_installchangelogs.dch.trimmed deleted file mode 100644 index 2cbd778..0000000 --- a/debian/.debhelper/generated/rusty-socks/dh_installchangelogs.dch.trimmed +++ /dev/null @@ -1,12 +0,0 @@ -rusty-socks (0.1.0-1) unstable; urgency=medium - - * Initial release of Rusty SOCKS proxy server - * Full SOCKS5 protocol implementation with authentication support - * HTTP proxy functionality with CONNECT method - * Multi-threaded async architecture using tokio - * YAML configuration system with validation - * Systemd service integration - * Comprehensive security features and logging - * Debian packaging and Arch AUR support - - -- Quintus Leung Tue, 27 May 2025 12:00:00 +0000 diff --git a/debian/.debhelper/generated/rusty-socks/installed-by-dh_installdocs b/debian/.debhelper/generated/rusty-socks/installed-by-dh_installdocs deleted file mode 100644 index e69de29..0000000 diff --git a/debian/.debhelper/generated/rusty-socks/postinst.service b/debian/.debhelper/generated/rusty-socks/postinst.service deleted file mode 100644 index 5f49976..0000000 --- a/debian/.debhelper/generated/rusty-socks/postinst.service +++ /dev/null @@ -1,30 +0,0 @@ -# Automatically added by dh_installsystemd/13.11.4 -if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then - # The following line should be removed in trixie or trixie+1 - deb-systemd-helper unmask 'rusty-socks.service' >/dev/null || true - - # was-enabled defaults to true, so new installations run enable. - if deb-systemd-helper --quiet was-enabled 'rusty-socks.service'; then - # Enables the unit on first installation, creates new - # symlinks on upgrades if the unit file has changed. - deb-systemd-helper enable 'rusty-socks.service' >/dev/null || true - else - # Update the statefile to add new symlinks (if any), which need to be - # cleaned up on purge. Also remove old symlinks. - deb-systemd-helper update-state 'rusty-socks.service' >/dev/null || true - fi -fi -# End automatically added section -# Automatically added by dh_installsystemd/13.11.4 -if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then - if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - if [ -n "$2" ]; then - _dh_action=restart - else - _dh_action=start - fi - deb-systemd-invoke $_dh_action 'rusty-socks.service' >/dev/null || true - fi -fi -# End automatically added section diff --git a/debian/.debhelper/generated/rusty-socks/prerm.service b/debian/.debhelper/generated/rusty-socks/prerm.service deleted file mode 100644 index aec5138..0000000 --- a/debian/.debhelper/generated/rusty-socks/prerm.service +++ /dev/null @@ -1,5 +0,0 @@ -# Automatically added by dh_installsystemd/13.11.4 -if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then - deb-systemd-invoke stop 'rusty-socks.service' >/dev/null || true -fi -# End automatically added section diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp deleted file mode 100644 index 9c7a001..0000000 --- a/debian/debhelper-build-stamp +++ /dev/null @@ -1 +0,0 @@ -rusty-socks diff --git a/debian/files b/debian/files deleted file mode 100644 index 425032d..0000000 --- a/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -rusty-socks_0.1.0-1_amd64.buildinfo net optional -rusty-socks_0.1.0-1_amd64.deb net optional diff --git a/debian/rules b/debian/rules index 8ab3ce1..66dd5c4 100755 --- a/debian/rules +++ b/debian/rules @@ -4,10 +4,18 @@ dh $@ override_dh_auto_build: +ifdef CARGO_BUILD_TARGET + cargo build --release --target $(CARGO_BUILD_TARGET) +else cargo build --release +endif override_dh_auto_install: +ifdef CARGO_BUILD_TARGET + install -D -m755 target/$(CARGO_BUILD_TARGET)/release/rusty-socks debian/rusty-socks/usr/bin/rusty-socks +else install -D -m755 target/release/rusty-socks debian/rusty-socks/usr/bin/rusty-socks +endif install -D -m644 config/rusty-socks.service debian/rusty-socks/lib/systemd/system/rusty-socks.service install -D -m644 config/rusty-socks.sysusers.conf debian/rusty-socks/usr/lib/sysusers.d/rusty-socks.conf install -D -m640 config/config.yml.journald.example debian/rusty-socks/etc/rusty-socks/config.yml diff --git a/debian/rusty-socks.postrm.debhelper b/debian/rusty-socks.postrm.debhelper deleted file mode 100644 index 2120d35..0000000 --- a/debian/rusty-socks.postrm.debhelper +++ /dev/null @@ -1,12 +0,0 @@ -# Automatically added by dh_installsystemd/13.11.4 -if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then - systemctl --system daemon-reload >/dev/null || true -fi -# End automatically added section -# Automatically added by dh_installsystemd/13.11.4 -if [ "$1" = "purge" ]; then - if [ -x "/usr/bin/deb-systemd-helper" ]; then - deb-systemd-helper purge 'rusty-socks.service' >/dev/null || true - fi -fi -# End automatically added section diff --git a/debian/rusty-socks.substvars b/debian/rusty-socks.substvars deleted file mode 100644 index e33517b..0000000 --- a/debian/rusty-socks.substvars +++ /dev/null @@ -1,3 +0,0 @@ -shlibs:Depends=libc6 (>= 2.34), libgcc-s1 (>= 4.2) -misc:Depends= -misc:Pre-Depends=