diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b921323 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,78 @@ +name: Release +on: workflow_dispatch +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + release_id: ${{ steps.create.outputs.id }} + release_url: ${{ steps.create.outputs.upload_url }} + steps: + - name: create release + id: create + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: latest + release_name: latest + draft: true + prerelease: false + build: + needs: create-release + runs-on: ubuntu-latest + strategy: + matrix: + platform: ["amd64", "arm64/v8"] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + - name: build docker environment + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/${{ matrix.platform }} + push: false + tags: instrew-env + - name: build instrew + run: docker run --rm -v "$PWD"/:/instrew/ instrew-env + - name: generate artifact name + uses: mad9000/actions-find-and-replace-string@5 + id: artifact-name + with: + source: instrew-${{ matrix.platform }}.tar.gz + find: '/' + replace: '' + - name: bundle instrew + run: mv install instrew && tar -czf ${{ steps.artifact-name.outputs.value }} instrew + - name: upload release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.release_url }} + asset_path: ./${{ steps.artifact-name.outputs.value }} + asset_name: ${{ steps.artifact-name.outputs.value }} + asset_content_type: application/gzip + publish-release: + needs: + - create-release + - build + runs-on: ubuntu-latest + steps: + - name: delete-previous-release + uses: dev-drprasad/delete-older-releases@v0.2.0 + with: + keep_latest: 0 + delete_tags: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: publish release + uses: eregon/publish-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.create-release.outputs.release_id }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 117d589..57b0901 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /*.sublime-* -/build* +/build/* /install diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..60cc33d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# build this docker image for a clean environemnt to build instrew +FROM ubuntu:24.04 + +# install dependencies +RUN apt update \ + && apt install -y gnupg wget meson cmake pkg-config libssl-dev clang + +# install LLVM +RUN wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -\ + && echo 'deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-17 main' >> /etc/apt/sources.list \ + && apt update \ + && apt install -y llvm-17 \ + && update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-17 17 + +# create mount point for project +RUN mkdir /instrew/ + +# build and test project +WORKDIR /instrew/ +CMD /instrew/build.sh \ No newline at end of file diff --git a/README.md b/README.md index 754495d..af87a5c 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,13 @@ Instrew is a performance-targeted transparent dynamic binary translator(/instrum After cloning and checking out submodules, compile Instrew as follows: ``` -mkdir build -meson build -Dbuildtype=release -ninja -C build -# optionally, run tests -ninja -C build test +./build.sh +``` + +If your build has dependency issues, consider using the provided dockerfile +``` +docker build . --tag instrew-env # run once +docker run --rm -v "$PWD"/:/instrew instrew-env # run to build instrew ``` Afterwards, you can run an application with Instrew. Statically linked applications often have a significantly lower translation time. New glibc versions often tend to use recent syscalls that are not yet supported, therefore warnings about missing system calls can sometimes be ignored. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..9c03674 --- /dev/null +++ b/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +mkdir -p build +meson build -Dprefix="$PWD"/install -Dbuildtype=release +ninja -C build +ninja -C build test +ninja -C build install \ No newline at end of file