pfirsich / makelove

A build tool for löve games
MIT License
143 stars 12 forks source link

Build broken using Love12 AppImages #40

Open pakeke-constructor opened 1 year ago

pakeke-constructor commented 1 year ago

Hi- I have been using love with a custom AppImage, (specifically, the latest love-12 AppImage generated from github actions).

The new Love-12 appImages contain liblove-12.so as opposed to liblove.so, which is breaking makelove. I'm not sure why this was renamed, I've asked on the love discord. I had a discussion with Sasha, turns out liblove has always been named this way. I think it's just because I got the extracted appimage from the github CI, why there were issues.

What do you think about this? Would it be worth making the liblove detection a bit more generic to detect different versions....?

I also suspect that this was the cause of #38

(For reference, here is a tree of the new extracted appimage for love 12)

appimage/
    squashfs-root/
        love.desktop
        .DirIcon
        AppRun
        love.svg
        license.txt
        share/
            mime/
                packages/
                    love.xml
            applications/
                love.desktop
            pixmaps/
                love.svg
            lua/
                5.1/
            luajit-2.1.0-beta3/
                jit/
                    p.lua
                    dump.lua
                    dis_mips.lua
                    dis_mipsel.lua
                    bc.lua
                    bcsave.lua
                    dis_arm.lua
                    dis_mips[....]el.lua
                    v.lua
                    dis_arm64be.lua
                    dis_ppc.lua
                    dis_x64.lua
                    zone.lua
                    vmdef.lua
                    dis_arm64.lua
                    dis_mips64.lua
                    dis_x86.lua
            icons/
                hicolor/
                    scalable/
                        mimetypes/
                            application-x-love-game.svg
        lib/
            libluajit-5.1.so.2
            liblove-12.0.so
            libogg.so.0
            libvorbisfile.so.3
            libfreetype.so.6
            libtheoradec.so.1
            libbrotlidec.so.1
            libvorbis.so.0
            libmodplug.so.1
            libz.so.1
            libbrotlicommon.so.1
            libopenal.so.1
            libSDL2-2.0.so.0
        bin/
            love
pfirsich commented 1 year ago

Sorry for the long delay. I have been on vacation, then quit my job and lots of stuff has been happening. I am a bit confused as to how it worked in the past, as there seems to be a dedicated branch for official AppImages that (I guess) worked well with just checking for liblove.so (https://github.com/pfirsich/makelove/blob/master/makelove/linux.py#L234). That whole liblove check is only relevant when shared_libraries is defined in the config, right? So it's not super, super broken, I think? Would you (or anyone reading) be willing to contribute the necessary fixes? I'd probably replace that block with something like this:

so_target_dir = find_liblove([
    appdir("lib/"), # pfirsich-style AppImages
    appdir("usr/lib"), # Official AppImages (since 11.4)
])
if so_target_dir == None:
    sys.exit("Could not find liblove.so in AppDir. The AppImage has an unknown format.")

and do find_liblove like this maybe?

def find_liblove(search_dirs: list[str]):
    is_liblove = lambda fname: fname.startswith("liblove") and fname.endswith(".so")
    for search_dir in search_dirs:
        if any(is_liblove(f) for f in os.listdir(search_dir)):
            return search_dir
    return None

This is not tested or anything. And you can do it a different way too, if you want.