diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..1e7a990
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "shared-modules"]
+ path = shared-modules
+ url = https://github.com/flathub/shared-modules.git
diff --git a/shared-modules b/shared-modules
new file mode 160000
index 0000000..ba51129
--- /dev/null
+++ b/shared-modules
@@ -0,0 +1 @@
+Subproject commit ba5112961730f0e1560da290c72880f758af7894
diff --git a/tools/tinyxml/entity.patch b/tools/tinyxml/entity.patch
new file mode 100644
index 0000000..66d89a6
--- /dev/null
+++ b/tools/tinyxml/entity.patch
@@ -0,0 +1,64 @@
+? entity.patch
+Index: tinyxml.cpp
+===================================================================
+RCS file: /cvsroot/tinyxml/tinyxml/tinyxml.cpp,v
+retrieving revision 1.105
+diff -u -r1.105 tinyxml.cpp
+--- tinyxml.cpp 5 Jun 2010 19:06:57 -0000 1.105
++++ tinyxml.cpp 19 Jul 2010 21:24:16 -0000
+@@ -57,30 +57,7 @@
+ {
+ unsigned char c = (unsigned char) str[i];
+
+- if ( c == '&'
+- && i < ( (int)str.length() - 2 )
+- && str[i+1] == '#'
+- && str[i+2] == 'x' )
+- {
+- // Hexadecimal character reference.
+- // Pass through unchanged.
+- // © -- copyright symbol, for example.
+- //
+- // The -1 is a bug fix from Rob Laveaux. It keeps
+- // an overflow from happening if there is no ';'.
+- // There are actually 2 ways to exit this loop -
+- // while fails (error case) and break (semicolon found).
+- // However, there is no mechanism (currently) for
+- // this function to return an error.
+- while ( i<(int)str.length()-1 )
+- {
+- outString->append( str.c_str() + i, 1 );
+- ++i;
+- if ( str[i] == ';' )
+- break;
+- }
+- }
+- else if ( c == '&' )
++ if ( c == '&' )
+ {
+ outString->append( entity[0].str, entity[0].strLength );
+ ++i;
+Index: xmltest.cpp
+===================================================================
+RCS file: /cvsroot/tinyxml/tinyxml/xmltest.cpp,v
+retrieving revision 1.89
+diff -u -r1.89 xmltest.cpp
+--- xmltest.cpp 5 Jun 2010 17:41:52 -0000 1.89
++++ xmltest.cpp 19 Jul 2010 21:24:16 -0000
+@@ -1340,6 +1340,16 @@
+ }*/
+ }
+
++ #ifdef TIXML_USE_STL
++ {
++ TiXmlDocument xml;
++ xml.Parse("foo
+bar");
++ std::string str;
++ str << xml;
++ XmlTest( "Entity escaping", "foo
+bar", str.c_str() );
++ }
++ #endif
++
+ /* 1417717 experiment
+ {
+ TiXmlDocument xml;
diff --git a/tools/tinyxml/tinyxml-2.5.3-stl.patch b/tools/tinyxml/tinyxml-2.5.3-stl.patch
new file mode 100644
index 0000000..7bcde59
--- /dev/null
+++ b/tools/tinyxml/tinyxml-2.5.3-stl.patch
@@ -0,0 +1,12 @@
+diff -up tinyxml/tinyxml.h~ tinyxml/tinyxml.h
+--- tinyxml/tinyxml.h~ 2007-11-30 22:39:36.000000000 +0100
++++ tinyxml/tinyxml.h 2007-11-30 22:39:36.000000000 +0100
+@@ -26,6 +26,8 @@ distribution.
+ #ifndef TINYXML_INCLUDED
+ #define TINYXML_INCLUDED
+
++#define TIXML_USE_STL 1
++
+ #ifdef _MSC_VER
+ #pragma warning( push )
+ #pragma warning( disable : 4530 )
diff --git a/tools/tinyxml/tinyxml.patch b/tools/tinyxml/tinyxml.patch
new file mode 100644
index 0000000..eb7194d
--- /dev/null
+++ b/tools/tinyxml/tinyxml.patch
@@ -0,0 +1,36 @@
+*** Makefile 2018-09-19 17:05:59.067745666 +0200
+--- Makefile~ 2018-09-19 17:07:06.980472539 +0200
+*************** PROFILE := NO
+*** 15,21 ****
+
+ # TINYXML_USE_STL can be used to turn on STL support. NO, then STL
+ # will not be used. YES will include the STL files.
+! TINYXML_USE_STL := NO
+
+ #****************************************************************************
+
+--- 15,21 ----
+
+ # TINYXML_USE_STL can be used to turn on STL support. NO, then STL
+ # will not be used. YES will include the STL files.
+! TINYXML_USE_STL := YES
+
+ #****************************************************************************
+
+*************** RELEASE_CFLAGS := -Wall -Wno-unknown-p
+*** 31,37 ****
+ LIBS :=
+
+ DEBUG_CXXFLAGS := ${DEBUG_CFLAGS}
+! RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}
+
+ DEBUG_LDFLAGS := -g
+ RELEASE_LDFLAGS :=
+--- 31,37 ----
+ LIBS :=
+
+ DEBUG_CXXFLAGS := ${DEBUG_CFLAGS}
+! RELEASE_CXXFLAGS := ${RELEASE_CFLAGS} -fPIC
+
+ DEBUG_LDFLAGS := -g
+ RELEASE_LDFLAGS :=
diff --git a/tools/tinyxml/tinyxml.yaml b/tools/tinyxml/tinyxml.yaml
new file mode 100644
index 0000000..de54013
--- /dev/null
+++ b/tools/tinyxml/tinyxml.yaml
@@ -0,0 +1,24 @@
+name: tinyxml
+sources:
+ - type: archive
+ url: https://netcologne.dl.sourceforge.net/project/tinyxml/tinyxml/2.6.2/tinyxml_2_6_2.tar.gz
+ sha256: 15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593
+ - type: file
+ url: https://git.archlinux.org/svntogit/community.git/plain/trunk/tinyxml.pc?h=packages/tinyxml
+ sha256: 0e37a568eaebb8f0644f148a3d3efa921ac518217e1c0de46c2859d26516bcc4
+ dest-filename: tinyxml.pc
+ - type: patch
+ path: tinyxml-2.5.3-stl.patch
+ - type: file
+ path: entity.patch
+ - type: file
+ path: tinyxml.patch
+buildsystem: simple
+build-commands:
+ - patch -p0 -i entity.patch
+ - patch -p0 -i tinyxml.patch
+ - make
+ - g++ -fPIC "$CXXFLAGS" -shared -o "libtinyxml.so" -Wl,-soname,"libtinyxml.so" $(ls *.o | grep -v xmltest)
+ - install libtinyxml.so /app/lib
+ - install tinyxml.pc /app/lib/pkgconfig/tinyxml.pc
+ - install *.h /app/include
diff --git a/tv.kodi.Kodi/tv.kodi.Kodi.conf b/tv.kodi.Kodi/tv.kodi.Kodi.conf
new file mode 100644
index 0000000..9e3b4d5
--- /dev/null
+++ b/tv.kodi.Kodi/tv.kodi.Kodi.conf
@@ -0,0 +1 @@
+{"name": "tv.kodi.Kodi", "branches": ["18-b2", "master"]}
diff --git a/tv.kodi.Kodi/tv.kodi.Kodi.yaml b/tv.kodi.Kodi/tv.kodi.Kodi.yaml
new file mode 100644
index 0000000..11739b6
--- /dev/null
+++ b/tv.kodi.Kodi/tv.kodi.Kodi.yaml
@@ -0,0 +1,168 @@
+id: tv.kodi.Kodi
+runtime: org.freedesktop.Platform
+runtime-version: 18.08
+sdk: org.freedesktop.Sdk
+branch: 18-b2
+separate-locales: false
+
+modules:
+ - name: lzo2
+ sources:
+ - type: git
+ url: https://github.com/damageboy/lzo2.git
+ - name: libass
+ sources:
+ - type: archive
+ url: https://github.com/libass/libass/archive/0.14.0.tar.gz
+ sha256: 82e70ee1f9afe2e54ab4bf6510b83bb563fcb2af978f0f9da82e2dbc9ae0fd72
+ - name: libcdio
+ sources:
+ - type: archive
+ url: https://git.savannah.gnu.org/cgit/libcdio.git/snapshot/libcdio-release-2.0.0.tar.gz
+ sha256: d878079955b9f92875686052ad7b61bf7e812d40b11509c008e9f29f107c9770
+ config-opts:
+ - --without-cd-drive
+ - --without-cd-info
+ - --without-cdda-player
+ - --without-cd-read
+ - --without-iso-info
+ - --without-iso-read
+ - name: flatbuffers
+ sources:
+ - type: archive
+ url: https://github.com/google/flatbuffers/archive/v1.9.0.tar.gz
+ sha256: 5ca5491e4260cacae30f1a5786d109230db3f3a6e5a0eb45d0d0608293d247e3
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_INSTALL_LIBDIR=/app/lib
+ - -DCMAKE_BUILD_TYPE=Release
+ - -DCMAKE_CXX_COMPILER=clang++
+ - -DFLATBUFFERS_BUILD_FLATLIB=OFF
+ - -DFLATBUFFERS_BUILD_SHAREDLIB=ON
+ - name: fmt
+ sources:
+ - type: archive
+ url: https://github.com/fmtlib/fmt/archive/5.2.0.tar.gz
+ sha256: b0e8c71a8fb906123966686f788e83cd95ae499afe9c25ff6284f624488435ac
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ cleanup:
+ - /lib64
+ - name: fstrcmp
+ sources:
+ - type: archive
+ url: https://netcologne.dl.sourceforge.net/project/fstrcmp/fstrcmp/0.7/fstrcmp-0.7.D001.tar.gz
+ sha256: e4018e850f80700acee8da296e56e15b1eef711ab15157e542e7d7e1237c3476
+ buildsystem: simple
+ build-commands:
+ - ./configure --prefix=/app
+ - echo "echo Skip PDF; echo '' > etc/building.pdf; echo '' > etc/readme.pdf; echo '' > etc/reference.pdf" > ps2pdf
+ - chmod +x ps2pdf
+ - PATH=$PATH:`pwd` make install
+ - name: rapidjson
+ sources:
+ - type: git
+ url: https://github.com/Tencent/rapidjson.git
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ - name: taglib
+ sources:
+ - type: archive
+ url: https://github.com/taglib/taglib/archive/v1.11.1.tar.gz
+ sha256: b6d1a5a610aae6ff39d93de5efd0fdc787aa9e9dc1e7026fa4c961b26563526b
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ - "../tools/tinyxml/tinyxml.yaml"
+ - "../shared-modules/glu/glu-9.0.0.json"
+ - name: java
+ sources:
+ - type: archive
+ url: https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz
+ sha256: f3b26abc9990a0b8929781310e14a339a7542adfd6596afb842fa0dd7e3848b2
+ buildsystem: simple
+ build-commands:
+ - mkdir -p /app/java
+ - cp -rv * /app/java
+ - echo "exec /app/java/bin/java \$@" > /app/bin/java
+ - echo "exec /app/java/bin/javac \$@" > /app/bin/javac
+ - chmod +x /app/bin/java /app/bin/javac
+ cleanup:
+ - "*"
+ - name: swig
+ sources:
+ - type: archive
+ url: https://github.com/swig/swig/archive/rel-3.0.12.tar.gz
+ sha256: 64971de92b8a1da0b9ffb4b51e9214bb936c4dbbc304367899cdb07280b94af6
+ cleanup:
+ - "*"
+ - name: cmake
+ sources:
+ - type: archive
+ url: https://cmake.org/files/v3.12/cmake-3.12.2.tar.gz
+ sha256: 0f97485799e51a7070cc11494f3e02349b0fc3a24cc12b082e737bf67a0581a4
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ cleanup:
+ - "*"
+ - "../shared-modules/python2.7/python-2.7.15.json"
+ - "../shared-modules/udev/udev-175.json"
+ - name: libnfs
+ sources:
+ - type: archive
+ url: https://github.com/sahlberg/libnfs/archive/libnfs-3.0.0.tar.gz
+ sha256: 445d92c5fc55e4a5b115e358e60486cf8f87ee50e0103d46a02e7fb4618566a5
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ - name: sndio
+ sources:
+ - type: archive
+ url: http://www.sndio.org/sndio-1.5.0.tar.gz
+ sha256: 12c70044749ad9cb7eaeb26c936816aa6b314fe4be71ef479d12272e4c5ad253
+ - name: kodi
+ build-options:
+ build-args:
+ - --share=network
+ sources:
+ - type: archive
+ url: https://github.com/xbmc/xbmc/archive/18.0b2-Leia.tar.gz
+ sha256: 25fc0aabfb523d4db19e08b1990d4851592ee2adec0424f5fb729bd3672eae69
+ buildsystem: cmake-ninja
+ builddir: true
+ config-opts:
+ - -DCMAKE_BUILD_TYPE=Release
+ - -DCMAKE_INSTALL_LIBDIR=/app/lib
+ - name: fix-starter
+ buildsystem: simple
+ build-commands:
+ - bash -c "for x in /app/share/icons/hicolor/*/apps/kodi.png; do mv -v \$x \${x%kodi.png}tv.kodi.Kodi.png; done"
+ - mv /app/share/applications/kodi.desktop /app/share/applications/tv.kodi.Kodi.desktop
+ - perl -pi -e s/Icon\\=kodi/Icon\\=tv\\.kodi\\.Kodi/g /app/share/applications/tv.kodi.Kodi.desktop
+cleanup:
+ - /include
+ - /lib/debug
+ - /lib/cmake
+ - /lib/pkgconfig
+ - /share/doc
+ - /share/info
+ - /share/man
+ - /share/xsessions
+
+command: kodi
+finish-args:
+ - --share=network
+ - --socket=x11
+ - --socket=wayland
+ - --socket=pulseaudio
+ - --filesystem=home
+ - --device=all