Skip to content

Commit

Permalink
wf
Browse files Browse the repository at this point in the history
  • Loading branch information
userdocs committed Feb 1, 2025
1 parent f6fa79a commit f0ac71a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
name: ${{ matrix.name }}-${{ matrix.arch }}-win${{ matrix.filename }}.zip

env:
cygwin_path: ""
cygwin_path: "cygwin"
source_branch: ${{ inputs.source_branch }}
source_repo: ${{ inputs.source_repo }}

Expand All @@ -61,7 +61,7 @@ jobs:

- name: Build static

run: .\cygwin\bin\bash.exe -l ci-windows-cygwin-build.sh "${{ matrix.openssl }}" "${{ env.cygwin_path }}" "${source_repo}" "${source_branch}"
run: .\cygwin\bin\bash.exe -l ci-windows-cygwin-build.sh "${{ matrix.openssl }}" "$env:cygwin_path" "$env:source_repo" "$env:source_branch"

- name: VirusTotal Scan
id: virustotal
Expand Down
22 changes: 11 additions & 11 deletions ci-linux-crossbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Example - to cross-compile iperf3 for aarch64-linux-musl save the script in ~/iperf3 then use the following command:
#
# docker run -it -w /root -v ~/iperf3:/root ghcr.io/userdocs/qbt-musl-cross-make:aarch64-linux-musl /bin/bash crossbuild.sh
# docker run -it -w /home/gh -v ~/iperf3:/home/gh ghcr.io/userdocs/qbt-musl-cross-make:aarch64-linux-musl /bin/bash crossbuild.sh

github_repo="${1:-"https://github.com/esnet/iperf.git"}"
github_branch="${2:-"master"}"
Expand All @@ -14,27 +14,27 @@ arch="${4:-x86_64}"
printf '\n%s\n' "Building iperf3 for $crossbuild_target"
printf '%s\n\n' "repo: $github_repo branch:$github_branch"

apk update
sudo apk update

CXXFLAGS="--static -static -I/root/local/include"
LDFLAGS="--static -static -L/root/local/lib"
CXXFLAGS="--static -static -I/home/gh/local/include"
LDFLAGS="--static -static -L/home/gh/local/lib"

cd || exit
mkdir -p /root/local
mkdir -p /home/gh/local

repo="$(cat /etc/apk/repositories | sed -rn 's|https://dl-cdn.alpinelinux.org/alpine/(.*)/(.*)|\1|p' | head -1)"
openssl_libs_static="$(apk info openssl-libs-static | head -1 | awk '{ print $1 }')"
openssl_dev="$(apk info openssl-dev | head -1 | awk '{ print $1 }')"

curl -sLO "https://dl-cdn.alpinelinux.org/alpine/${repo}/main/${arch}/${openssl_dev}.apk"
curl -sLO "https://dl-cdn.alpinelinux.org/alpine/${repo}/main/${arch}/${openssl_libs_static}.apk"
tar -xzf "${openssl_dev}.apk" --strip-components=1 -C /root/local
tar -xzf "${openssl_libs_static}.apk" --strip-components=1 -C /root/local
tar -xzf "${openssl_dev}.apk" --strip-components=1 -C /home/gh/local
tar -xzf "${openssl_libs_static}.apk" --strip-components=1 -C /home/gh/local

rm -rf /root/iperf3
git clone --no-tags --single-branch --branch "${github_branch}" --shallow-submodules --recurse-submodules -j"$(nproc)" --depth 1 "${github_repo}" /root/iperf3
cd /root/iperf3 || exit
rm -rf /home/gh/iperf3
git clone --no-tags --single-branch --branch "${github_branch}" --shallow-submodules --recurse-submodules -j"$(nproc)" --depth 1 "${github_repo}" /home/gh/iperf3
cd /home/gh/iperf3 || exit

./configure --with-openssl="/root/local" --disable-shared --enable-static-bin --prefix="/root/local"
./configure --with-openssl="/home/gh/local" --disable-shared --enable-static-bin --prefix="/home/gh/local"
make -j$(nproc)
make install
18 changes: 15 additions & 3 deletions ci-windows-cygwin-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@

HOME="$(pwd)"
with_openssl="${1:-no}"
cygwin_path="${2:-${HOME}}/cygwin"
if [[ "${2}" =~ ^/ ]]; then
cygwin_path="${2}"
else
cygwin_path="${HOME}/${2:-cygwin}"
fi
source_repo="${3:-https://github.com/esnet/iperf.git}"
source_branch="${4:-master}"

printf '\n%b\n' " \e[93m\U25cf\e[0m With openssl = ${with_openssl}"
printf '%b\n' " \e[93m\U25cf\e[0m Build path = ${HOME}"
printf '%b\n' " \e[93m\U25cf\e[0m Cygwin path = ${cygwin_path}"

printf '\n%b\n' " \e[93m\U25cf\e[0m parameters = ${*}"

printf '\n%b\n' " \e[93m\U25cf\e[0m with_openssl = ${with_openssl}"
printf '\n%b\n' " \e[93m\U25cf\e[0m cygwin_path = ${cygwin_path}"
printf '\n%b\n' " \e[93m\U25cf\e[0m source_repo = ${source_repo}"
printf '\n%b\n' " \e[93m\U25cf\e[0m source_branch = ${source_branch}"

if [[ "${with_openssl}" == 'yes' ]]; then
printf '\n%b\n' " \e[94m\U25cf\e[0m Downloading zlib"
curl -sLO "https://github.com/userdocs/qbt-workflow-files/releases/latest/download/zlib.tar.xz"

openssl_version="$(git ls-remote -q -t --refs "https://github.com/openssl/openssl.git" | awk '/openssl-3\.0\./{sub("refs/tags/", "");sub("(.*)(v6|rc|alpha|beta)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n1)"
openssl_version="$(git ls-remote -q -t --refs "https://github.com/openssl/openssl.git" | awk '/openssl-3\.1\./{sub("refs/tags/", "");sub("(.*)(v6|rc|alpha|beta)(.*)", ""); print $2 }' | awk '!/^$/' | sort -rV | head -n1)"

printf '\n%b\n' " \e[94m\U25cf\e[0m Downloading openssl ${openssl_version}"
curl -sLO "https://github.com/openssl/openssl/releases/download/${openssl_version}/${openssl_version}.tar.gz"
Expand All @@ -38,7 +49,7 @@ if [[ "${with_openssl}" == 'yes' ]]; then

printf '\n%b\n\n' " \e[94m\U25cf\e[0m Configuring openssl"
pushd "${HOME}/openssl" || exit 1
./config --prefix="${cygwin_path}" threads no-shared no-dso no-comp
./config --prefix="${cygwin_path}" --libdir=lib threads no-shared no-dso no-comp

printf '\n%b\n\n' " \e[94m\U25cf\e[0m Building openssl"
make -j"$(nproc)"
Expand All @@ -50,6 +61,7 @@ fi
printf '\n%b\n\n' " \e[94m\U25cf\e[0m Cloning iperf3 git repo"

[[ -d "$HOME/iperf3_build" ]] && rm -rf "$HOME/iperf3_build"
printf '\n%b\n\n' " \e[94m\U25cf\e[0m git clone --no-tags --single-branch --branch ${source_branch} --shallow-submodules --recurse-submodules -j$(nproc) --depth 1 ${source_repo} $HOME/iperf3_build"
git clone --no-tags --single-branch --branch "${source_branch}" --shallow-submodules --recurse-submodules -j"$(nproc)" --depth 1 "${source_repo}" "$HOME/iperf3_build"
cd "$HOME/iperf3_build" || exit 1

Expand Down

0 comments on commit f0ac71a

Please sign in to comment.