addpkg(x11/glslviewer): 3.2.4 (#23811)

- Fixes https://github.com/termux/termux-packages/issues/23809

- Fixes https://github.com/patriciogonzalezvivo/glslViewer/issues/373

Co-authored-by: Robert Kirkman <rkirkman@termux.dev>
This commit is contained in:
termux-pacman-bot
2025-03-17 04:04:13 +00:00
parent ccc80742cf
commit a1461e16b5
7 changed files with 229 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
TERMUX_PKG_HOMEPAGE="https://patriciogonzalezvivo.com/2015/glslViewer/"
TERMUX_PKG_DESCRIPTION="Console-based GLSL Sandbox for 2D/3D shaders"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="3.2.4"
TERMUX_PKG_SRCURL=git+https://github.com/patriciogonzalezvivo/glslViewer
TERMUX_PKG_GIT_BRANCH=$TERMUX_PKG_VERSION
TERMUX_PKG_DEPENDS="ffmpeg, glfw, glu, libdrm, liblo, libxcb, mesa-dev, ncurses"
TERMUX_PKG_RECOMMENDS="xorg-server-xvfb"
TERMUX_PKG_AUTO_UPDATE=true
termux_step_pre_configure() {
CPPFLAGS+=" -Wno-implicit-function-declaration"
}

View File

@@ -0,0 +1,22 @@
Fixes error: call to member function 'setUniform' is ambiguous
--- a/src/core/uniforms.cpp
+++ b/src/core/uniforms.cpp
@@ -88,7 +88,7 @@ Uniforms::Uniforms() : m_frame(0), m_play(true), m_change(false) {
//
functions["u_iblLuminance"] = UniformFunction("float", [this](vera::Shader& _shader) {
if (activeCamera)
- _shader.setUniform("u_iblLuminance", 30000.0f * activeCamera->getExposure());
+ _shader.setUniform("u_iblLuminance", float(30000.0f * activeCamera->getExposure()));
},
[this]() {
if (activeCamera)
@@ -150,7 +150,7 @@ Uniforms::Uniforms() : m_frame(0), m_play(true), m_change(false) {
functions["u_cameraExposure"] = UniformFunction("float", [this](vera::Shader& _shader) {
if (activeCamera)
- _shader.setUniform("u_cameraExposure", activeCamera->getExposure());
+ _shader.setUniform("u_cameraExposure", float(activeCamera->getExposure()));
},
[this]() {
if (activeCamera)

View File

@@ -0,0 +1,16 @@
Fixes ERROR: MIME cache found in package. Please disable 'update-mime-database'.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -167,10 +166,6 @@ else()
install(CODE "execute_process(COMMAND ${XDG-MIME_EXECUTABLE} default ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications/glslViewer.desktop model/obj)")
install(CODE "execute_process(COMMAND ${XDG-MIME_EXECUTABLE} default ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications/glslViewer.desktop model/gltf-binary)")
install(CODE "execute_process(COMMAND ${XDG-MIME_EXECUTABLE} default ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications/glslViewer.desktop model/gltf+json)")
- find_program(UPDATE_MIME_DATABASE update-mime-database)
- install(CODE "execute_process(COMMAND ${UPDATE_MIME_DATABASE} ${CMAKE_INSTALL_FULL_DATAROOTDIR}/mime )")
- find_program(UPDATE_DESKTOP_DATABASE update-desktop-database)
- install(CODE "execute_process(COMMAND ${UPDATE_DESKTOP_DATABASE} ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications)")
# Add a thumbnailer for 3D Models
install(FILES "${PROJECT_SOURCE_DIR}/assets/glslViewer.thumbnailer" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/thumbnailers)

View File

@@ -0,0 +1,44 @@
Works around error: use of undeclared identifier 'pthread_cancel'
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -203,6 +203,14 @@ void loop() {
#endif
}
+#ifdef __ANDROID__
+static void
+thread_signal_handler (int signum)
+{
+ pthread_exit (0);
+}
+#endif
+
// Main program
//============================================================================
int main(int argc, char **argv) {
@@ -1113,11 +1121,24 @@ int main(int argc, char **argv) {
// Wait for watchers to end
fileWatcher.join();
+ #ifdef __ANDROID__
+ struct sigaction actions;
+ memset (&actions, 0, sizeof (actions));
+ sigemptyset (&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = thread_signal_handler;
+ sigaction (SIGUSR2, &actions, NULL);
+ #endif
+
// Force cinWatcher to finish (because is waiting for input)
#ifndef PLATFORM_WINDOWS
pthread_t cinHandler = cinWatcher.native_handle();
+ #ifdef __ANDROID__
+ pthread_kill(( cinHandler ), SIGUSR2);
+ #else
pthread_cancel( cinHandler );
#endif
+ #endif
#if defined(SUPPORT_NCURSES)
endwin();

View File

@@ -0,0 +1,89 @@
Fixes src/core/tools/record.cpp:47:29: error: redefinition of 'pipe' as different kind of symbol
--- a/src/core/tools/record.cpp
+++ b/src/core/tools/record.cpp
@@ -44,7 +44,7 @@ using Clock = std::chrono::steady_clock;
using TimePoint = std::chrono::time_point<Clock>;
using Seconds = std::chrono::duration<float>;
-FILE* pipe = nullptr;
+FILE* ffmpeg_pipe = nullptr;
std::atomic<bool> pipe_isRecording;
std::thread pipe_thread;
RecordingSettings pipe_settings;
@@ -53,7 +53,7 @@ TimePoint pipe_start;
TimePoint pipe_lastFrame;
LockFreeQueue pipe_frames;
-bool recordingPipe() { return (pipe != nullptr && pipe_isRecording.load()); }
+bool recordingPipe() { return (ffmpeg_pipe != nullptr && pipe_isRecording.load()); }
// From https://github.com/tyhenry/ofxFFmpeg
bool recordingPipeOpen(const RecordingSettings& _settings, float _start, float _end) {
@@ -128,12 +128,12 @@ bool recordingPipeOpen(const RecordingSettings& _settings, float _start, float _
// std::cout << cmd << std::endl;
- if ( pipe != nullptr )
- P_CLOSE( pipe );
+ if ( ffmpeg_pipe != nullptr )
+ P_CLOSE( ffmpeg_pipe );
- pipe = P_OPEN( cmd.c_str() );
+ ffmpeg_pipe = P_OPEN( cmd.c_str() );
- if ( !pipe ) {
+ if ( !ffmpeg_pipe ) {
// // get error string from 'errno' code
// char errmsg[500];
// std::strerror_s( errmsg, 500, errno );
@@ -168,7 +168,7 @@ void processFrame() {
if ( pipe_frames.consume( std::move( pixels ) ) && pixels ) {
std::unique_ptr<unsigned char[]> data = std::move( pixels );
const size_t dataLength = pipe_settings.src_width * pipe_settings.src_height * pipe_settings.src_channels;
- const size_t written = pipe ? fwrite( data.get(), sizeof( char ), dataLength, pipe ) : 0;
+ const size_t written = ffmpeg_pipe ? fwrite( data.get(), sizeof( char ), dataLength, ffmpeg_pipe ) : 0;
if ( written <= 0 )
std::cout << "Unable to write the frame." << std::endl;
@@ -188,9 +188,9 @@ void processFrame() {
// close ffmpeg pipe once stopped recording
- if ( pipe ) {
+ if ( ffmpeg_pipe ) {
console_clear();
- if ( P_CLOSE( pipe ) < 0 ) {
+ if ( P_CLOSE( ffmpeg_pipe ) < 0 ) {
// // get error string from 'errno' code
// char errmsg[500];
// strerror_s( errmsg, 500, errno );
@@ -202,7 +202,7 @@ void processFrame() {
console_refresh();
}
- pipe = nullptr;
+ ffmpeg_pipe = nullptr;
counter = 0;
}
@@ -212,7 +212,7 @@ size_t recordingPipeFrame( std::unique_ptr<unsigned char[]>&& _pixels ) {
return 0;
}
- if ( !pipe ) {
+ if ( !ffmpeg_pipe ) {
std::cerr << "Can't add new frame - FFmpeg pipe is invalid!" << std::endl;
return 0;
}
@@ -264,8 +264,8 @@ void recordingPipeClose() {
if ( pipe_thread.joinable() )
pipe_thread.join();
- if ( pipe != nullptr )
- P_CLOSE( pipe );
+ if ( ffmpeg_pipe != nullptr )
+ P_CLOSE( ffmpeg_pipe );
}
#else

View File

@@ -0,0 +1,31 @@
Fixes ld.lld: error: undefined symbol: index
--- a/deps/CMakeLists.txt
+++ b/deps/CMakeLists.txt
@@ -1,6 +1,2 @@
## VERA
add_subdirectory(vera)
-
-if (NOT EMSCRIPTEN)
- add_subdirectory(liblo/cmake)
-endif()
\ No newline at end of file
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,7 +54,6 @@ add_executable(glslViewer
)
-include_directories(deps/liblo)
target_include_directories(glslViewer PRIVATE deps)
target_link_libraries(glslViewer PRIVATE vera)
# target_compile_definitions(vera PUBLIC SUPPORT_PLY_BINARY)
@@ -148,7 +147,7 @@ else()
set(CPACK_GENERATOR "ZIP")
else()
- target_link_libraries(glslViewer PRIVATE pthread dl lo_static)
+ target_link_libraries(glslViewer PRIVATE pthread dl lo)
install(TARGETS glslViewer DESTINATION ${CMAKE_INSTALL_BINDIR})
if (NOT APPLE)

View File

@@ -0,0 +1,13 @@
Fixes ld.lld: error: undefined symbol: _glfwInitJoysticksLinux
--- a/deps/vera/deps/CMakeLists.txt
+++ b/deps/vera/deps/CMakeLists.txt
@@ -5,7 +5,7 @@ if (NOT NO_X11 AND NOT FORCE_GBM AND NOT EMSCRIPTEN)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
set(GLFW_INSTALL OFF CACHE BOOL "")
- add_subdirectory(glfw)
+ find_package(glfw3 3.3 REQUIRED)
if(APPLE)
target_compile_options(glfw PRIVATE "-Wno-deprecated-declarations")