build static FreeBSD binaries for release

This commit is contained in:
acetone
2026-10-03 02:51:57 -04:00
parent a2c38f86e6
commit 4bf05e2e35
3 changed files with 54 additions and 14 deletions
+17 -13
View File
@@ -14,16 +14,16 @@ on:
- libi2pd_client/**
- Makefile
- Makefile.bsd
tags:
- '*'
- contrib/static/build-freebsd.sh
pull_request:
branches:
- '*'
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
name: FreeBSD ${{ matrix.release }} with UPnP
name: FreeBSD ${{ matrix.release }} static
strategy:
fail-fast: false
@@ -34,27 +34,31 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
- name: Build in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
release: ${{ matrix.release }}
usesh: true
mem: 2048
mem: 4096
sync: rsync
copyback: true
prepare: |
sed -i '' 's|/quarterly"|/latest"|' /etc/pkg/FreeBSD.conf
pkg update -f
pkg install -y devel/cmake devel/gmake devel/boost-libs security/openssl35 net/miniupnpc
pkg install -y devel/cmake devel/gmake perl5 devel/boost-libs net/miniupnpc
run: |
set -e
cd build
cmake -DWITH_UPNP=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local .
gmake -j2
./i2pd --version
./i2pd --version | grep -E '^OpenSSL (3\.([5-9]|[1-9][0-9])|[4-9])\.'
./i2pd --version | grep -E '^Boost version 1\.(8[1-9]|9[0-9])\.'
sh contrib/static/build-freebsd.sh
file build/i2pd | grep 'statically linked'
build/i2pd --version
build/i2pd --version | grep -E '^OpenSSL (3\.([5-9]|[1-9][0-9])|[4-9])\.'
build/i2pd --version | grep -E '^Boost version 1\.(8[1-9]|9[0-9])\.'
mkdir /tmp/datadir
build/i2pd --datadir=/tmp/datadir --log=file --logfile=/tmp/datadir/i2pd.log --loglevel=info &
sleep 15
kill -0 $!
grep 'Daemon: Starting NetDB' /tmp/datadir/i2pd.log
kill -9 $!
- name: Upload artifacts
uses: actions/upload-artifact@v4
+9 -1
View File
@@ -18,9 +18,12 @@ jobs:
debian:
uses: ./.github/workflows/build-deb.yml
freebsd:
uses: ./.github/workflows/build-freebsd.yml
release:
name: Draft release
needs: [windows, macos, linux, debian]
needs: [windows, macos, linux, debian, freebsd]
runs-on: ubuntu-latest
permissions:
contents: write
@@ -49,6 +52,11 @@ jobs:
done
chmod +x artifacts/i2pd-macos/i2pd
tar -czf release/i2pd_${TAG}_osx.tar.gz -C artifacts/i2pd-macos i2pd
for dir in artifacts/i2pd-freebsd-*; do
chmod +x $dir/i2pd
rel=${dir##*-}
tar -czf release/i2pd_${TAG}_freebsd${rel%%.*}_amd64.tar.gz -C $dir i2pd
done
cp artifacts/i2pd-linux-all/* release/
cp artifacts/i2pd_trixie_*/i2pd_*.deb release/
cd release
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
# Fully static i2pd for FreeBSD, run from the source tree with the cmake, gmake, perl5, boost-libs and miniupnpc packages
set -e
OPENSSL_VERSION=3.5.8
JOBS=4
SRC=$(pwd)
WORK=${TMPDIR:-/tmp}/i2pd-freebsd
mkdir -p "$WORK"
cd "$WORK"
OPENSSL=openssl-$OPENSSL_VERSION
fetch -q https://github.com/openssl/openssl/releases/download/$OPENSSL/$OPENSSL.tar.gz
fetch -q https://github.com/openssl/openssl/releases/download/$OPENSSL/$OPENSSL.tar.gz.sha256
[ "$(sha256 -q $OPENSSL.tar.gz)" = "$(cut -d' ' -f1 $OPENSSL.tar.gz.sha256)" ]
tar xzf $OPENSSL.tar.gz
cd $OPENSSL
# no-autoload-config: a static binary must not read the host's openssl.cnf
./Configure --prefix="$WORK/openssl" --libdir=lib --openssldir=/nonexistent \
no-autoload-config no-shared no-module no-dso no-engine no-tests no-docs
gmake -j$JOBS build_libs
gmake install_dev
cd "$SRC/build"
cmake -DWITH_STATIC=ON -DWITH_UPNP=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$WORK/openssl" .
gmake -j$JOBS
strip i2pd