Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Packaging native libraries #41

@Alloyed

Description

@Alloyed

If you're interested in handling the native library thing, I've already thought a bit about how I would implement it. This stuff never made its way into loverocks mostly because it exists in a scope bigger than loverocks itself, so maybe this is the right place for it. This is basically a copy-paste from my existing notes, so sorry it's not as clear as it should be.

native libs are loadable from

  • the directory the exe is in
  • the savegame directory
  • not the .love archive, but the current implementation will unpack each lib if that's the only place it can find it

It's actually impossible to statically determine which external dependencies a lib links to, because they can always use a makefile/cmake. You can probably parse the output of ldd once you've made it but how do you make that cross platform/avoid packing things like libc with your game?

Java approach

have a single mega-.love file that holds all the binaries you can find, put them each under a subtree, for examplerocks/win_x86/lib/..., extract as needed

pros:

  • one file for everybody, just like jars

cons:

  • Fixed set of platforms
  • How do you do all the extra arches? afaict luarocks can't do cross compiling
  • wasted space/extra loading time to unpack the libs
  • You still have to get a .love binary

Fused games

Leave the binaries out of the love file, put them in next to your fused_game.exe, and then just pack everything up afterward

pros:

  • 0 user effort involved
  • Fits conventions from native C++ games

cons:

  • you still need extra machines to do other OS's
  • loverocks probably shouldn't do exe packing

source only

No binaries allowed. If a user wants to play a game with a native lib, they install loverocks and run loverocks deps themselves on your .love file.

pros:

  • makes life easy for users on weird arches/linux
  • external deps are not our problem
  • 0 effort involved

cons:

  • yet another build tool
  • All of your C code has to be publicly readable
  • 10 times the effort on source-hostile environments like Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions