A Moonlight client using the Kodi Game API.
Moonlight is an open source implementation of NVIDIA GameStream and allows to stream your collection of Steam games from the gaming machine to the client.
Building this add-on requires Kodi's internal CMake-based build system for binary add-ons. If you are cross-compiling or just packaging the add-on, it is recommended that you use the Makefile provided with Kodi.
The Makefile will download, build and install the add-on and its dependencies. There is no need to manually clone the add-on if Kodi's source is available.
The version fetched by Kodi's build system is defined by a text file included with Kodi at project/cmake/addons/addons/game.moonlight or fetched from the binary add-ons repo specified in project/cmake/addons/bootstrap/repositories/binary-addons.txt.
First, make sure Kodi's add-on build system is installed somewhere. You can perform a system install (to /usr/local
) or a local install (I prefer $HOME/kodi
). Specify this when you build Kodi:
./bootstrap
./configure --prefix=$HOME/kodi
make
make install
Now, run the Makefile with the path to the build system:
cd tools/depends/target/binary-addons
make PREFIX=$HOME/kodi ADDONS="game.moonlight"
You can specify multiple add-ons, and wildcards are accepted too. For example, ADDONS="pvr.*"
will build all pvr add-ons.
On Linux this performs a cross-compile install, so to package the add-on you'll need to copy the library and add-on files manually:
cd $HOME/workspace/kodi/addons
mkdir -p game.moonlight
cp -r $HOME/kodi/share/kodi/addons/game.moonlight/ .
cp -r $HOME/kodi/lib/kodi/addons/game.moonlight/ .
To rebuild the add-on or compile a different one, clean the build directory:
make clean
Building on OSX is similar to Linux, but all the paths are determined for you. This command will download, build and install the add-on to the addons/
directory in your Kodi repo:
cd tools/depends/target/binary-addons
make ADDONS="game.moonlight"
First, download and install CMake.
To compile on windows, open a command prompt at tools\buildsteps\win32
and run the script:
make-addons.bat install game.moonlight
When developing, compiling from a git repo is more convenient than repeatedly pushing changes to a remote one for Kodi's Makefile.
The add-on requires several dependencies to build properly. Like Kodi's build system, you can perform a system install or a local one (demonstrated here). The dependencies can be found in depends/common:
- p8-platform
- kodi-platform
- zlib
- openssl
- enet
- moonlight-common-c
- pugixml (will be replaced by tinyxml2 in the future)
You can provide them yourself, or build and install them to the kodi --prefix
directory that you passed to ./configure
. Follow the instructions below if you're not providing them yourself:
git clone https://github.com/Pulse-Eight/platform.git
cd platform
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
git clone https://github.com/xbmc/kodi-platform.git
cd kodi-platform
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
wget http://mirrors.xbmc.org/build-deps/sources/zlib-1.2.8.tar.gz
tar -xzvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
wget http://mirrors.xbmc.org/build-deps/sources/openssl-1.0.2h.tar.gz
tar -xzvf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
wget https://raw.githubusercontent.com/kodi-game/game.moonlight/master/depends/common/openssl/CMakeLists.txt
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
git clone https://github.com/cgutman/enet
cd enet
wget https://raw.githubusercontent.com/kodi-game/game.moonlight/master/depends/common/enet/0001-cmake-Add-missing-install-scripts-and-set-PIC-to-ON.patch -O - | patch
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
git clone https://github.com/moonlight-stream/moonlight-common-c
cd moonlight-common-c
wget https://raw.githubusercontent.com/kodi-game/game.moonlight/master/depends/common/moonlight-common-c/CMakeLists.txt
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
wget https://github.com/zeux/pugixml/releases/download/v1.7/pugixml-1.7.tar.gz
tar -xzvf pugixml-1.7.tar.gz
cd pugixml-1.7
wget https://raw.githubusercontent.com/kodi-game/game.moonlight/master/depends/common/pugixml/CMakeLists.txt
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/kodi \
..
make
make install
cd ../..
With these dependencies in place, the add-on can be built:
git clone https://github.com/xbmc/game.moonlight.git
cd game.moonlight
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH=$HOME/kodi \
-DCMAKE_INSTALL_PREFIX=$HOME/workspace/kodi/addons \
-DPACKAGE_ZIP=1 \
..
make
make install
where $HOME/workspace/kodi
symlinks to the directory you cloned Kodi into.
This instructions here came from this helpful forum post.
First, open tools\windows\prepare-binary-addons-dev.bat
and change -DCMAKE_BUILD_TYPE=Debug ^
to -DCMAKE_BUILD_TYPE=Release ^
.
Open a command prompt at tools\windows
and run the script:
prepare-binary-addons-dev.bat game.moonlight
Open project\cmake\addons\build\kodi-addons.sln
and build the solution. This downloads the add-on from the version specified in its text file (see above) and creates a Visual Studio project for it. If the build fails, try running it twice.
This should package and copy the add-on to the addons/
directory. If not, you can try opening the solution project\cmake\addons\build\<addon-id>-prefix\src\<addon-id>-build\<addon-id>.sln
and building the INSTALL project or, worse case, copy by hand.