MirOil-for-Lomiri
I've set up a temporary Github project to maintain the work in progress on Miroil. It is here:
https://github.com/MirOil-for-Lomiri
This contains forks of two projects: Mir and QtMir. These can be kept in step with the growing Miroil API.
So that these can be used together, the default branch (mir-1.9-miroil) of Mir is based upon Mir 1.8, and the default branch (miroil) of QtMir is based on https://github.com/ubports/qtmir/tree/xenial_-_edge_-_wayland_-_x11.
This is work I started last year and have been continued by "erlend-g" this year.
The problem and the approach
Currently QtMir can only build against Mir 1.x as it depends on some APIs that were removed in Mir 2.x. Miroil is intended to replace the missing functionality by moving some logic from QtMir to Miroil.
By publishing the functionality as new, cleaner APIs in Miroil this will make it possible to use QtMir on Mir 2.x. This is important for UBports as QtMir is the library that Lomiri uses to work on Mir.
By basing this work in progress on Mir 1.x, it is possible to make incremental changes to both Miroil and QtMir while everything keeps running. In particular, it is possible to run the QtMir demo and tests (but see below) following changes to these projects.
Getting and building the source
QtMir has a bunch of dependencies that are not in the Ubuntu archive, so the best approach I've found is to take an Ubuntu 16.04 system (installed on an old laptop) and add the UBports archive. (It is also possible to a VM, but this stack needs 3D acceleration enabled, and there may be other quirks.)
So, on a 16.04 system:
sudo apt-add-repository http://repo.ubports.com/
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4BD4B4D6DBB583F1
sudo apt update
sudo apt dist-upgrade
Mir
Next, add some development tools and clone and build Mir:
sudo apt install devscripts equivs git
git clone --recursive https://github.com/MirOil-for-Lomiri/mir.git
cd mir
sed -i /.*wlcs.*/d debian/control
mk-build-deps -i -s sudo
mkdir build
cd build
cmake -DMIR_ENABLE_WLCS_TESTS=off ..
make -4
Then install in /usr/local:
sudo make install
sudo ldconfig
QtMir
Clone QtMir, get the remaining dependencies and build:
git clone https://github.com/MirOil-for-Lomiri/qtmir.git
cd qtmir
mk-build-deps -i -s sudo
mkdir -p cmake-build-debug
cd cmake-build-debug
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j 4 all test
Note that one of the tests crashes: Test #9: ApplicationManager ...............***Exception: SegFault 0.28 sec. That happens on the upstream branch too and I've not investigated further.
Then install in /usr/local:
sudo make install
sudo ldconfig
sudo ln -s /usr/local/share/glib-2.0/schemas/com.canonical.qtmir.gschema.xml /usr/share/glib-2.0/schemas/
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
Running the demo
The demos are in the demos directory.
export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/local/lib/qt5/plugins/platforms
export QML2_IMPORT_PATH=/usr/local/lib/qt5/qml
export QT_QPA_PLATFORM=mirserver
export MIR_SERVER_ENABLE_MIRCLIENT=
export MIR_SERVER_CURSOR=null
qmlscene demos/qml-demo-shell/qml-demo-shell.qml
Next steps
I'm in the process of syncing the Mir branch with the changes upstream, and have re-sync'ed the QtMir branch. I've invited @mariogrip and "erlend-g" to join the project, and anyone else interested in helping should contact me.