Skip to content

Commit

Permalink
Infrastructure: add flatpak support (Mudlet#6494)
Browse files Browse the repository at this point in the history
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Add flatpak support
#### Motivation for adding to Mudlet
AppImage alternative and possibly better Steam Deck support
#### Other info (issues closed, discussion etc)
Sound works!

---------

Co-authored-by: Vadim Peretokin <[email protected]>
  • Loading branch information
vadi2 and vadi2 authored Jan 29, 2024
1 parent 4756d48 commit d7fb22f
Show file tree
Hide file tree
Showing 3 changed files with 244 additions and 0 deletions.
43 changes: 43 additions & 0 deletions CI/lua-5.1.5-so.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff -ur lua-5.1.4/src/Makefile lua-5.1.4-new/src/Makefile
--- lua-5.1.4/src/Makefile 2008-01-19 20:37:58.000000000 +0100
+++ lua-5.1.4-new/src/Makefile 2012-02-23 18:26:43.000000000 +0100
@@ -23,6 +23,7 @@
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o
@@ -36,7 +37,7 @@
LUAC_O= luac.o print.o

ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
ALL_A= $(LUA_A)

default: $(PLAT)
@@ -51,6 +52,11 @@
$(AR) $@ $?
$(RANLIB) $@

+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)

--- lua-5.1.4/Makefile 2008-08-12 02:40:48.000000000 +0200
+++ lua-5.1.4-new/Makefile 2012-02-23 19:06:32.000000000 +0100
@@ -53,7 +53,7 @@
all: $(PLAT)

$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V) R=$(R)

test: dummy
src/lua test/hello.lua
188 changes: 188 additions & 0 deletions CI/org.mudlet.mudlet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
id: org.mudlet.mudlet
runtime: org.kde.Platform
runtime-version: '5.15-23.08'
sdk: org.kde.Sdk
command: mudlet
rename-desktop-file: mudlet.desktop
rename-icon: mudlet
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri
- --socket=pulseaudio
- --share=network
- --filesystem=home

cleanup:
- /bin/json_reformat
- /bin/json_verify

modules:
- name: lua-5.1
buildsystem: simple
build-commands:
- make -j $FLATPAK_BUILDER_N_JOBS CFLAGS="$CFLAGS -fPIC -DLUA_USE_LINUX" linux
- make INSTALL_TOP=$FLATPAK_DEST TO_LIB='liblua.a liblua.so.5.1.5' install
- ln -sf liblua.so.5.1.5 $FLATPAK_DEST/lib/liblua.so
- ln -sf liblua.so.5.1.5 $FLATPAK_DEST/lib/liblua.so.5.1
- install -Dm0644 etc/lua.pc $FLATPAK_DEST/lib/pkgconfig/lua.pc
- ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua51.pc
- ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua5.1.pc
- ln -sf lua.pc $FLATPAK_DEST/lib/pkgconfig/lua-5.1.pc
sources:
- type: archive
url: 'https://www.lua.org/ftp/lua-5.1.5.tar.gz'
sha256: 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
- type: patch
path: lua-5.1.5-so.patch
- type: shell
commands:
- sed -i "s|/usr/local|$FLATPAK_DEST|" etc/lua.pc src/luaconf.h
cleanup:
- '*.a'
- /bin
- /include
- /lib/pkgconfig
- /man

- name: libsecret
buildsystem: meson
config-opts:
- -Dmanpage=false
- -Dvapi=false
- -Dgtk_doc=false
- -Dintrospection=false
# https://gitlab.gnome.org/GNOME/libsecret/-/issues/49
- -Dgcrypt=false
sources:
- commit: 3fe635e64efd4b8dbc9ec3548b0bc8034c7665c4
tag: 0.20.4
type: git
url: https://gitlab.gnome.org/GNOME/libsecret.git
cleanup:
- /bin/secret-tool

- name: libzip
buildsystem: cmake-ninja
config-opts:
- "-DCMAKE_BUILD_TYPE=Release"
- "-DCMAKE_INSTALL_LIBDIR=lib"
cleanup:
- "/include"
- "/bin"
- "/share"
- "/lib/pkgconfig"
- "/lib/*.la"
sources:
- type: archive
url: https://libzip.org/download/libzip-1.9.2.tar.xz
sha256: c93e9852b7b2dc931197831438fee5295976ee0ba24f8524a8907be5c2ba5937

- name: pugixml
buildsystem: cmake-ninja
config-opts:
- -DBUILD_SHARED_LIBS=on .
sources:
- type: archive
url: https://github.com/zeux/pugixml/releases/download/v1.11.4/pugixml-1.11.4.tar.gz
sha256: 8ddf57b65fb860416979a3f0640c2ad45ddddbbafa82508ef0a0af3ce7061716

- name: yajl
buildsystem: cmake-ninja
builddir: true
config-opts:
- '-DCMAKE_BUILD_TYPE=Release'
sources:
- type: archive
url: 'https://github.com/lloyd/yajl/archive/refs/tags/2.1.0.tar.gz'
sha256: 3fb73364a5a30efe615046d07e6db9d09fd2b41c763c5f7d3bfb121cd5c5ac5a

- name: luarocks
buildsystem: simple
build-commands:
- >-
./configure --with-lua=/app --prefix=/app
--with-lua-include=/app/include --force-config
- make build
- make install
build-options:
strip: false
no-debuginfo: true
no-debuginfo-compression: true
sources:
- type: archive
url: 'https://github.com/luarocks/luarocks/archive/refs/tags/v3.9.2.tar.gz'
sha256: a0b36cd68586cd79966d0106bb2e5a4f5523327867995fd66bee4237062b3e3b
cleanup:
- /bin/luarocks*
- /share/luarocks
- /etc/luarocks*

- name: sqlite3
config-opts:
- CFLAGS=-O2 -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE
sources:
- type: archive
url: 'https://www.sqlite.org/2021/sqlite-autoconf-3360000.tar.gz'
sha256: bd90c3eb96bee996206b83be7065c9ce19aef38c3f4fb53073ada0d0b69bbce3
cleanup:
- /bin/sqlite3

- name: pcre8
config-opts:
- "--enable-utf"
- "--enable-unicode-properties"
- "--prefix=/app"
sources:
- type: archive
url: 'https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.bz2'
sha256: 4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8
cleanup:
- /bin/pcre-config
- /bin/pcregrep
- /bin/pcretest

- name: boost
buildsystem: 'simple'
build-commands:
# we don't need to build boost, only using it for headers
- cp -r * /app/include
sources:
- type: archive
url: 'https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2'
sha256: 6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e

- name: luarucks-mods
buildsystem: simple
build-options:
build-args:
- '--share=network'
build-commands:
- luarocks install --tree="/app" lua-yajl YAJL_INCDIR="/app/include" YAJL_LIBDIR="/app/lib" LUA_INCDIR="/app/include"
- luarocks install --tree="/app" luautf8
- luarocks install --tree="/app" LuaFileSystem
- luarocks install --tree="/app" lua-zip ZIP_INCDIR="/app/include" ZIP_LIBDIR="/app/lib" LUA_INCDIR="/app/include"
- luarocks install --tree="/app" LuaSQL-SQLite3 SQLITE_INCDIR="/app/include"
- luarocks install --tree="/app" lrexlib-pcre PCRE_INCDIR="/app/include" PCRE_LIBDIR="/app/lib"

- name: glu
config-opts:
- --disable-static
sources:
- type: archive
url: https://ftp.osuosl.org/pub/blfs/conglomeration/glu/glu-9.0.2.tar.xz
sha256: 6e7280ff585c6a1d9dfcdf2fca489251634b3377bfc33c29e4002466a38d02d4
cleanup:
- /include
- /lib/*.a
- /lib/*.la
- /lib/pkgconfig

- name: mudlet
buildsystem: cmake-ninja
config-opts:
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
sources:
- type: dir
path: ../
13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,19 @@ if(UNIX AND NOT APPLE)
DESTINATION "share/applications" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ
WORLD_READ)

install(
FILES "../mudlet.desktop"
DESTINATION "share/applications" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ
WORLD_READ)
install(
FILES "../mudlet.svg"
DESTINATION "share/icons/hicolor/scalable/apps" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ
WORLD_READ)
install(
FILES "../mudlet.png"
DESTINATION "share/icons/hicolor/256x256/apps" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ
WORLD_READ)

install(
TARGETS mudlet
RUNTIME
Expand Down

0 comments on commit d7fb22f

Please sign in to comment.