Skip to content

Commit

Permalink
new package: movit
Browse files Browse the repository at this point in the history
  • Loading branch information
knyipab authored and licy183 committed May 30, 2024
1 parent 604de80 commit 15113d7
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
11 changes: 11 additions & 0 deletions x11-packages/movit/0001-use-make_bundled_shaders.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/Makefile.in
+++ b/Makefile.in
@@ -185,7 +185,7 @@
make_bundled_shaders: $(MAKE_BUNDLE_OBJS)
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o make_bundled_shaders $(MAKE_BUNDLE_OBJS) -lepoxy
bundled_shaders.cpp: make_bundled_shaders $(SHADERS)
- ./make_bundled_shaders $(SHADERS) > $@
+ ./make_bundled_shaders.py $(SHADERS) > $@

install: libmovit.la
$(MKDIR) -p $(DESTDIR)$(libdir)/
30 changes: 30 additions & 0 deletions x11-packages/movit/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TERMUX_PKG_HOMEPAGE=https://movit.sesse.net/
TERMUX_PKG_DESCRIPTION="The modern video toolkit"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=1.7.1
TERMUX_PKG_SRCURL=https://movit.sesse.net/movit-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=b33073b705f0ccb6ac4942cf51151515407b40bb4e9a2dd0228c1c2cb1fbc11a
TERMUX_PKG_DEPENDS="fftw, libepoxy"
TERMUX_PKG_BUILD_DEPENDS="eigen, googletest, sdl2"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-static"
TERMUX_PKG_EXTRA_MAKE_ARGS="TESTS="

termux_step_post_get_source() {
cp $TERMUX_PKG_BUILDER_DIR/make_bundled_shaders.py $TERMUX_PKG_SRCDIR/
chmod +x $TERMUX_PKG_SRCDIR/make_bundled_shaders.py
}

termux_step_pre_configure() {
# fix arm build and potentially other archs hidden bugs
# ERROR: ./lib/libmovit.so contains undefined symbols:
# 69: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uidiv
# 120: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_idiv
# 155: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_ul2d
# 205: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_uidivmod
# 217: 00000000 0 NOTYPE GLOBAL DEFAULT UND __aeabi_idivmod
LDFLAGS+=" $($CC -print-libgcc-file-name)"
autoreconf -fi
}
56 changes: 56 additions & 0 deletions x11-packages/movit/make_bundled_shaders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3

from collections import namedtuple
import string
import sys

def printf(format, *args):
print(format % args, end="")

BundledShader = namedtuple("BundledShader", "filename offset length")

def read_file(filename):
with open(filename, "rb") as fp:
return fp.read()

def main(argc, argv):
shaders = []
bundle = bytearray()

for i in range(1, argc):
contents = read_file(argv[i])
shaders.append(BundledShader(argv[i], len(bundle), len(contents)))
bundle += contents

printf("// Autogenerated by make_bundled_shaders.py. Do not edit by hand!\n")
printf("#include <string>\n")
printf("#include \"bundled_shaders.h\"\n")
printf("\n")
printf("namespace movit {\n")
printf("\n")
printf("BundledShader bundled_shaders[] = {\n")
for shader in shaders:
printf("\t{ \"%s\", %u, %u },\n", shader.filename, shader.offset, shader.length)
printf("\t{ nullptr, 0, 0 }\n")
printf("};\n")
printf("const char *shader_bundle = \"")
for ch in bundle:
ch = chr(ch)
if ch == '\n':
printf("\\n")
elif ch == '\t':
printf("\\t")
elif ch == '"':
printf("\\\"")
elif ch == '\\':
printf("\\\\")
elif not ch in string.printable:
printf("\\%o", ord(ch))
else:
printf("%c", ch)
printf("\";\n")
printf("\n")
printf("} // namespace movit\n")

if __name__ == '__main__':
main(len(sys.argv), sys.argv)

0 comments on commit 15113d7

Please sign in to comment.