Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tur/megaglest/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
TERMUX_PKG_HOMEPAGE=https://megaglest.org/
TERMUX_PKG_DESCRIPTION="A free and open source 3D real-time strategy game"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@IntinteDAO"
TERMUX_PKG_VERSION=3.13.0
TERMUX_PKG_SRCURL=https://github.com/MegaGlest/megaglest-source/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=e02e58c2329558cc5d67374b5e5f9b3cfaafc300b96feff71df8d4b0d39e1eaa
TERMUX_PKG_DEPENDS="glib, openal-soft, sdl2, libvorbis, libjpeg-turbo, libpng, freetype, curl, libxml2, wxwidgets, lua52, fribidi, libandroid-glob, libftgl2, glew"

TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DLUA_LIBRARIES=${TERMUX_PREFIX}/lib/liblua5.2.so
-DLUA_INCLUDE_DIR=${TERMUX_PREFIX}/include/lua5.2
-DLUA_MATH_LIBRARY=$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libm.so
Copy link
Member

@robertkirkman robertkirkman Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just write -DLUA_MATH_LIBRARY=m does that work instead and prevent the error in CI? Yes I know that some packages like neovim do this, but it just looks like a big mess, maybe it's fine with only -DLUA_MATH_LIBRARY=m. If it really does have to be like this then you can move this to termux_step_pre_configure() (like it is in neovim)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I see when I test, it does need either that or a patch, so put it in termux_step_pre_configure() like neovim:

termux_step_pre_configure() {
	TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLUA_MATH_LIBRARY=$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libm.so"

-DWANT_STATIC_LIBS=OFF
-DBUILD_SHARED_LIBS=ON
-DBUILD_MEGAGLEST_MAP_EDITOR=OFF
-DCMAKE_SYSTEM_NAME=OpenBSD
-DBUILD_MEGAGLEST_MODEL_VIEWER=OFF
-DMEGAGLEST_DATA_INSTALL_PATH=share/games/megaglest/
-DWANT_DEV_OUTPATH=ON
"

termux_step_pre_configure() {
export LDFLAGS+=" -landroid-glob -Wl,--no-as-needed,-lOpenSLES,--as-needed"
export CFLAGS+=" -D__OpenBSD__"
export CXXFLAGS+=" -D__OpenBSD__"
}

termux_step_post_make_install() {
echo "POST INSTALL for Menu entries"
Copy link
Member

@robertkirkman robertkirkman Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do? (is it a placeholder for WIP function?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The game does not install game data files, as they are located in a different source. This needs to be fixed so that the game and game data are installed at the same time.

You can add additional URLs in TERMUX_PKG_SRCURL, like this:

TERMUX_PKG_SRCURL=(https://github.com/MegaGlest/megaglest-source/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
					https://github.com/MegaGlest/megaglest-data/releases/download/3.13.0/megaglest-standalone-data-${TERMUX_PKG_VERSION}.tar.xz)
TERMUX_PKG_SHA256=(e02e58c2329558cc5d67374b5e5f9b3cfaafc300b96feff71df8d4b0d39e1eaa
					996040acfb338cfcbd0612b13db9c1734a7588bcc60c7e9b87e9fd619629dda3)

this will make the megaglest-standalone-data be extracted somewhere in $TERMUX_PKG_SRCDIR too, in this case mixed into the other sources, and you can try to install the assets from there in termux_step_post_make_install().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do? (is it a placeholder for WIP function?)

Yep. I had a issues with that. I usually create a package with 1 link, not 2s and I don't know how to work on 2 archives at once.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I had a issues with that. I usually create a package with 1 link, not 2s and I don't know how to work on 2 archives at once.

I have given the code block which you can copy and paste in order to start with it, but if you still don't understand it, let me know and later I can try to finish the entire thing and send it

}
88 changes: 88 additions & 0 deletions tur/megaglest/linker.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
diff -ur orig/source/shared_lib/include/feathery_ftp/ftpTypes.h mod/source/shared_lib/include/feathery_ftp/ftpTypes.h
--- orig/source/shared_lib/include/feathery_ftp/ftpTypes.h 2017-03-08 21:39:12.000000000 +0100
+++ mod/source/shared_lib/include/feathery_ftp/ftpTypes.h 2025-07-17 11:03:14.934302633 +0200
@@ -69,7 +69,7 @@
extern "C" {
#endif

-int VERBOSE_MODE_ENABLED;
+extern int VERBOSE_MODE_ENABLED;

typedef ip_t (*ftpFindExternalFTPServerIpType)(ip_t clientIp);
typedef void (*ftpAddUPNPPortForwardType)(int internalPort, int externalPort);
@@ -77,11 +77,11 @@
typedef int (*ftpIsValidClientType)(ip_t clientIp);
typedef int (*ftpIsClientAllowedToGetFileType)(ip_t clientIp, const char *username, const char *filename);

-ftpFindExternalFTPServerIpType ftpFindExternalFTPServerIp;
-ftpAddUPNPPortForwardType ftpAddUPNPPortForward;
-ftpRemoveUPNPPortForwardType ftpRemoveUPNPPortForward;
-ftpIsValidClientType ftpIsValidClient;
-ftpIsClientAllowedToGetFileType ftpIsClientAllowedToGetFile;
+extern ftpFindExternalFTPServerIpType ftpFindExternalFTPServerIp;
+extern ftpAddUPNPPortForwardType ftpAddUPNPPortForward;
+extern ftpRemoveUPNPPortForwardType ftpRemoveUPNPPortForward;
+extern ftpIsValidClientType ftpIsValidClient;
+extern ftpIsClientAllowedToGetFileType ftpIsClientAllowedToGetFile;

#ifdef __cplusplus
}
diff -ur orig/source/shared_lib/sources/feathery_ftp/ftpRuntime.c mod/source/shared_lib/sources/feathery_ftp/ftpRuntime.c
--- orig/source/shared_lib/sources/feathery_ftp/ftpRuntime.c 2017-03-08 21:39:12.000000000 +0100
+++ mod/source/shared_lib/sources/feathery_ftp/ftpRuntime.c 2025-07-17 11:04:27.524309864 +0200
@@ -30,6 +30,13 @@
#include "ftp.h"
#include "ftpMessages.h"

+int VERBOSE_MODE_ENABLED = 0;
+ftpFindExternalFTPServerIpType ftpFindExternalFTPServerIp = NULL;
+ftpAddUPNPPortForwardType ftpAddUPNPPortForward = NULL;
+ftpRemoveUPNPPortForwardType ftpRemoveUPNPPortForward = NULL;
+ftpIsValidClientType ftpIsValidClient = NULL;
+ftpIsClientAllowedToGetFileType ftpIsClientAllowedToGetFile = NULL;
+

/**
* @brief server-sockets that listens for incoming connections
diff -ur orig/source/shared_lib/sources/platform/posix/miniftpserver.cpp mod/source/shared_lib/sources/platform/posix/miniftpserver.cpp
--- orig/source/shared_lib/sources/platform/posix/miniftpserver.cpp 2017-03-08 21:39:12.000000000 +0100
+++ mod/source/shared_lib/sources/platform/posix/miniftpserver.cpp 2025-07-17 11:06:54.287657818 +0200
@@ -40,7 +40,7 @@
static std::map<uint32,uint32> clientToFTPServerList;
FTPClientValidationInterface * FTPServerThread::ftpValidationIntf = NULL;

-ip_t FindExternalFTPServerIp(ip_t clientIp) {
+static ip_t FindExternalFTPServerIp(ip_t clientIp) {
ip_t result = clientToFTPServerList[clientIp];

if(SystemFlags::VERBOSE_MODE_ENABLED) printf("===> FTP Server thread clientIp = %u, result = %u\n",clientIp,result);
@@ -49,7 +49,7 @@
return result;
}

-int isValidClientType(ip_t clientIp) {
+static int isValidClientType(ip_t clientIp) {
int result = 0;
if(FTPServerThread::getFtpValidationIntf() != NULL) {
result = FTPServerThread::getFtpValidationIntf()->isValidClientType(clientIp);
@@ -57,7 +57,7 @@
return result;
}

-int isClientAllowedToGetFile(ip_t clientIp, const char *username, const char *filename) {
+static int isClientAllowedToGetFile(ip_t clientIp, const char *username, const char *filename) {
int result = 1;

//printf("In [%s::%s] Line: %d username [%s] file [%s]\n",__FILE__,__FUNCTION__,__LINE__,username,filename);
@@ -87,9 +87,9 @@
this->ftpValidationIntf = ftpValidationIntf;
this->tempFilesPath = tempFilesPath;

- ftpInit(&FindExternalFTPServerIp,&UPNP_Tools::AddUPNPPortForward,&UPNP_Tools::RemoveUPNPPortForward,
+ ftpInit(&FindExternalFTPServerIp, &UPNP_Tools::AddUPNPPortForward, &UPNP_Tools::RemoveUPNPPortForward,
&isValidClientType, &isClientAllowedToGetFile);
- VERBOSE_MODE_ENABLED = SystemFlags::VERBOSE_MODE_ENABLED;
+ //VERBOSE_MODE_ENABLED = SystemFlags::VERBOSE_MODE_ENABLED;

if(SystemFlags::VERBOSE_MODE_ENABLED) printf("***FTP SERVER STARTED [%p]\n",this);
}
Loading
Loading