libretro / libretro-gme

Port of blargg's Game_Music_Emu library
GNU General Public License v3.0
11 stars 18 forks source link

Add RAR support via libarchive #25

Open vaguerant opened 3 years ago

vaguerant commented 3 years ago

According to #13, libretro-gme lacks RAR support because

there are no easy way to handle rar files graciously with a correctly licensed library.

RAR support would be particularly handy in this core as it is by far the most common distribution method for SNES .spc files (bundled up in RAR archives and renamed to .rsn).

I was curious how other tools, like Debian's unrar-free, avoid similar problems. It turns out unrar-free is just a frontend to libarchive.

libarchive's licensing is slightly complicated, but there is nothing alarming in there; it's all GPLv3-compatible. The bulk of the code is licensed under the FreeBSD license, a handful of files are under the Modified BSD license, and a few files are triple-licensed as CC0 1.0 Universal, OpenSSL and Apache 2.0, the last of which is GPLv3-compatible. One file is in the public domain.

Ultimately, this means the entirety of libarchive could be relicensed as GPLv3 and reused here in GME. That may be overkill for the purpose of adding RAR support to one core, so there may be a couple of other options worth considering, like using libarchive at a project level or stripping the library down to just a RAR unpacking library, although both seem like big changes and a lot of work. Regardless, at least on the licensing side, it seems like there's no barrier to adding RAR support here.