Skip to content

Commit

Permalink
snap support
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Dec 28, 2023
1 parent 5c709ec commit 941dc56
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CMake

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Add PPA
run: sudo apt-add-repository ppa:mir-team/release

- name: Install dependencies
run: sudo apt-get install libmiral-dev

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ mir-builder.*
build
Technical_Test_-_Software_Engineer_-_Mir_-_Google_Docs.pdf
.cache
temp-build
temp-build

*.snap
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0022 NEW)

project(miracle-wm)

project(MiracleWM)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -13,7 +16,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

find_package(PkgConfig)
pkg_check_modules(MIRAL miral REQUIRED)
find_package(OpenGL REQUIRED)

add_executable(miracle-wm
src/display_listener.cpp
Expand All @@ -25,4 +27,8 @@ add_executable(miracle-wm
)

target_include_directories(miracle-wm PUBLIC SYSTEM ${MIRAL_INCLUDE_DIRS})
target_link_libraries( miracle-wm ${MIRAL_LDFLAGS} -lwayland-client)
target_link_libraries( miracle-wm ${MIRAL_LDFLAGS})

install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/miracle-wm
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ Features:
- [x] Moving window with keyboard
- [ ] Gaps in windows
- [ ] Account for minimum sizes on windows (e.g. gedit)
- [ ] Disabling many of the Floating Window Manager features
- [x] Disabling many of the Floating Window Manager features
- [ ] Handle exclusion zones
- [ ] Handle output creation, updating, and deletion
- [ ]

## Tiling Advanced + Initial Shell (Due: February 1st)
Version: 0.2
Expand Down
101 changes: 101 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: miracle-wm
adopt-info: miracle-wm
summary: "miracle-wm: a tiling window manager built on Mir"
description: |
miracle-wm is a tiling window manager based off the Mir library.
It is intended to provide an i3/sway-like experience.
confinement: classic
base: core22

architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf

package-repositories:
- type: apt
ppa: mir-team/release

apps:
miracle-wm:
command: &_command usr/local/bin/miracle-wm
environment: &_environment
# Prep for Mir
MIR_SERVER_PLATFORM_PATH: ${SNAP}/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/mir/server-platform
__EGL_VENDOR_LIBRARY_DIRS: $SNAP/etc/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri
LIBINPUT_QUIRKS_DIR: ${SNAP}/usr/share/libinput
PATH: ${SNAP}/usr/local/bin/:${PATH}
# For "reasons" this is being set despite this being a classic snap. This overwrites the nonsense
LD_LIBRARY_PATH: ""

parts:
miracle-wm:
build-attributes:
- enable-patchelf
override-pull: |
craftctl default
# work around https://github.com/diddlesnaps/snapcraft-multiarch-action/issues/22
git config --global --add safe.directory ${CRAFT_PART_SRC}
server_version=`git rev-list --count HEAD`
mir_version=`LANG=C apt-cache policy mir-graphics-drivers-desktop | sed -rne 's/^\s+Candidate:\s+([^-]*)-.+$/\1/p'`
craftctl set version=$server_version-mir$mir_version
if echo $mir_version | grep -e '+dev' -e '~rc' -q; then craftctl set grade=devel; else craftctl set grade=stable; fi
plugin: cmake
source: .
build-packages:
- pkg-config
- libmiral-dev
- libboost-filesystem-dev
- libfreetype6-dev
- libwayland-dev
- libxkbcommon-dev
- g++
- make
stage-packages:
- libmiral6
- mir-graphics-drivers-desktop
- libfreetype6
prime:
- -lib/udev
- -usr/doc
- -usr/doc-base
- -usr/share/applications
- -usr/share/apport
- -usr/share/bug
- -usr/share/doc
- -usr/share/doc-base
- -usr/share/icons
- -usr/share/libdrm
- -usr/share/libwacom
- -usr/share/lintian
- -usr/share/man
- -usr/share/pkgconfig

mesa-patchelf:
build-attributes:
- enable-patchelf
plugin: nil
stage-packages:
- libgl1-mesa-dri
- libtinfo5
# included in this part because it tries to pull in mesa bits
- gvncviewer
- swaybg
- synapse
- xvfb
- xwayland
stage:
# The libraries in .../dri need no-patchelf, so they come from the mesa-unpatched part
- -usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri

mesa-no-patchelf:
plugin: nil
stage-packages:
- libgl1-mesa-dri
build-attributes:
- no-patchelf # Otherwise snapcraft may strip the build ID and cause the driver to crash
stage:
# Only the libraries in .../dri need to not be patched, the rest come from the mesa part
- usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/dri

0 comments on commit 941dc56

Please sign in to comment.