Du bist nicht angemeldet.

#1 23.01.2020 12:25:22

voodoo-magic
Mitglied

[gelöst] Patch funktion

Hallo zusammen,

kann mir bitte jemand die Funktion von diesem Patch erklären.
Mein Problem ist mit den Zahlen, die Werten vor dem Minus und nach dem Plus.

Danke

@@ -236,7 +236,7 @@ FEATURES="
   xrandr
   xrender
   xshape
-  opengl
+  gl
   pthread
   dlfcn
   vdpau

hier die Original Datei.
FEATURES=" steht in der Zeile 228
Muss es dann nicht @@ -240,7 +240,7 heissen?
opengl ist in Zeile 240

FEATURES="
  $SUBSYSTEMS
  libextractor
  libavutil
  libjpeg
  dbus_glib_1
  xshm
  xdpms
  xinerama
  xrandr
  xrender
  xshape
  opengl
  pthread
  dlfcn
  i18n
  libcap
  libbluray
  libcec
  mce-dbus-names
  avahi-client
"

Beitrag geändert von voodoo-magic (26.01.2020 19:23:57)

Offline

#2 23.01.2020 13:22:47

drcux
Mitglied

Re: [gelöst] Patch funktion

@@ = Trennzeichen und Zeichen für "unified context"

-236,7 = in 7 Zeilen nach Zeile 236 muss mindestens eine Zeile entfernt werden

+236,7 = wie oben, nur "hinzugefügt werden"

@@ = Trennzeichen

FEATURES=" = gehört zu

Offline

#3 23.01.2020 14:36:59

voodoo-magic
Mitglied

Re: [gelöst] Patch funktion

Danke @drcux,

dann ist der Patch doch falsch, wenn ich opengl in Zeile 240 ersetzen will.

muss die Zeile nicht so sein?
@@ -236,4 +236,4 @@ FEATURES="

Zeile 236 xinerama
Zeile 237 xrandr
Zeile 238 xrender
Zeile 239 xshape
Zeile 240 opengl

Offline

#4 23.01.2020 14:48:51

schard
Moderator

Re: [gelöst] Patch funktion

Nein, das ist korrekt.
Die sieben betreffenden Zeilen sind auch gelistet:

   xrandr
   xrender
   xshape
-  opengl
+  gl
   pthread
   dlfcn
   vdpau

Die Zeile "  opengl" wird also durch die Zeile "  gl" ersetzt.
Also sind die sieben Zeilen vorher:

237   xrandr
238   xrender
239   xshape
240   opengl
241   pthread
242   dlfcn
243   vdpau

und nachher

237   xrandr
238   xrender
239   xshape
240   gl
241   pthread
242   dlfcn
243   vdpau

Offline

#5 24.01.2020 00:37:02

voodoo-magic
Mitglied

Re: [gelöst] Patch funktion

Was habe ich Falsch gemacht?

patching file configure
Hunk #1 succeeded at 237 (offset 1 line).
Hunk #2 succeeded at 282 (offset 1 line).
Hunk #3 FAILED at 400.
patch: **** malformed patch at line 33: enabled xrender && add_flags "LIBS_X11" "-lm"

Patch

--- a/configure
+++ b/configure
@@ -236,7 +236,7 @@ FEATURES="
   xrandr
   xrender
   xshape
-  opengl
+  gl
   pthread
   dlfcn
   i18n
@@ -281,7 +281,7 @@ show_help(){
   echo "  --disable-xrandr       disable Xrandr support [no]"
   echo "  --disable-xrender      disable Xrender support (HUD OSD) [no]"
   echo "  --disable-xshape       disable Xshape support (non-transparent HUD OSD without composite manager) [no]"
-  echo "  --disable-opengl       disable OpenGL support (transparent HUD OSD without composite manager) [no]"
+  echo "  --disable-gl           disable OpenGL support (transparent HUD OSD without composite manager) [no]"
   echo "  --disable-i18n         disable i18n support [no]"
   echo "  --disable-libcap       disable libcap support [no]"
   echo "  --disable-avahi-client disable avahi support [no]"
@@ -400,7 +400,7 @@ if enabled libxine; then
    test_library X11  xrender      "X11/extensions/Xrender.h"  "-lXrender"   "XRenderQueryFormats(0)"
    test_library X11  xshape       "X11/extensions/shape.h"    "-lXext"      "XShapeQueryExtension(0,0,0)"
    test_library X11  xdpms        "X11/extensions/dpms.h"     "-lXext"      "DPMSDisable(0)"
    test_library X11  xinerama     "X11/extensions/Xinerama.h" "-lXinerama"  "XineramaQueryScreens(0,0)"
-   test_library X11  opengl       "GL/glx.h"                  "-lGL -lGLU"  "glXQueryVersion(0,0,0)"
+   test_library X11  gl           "GL/glx.h"                  "-lGL -lGLU"  "glXQueryVersion(0,0,0)"
    test_library X11  dbus-glib-1  \
      "dbus/dbus-glib.h" \
@@ -415,7 +415,7 @@ check_deps

# need -lm for ceil/floor in HUD OSD
enabled xrender && add_flags "LIBS_X11" "-lm"
-# need -ldl and -lpthread with opengl
-enabled opengl  && add_flags "LIBS_X11" $LIBS_DLFCN $LIBS_PTHREAD
+# need -ldl and -lpthread with gl
+enabled gl     && add_flags "LIBS_X11" $LIBS_DLFCN $LIBS_PTHREAD
# need -ldl for dlopen() in vdr plugin
enabled vdr     && add_flags "LIBS_VDR" $LIBS_DLFCN

configure

#!/bin/sh
#
# vdr-xinelibout configure script
#
# Copyright (c) Petri Hintukainen 2008
#
# See the main source file 'xineliboutput.c' for copyright information and
# how to reach the author.
#
# * $Id$
#

PKG_CONFIG="pkg-config"
makefile="config.mak"
header="features.h"
logfile="configure.log"
debug=no

CC="cc"
CXX="g++"
CFLAGS=""

#
# tools
#

toupper(){
  echo "$@" | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_
}

die(){
  log "$@"
  exit 1
}

log(){
  echo "$@"
  echo "$@" >> $logfile
}

logdbg(){
  [ x$debug = xyes ] && log "$@" || echo "$@" >> $logfile
}

not_in_list(){
  key=$1
  shift
  for item in $*; do
    test $key = $item && return 1
  done
  return 0
}

add_flag(){
  eval not_in_list $flag \$$flags_list || return 1
  logdbg "adding $flag to $flags_list"
  eval $flags_list=\"\$${flags_list} ${flag}\"
}

add_flags(){
  flags_list=$1
  shift 
  for flag in $*; do
    add_flag $flags_list $flag
  done
}

#
# enable/disable
#

set_opt(){
  eval HAVE_$(toupper $1)=$2
}

set_opts(){
  optvalue=$1
  shift
  for optname in $*; do
    set_opt $optname $optvalue
  done
}

enable(){
  set_opts yes $*
}

disable(){
  set_opts no $*
}

enabled(){
  ucfeature=$(toupper $1)
  eval test "x\$HAVE_${ucfeature}" = "xyes"
}

disabled(){
  ucfeature=$(toupper $1)
  eval test "x\$HAVE_${ucfeature}" = "xno"
}

#
# compile/link tests
#

generate_test_c(){
  hdrname="$1"
  subsys="$2"
  func="$3"
  if test x"$subsys" = xX11 ; then
    cat <<EOF >testhdr.c
#include <X11/Xlib.h>
#include <$hdrname>
int main(int c, char **v) { 
  $func; 
  return 0; 
}
EOF
  else
    cat <<EOF >testhdr.c
#include <stdio.h>
#include <$hdrname>
int main(int c, char **v) { 
  $func; 
}
EOF
  fi
}

test_library_c(){

  log -n "Checking for $libname ... "
  generate_test_c "$hdr" "$subsys" "$func"
  $CC -g testhdr.c -o testhdr $CFLAGS $inc $lib >> $logfile 2>&1
  err=$?

  if test $err = 0; then
    log "yes"
    add_flags LIBS_$subsys $lib
    add_flags CFLAGS_$subsys $inc
  else
    log "no"
    logdbg "--------"
    logdbg "/* $CC -g testhdr.c -o testhdr $CFLAGS $inc $lib */"
    logdbg `cat testhdr.c`
    logdbg "--------"
  fi

  rm -f testhdr.c testhdr
  return $err
}

#
# pkg-config tests
#

test_pkgconfig(){
  disabled pkgconfig && return 1
  log -n "Checking for $PKG_CONFIG ... "
  disable pkgconfig
  $PKG_CONFIG --version>/dev/null && enable pkgconfig
  log $HAVE_PKGCONFIG
}

test_library_pc(){
  subsys="$1"
  libname="$2"

  log -n "Checking for pkg-config $libname ... "
  if $PKG_CONFIG --exists $libname; then
   if $PKG_CONFIG --libs $libname >/dev/null; then
    add_flags LIBS_$subsys \
              `pkg-config --libs-only-L $libname` \
              `pkg-config --libs-only-l $libname`
    add_flags CFLAGS_$subsys `pkg-config --cflags-only-I $libname`
    log "yes"
    return 0
   fi
  fi
  log "no"
  return 1
}

#
# generic test
#

test_library(){
  subsys="$1"
  libname="$2"
  hdr="$3"
  lib="$4"
  func="$5"
  inc="$6"
  feature=$(toupper $libname)

  # do not test if disabled from command-line
  if disabled $feature; then
    log "Not checking for $libname"
    disable $feature
    return 1
  fi

  disable $feature

  # try pkg-config first
  if enabled pkgconfig; then
     test_library_pc "$subsys" "$libname" && enable "$feature"
  fi

  # compile/link test as fallback
  if disabled $feature; then
    test_library_c "$subsys" "$libname" "$hdr" "$lib" "$func" "$inc" && enable $feature
  fi
}

#
# configurable features
#

SUBSYSTEMS="
  x11
  wayland
  fb
  vdr
  libxine
"
FEATURES="
  $SUBSYSTEMS
  libextractor
  libavutil
  libjpeg
  dbus_glib_1
  xshm
  xdpms
  xinerama
  xrandr
  xrender
  xshape
  opengl
  pthread
  dlfcn
  i18n
  libcap
  libbluray
  libcec
  mce-dbus-names
  avahi-client
"

# set defaults

enable wayland x11 vdr fb xine i18n libcec

# clear log file

rm -f $logfile

#
# Parse command-line arguments
#

show_help(){
  echo "Usage: configure [options]"
  echo "Options: [defaults in brackets after descriptions]"
  echo
  echo "  --help                 print this message"
  echo "  --enable-x11           build X11 frontend (vdr-sxfe) [yes]"
  echo "  --enable-wayland       build Wayland frontend (vdr-wlfe) [yes]"
  echo "  --enable-fb            build framebuffer frontend (vdr-fbfe) [yes]"
  echo "  --enable-vdr           build VDR plugin [yes]"
  echo "  --enable-libxine       build xine plugins [yes]"
  echo
  echo "  --disable-libextractor disable libextractor support (media file metainfo) [no]"
  echo "  --disable-libbluray    disable libbluray support (BluRay metainfo) [no]"
  echo "  --disable-libcec       disable libcec support (HDMI-CEC remote control) [no]"
  echo "  --disable-libjpeg      disable libjpeg support [no]"
  echo "  --disable-dbus-glib-1  disable dbus-glib support [no]"
  echo "  --disable-xshm         disable XShm support [no]"
  echo "  --disable-xdpms        disable Xdpms support [no]"
  echo "  --disable-xinerama     disable Xinerama support [no]"
  echo "  --disable-xrandr       disable Xrandr support [no]"
  echo "  --disable-xrender      disable Xrender support (HUD OSD) [no]"
  echo "  --disable-xshape       disable Xshape support (non-transparent HUD OSD without composite manager) [no]"
  echo "  --disable-opengl       disable OpenGL support (transparent HUD OSD without composite manager) [no]"
  echo "  --disable-i18n         disable i18n support [no]"
  echo "  --disable-libcap       disable libcap support [no]"
  echo "  --disable-avahi-client disable avahi support [no]"
  echo
  echo "  --debug                debug configure script"
  echo "  --disable-pkgconfig    do not use pkg-config"
  echo "  --cc=CC                select C compiler"
  echo "  --cxx=CXX              select C++ compiler"
  echo "  --add-cflags=FLAGS     add compiler flags"
}

for opt do
  optval="${opt#*=}"
  logdbg "Command line: $opt  [$optval]"
  case "$opt" in
    --help)
      show_help && die
      ;;
    --debug)
      debug=yes
      logdbg "Debug mode"
      ;;
    --cc=?*)
      CC=$optval
      logdbg "C compiler: $CC"
      ;;
    --cxx=?*)
      CXX=$optval
      logdbg "C++ compiler: $CXX"
      ;;
    --add-cflags=?*)
      CFLAGS="$CFLAGS $optval"
      logdbg "CFLAGS: $CFLAGS"
      ;;
    --disable-pkgconfig)
      disable pkgconfig
      logdbg "Disabled pkg-config"
      ;;
    --enable-?*|--disable-?*)
      eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
      logdbg "    $action $option"
      not_in_list $option $FEATURES && die "unknown option $opt"
      eval $action \${option}
      ;;
    -*)
      die "unknown option $opt"
      ;;
  esac
done

#
# maintain deps
#

check_deps(){
  disabled libxine && disable wayland x11 fb libavutil libjpeg libcec
  disabled x11     && disable dbus-glib-1 xshm xrandr xrender xshape opengl xdpms xinerama
  disabled vdr     && disable libextractor libcap libbluray avahi-client
  disabled dlfcn   && disable opengl
  disabled pthread && disable opengl
  disabled xrender && disable xshape xshm
  disabled wayland-client && disable wayland
}

check_deps

#
# Run the tests
#

test_pkgconfig

# fake test that should fail
[ $debug = yes ] && \
  test_library   X11  do_error     "none.h"         "-lnolib"

test_library     VDR   libextractor "extractor.h"        "-lextractor" "EXTRACTOR_getKeywords(0,0)"
test_library     VDR   libcap       "sys/capability.h"   "-lcap"       "cap_get_proc()"
test_library     VDR   libbluray    "libbluray/bluray.h" "-lbluray"    "bd_get_disc_info(0)"
test_library     VDR   avahi-client "avahi-client/publish.h" "-lavahi-common -lavahi-client"    "avahi_client_new"
test_library     XINE  libxine      "xine.h"             "-lxine"      "xine_init(0)"
test_library     DLFCN dlfcn        "dlfcn.h"            "-ldl"        "dlopen(0,0)"

if enabled libxine; then

  log -n "Checking for xine plugin directory ..."
  if enabled pkgconfig && $PKG_CONFIG libxine --atleast-version 1.1.17; then
    XINEPLUGINDIR=`$PKG_CONFIG libxine --variable=plugindir`
  else
    XINEPLUGINDIR=`xine-config --plugindir`
  fi
  log " $XINEPLUGINDIR"

  test_library   AVUTIL  libavutil    "libavutil/mem.h"        "-lavutil"    "av_mallocz(1)"
  test_library   JPEG    libjpeg      "jpeglib.h"              "-ljpeg"      "jpeg_create_compress(0)"
  test_library   X11     x11          "X11/X.h"                "-lX11"       "XInitThreads()"
  if enabled wayland; then
    test_library   WAYLAND wayland-client  "wayland-client.h"    "-lwayland-client" "wl_display_connect(0)"
    test_library   WAYLAND wayland-cursor  "wayland-cursor.h"    "-lwayland-cursor" "wl_cursor_theme_load(0,0,0)"
  fi
  test_library   PTHREAD pthread      "pthread.h"              "-lpthread"   "pthread_create(0,0,0,0)"

  if enabled libcec; then
    test_library   CEC     libcec       "libcec/cecc.h"          "-lcec"       "libcec_initialise(0)"
    if disabled libcec; then
      # try libcec < 3.0.0
      enable libcec
      test_library   CEC     libcec       "libcec/cecc.h"          "-lcec"       "cec_initialise(0)"
    fi
  fi

  if enabled x11; then
    test_library X11  xext         "X11/extensions/Xext.h"     "-lXext"      ""
    test_library X11  xshm         "X11/extensions/XShm.h"     "-lXext"      "XShmQueryExtension(0)"
    test_library X11  xrandr       "X11/extensions/Xrandr.h"   "-lXrandr"    "XRRGetScreenInfo(0,0)"
    test_library X11  xrender      "X11/extensions/Xrender.h"  "-lXrender"   "XRenderQueryFormats(0)"
    test_library X11  xshape       "X11/extensions/shape.h"    "-lXext"      "XShapeQueryExtension(0,0,0)"
    test_library X11  xdpms        "X11/extensions/dpms.h"     "-lXext"      "DPMSDisable(0)"
    test_library X11  xinerama     "X11/extensions/Xinerama.h" "-lXinerama"  "XineramaQueryScreens(0,0)"
    test_library X11  opengl       "GL/glx.h"                  "-lGL -lGLU"  "glXQueryVersion(0,0,0)"
    test_library X11  dbus-glib-1  \
      "dbus/dbus-glib.h" \
      "-ldbus-glib-1 -lgobject-2.0 -lglib-2.0" \
      "dbus_g_bus_get(0,0)" \
      "-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib/glib-2.0/include"
    enabled dbus-glib-1 && test_library X11 mce-dbus-names "mce/dbus-names.h" "" ""
  fi
fi

check_deps

# need -lm for ceil/floor in HUD OSD
enabled xrender && add_flags "LIBS_X11" "-lm"
# need -ldl and -lpthread with opengl
enabled opengl  && add_flags "LIBS_X11" $LIBS_DLFCN $LIBS_PTHREAD
# need -ldl for dlopen() in vdr plugin
enabled vdr     && add_flags "LIBS_VDR" $LIBS_DLFCN

#
# Print results
#

log
log "Enabled features:"
for feature in $FEATURES; do
  enabled $feature && log "  $feature"
done
log "Disabled features:"
for feature in $FEATURES; do
  enabled $feature || log "  $feature"
done
log

#
# create features.h
#

log "Creating $header ..."

cat <<EOF >$header
/* Automatically generated by configure - do not modify! */

#ifndef XINELIBOUTPUT_FEATURES_H
#define XINELIBOUTPUT_FEATURES_H

EOF

for feature in $FEATURES; do
  enabled $feature && 
    echo "#define HAVE_$(toupper $feature) 1">>$header || \
    echo "#undef  HAVE_$(toupper $feature)">>$header
done

echo "" >> $header
echo "#endif /* XINELIBOUTPUT_FEATURES_H */" >> $header

#
# create config.mak
#

log "Creating $makefile ..."

echo "# Automatically generated by configure - do not modify!" > $makefile
echo >> $makefile

# subsystems
echo "XINELIBOUTPUT_VDRPLUGIN=$HAVE_VDR" >> $makefile
echo "XINELIBOUTPUT_XINEPLUGIN=$HAVE_LIBXINE" >> $makefile
echo "XINELIBOUTPUT_X11=$HAVE_X11" >> $makefile
echo "XINELIBOUTPUT_FB=$HAVE_FB" >> $makefile
echo "XINELIBOUTPUT_WAYLAND=$HAVE_WAYLAND_CLIENT" >> $makefile
echo >> $makefile

# features
for feature in $FEATURES; do
  feature="`toupper $feature`"
  enabled $feature && 
    echo "HAVE_$feature=yes">>$makefile ||
    echo "HAVE_$feature=no">>$makefile
done
echo >> $makefile

# xine plugin dir
enabled libxine && echo "XINEPLUGINDIR=$XINEPLUGINDIR" >> $makefile && echo >> $makefile

# cc/ld flags
echo "CC = $CC">>$makefile
echo "CXX = $CXX">>$makefile
echo "CFLAGS_XINE += $CFLAGS_XINE">>$makefile
echo "CFLAGS_VDR  += $CFLAGS_VDR">>$makefile
echo "CFLAGS_X11  += $CFLAGS_X11">>$makefile
echo "CFLAGS_WAYLAND += $CFLAGS_WAYLAND">>$makefile
echo "CFLAGS_AVUTIL += $CFLAGS_AVUTIL">>$makefile
echo "LIBS_XINE   += $LIBS_XINE">>$makefile
echo "LIBS_JPEG   += $LIBS_JPEG">>$makefile
echo "LIBS_AVUTIL += $LIBS_AVUTIL">>$makefile
echo "LIBS_PTHREAD += $LIBS_PTHREAD">>$makefile
echo "LIBS_VDR    += $LIBS_VDR">>$makefile
echo "LIBS_X11    += $LIBS_X11">>$makefile
echo "LIBS_WAYLAND+= $LIBS_WAYLAND">>$makefile
echo "LIBS_CEC    += $LIBS_CEC">>$makefile

Offline

#6 24.01.2020 14:33:32

stefanhusmann
Moderator

Re: [gelöst] Patch funktion

Das "e" von "enabled" darf m.E. nicht in derselben Spalte wie das + bzw.- sein. Mach da mal ein Leerzeichen davor.

Offline

#7 24.01.2020 18:53:36

schard
Moderator

Re: [gelöst] Patch funktion

Warum schreibst du die Patches überhaupt von Hand?

Offline

#8 24.01.2020 20:35:07

drcux
Mitglied

Re: [gelöst] Patch funktion

Oder einfach mal Links zu dem Projekt/Patch, das man es mal selber nachzuvollziehen kann...

Offline

#9 24.01.2020 21:00:35

voodoo-magic
Mitglied

Re: [gelöst] Patch funktion

Ich versuche die neue Git Version 2.2.0 von vdr-xineliboutput zu kompilieren.
Dieser Patch xineliboutput-glvnd-1.2-compat.patch funktioniert nicht.

https://aur.archlinux.org/packages/vdr-xineliboutput.

Danke

Offline

#10 24.01.2020 22:33:26

arisinfenix
Mitglied

Re: [gelöst] Patch funktion

Da hat sich wohl von Version 2.1.0.r183.g32a5ffc im AUR (für die der Patch ist) zu 2.2.0 was an der zu patchenden Datei geändert.

Ich würde so vorgehen:

1. Ist der Patch für 2.2.0 noch nötig?

Falls ja:

2. Die Änderungen aus dem Patch in der Datei aus 2.2.0 manuell vornehmen.
    (ist ja noch relativ übersichtlich wink )

3. Mit diff -u bzw. git diff einen neuen Patch erstellen.

Offline

#11 25.01.2020 10:49:38

drcux
Mitglied

Re: [gelöst] Patch funktion

In der neueren Version sind einige Zeilen in der "configure" hinzugefügt worden, somit muss patch patzen. Also selber einen Patch schreiben...

Hunk #1 succeeded at 237 (offset 1 line).

Hier sagt patch es auch schon, der zu verändernde Block liegt eine Zeile weiter.

Beitrag geändert von drcux (25.01.2020 10:59:25)

Offline

#12 25.01.2020 20:27:33

arisinfenix
Mitglied

Re: [gelöst] Patch funktion

Inzwischen ist das AUR Paket auch auf Version 2.2.0. Der Patch wurde entfernt und durch eine sed Zeile ersetzt.

prepare() {
  cd "${srcdir}/$pkgbase"

  # Make xineliboutput use "gl.pc" instead of "opengl.pc"
  # This is needed to have some legacy stuff that is still needed here
  sed -ri 's/(\s|-)opengl(\s|$)/\1gl\2/g' configure
}

Offline

Schnellantwort auf dieses Thema

Schreibe deinen Beitrag und versende ihn
Deine Antwort

Fußzeile des Forums