diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 00000000..65679288 --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,37 @@ +name: Artefact builder +on: + push: + branches: + - internal + tags: + - v*.*.* +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build + run: | + docker buildx build --platform linux/amd64,linux/arm64 --output=type=local,dest=dist . + mv dist/linux_amd64/app/build/cage dist/cage-amd64 + mv dist/linux_arm64/app/build/cage dist/cage-arm64 + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: cage-binaries + path: dist/cage-* + retention-days: 1 + - name: create release + if: startsWith(github.ref, 'refs/tags/v') + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/cage-*" + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 801fc324..ca0987de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ /subprojects/** -!/subprojects/*.wrap \ No newline at end of file +!/subprojects/*.wrap +!/subprojects/packagecache +!/subprojects/packagecache/.placeholder +!/subprojects/packagefiles +!/subprojects/packagefiles/*.patch \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 261ea9d2..3f7655e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ FROM debian:12-slim #debian 12 is required to have a recent-enough built-in meson. +ENV DEBIAN_FRONTEND=noninteractive # Install build tools RUN apt-get -qqy update \ && apt-get -qqy --no-install-recommends install \ + git \ ca-certificates \ build-essential \ cmake \ @@ -26,13 +28,9 @@ RUN apt-get -qqy update \ quilt \ libexpat1-dev \ libffi-dev \ - libxml2-dev \ - liblzma-dev \ && rm -rf /var/lib/apt/lists/* # wlroots build-deps (https://packages.debian.org/source/bookworm/wlroots) -# - libwayland-dev is required for wayland-scanner, which is set as "native" but could probablyt be force to use the local file. -# (https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/meson.build#L8) RUN apt-get -qqy update \ && apt-get -qqy --no-install-recommends install \ libavformat-dev \ @@ -63,19 +61,34 @@ RUN apt-get -qqy update \ libx11-xcb-dev \ libxkbcommon-dev \ hwdata \ - libwayland-dev \ xwayland \ libxcb-ewmh-dev \ && rm -rf /var/lib/apt/lists/* WORKDIR /app -COPY . /app -RUN rm -rf /app/build +RUN mkdir -p /app/subprojects -RUN meson setup build --prefer-static --default-library=static --buildtype=release -Dwerror=false -Doptimization=2 \ - -Dxwayland=enabled \ +COPY meson_options.txt meson.build /app/ +COPY *.in *.scd .clang-format .clang-format-ignore /app/ + +COPY subprojects/*.wrap /app/subprojects/ +COPY subprojects/packagefiles /app/subprojects/packagefiles +COPY subprojects/packagecache /app/subprojects/packagecache + +COPY ./protocol /app/protocol +COPY *.[ch] /app/ + + +# Fix for the use of local wayland-scanner in subsequent builds +ENV PATH="${PATH}:/app/build/subprojects/wayland-1.22.0/src" + +RUN meson setup build --prefer-static --default-library=static --buildtype=release -Dwerror=false \ + -Dxwayland=enabled -Dinput_calibration=enabled -Dman-pages=disabled \ -Dwlroots:auto_features=enabled -Dwlroots:backends=auto -Dwlroots:renderers=auto \ - -Dwayland:documentation=false -Dwayland:tests=false + -Dwayland:documentation=false -Dwayland:dtd_validation=false + +RUN ninja -C build -RUN ninja -C build \ No newline at end of file +# Makes the image unusable, but useful to use with `docker buildx build --output=type=local`as we are. +RUN rm -rf /usr /var \ No newline at end of file diff --git a/subprojects/packagecache/.placeholder b/subprojects/packagecache/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/subprojects/packagefiles/0001-use-local-wayland-scanner.patch b/subprojects/packagefiles/0001-use-local-wayland-scanner.patch new file mode 100644 index 00000000..dca98423 --- /dev/null +++ b/subprojects/packagefiles/0001-use-local-wayland-scanner.patch @@ -0,0 +1,25 @@ +Use local wayland-scanner instead of looking for the native one in the host system. +Since we don't plan to do cross-compilation and wayland-scanner is built from wayland subproject, we override this. +--- + protocol/meson.build | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/protocol/meson.build b/protocol/meson.build +index c60f2b9a..76cfbf24 100644 +--- a/protocol/meson.build ++++ b/protocol/meson.build +@@ -5,10 +5,8 @@ wayland_protos = dependency('wayland-protocols', + ) + wl_protocol_dir = wayland_protos.get_variable('pkgdatadir') + +-wayland_scanner_dep = dependency('wayland-scanner', native: true) + wayland_scanner = find_program( +- wayland_scanner_dep.get_variable('wayland_scanner'), +- native: true, ++ 'wayland-scanner' + ) + + protocols = { +-- +2.39.2 + diff --git a/subprojects/wlroots.wrap b/subprojects/wlroots.wrap index d6e62a35..dc65c172 100644 --- a/subprojects/wlroots.wrap +++ b/subprojects/wlroots.wrap @@ -4,5 +4,7 @@ source_url =https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/0.17.2/dow source_filename = wlroots-0.17.2.tar.xz source_hash = f4007d3f71e190b9000ab4a30afd87833b034ab2602030a00af4465ffd4e997c +diff_files = 0001-use-local-wayland-scanner.patch + [provide] wlroots = wlroots