diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 2f3543c..f3fc2d8 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -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 }} @@ -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 diff --git a/ci-linux-crossbuild.sh b/ci-linux-crossbuild.sh index 3187f88..b6fecee 100644 --- a/ci-linux-crossbuild.sh +++ b/ci-linux-crossbuild.sh @@ -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"}" @@ -14,13 +14,13 @@ 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 }')" @@ -28,13 +28,13 @@ 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 diff --git a/ci-windows-cygwin-build.sh b/ci-windows-cygwin-build.sh index 7179447..e1ef993 100644 --- a/ci-windows-cygwin-build.sh +++ b/ci-windows-cygwin-build.sh @@ -2,7 +2,11 @@ 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}" @@ -10,11 +14,18 @@ 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" @@ -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)" @@ -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