Skip to content

Commit

Permalink
fix(tur/luanti): prepend termux prefix to tmp paths (termux-user-repo…
Browse files Browse the repository at this point in the history
…sitory#1326)

Fixes termux-user-repository#1325

Lua portion adapted from the patch for the `/tmp` folder
in the Lua packages of termux-packages, here:
https://github.com/termux/termux-packages/blob/master/packages/liblua52/lua-5.2.4_src_loslib.c.patch
  • Loading branch information
robertkirkman authored Nov 23, 2024
1 parent a73f45e commit 3ee3cd9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tur/luanti/0003-prepend-termux-prefix-to-tmp-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Fixes "An error occurred: Failed to download 'Minetest Game'"
when trying to download any gamemode through the builtin browser,
as described here: https://github.com/termux-user-repository/tur/issues/1325

Lua portion adapted from https://github.com/termux/termux-packages/blob/master/packages/liblua52/lua-5.2.4_src_loslib.c.patch
--- a/lib/lua/src/luaconf.h
+++ b/lib/lua/src/luaconf.h
@@ -653,9 +653,9 @@ union luai_Cast { double l_d; long l_l; };

#if defined(LUA_USE_MKSTEMP)
#include <unistd.h>
-#define LUA_TMPNAMBUFSIZE 32
+#define LUA_TMPNAMBUFSIZE 512
#define lua_tmpnam(b,e) { \
- strcpy(b, "/tmp/lua_XXXXXX"); \
+ strcpy(b, "@TERMUX_PREFIX@/tmp/lua_XXXXXX"); \
e = mkstemp(b); \
if (e != -1) close(e); \
e = (e == -1); }
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -439,7 +439,7 @@ std::string TempPath()
#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION
return porting::path_cache;
#else
- return DIR_DELIM "tmp";
+ return "@TERMUX_PREFIX@" DIR_DELIM "tmp";
#endif
}

1 change: 1 addition & 0 deletions tur/luanti/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="An open source voxel game engine."
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux-user-repository"
TERMUX_PKG_VERSION=1:5.10.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/minetest/minetest/archive/refs/tags/${TERMUX_PKG_VERSION:2}.zip
TERMUX_PKG_SHA256=e74e994c0f1b188d60969477f553ad83b8ce20ee1e0e2dcd068120189cb0f56c
TERMUX_PKG_AUTO_UPDATE=true
Expand Down

0 comments on commit 3ee3cd9

Please sign in to comment.