1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2026-04-19 07:53:34 +02:00

Added new version of tvtime.

This commit is contained in:
2021-02-02 19:45:17 +01:00
parent f7a4535438
commit 6700fc39b1
9 changed files with 473 additions and 34 deletions

View File

@@ -0,0 +1,25 @@
--- a/src/utils.c
+++ b/src/utils.c
@@ -202,17 +202,11 @@
}
}
- /* If we can't use our /tmp directory, put the fifo in $HOME. */
- if( !mkdir_and_force_owner( fifodir, uid, getgid() ) ) {
- if( asprintf( &fifo, "%s/.tvtime/tvtimefifo-%s",
- getenv( "HOME" ), hostname ) < 0 ) {
- fifo = 0;
- }
- } else {
- if( asprintf( &fifo, "%s/tvtimefifo-%s", fifodir, hostname ) < 0 ) {
- fifo = 0;
- }
- }
+ /* put the fifo in $HOME */
+ if( asprintf( &fifo, "%s/.tvtime/tvtimefifo-%s",
+ getenv( "HOME" ), hostname ) < 0 ) {
+ fifo = 0;
+ }
free( hostname );
free( fifodir );
return fifo;

View File

@@ -0,0 +1,26 @@
From bfa96fec44b7db78b43b9b8d20d7ca02616f70ed Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 13 Aug 2018 17:41:57 +0200
Subject: Fix: "warning: implicit declaration of function 'minor' / 'major'"
errors
Fix the "warning: implicit declaration of function 'minor' / 'major'"
compiler warnings which ultimately lead to the following build error:
src/get_media_devices.c:522: undefined reference to `major'
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/get_media_devices.c | 1 +
1 file changed, 1 insertion(+)
--- a/src/get_media_devices.c
+++ b/src/get_media_devices.c
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>

View File

@@ -0,0 +1,30 @@
Description: Use pkg-config for finding freetype
Author: Adrian Bunk <bunk@debian.org>
Bug-Debian: https://bugs.debian.org/892455
--- a/configure.ac
+++ b/configure.ac
@@ -71,10 +71,7 @@
dnl freetype
dnl ---------------------------------------------
dnl Test for freetype
-AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
-if test "$FREETYPE_CONFIG" = "no" ; then
- AC_MSG_ERROR(freetype2 needed and freetype-config not found)
-fi
+PKG_CHECK_MODULES(TTF, freetype2)
dnl ---------------------------------------------
dnl libxml2
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,9 +19,6 @@
tmpdir = /tmp
localedir = $(datadir)/locale
-TTF_CFLAGS = `$(FREETYPE_CONFIG) --cflags`
-TTF_LIBS = `$(FREETYPE_CONFIG) --libs`
-
# Set the following if you want to specify an additional font directory
# FONT_CFLAGS = -DFONTDIR='/usr/share/fonts/truetype/freefont/'

View File

@@ -0,0 +1,65 @@
--- a/src/tvtime-command.c
+++ b/src/tvtime-command.c
@@ -39,6 +39,9 @@
int main( int argc, char **argv )
{
+ if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+ if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
int nc = tvtime_num_commands();
config_t *cfg;
FILE *fifo;
--- a/src/tvtime-configure.c
+++ b/src/tvtime-configure.c
@@ -19,6 +19,8 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <string.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef HAVE_CONFIG_H
@@ -35,6 +37,9 @@
int main( int argc, char **argv )
{
+ if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+ if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
config_t *cfg;
/*
--- a/src/tvtime-scanner.c
+++ b/src/tvtime-scanner.c
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef HAVE_CONFIG_H
@@ -47,6 +48,9 @@
int main( int argc, char **argv )
{
+ if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+ if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
config_t *cfg;
station_mgr_t *stationmgr = 0;
videoinput_t *vidin;
--- a/src/tvtime.c
+++ b/src/tvtime.c
@@ -2624,6 +2624,9 @@
int main( int argc, char **argv )
{
+ if( ! getenv( "HOME" ) ) { fprintf( stderr, "this program needs HOME\n" ); exit( 1 ); }
+ if( strlen( getenv( "HOME" ) ) > 230 ) { fprintf( stderr, "HOME is too long\n" ); exit( 1 ); }
+
rtctimer_t *rtctimer = 0;
int read_stdin = 1;
int result = 0;

View File

@@ -0,0 +1,53 @@
Description: Use pkg-config instead of xml2-config
Author: Adrian Bunk <bunk@debian.org>
Bug-Debian: https://bugs.debian.org/949507
--- tvtime-1.0.11.orig/configure.ac
+++ tvtime-1.0.11/configure.ac
@@ -77,16 +77,7 @@ dnl ------------------------------------
dnl libxml2
dnl ---------------------------------------------
dnl Test for libxml2
-AC_PATH_PROG(LIBXML2_CONFIG,xml2-config,no)
-if test "$LIBXML2_CONFIG" = "no" ; then
- AC_MSG_ERROR(libxml2 needed and xml2-config not found)
-else
- XML2_LIBS="`$LIBXML2_CONFIG --libs`"
- XML2_FLAG="`$LIBXML2_CONFIG --cflags`"
- AC_DEFINE(HAVE_LIBXML2,,[LIBXML2 support])
-fi
-AC_SUBST(XML2_LIBS)
-AC_SUBST(XML2_FLAG)
+PKG_CHECK_MODULES(XML2, libxml-2.0)
dnl ---------------------------------------------
dnl libasound2
--- tvtime-1.0.11.orig/src/Makefile.am
+++ tvtime-1.0.11/src/Makefile.am
@@ -78,22 +78,22 @@ bin_PROGRAMS = tvtime tvtime-command tvt
tvtime_SOURCES = $(COMMON_SRCS) $(OUTPUT_SRCS) $(PLUGIN_SRCS) tvtime.c
tvtime_CFLAGS = $(TTF_CFLAGS) $(PNG_CFLAGS) $(OPT_CFLAGS) \
- $(PLUGIN_CFLAGS) $(X11_CFLAGS) $(XML2_FLAG) $(ALSA_CFLAGS) \
+ $(PLUGIN_CFLAGS) $(X11_CFLAGS) $(XML2_CFLAGS) $(ALSA_CFLAGS) \
$(FONT_CFLAGS) $(AM_CFLAGS)
tvtime_LDFLAGS = $(TTF_LIBS) $(ZLIB_LIBS) $(PNG_LIBS) \
$(X11_LIBS) $(XML2_LIBS) $(ALSA_LIBS) -lm
tvtime_command_SOURCES = utils.h utils.c tvtimeconf.h tvtimeconf.c \
tvtime-command.c
-tvtime_command_CFLAGS = $(OPT_CFLAGS) $(XML2_FLAG) $(AM_CFLAGS)
+tvtime_command_CFLAGS = $(OPT_CFLAGS) $(XML2_CFLAGS) $(AM_CFLAGS)
tvtime_command_LDFLAGS = $(ZLIB_LIBS) $(XML2_LIBS)
tvtime_configure_SOURCES = utils.h utils.c tvtimeconf.h tvtimeconf.c \
tvtime-configure.c
-tvtime_configure_CFLAGS = $(OPT_CFLAGS) $(XML2_FLAG) $(AM_CFLAGS)
+tvtime_configure_CFLAGS = $(OPT_CFLAGS) $(XML2_CFLAGS) $(AM_CFLAGS)
tvtime_configure_LDFLAGS = $(ZLIB_LIBS) $(XML2_LIBS)
tvtime_scanner_SOURCES = utils.h utils.c videoinput.h videoinput.c \
tvtimeconf.h tvtimeconf.c station.h station.c tvtime-scanner.c \
get_media_devices.c get_media_devices.h
-tvtime_scanner_CFLAGS = $(OPT_CFLAGS) $(XML2_FLAG) $(ALSA_CFLAGS) $(AM_CFLAGS)
+tvtime_scanner_CFLAGS = $(OPT_CFLAGS) $(XML2_CFLAGS) $(ALSA_CFLAGS) $(AM_CFLAGS)
tvtime_scanner_LDFLAGS = $(ZLIB_LIBS) $(XML2_LIBS) $(ALSA_LIBS)

View File

@@ -0,0 +1,12 @@
diff -ur tvtime-orig/docs/Makefile.am tvtime/docs/Makefile.am
--- tvtime-orig/docs/Makefile.am 2021-02-02 19:37:13.096223652 +0100
+++ tvtime/docs/Makefile.am 2021-02-02 19:38:42.888221598 +0100
@@ -34,7 +34,7 @@
# http://www.freedesktop.org/standards/desktop-entry-spec/
desktopdatadir = $(datadir)/applications
dist_desktopdata_DATA = tvtime.desktop
-appdatadir = $(datadir)/appdata
+appdatadir = $(datadir)/metainfo
dist_appdata_DATA = tvtime.appdata.xml
# We use $(datadir)/icons/hicolor as our theme from the freedesktop spec

View File

@@ -0,0 +1,200 @@
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <libxml/parser.h>
#include <math.h>
+#include <libgen.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -596,7 +597,30 @@
}
xmlKeepBlanksDefault( 0 );
- xmlSaveFormatFile( config_filename, doc, 1 );
+
+ if( create_file )
+ {
+ char *temp_config_filename = strdup( config_filename );
+
+ if( ! temp_config_filename )
+ {
+ fprintf( stderr, "strdup failed for config_filename %s\n", config_filename );
+ xmlFreeDoc( doc );
+ return 0;
+ }
+
+ mkdir_and_force_owner( dirname( temp_config_filename ), getuid(), getgid() );
+
+ free( temp_config_filename );
+ }
+
+ if( xmlSaveFormatFile( config_filename, doc, 1 ) == -1 )
+ {
+ fprintf( stderr, "xmlSaveFormatFile returned -1 for config_filename %s\n", config_filename );
+ xmlFreeDoc( doc );
+ return 0;
+ }
+
if( create_file ) {
if( chown( config_filename, getuid(), getgid() ) < 0 ) {
lfprintf( stderr, _("Cannot change owner of %s: %s.\n"),
@@ -897,14 +921,6 @@
ct->buttonmapmenu[ 4 ] = TVTIME_MENU_UP;
ct->buttonmapmenu[ 5 ] = TVTIME_MENU_DOWN;
- /* Make the ~/.tvtime directory every time on startup, to be safe. */
- if( asprintf( &temp_dirname, "%s/.tvtime", getenv( "HOME" ) ) < 0 ) {
- /* FIXME: Clean up ?? */
- return 0;
- }
- mkdir_and_force_owner( temp_dirname, ct->uid, getgid() );
- free( temp_dirname );
-
/* First read in global settings. */
asprintf( &base, "%s/tvtime.xml", CONFDIR );
if( file_is_openable_for_read( base ) ) {
@@ -1113,6 +1129,7 @@
int option_index = 0;
int filename_specified = 0;
int c;
+ int config_needs_saving = 0;
if( argc == 1 ) {
print_config_usage( argv );
@@ -1123,11 +1140,11 @@
"aAhmMF:g:I:d::b::i::c:n::D:f::x:t::Ll::R::p::P::z::",
long_options, &option_index )) != -1 ) {
switch( c ) {
- case 'a': ct->aspect = 1; break;
- case 'A': ct->aspect = 0; break;
- case 'm': ct->fullscreen = 1; break;
- case 'L': ct->borderless = 1; break;
- case 'M': ct->fullscreen = 0; break;
+ case 'a': ct->aspect = 1; config_needs_saving = 1; break;
+ case 'A': ct->aspect = 0; config_needs_saving = 1; break;
+ case 'm': ct->fullscreen = 1; config_needs_saving = 1; break;
+ case 'L': ct->borderless = 1; config_needs_saving = 1; break;
+ case 'M': ct->fullscreen = 0; config_needs_saving = 1; break;
case 'F': if( ct->config_filename ) free( ct->config_filename );
filename_specified = 1;
ct->config_filename = expand_user_path( optarg );
@@ -1137,18 +1154,20 @@
ct->config_filename );
conf_xml_parse( ct, ct->config_filename );
}
+ // intentionally not : config_needs_saving = 1;
break;
case 'x': if( ct->mixerdev ) { free( ct->mixerdev ); }
- ct->mixerdev = strdup( optarg ); break;
+ ct->mixerdev = strdup( optarg ); config_needs_saving = 1; break;
case 'g': if( ct->geometry ) { free( ct->geometry ); }
- ct->geometry = strdup( optarg ); break;
- case 'I': ct->inputwidth = atoi( optarg ); break;
+ ct->geometry = strdup( optarg ); config_needs_saving = 1; break;
+ case 'I': ct->inputwidth = atoi( optarg ); config_needs_saving = 1; break;
case 'd': if( !optarg ) {
fprintf( stdout, "V4LDevice:%s\n",
config_get_v4l_device( ct ) );
} else {
free( ct->v4ldev );
ct->v4ldev = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'b': if( !optarg ) {
@@ -1157,6 +1176,7 @@
} else {
free( ct->vbidev );
ct->vbidev = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'i': if( !optarg ) {
@@ -1164,16 +1184,18 @@
config_get_inputnum( ct ) );
} else {
ct->inputnum = atoi( optarg );
+ config_needs_saving = 1;
}
break;
case 'c': ct->prev_channel = ct->start_channel;
- ct->start_channel = atoi( optarg ); break;
+ ct->start_channel = atoi( optarg ); config_needs_saving = 1; break;
case 't': if( !optarg ) {
fprintf( stdout, "XMLTVFile:%s\n",
config_get_xmltv_file( ct ) );
} else {
if( ct->xmltvfile ) free( ct->xmltvfile );
ct->xmltvfile = expand_user_path( optarg );
+ config_needs_saving = 1;
}
break;
case 'l': if( !optarg ) {
@@ -1182,6 +1204,7 @@
} else {
if( ct->xmltvlanguage ) free( ct->xmltvlanguage );
ct->xmltvlanguage = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'n': if( !optarg ) {
@@ -1189,6 +1212,7 @@
} else {
free( ct->norm );
ct->norm = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'f': if( !optarg ) {
@@ -1197,6 +1221,7 @@
} else {
free( ct->freq );
ct->freq = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'R': if( !optarg ) {
@@ -1204,6 +1229,7 @@
config_get_priority( ct ) );
} else {
ct->priority = atoi( optarg );
+ config_needs_saving = 1;
}
break;
case 'p': if( !optarg ) {
@@ -1212,6 +1238,7 @@
} else {
free( ct->alsa_inputdev );
ct->alsa_inputdev = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'P': if( !optarg ) {
@@ -1220,6 +1247,7 @@
} else {
free( ct->alsa_outputdev );
ct->alsa_outputdev = strdup( optarg );
+ config_needs_saving = 1;
}
break;
case 'z': if( !optarg ) {
@@ -1227,6 +1255,7 @@
config_get_alsa_latency( ct ) );
} else {
ct->alsa_latency = atoi( optarg );
+ config_needs_saving = 1;
}
break;
default:
@@ -1235,6 +1264,9 @@
}
}
+ if( ! config_needs_saving )
+ return 1;
+
if( !filename_specified ) {
char *fifofile = get_tvtime_fifo_filename( config_get_uid( ct ) );
int fifofd;