• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 17
openelec AND retroplayer? i need a clean pair of pants
RetroPlayer can now be used in an embedded linux environment via OpenELEC.

Download builds

Builds can be found in the Builds thread

  • 2015-09-02: Updated to RetroPlayer based on Kodi 15.1 on OpenELEC 6.0 beta 4 (5.95.4)
  • 2014-07-04: Updated to RetroPlayer based on XBMC 13.1 on OpenELEC 4.0.6
  • 2014-05-26: Updated to RetroPlayer based on XBMC 13.0 on OpenELEC 4.0.0
  • 2013-09-12: Updated to RetroPlayer PR candidate based on XBMC 12-alpha7 on OpenELEC 3.2.0

Compile from source

  1. Clone my OpenELEC fork: https://github.com/garbear/OpenELEC.tv
  2. cd into tools/mkpkg and run ./mkpkg_kodi-retroplayer and ./mkpkg_retroplayer
    • ./mkpkg_kodi-retroplayer will download and package the latest RetroPlayer from https://github.com/garbear/xbmc
    • ./mkpkg_retroplayer will download and package all libretro cores and their game add-on wrappers at their master version
  3. (optional) Verify sources have been packaged. cd into sources/ and inspect archives
  4. Compile OpenELEC for the chosen project and architecture, e.g. time PROJECT=Generic ARCH=x86_64 make release

Updating sources

  1. Make sure your OpenELEC repo is on the default branch
    • Currently retroplayer-5.95.4. You can check the default branch here
  2. Make sure your OpenELEC repo is up-to-date
    • Example: git pull --rebase (the --rebase avoids merge errors in case I force push)
    • If git says "Cannot pull with rebase: You have unstaged changes. Please commit or stash them", run git stash and try again
  3. Run ./mkpkg_kodi-retroplayer to update RetroPlayer archive in the sources/ folder
    • If ./mkpkg_kodi-retroplayer yields merge errors, remove tools/mkpkg/kodi-retroplayer-15.1.git/ and try again
  4. Run ./mkpkg_retroplayer to update libretro cores, game add-ons and peripheral add-ons
  5. (optional) Run git diff. This will show you all the package versions that have been updated

Hacking on OpenELEC

The OpenELEC repo is laid out in several folders. The important ones are:
  • build.OpenELEC-Generic.x86_64-5.95.4/
    • The build.XXXXX folders contain the compiled packages. If a package is misbehaving, you can force a rebuild by deleting its folder here
  • packages/
    • This defines all the packages, their versions, and build instructions
    • Kodi is defined in packages/mediacenter/kodi. This package shows off many of the features of the OpenELEC build system, including patches and OS files
    • Binary add-ons require an extra definition. Add their package name to packages/virtual/mediacenter/package.mk. If a binary add-on fails to compile, comment it out in this file
  • sources/
    • OpenELEC looks here for packaged sources
    • If the source doesn't exist, OpenELEC will try to download from the OpenELEC server
    • RetroPlayer isn't hosted on the OpenELEC server. This is why ./mkpkg_kodi-retroplayer and ./mkpkg_retroplayer were created
  • scripts/
    • This is the OpenELEC build system itself. Much of my OpenELEC knowledge has come from reading the sources

Handling conflicting patches

OpenELEC carries additional patches for Kodi. Because the OpenELEC team lives on the bleeding edge, many of the patches are pull requests waiting to be reviewed/merged. RetroPlayer is a large patch, so occasionally it will clash with one of OpenELEC's patches. In this case, the conflicting patch must be hunted down in the packages/mediacenter/kodi/patches/ folder and removed. For example, see dc0cdb5.

Handling additional Kodi dependencies

Kodi has an extensive build system that can provide all of its dependencies, as well as binary add-ons. This build system isn't used. Instead, OpenELEC's shell scripts replace all of this functionality. This means that all additional dependencies and binary add-ons must have their own package in the packages/ folder.

Adding binary add-ons

Before I talk about libretro cores, I'll explain peripheral.joystick. The following instructions apply to OpenELEC 5.95.4:

  1. Create packages/mediacenter/kodi-binary-addons/peripheral.joystick/package.mk

    First, the package must be defined. The variables are self explanatory. PKG_VERSION should point to the hash of the master branch. Fortunately, this hash is sed'ed to whatever version is placed in the sources/ directory by the mkpkg_retroplayer script.

    The build instructions in package.mk look like this:

    configure_target() {
            -DCMAKE_INSTALL_PREFIX=/usr \
            -DCMAKE_MODULE_PATH=$SYSROOT_PREFIX/usr/lib/kodi \

    addon() {
      mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/
      cp -PR $PKG_BUILD/.install_pkg/usr/share/kodi/addons/$PKG_NAME/* $ADDON_BUILD/$PKG_ADDON_ID/
      cp -PL $PKG_BUILD/.install_pkg/usr/lib/kodi/addons/$PKG_NAME/*.so $ADDON_BUILD/$PKG_ADDON_ID/

    Where does the configure step come from? View the readme at https://github.com/kodi-game/peripheral.joystick . You can see that the cmake step is adapted from the instructions in the readme.

    The addon() step is a result of Kodi's binary add-on build system. Open peripheral.joystick's CMakeLists.txt and scroll to the bottom.You'll see the line

    build_addon(peripheral.joystick JOYSTICK DEPLIBS)

    The build_addon() macro invokes Kodi's binary add-on build system. At least part of it (more on this later). The cp commands copy the output of this macro to the correct OpenELEC directory.

  2. Edit packages/virtual/mediacenter/package.mk

    OK, so the package is defined. We must tell OpenELEC that Kodi depends on this add-on so that it'll be built. This is accomplished by editing packages/virtual/mediacenter/package.mk and adding the line

    PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET peripheral.joystick"

  3. Create tools/mkpkg/mkpkg_peripheral.joystick

    Now OpenELEC will include peripheral.joystick in the build. However, it'll try to download a source archive from the OpenELEC server, which obviously doesn't exist. To solve this, we'll copy/paste/modify another binary add-on's script to create our own at tools/mkpkg/mkpkg_peripheral.joystick. This script will:
    • Clone peripheral.joystick
    • Archive the sources into peripheral.joystick-XXXXXXX.tar.xz
    • Copy the archive to sources/peripheral.joystick/peripheral.joystick-XXXXXXX.tar.xz
    • Create a .md5 and .url file. If either of these is missing or not EXACTLY as they should be, OpenELEC will ignore the source archive and attempt (and fail) to download from sources.openelec.tv.
    • Update the version hash using sed in peripheral.joystick's package.mk from earlier. If the version was updated, you can view this using git diff

  4. Edit tools/mkpkg/mkpkg_retroplayer

    Finally, so that peripheral.joystick will be updated along with the other retroplayer add-ons, edit the file tools/mkpkg/mkpkg_retroplayer and add the line


Adding libretro cores

To explain libretro cores, I'll use game.libretro.mupen64plus as an example.

Start by reviewing the general structure of a libretro-based game add-on in the Porting libretro cores to Kodi thread.

Next, follow the binary add-on build steps above for game.libretro.mupen64plus.

You'll recall from the libretro cores thread that the libretro core is defined as a dependency for game.libretro.mupen64plus (see depends/common/mupen64plus). OpenELEC imports the build_addon() macro from Kodi's binary add-on build system, but it doesn't handle add-on depends. This means that we must add the libretro core as an additional package for the OpenELEC build system.

  1. Create packages/mediacenter/kodi-binary-addons/libretro-mupen64plus/package.mk.

    The build instructions in package.mk now look like this:

    make_target() {

    makeinstall_target() {
      mkdir -p $INSTALL/usr/lib
      echo "set($PKG_LIBVAR $INSTALL/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/$PKG_NAME-config.cmake

    Similar to game.libretro.mupen64plus, these are derived from commands in the depend's CMakelists.txt. The make_target() function is equal to the build command for linux from CMakeLists.txt (for release build, ${LIBRETRO_DEBUG} is empty):

    elseif("${CORE_SYSTEM_NAME}" STREQUAL "linux")

    This depends on the build command for the core. For example, see FCEUmm's CMakeLists.txt. The linux build command is

    elseif("${CORE_SYSTEM_NAME}" STREQUAL "linux")
      set(BUILD_COMMAND make -f Makefile.libretro ${LIBRETRO_DEBUG})

    and the corresponding make_target() in packages/mediacenter/kodi-binary-addons/libretro-fceumm/package.mk is:

    make_target() {
      make -f Makefile.libretro

    Now for makeinstall_target(). The lines



    are derived from the install command in CMakeLists.txt:

    #install the generated shared library
    install(FILES ${PROJECT_SOURCE_DIR}/mupen64plus_libretro${CMAKE_SHARED_LIBRARY_SUFFIX}

    You'll see that:
    • $PKG_LIBPATH is equal to mupen64plus_libretro${CMAKE_SHARED_LIBRARY_SUFFIX}
    • $INSTALL/usr/lib/$PKG_LIBNAME is equal to ${CMAKE_INSTALL_PREFIX}/lib/mupen64plus_libretro${CMAKE_SHARED_LIBRARY_SUFFIX}

    Another variation is if a core's output .so is in a subdirectory. For example, from Nestopia's CMakeLists.txt, the build command is

    elseif("${CORE_SYSTEM_NAME}" STREQUAL "linux")
      set(BUILD_COMMAND make -C libretro ${LIBRETRO_DEBUG})

    make -C libretro outputs to a subfolder named "libretro". Correspondingly, the install command looks like (notice the extra "libretro"):

    #install the generated shared library

    and the $PKG_LIBPATH in packages/mediacenter/kodi-binary-addons/libretro-nestopia/package.mk is defined as such:


    Finally, The line echo "set($PKG_LIBVAR $INSTALL/usr/lib/$PKG_LIBNAME)" > $SYSROOT_PREFIX/usr/$PKG_NAME-config.cmake (which generates libretro-mupen64plus-config.cmake) is the bash equivalent of:

    # write the mupen64plus-config.cmake script
    file(WRITE ${CMAKE_INSTALL_PREFIX}/libretro-mupen64plus-config.cmake "set(MUPEN64PLUS_LIB

  2. Create packages/mediacenter/kodi-binary-addons/libretro-mupen64plus/patches

    Remember how OpenELEC doesn't build add-on depends and we need to do everything ourselves? Copy the patches from depends/common/mupen64plus/ to packages/mediacenter/kodi-binary-addons/libretro-mupen64plus/patches/

  3. Edit packages/virtual/mediacenter/package.mk and add the line:

    PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET libretro-mupen64plus"

  4. Create tools/mkpkg/mkpkg_libretro-mupen64plus

  5. Edit tools/mkpkg/mkpkg_retroplayer and add the line:


Well there you go, OpenELEC is a powerful build system with an incredibly steep learning curve, probably because the thing is 100% shell script. Adding RetroPlayer required 3,000 lines of bash. Think about that. Every 100 lines of code creates 1 bug. I've hit far more than 30 typos/snafus over the few years I've been doing OpenELEC retroplayer builds, so this would appear an underestimate. If you design your own build system, please try to avoid heavy use of copy-paste and prefer declarative syntaxes over imperative ones.
You... are... my... hero! Thank you! Can't wait to try this tonight!
garbear is so hot right now 8) the OpenELEC.tv repo will automatically update itself whenever a new commit is pushed to github.com/garbear/xbmc.git within 25 seconds: https://github.com/garbear/OpenELEC.tv/commits
hey, does anyone know if it works with raspberry? great work btw. Smile
Not until we compile the emulators cores for ARM
I love progress in this area! Smile yes garbear you're on fire! Big Grin
Btw, what controllers do you use to play on openelec? I've tried to get my sixaxis to work with 3.1.5 without luck..
First of all, thank you to garbear for all of your work on the Retroplayer project! This is, in my mind, the most exciting thing happening in xbmc!

Now my question: I've been struggling to compile OpenELEC for the last two days. I'm new to compiling Linux programs from source so please bear with me. Following the instructions in this thread and at openelec.tv I'm able to get the build started but when it tries to download gmp-5.1.2 I get a 404 from the openelec mirror (checked, only up to gmp-5.1.1 available) and attempting to download from ftp.gmp.lib.org times out and retries 20 times causing the build to fail. For whatever reason I am unable to access the gmplib FTP site from any computer in my home. I'm pretty sure I could google another mirror but how would I add that mirror to the build script?

Check out packages/devel/gmp/meta you can specify different versions or mirror URLs. gpm-5.1.2 downloaded for me, I have the tar.xz sitting in my /sources folder.
(2013-08-17, 10:17)garbear Wrote: Check out packages/devel/gmp/meta you can specify different versions or mirror URLs. gpm-5.1.2 downloaded for me, I have the tar.xz sitting in my /sources folder.

Thanks garbear! I was able to get gmp lib by editing my meta file, unfortunately now at some point the compile crashes my pc (Arch Linux x86_64, Intel Pentium G620). I haven't had time yet to track down what exactly is causing the crash but once I do I'll check back in. Thanks again for your help.
cool, let me know when you get a chance to track it down
very cool just I wait your release for 3.1.6. Out from Openelec!!

Very nice job again Garbear Wink
(2013-08-21, 17:45)yallah Wrote: very cool just I wait your release for 3.1.6. Out from Openelec!!

Very nice job again Garbear Wink

There is a problem with the installer, I would guess 3.1.7 is coming soon...
nop for installer need put 3.0.6 and do update from openelec settings. Will get 3.1.6 and restart.

Yes, I know. Was just guessing that they will prepare another quick update because of this which would make rebasing on 3.1.6 unnecessary. Maybe I'm wrong... Blush
k, lemme know when 3.1.7 releases
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 17

Logout Mark Read Team Forum Stats Members Help
openelec AND retroplayer? i need a clean pair of pants4
This forum uses Lukasz Tkacz MyBB addons.