diff --git a/.github/workflows/build-strace.yml b/.github/workflows/build-strace.yml new file mode 100644 index 0000000..c5a426a --- /dev/null +++ b/.github/workflows/build-strace.yml @@ -0,0 +1,166 @@ +name: strace +on: + workflow_dispatch +jobs: + build-x86: + name: Build strace x86 + runs-on: ubuntu-latest + container: muslcc/x86_64:i686-linux-musl + outputs: + version: ${{ steps.build_strace.outputs.PACKAGED_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh x86 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + build-x86_64: + name: Build strace x86_64 + runs-on: ubuntu-latest + container: muslcc/x86_64:x86_64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh x86_64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + build-armhf: + name: Build strace ARMHF + runs-on: ubuntu-latest + container: muslcc/x86_64:arm-linux-musleabihf + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh armhf + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + build-aarch64: + name: Build strace AARCH64 + runs-on: ubuntu-latest + container: muslcc/x86_64:aarch64-linux-musl + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: sudo apk update && sudo apk add bash && sudo bash build/install_deps_alpine.sh + + - name: Install testing dependencies + run: apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing yodl + + - name: Install build compiler + run: /bin/sh -c "apk update && apk upgrade && apk add --no-cache curl rsync sudo util-linux && cd / && curl -so ${ARCH}-cross.tgz ${HOST}/${ARCH}-cross.tgz && tar -xf ${ARCH}-cross.tgz && rm ${ARCH}-cross.tgz && cd ${ARCH}-cross" + env: + ARCH: x86_64-linux-musl + HOST: http://musl.cc/ + TEMP: /tmp + USER: 0 + + - name: Build strace + id: build_strace + run: $GITHUB_WORKSPACE/build/targets/build_strace.sh aarch64 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.build_strace.outputs.PACKAGED_NAME }} + path: ${{ steps.build_strace.outputs.PACKAGED_NAME_PATH }} + + create-release: + name: Create strace Release + runs-on: ubuntu-latest + needs: [build-x86, build-x86_64, build-armhf, build-aarch64] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare Environment + run: mkdir /tmp/releases + + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + path: /tmp/releases + + - name: List Artifacts + run: ls -laR /tmp/releases + + - name: Tag Release + id: tag_release + run: | + set +e + if git rev-list "strace-v${{ needs.build-x86.outputs.version }}".. >/dev/null;then + echo "Tag for strace-v${{ needs.build-x86.outputs.version }} already exists. Skipping release creation." + echo "NEW_RELEASE=false" >> $GITHUB_OUTPUT + else + git tag "strace-v${{ needs.build-x86.outputs.version }}" + git push origin "strace-v${{ needs.build-x86.outputs.version }}" + echo "NEW_RELEASE=true" >> $GITHUB_OUTPUT + fi + + - name: Create Release + uses: ncipollo/release-action@v1 + if: ${{ steps.tag_release.outputs.NEW_RELEASE == 'true' }} + with: + name: strace-v${{ needs.build-x86.outputs.version }} + tag: strace-v${{ needs.build-x86.outputs.version }} + artifacts: "/tmp/releases/*/*" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index fff326a..5772046 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ The following table shows the building status for the current toolset. The follo | Tool | Status | | ---- | ------ | -|[Nmap](https://github.com/takeshixx/static-toolbox/actions?query=workflow%3A%22Nmap%22)|![Nmap](https://github.com/takeshixx/static-toolbox/workflows/Nmap/badge.svg)| -|[OpenSSH](https://github.com/takeshixx/static-toolbox/actions?query=workflow%3A%22OpenSSH%22)|![OpenSSH](https://github.com/takeshixx/static-toolbox/workflows/OpenSSH/badge.svg)| -|[socat](https://github.com/takeshixx/static-toolbox/actions?query=workflow%3A%22socat%22)|![socat](https://github.com/takeshixx/static-toolbox/workflows/socat/badge.svg)| -|[GDB & gdbserver](https://github.com/takeshixx/static-toolbox/actions?query=workflow%3AGDB)|![GDB & gdbserver](https://github.com/takeshixx/static-toolbox/workflows/GDB%20&%20gdbserver/badge.svg)| -|[tcpdump](https://github.com/takeshixx/static-toolbox/actions?query=workflow%3A%22tcpdump%22)|![tcpdump](https://github.com/takeshixx/static-toolbox/workflows/tcpdump/badge.svg)| - +|[Nmap](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22Nmap%22)|![Nmap](https://github.com/ernw/static-toolbox/workflows/Nmap/badge.svg)| +|[OpenSSH](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22OpenSSH%22)|![OpenSSH](https://github.com/ernw/static-toolbox/workflows/OpenSSH/badge.svg)| +|[socat](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22socat%22)|![socat](https://github.com/ernw/static-toolbox/workflows/socat/badge.svg)| +|[GDB & gdbserver](https://github.com/ernw/static-toolbox/actions?query=workflow%3AGDB)|![GDB & gdbserver](https://github.com/ernw/static-toolbox/workflows/GDB%20&%20gdbserver/badge.svg)| +|[tcpdump](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22tcpdump%22)|![tcpdump](https://github.com/ernw/static-toolbox/workflows/tcpdump/badge.svg)| +|[strace](https://github.com/ernw/static-toolbox/actions?query=workflow%3A%22strace%22)|![strace](https://github.com/ernw/static-toolbox/workflows/strace/badge.svg)| diff --git a/build/targets/build_strace.sh b/build/targets/build_strace.sh index 39eb5a6..b87db5c 100755 --- a/build/targets/build_strace.sh +++ b/build/targets/build_strace.sh @@ -10,34 +10,39 @@ fi source $GITHUB_WORKSPACE/build/lib.sh init_lib "$1" +VERSION="v6.3" + build_strace() { fetch "https://github.com/strace/strace" "${BUILD_DIRECTORY}/strace" git cd "${BUILD_DIRECTORY}/strace" git clean -fdx - git checkout v5.7 + git checkout "$VERSION" ./bootstrap CMD="CFLAGS=\"${GCC_OPTS}\" " CMD+="CXXFLAGS=\"${GXX_OPTS}\" " CMD+="LDFLAGS=\"-static -pthread\" " - if [ "$CURRENT_ARCH" != "x86" ] && [ "$CURRENT_ARCH" != "x86_64" ];then - CMD+="CC_FOR_BUILD=\"/i686-linux-musl-cross/bin/i686-linux-musl-gcc\" " - CMD+="CPP_FOR_BUILD=\"/i686-linux-musl-cross/bin/i686-linux-musl-g++\" " + if [ "$CURRENT_ARCH" != "x86_64" ];then + CMD+="CC_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc\" " + CMD+="CPP_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++ -E\" " + CMD+="CXX_FOR_BUILD=\"/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++\" " fi - CMD+="./configure --host=i486-linux-musl --target=$(get_host_triple)" + CMD+="./configure --disable-mpers --host=$(get_host_triple)" eval "$CMD" make CFLAGS="-w" -j4 - strip strace + strip "${BUILD_DIRECTORY}/strace/src/strace" } main() { build_strace local version - version=$(get_version "${BUILD_DIRECTORY}/strace/strace --version 2>&1 | head -n1 | awk '{print \$4}'") - cp "${BUILD_DIRECTORY}/strace/strace" "${OUTPUT_DIRECTORY}/strace" + version=$(get_version "${BUILD_DIRECTORY}/strace/src/strace -V 2>&1 | head -n1 | awk '{print \$4}'") + version_number=$(echo "$version" | cut -d"-" -f2) + cp "${BUILD_DIRECTORY}/strace/src/strace" "${OUTPUT_DIRECTORY}/strace${version}" echo "[+] Finished building strace ${CURRENT_ARCH}" echo "PACKAGED_NAME=strace${version}" >> $GITHUB_OUTPUT echo "PACKAGED_NAME_PATH=${OUTPUT_DIRECTORY}/*" >> $GITHUB_OUTPUT + echo "PACKAGED_VERSION=${version_number}" >> $GITHUB_OUTPUT } main