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
11 changes: 11 additions & 0 deletions tur/numptyphysics/box2d.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/external/Box2D/Source/Makefile
+++ b/external/Box2D/Source/Makefile
@@ -6,7 +6,7 @@
TARGETS += Gen/nds-float/lib/libbox2d.a Gen/nds-fixed/lib/libbox2d.a
endif

-CXXFLAGS= -g -O2
+CXXFLAGS ?= -g -O2

SOURCES = \
./Dynamics/b2Body.cpp \
20 changes: 20 additions & 0 deletions tur/numptyphysics/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
TERMUX_PKG_HOMEPAGE=https://gitlab.com/thp/numptyphysics
TERMUX_PKG_DESCRIPTION="Crayon based physics puzzle game"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@IntinteDAO"
TERMUX_PKG_VERSION=0.3.10
TERMUX_PKG_SRCURL=https://gitlab.com/thp/numptyphysics/-/archive/0.3.10/numptyphysics-0.3.10.tar.bz2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It should probably have $TERMUX_PKG_VERSION used in TERMUX_PKG_SRCURL instead of the version number hardcoded.

TERMUX_PKG_SHA256=f863ba1bae51934bef31984e40ce1b3dbd82672c0bcd705b50185dd40c4f3618
TERMUX_PKG_DEPENDS="libtinyxml2, fontconfig, sdl2 | sdl2-compat, sdl2-image, sdl2-ttf"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_GROUPS="games"

termux_step_pre_configure() {
# Version is determined by git, but we don't have git repo here
export VERSION=$TERMUX_PKG_VERSION
}

termux_step_make_install() {
make install PREFIX=$TERMUX_PREFIX
make install_freedesktop PREFIX=$TERMUX_PREFIX
}
12 changes: 12 additions & 0 deletions tur/numptyphysics/install-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -3,7 +3,7 @@

install: $(APP) $(ADDITIONAL_INSTALL_TARGETS)
install -D -m 755 $(APP) $(DESTDIR)/$(PREFIX)/bin/$(APP)
- mkdir -p $(DESTDIR)/$(PREFIX)/share/$(APP)
- cp -rpv data $(DESTDIR)/$(PREFIX)/share/$(APP)/
+ mkdir -p $(DESTDIR)/$(PREFIX)/share/games/$(APP)
+ cp -rpv data $(DESTDIR)/$(PREFIX)/share/games/$(APP)/

.PHONY: install
28 changes: 28 additions & 0 deletions tur/numptyphysics/numptyphysics-0.3.8-respect-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://gitweb.gentoo.org/repo/gentoo.git/plain/games-puzzle/numptyphysics/numptyphysics-0.3.8.ebuild
From: games@gentoo.org
Subject: respect LDFLAGS
Forwarded: https://gitlab.com/thp/numptyphysics/-/merge_requests/39/diffs

---

diff '--color=auto' -NarU 2 a/external/Box2D/Source/Makefile b/external/Box2D/Source/Makefile
--- a/makefile
+++ b/makefile
@@ -37,7 +37,7 @@

$(TARGET): $(OBJECTS) $(LOCAL_LIBS)
$(SILENTMSG) "\tLD\t$@\n"
- $(SILENTCMD) $(CXX) -o $@ $^ $(LIBS)
+ $(SILENTCMD) $(CXX) -o $@ $^ $(LDFLAGS) $(LIBS)

clean: $(ADDITIONAL_CLEAN_TARGETS)
$(SILENTMSG) "\tCLEAN\n"
--- a/mk/pkgs.mk
+++ b/mk/pkgs.mk
@@ -1,4 +1,4 @@
ifneq ($(PKGS),)
-CXXFLAGS += $(shell $(CROSS_COMPILE)pkg-config --cflags $(PKGS))
-LIBS += $(shell $(CROSS_COMPILE)pkg-config --libs $(PKGS))
+CXXFLAGS += $(shell $(PKG_CONFIG) --cflags $(PKGS))
+LIBS += $(shell $(PKG_CONFIG) --libs $(PKGS))
endif
11 changes: 11 additions & 0 deletions tur/numptyphysics/unvendor-tinyxml2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/mk/main.in
+++ b/mk/main.in
@@ -3,7 +3,7 @@
include_makefile(platform/$(PLATFORM)/platform.mk)

add_external(thp)
-add_external(tinyxml2)
+add_pkgconfig(tinyxml2)
add_external(petals_log)
add_external(vmath)

17 changes: 17 additions & 0 deletions tur/numptyphysics/usr-games.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
From: Alexandre Detiste <tchet@debian.org>
Subject: use standard Debian games path
Forwarded: no

diff --git a/src/Os.cpp b/src/Os.cpp
index a741110..6de71a7 100644
--- a/src/Os.cpp
+++ b/src/Os.cpp
@@ -290,6 +290,8 @@ Os::appName()
std::string
Os::globalDataDir()
{
+ return "@TERMUX_PREFIX@/share/games/numptyphysics/data/";
Copy link
Copy Markdown
Member

@robertkirkman robertkirkman Jan 27, 2026

Choose a reason for hiding this comment

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

This patch, and the install-path.patch above, are in my opinion both "Debianisms". I think that all they do is move the app data path around to fit a Debian policy that I don't think necessarily exists in Termux; at least in my opinion, allowing the game to use its default location (if that's $TERMUX_PREFIX/share/numptyphysics/data) is probably fine.

I understand now that you did this to xmoto, but I admit I did not think about what you were doing very critically at that time, and I assumed that maybe you had changed the paths because the game otherwise failed to launch.

Does this game fail to work if you remove the patches that create the Debianism games folder?

Copy link
Copy Markdown
Member

@robertkirkman robertkirkman Jan 27, 2026

Choose a reason for hiding this comment

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

I understand that there are a couple of other packages in Termux that do already install a games folder, for example xboard, but in those cases that happens because the upstream code already contains references to a games folder, meaning that upstream intended that location relative to $PREFIX for their project.

In the case of numptyphysics, upstream shows that they intend the location relative to $PREFIX to be share/numptyphysics.

The reason I just feel concerned about allowing this in Termux is because:

Termux should, in my opinion, prioritize maintaining patches that are necessary for the functioning of the software on Android and also for the functioning of the software in harmony with the other packages in Termux, and should avoid exactly duplicating patches from other distros that only serve a purpose in the other distro and have no measurable benefits for Termux. This keeps the software behavior as close as possible to the intentions of upstream developers, while also reducing the amount of maintenance work required for bumping the packages in Termux.

+
std::string sourceData = thp::format("%s/data", g_appDir.c_str());

// Prefer './data' in the source checkout if available