tur icon indicating copy to clipboard operation
tur copied to clipboard

Newpkg: Supertux

Open IntinteDAO opened this issue 8 months ago • 26 comments

IntinteDAO avatar Mar 13 '25 16:03 IntinteDAO

@robertkirkman

IntinteDAO avatar Mar 13 '25 17:03 IntinteDAO

do you know how to enable touchscreen buttons in this version?

also, Do you know how to make it buildable in TERMUX_ON_DEVICE_BUILD=true mode?

also, I think that probably this variable TERMUX_ON_DEVICE_BUILD should not be outside of a function in a build.sh, because there is no other package that has this variable outside of a function in a build.sh.

robertkirkman avatar Mar 13 '25 22:03 robertkirkman

do you know how to enable touchscreen buttons in this version?

also, Do you know how to make it buildable in TERMUX_ON_DEVICE_BUILD=true mode?

also, I think that probably this variable TERMUX_ON_DEVICE_BUILD should not be outside of a function in a build.sh, because there is no other package that has this variable outside of a function in a build.sh.

  1. The question is whether we want it to be touchscreen by default. Generally Supertux is also on Android directly. This version can be “like the PC version”. But I don't want to decide it myself.

  2. The problem is that there is no OpenSLES in Android for on-device building. If you comment out LDFLAGS, the compilation will execute successfully.

  3. Forgive me, I don't know much about building packages. What should I change from TERMUX_ON_DEVICE_BUILD?

IntinteDAO avatar Mar 14 '25 16:03 IntinteDAO

  1. sometimes, there is something called an "ubuntu tablet"

image

generally, I prefer to partially pretend that Termux:X11 is probably not a desktop PC, but instead directly compare it to the "ubuntu tablet" for the purposes of touchscreen buttons support.

The thought goes like this: If an X11 application (which is internally using almost exactly the same touchscreen + windowing APIs, driven by the same application-side touchscreen backend code, on an "ubuntu tablet", as it would on Termux:X11) does have the ability to have touchscreen automatically enabled somehow, then it should do so, because the "ubuntu tablet" user would definitely prefer that to be the case.

The keyboard, mouse, or gamepad functionality, should also automatically activate when an external keyboard, mouse, or gamepad input, is used, respectively.

  1. could you tell me whether this command is successful for you or not on your device?

./build-package.sh -I -f luanti

I have been testing this command with my devices, and it has been working, but if on your device, the OpenSLES linking step has an error, then I would like to know about that so I can find out what is inconsistent about it.

  1. You can simply remove that line, and then make sure that the package builds on-device with the same compatibility as it does in the cross-compiler, and then everything will be fine.

robertkirkman avatar Mar 14 '25 16:03 robertkirkman

generally, I prefer to partially pretend that Termux:X11 is probably not a desktop PC, but instead directly compare it to the "ubuntu tablet" for the purposes of touchscreen buttons support.

The thought goes like this: If an X11 application (which is internally using almost exactly the same touchscreen + windowing APIs, driven by the same application-side touchscreen backend code, on an "ubuntu tablet", as it would on Termux:X11) does have the ability to have touchscreen automatically enabled somehow, then it should do so, because the "ubuntu tablet" user would definitely prefer that to be the case.

The keyboard, mouse, or gamepad functionality, should also automatically activate when an external keyboard, mouse, or gamepad input, is used, respectively.


I understand your point of view, although I think Termux rather “emulates” desktop solutions. At least for now. It doesn't support touch screens on a screen-by-screen basis (multi-touch, etc.), but on a mouse-by-mouse basis.


  1. Yes, luanti compilation works from your script, but so does Supertux. On-device compilation, on the other hand, does not work for either Supertux or Luanti.

IntinteDAO avatar Mar 14 '25 20:03 IntinteDAO

I understand your point of view, although I think Termux rather “emulates” desktop solutions. At least for now. It doesn't support touch screens on a screen-by-screen basis (multi-touch, etc.), but on a mouse-by-mouse basis.

this is not correct. in Termux:X11 settings, touch the "direct touch" setting. This is multitouch support.

image

Yes, luanti compilation works from your script, but so does Supertux. On-device compilation, on the other hand, does not work for either Supertux or Luanti.

could you send the result error of what happens from this command for you?

./build-package.sh -I -f luanti

on-device, like I mentioned, for your device, since on my Samsung Galaxy A70 SM-A705FN, and other devices, that works.

robertkirkman avatar Mar 15 '25 01:03 robertkirkman

this is not correct. in Termux:X11 settings, touch the "direct touch" setting. This is multitouch support.

Ok, didn't know that.

could you send the result error of what happens from this command for you?

Not an error - just a loop

CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd

IntinteDAO avatar Mar 16 '25 12:03 IntinteDAO

I can reproduce that, but I do know that it is not exactly directly related to luanti, well, it kind of is, but it's debatable. It happens because of code that is outside of the luanti folder and cannot be really fixed without reorganizing code somewhere else in the termux-packages repository. I will try to fix it in the future but not right now.

The text CPAN build and cache directory? only happens if you try to use build-package.sh on any package that depends on the package xdg-utils on-device while not already ever having had the package xdg-utils installed before trying to build. Unfortunately luanti is the first package in termux-packages that has a legitimate runtime dependency on xdg-utils (unless there are other packages I haven't noticed that have runtime failures because of not being patched to depend on xdg-utils), so it is the only package for which the edge case of build-package.sh trying to install xdg-utils during dependency fetching is reachable.

The code that is entering an infinite loop for you is somewhere inside this command that runs during the postinst script of xdg-utils.

cpan -fi File::MimeInfo

https://github.com/termux/termux-packages/blob/4c8fe0c5784e2b43fcdef579ff2d54484a2e37ad/x11-packages/xdg-utils/build.sh#L36

I know that because the text CPAN build and cache directory? only appears inside the code of perl, not anywhere else,

https://github.com/Perl/perl5/blob/27e7aaa9d0cc16ae5413e08b6dd5ab61cc839652/cpan/CPAN/lib/CPAN/FirstTime.pm#L1706

and the command cpan is provided by the package perl.

The way to reproduce this infinite loop is using these commands:

pkg remove -y xdg-utils
rm -rf ~/.cpan
cd tur/
./setup-environment.sh
scripts/setup-termux.sh
./build-package.sh -I -f luanti

Could you use this commands instead to make sure that you do not reach that infinite loop case?

pkg upgrade -y
pkg install xdg-utils
cd tur/
git pull origin master
./setup-environment.sh
scripts/setup-termux.sh
./build-package.sh -I -f luanti

robertkirkman avatar Mar 16 '25 13:03 robertkirkman

@robertkirkman I have one question. Can you jump (using space) in game? I don't know that I have a problem with the game or Termux X11 or something else.

IntinteDAO avatar Mar 18 '25 20:03 IntinteDAO

@robertkirkman I have one question. Can you jump (using space) in game? I don't know that I have a problem with the game or Termux X11 or something else.

There is a problem with keybindings yes, but it is not limited to supertux, some similar problems with both Space and Backspace also happen with X11 on Android with other games (in X11 servers both like Termux:X11 and also Xvnc from the package tigervnc [which is not the same thing as Termux:X11, but can run the same bionic-libc builds of games for testing behaviors]). It is possible to patch games to work around some of the problems, but then all games would need similar patches - I suspect there might be a way to fix the keybindings for multiple games simultaneously without having to customize patches individually for each affected game, but I don't know how to do that yet. I'm sorry for not responding sooner - I have not had time to work on supertux recently. I will try to make a solution for you for this soon

robertkirkman avatar Mar 20 '25 21:03 robertkirkman

@IntinteDAO I tried running it after installing it, but it didn't work.

~$ supertux2
CANNOT LINK EXECUTABLE "supertux2": cannot locate symbol "_ZN5boost10filesystem6detail28directory_iterator_constructERNS0_18directory_iteratorERKNS0_4pathEjPNS1_25directory_iterator_paramsEPNS_6system10error_codeE" referenced by "/data/data/com.termux/files/usr/bin/supertux2"...

hansm629 avatar Apr 15 '25 15:04 hansm629

@hansm629 Try now

IntinteDAO avatar Apr 16 '25 13:04 IntinteDAO

@IntinteDAO It works very well! Screenshot_2025-04-17_00-23-25 Screenshot_2025-04-17_00-25-20

hansm629 avatar Apr 16 '25 15:04 hansm629

@hansm629

Does space button works to you or you need to remap a key?

IntinteDAO avatar Apr 16 '25 18:04 IntinteDAO

@IntinteDAO Sorry for the late reply. Both the jump key and the attack key work fine! Screenshot_2025-04-19_10-50-43

hansm629 avatar Apr 19 '25 01:04 hansm629

@robertkirkman I think the bug with keyboard is fixed, please upgrade Termux X11 and confirm. It also works on Luanti

IntinteDAO avatar Apr 19 '25 18:04 IntinteDAO

@robertkirkman I think the bug with keyboard is fixed, please upgrade Termux X11 and confirm. It also works on Luanti

In the build of SuperTux I downloaded from the artifacts here just now, on Samsung Galaxy A70 with Termux:X11 APK version 20250410 and termux-x11-nightly version 1.03.01-4, by default the Space bar on an external USB keyboard is still not working with Jump by default, however, I have just noticed that Space does begin working in SuperTux for jumping IF "prefer scancodes when possible" is set to enabled in Termux:X11 preferences. I don't think I had tested that setting in SuperTux previously, and I had only used it for Luanti.

Regarding Luanti, what version of Luanti did you test, version 1:5.11.0-1, or version 1:5.11.0-2?

Version 1:5.11.0-2 is a version that I have patched specifically to force the Space bar to work for jump by default with no custom keybind required, fixing the problem that now seems to only exist in Luanti.

  • https://github.com/termux/termux-packages/pull/24231

robertkirkman avatar Apr 19 '25 21:04 robertkirkman

5.11.0-2 This one. So probably a patch is merged. But still something fix a issue, maybe this one: https://github.com/termux/termux-x11/commit/295381c5df9a89860d0920f853c2e12843e7b15f

But still, we need to downgrade luanti, check and then maybe contact with twaik to fix a issue on USB Keyboard if needed

IntinteDAO avatar Apr 20 '25 07:04 IntinteDAO

5.11.0-2 This one. So probably a patch is merged. But still something fix a issue, maybe this one: termux/termux-x11@295381c

But still, we need to downgrade luanti, check and then maybe contact with twaik to fix a issue on USB Keyboard if needed

I tested that PR before it was merged and described what happened for me here, you can read about what I saw in Luanti there:

  • https://github.com/termux/termux-x11/pull/768#issuecomment-2692202601

if you downgrade luanti, but keep the current Termux:X11 version, you should be able to reproduce the exact behavior i explained there (because at the time I wrote that, was using the older Luanti version, but using the then-future Termux:X11 version)

robertkirkman avatar Apr 20 '25 07:04 robertkirkman

Oh, but I only explained about the Backspace there. Ok, specifically regarding Space and 9-Key: if you downgrade Luanti and use any known Termux:X11 version (older or newer), then Space and 9-Key will have swapped behavior, meaning that 9-Key will jump and Space will type "9" symbol. but in the current Luanti from pkg install I forcibly changed that by applying a patch to the package and merging it into termux-packages repository.

robertkirkman avatar Apr 20 '25 07:04 robertkirkman

Originally I thought that would also affect SuperTux, but it now seems like that specific problem only affects Luanti as far as is currently known.

robertkirkman avatar Apr 20 '25 07:04 robertkirkman

@robertkirkman @hansm629 Does "space" button still works for you?

IntinteDAO avatar May 21 '25 18:05 IntinteDAO

It does, if "prefer scancodes when possible" is set to enabled.

SuperTux 7 which will support touchscreen buttons in X11 (as seen in the version I packaged as a test) might take a long time to officially release, so this could be added initially in TUR and then after a little while if SuperTux 7 does not officially release, I can open a PR here which bumps to the development commit and cherry picked upstream PR, and fixes any other problems.

For example another problem is that this package is supposed to depend on xdg-utils, but if it were marked for it, clean on-device building would get an infinite loop because of the bug in the postinst script of the xdg-utils package. really the correct solution should be to rewrite the postinst script of xdg-utils to make it not buggy

robertkirkman avatar May 21 '25 20:05 robertkirkman

IMO this game is pretty much playable like this IF you have have a keyboard, the problems are really small details that can be improved later.

* I have a different version of this package with some differences, but they aren't that important to have in a single PR.

* If this game ends up being approved, then soon afterward I would play it, and make a different PR later with any changes I want to apply (like unofficial touchscreen buttons from the PR to the upstream repository, which I tested works as the solution to touchscreen buttons for this game in Termux:X11) [SuperTux/supertux#3021](https://github.com/SuperTux/supertux/pull/3021),

* and those other changes could be discussed at that time.

Well, ofc. we should remember that Supertux2 have native Android application with touchscreen. But I can wait for newest version

IntinteDAO avatar Jul 12 '25 10:07 IntinteDAO

could you send the result error of what happens from this command for you?

Not an error - just a loop

CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd
CPAN build and cache directory? [/pzstd                          packages/zstd] /pzstd                          packages/zstd

I am trying to permanently fix this here

  • https://github.com/termux/termux-packages/pull/27116

after I merge that, the infinite loop should disappear

robertkirkman avatar Nov 05 '25 15:11 robertkirkman

Ok the infinite loop should now be actually fixed, so you can add xdg-utils to dependencies here and it should work without that problem anymore

robertkirkman avatar Nov 08 '25 02:11 robertkirkman