Repository navigation
build: build the vendored Capstone from the autotools build #316
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| jobs: | |
| test-callgrind: | |
| strategy: | |
| matrix: | |
| runner: | |
| - platform: ubuntu-22.04 | |
| ubuntu-version: 22.04 | |
| - platform: ubuntu-24.04 | |
| ubuntu-version: 24.04 | |
| runs-on: ${{ matrix.runner.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Skip installing package docs to avoid wasting time when installing valgrind | |
| # See: https://github.com/actions/runner-images/issues/10977#issuecomment-2810713336 | |
| - name: Skip installing package docs | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo tee /etc/dpkg/dpkg.cfg.d/01_nodoc > /dev/null << 'EOF' | |
| path-exclude /usr/share/doc/* | |
| path-exclude /usr/share/man/* | |
| path-exclude /usr/share/info/* | |
| EOF | |
| - name: Update apt-get cache | |
| run: sudo apt-get update | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| automake \ | |
| autoconf \ | |
| libc6-dev \ | |
| gdb \ | |
| docbook \ | |
| docbook-xsl \ | |
| docbook-xml \ | |
| xsltproc | |
| - name: Run autogen | |
| run: ./autogen.sh | |
| # CodSpeed only runs the 64-bit tool, and cycle estimation needs a | |
| # 64-bit Capstone, so skip the 32-bit secondary build entirely. This | |
| # halves build time and avoids compiling cycledecode.c without Capstone. | |
| - name: Configure | |
| run: ./configure --enable-only64bit | |
| - name: Build Valgrind | |
| run: make -j$(nproc) | |
| - name: TEMP fingerprint of the build | |
| run: | | |
| echo "nproc=$(nproc) cpu=$(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2-)" | |
| sha256sum callgrind/callgrind-amd64-linux third_party/libcapstone.a | |
| ls -l third_party/libcapstone.a callgrind/callgrind-amd64-linux | |
| # The vendored build must not write anything into the submodule checkout. | |
| - name: Check the Capstone submodule is clean | |
| run: test -z "$(git -C third_party/capstone status --porcelain --untracked-files=all)" | |
| - name: Build test dependencies | |
| run: | | |
| make -C tests arch_test os_test true | |
| make -C callgrind/tests check | |
| - name: TEMP fingerprint of the test binary | |
| run: sha256sum callgrind/tests/inline-crossfile | |
| - name: Run Callgrind tests | |
| run: | | |
| cd callgrind/tests | |
| TESTS=$(ls *.vgtest | grep -v bug497723.vgtest) | |
| perl ../../tests/vg_regtest --valgrind=../../vg-in-place $TESTS | |
| - name: Upload test logs | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: callgrind-test-logs-${{ matrix.runner.ubuntu-version }} | |
| path: callgrind/tests/*.log | |
| # `make` builds the vendored submodule; this guards the other supported path, | |
| # --with-capstone=PATH, which debian/rules forwards CAPSTONE_DIR to. | |
| build-with-prebuilt-capstone: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Update apt-get cache | |
| run: sudo apt-get update | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| automake \ | |
| autoconf \ | |
| cmake \ | |
| libc6-dev | |
| # Not the distribution's libcapstone-dev: a Valgrind tool links | |
| # -nodefaultlibs and runs without glibc's %fs TLS, so the decoder has to | |
| # be built without stack-protector and without fortify, which no distro | |
| # package is. | |
| - name: Build Capstone outside the source tree | |
| run: | | |
| cmake -S third_party/capstone -B "$RUNNER_TEMP/capstone-build" \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF \ | |
| -DCAPSTONE_X86_SUPPORT=ON \ | |
| -DCAPSTONE_ARM64_SUPPORT=ON \ | |
| -DCAPSTONE_BUILD_SHARED_LIBS=OFF \ | |
| -DCAPSTONE_BUILD_CSTOOL=OFF \ | |
| -DCMAKE_INSTALL_LIBDIR=lib \ | |
| -DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/capstone" \ | |
| -DCMAKE_C_FLAGS="-fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -fPIC" | |
| cmake --build "$RUNNER_TEMP/capstone-build" -j"$(nproc)" | |
| cmake --install "$RUNNER_TEMP/capstone-build" | |
| - name: Run autogen | |
| run: ./autogen.sh | |
| - name: Configure | |
| run: ./configure --enable-only64bit --with-capstone="$RUNNER_TEMP/capstone" | |
| - name: Build Valgrind | |
| run: make -j$(nproc) | |
| - name: Check cycle estimation | |
| run: | | |
| ./vg-in-place --tool=callgrind --cycle-estimation=yes \ | |
| --callgrind-out-file=/dev/null /bin/true 2>&1 | grep -q 'Events : Ir Ct Cl' | |