salsaman / LiVES

LiVES is a feature rich application which combines elements of VJ and video editing software. The current version runs on Linux / BSD. Check_out_the_new_discussion_area https://github.com/salsaman/LiVES/discussions
http://lives-video.com
GNU General Public License v3.0
90 stars 11 forks source link

Several patches from FreeBSD ports #11

Closed VVD closed 3 years ago

VVD commented 4 years ago

Fixed bug with HAVE_OPENCV => $HAVE_OPENCV, added "--libs-only-other" for "pkg-config opencv" and added possibility to ignore pulseaudio and alsa.

--- configure.ac.orig
+++ configure.ac
@@ -544,12 +544,14 @@

 PKG_CHECK_MODULES(OPENCV, opencv >= 2.3.1, HAVE_OPENCV=true, HAVE_OPENCV=false)

-if test "HAVE_OPENCV" = "true" ; then
-OPENCV_LIBS_ONLY_L = `pkg-config opencv --libs-only-L`
+if test "$HAVE_OPENCV" = "true" ; then
+OPENCV_LIBS_ONLY_L=`pkg-config opencv --libs-only-L`
+OPENCV_LIBS_ONLY_OTHER=`pkg-config opencv --libs-only-other`
 fi

 AC_SUBST(OPENCV_CFLAGS)
 AC_SUBST(OPENCV_LIBS_ONLY_L)
+AC_SUBST(OPENCV_LIBS_ONLY_OTHER)

 AM_CONDITIONAL(HAVE_OPENCV,$HAVE_OPENCV)

@@ -742,15 +744,22 @@
 AM_CONDITIONAL(HAVE_DIRAC,$HAVE_DIRAC)

 HAVE_ALSA=false
+AC_ARG_ENABLE(alsa, [  --disable-alsa     Disable alsa support.] , disable_alsa=yes)
+if test "x$disable_alsa" != "xyes" ; then
 dnl check for libasound
 PKG_CHECK_MODULES(ALSA,alsa,HAVE_ALSA=true,HAVE_ALSA=false)
 AC_SUBST(ALSA_CFLAGS)
 AC_SUBST(ALSA_LIBS)
+else
+echo not checking for alsa
+fi

 AM_CONDITIONAL(HAVE_ALSA,$HAVE_ALSA)

 HAVE_PULSE_AUDIO=false
 HAVE_PA_STREAM_BEGIN_WRITE=false
+AC_ARG_ENABLE(pulse, [  --disable-pulse    Disable pulseaudio support.] , disable_pulse=yes)
+if test "x$disable_pulse" != "xyes" ; then
 dnl check for pulse-audio
 PKG_CHECK_MODULES(PULSE,libpulse >= 0.9.14,HAVE_PULSE_AUDIO=true,HAVE_PULSE_AUDIO=false)
 if test "$HAVE_PULSE_AUDIO" = "true" ; then
@@ -759,6 +768,9 @@

 AC_SUBST(PULSE_CFLAGS)
 AC_SUBST(PULSE_LIBS)
+else
+echo not checking for pulse
+fi

 AM_CONDITIONAL(HAVE_PULSE_AUDIO,$HAVE_PULSE_AUDIO)
 AM_CONDITIONAL(HAVE_PA_STREAM_BEGIN_WRITE,$HAVE_PA_STREAM_BEGIN_WRITE)
@@ -865,7 +877,9 @@
 HAVE_SYSTEM_WEED_COMPAT=false
 HAVE_SYSTEM_WEED_PLUGIN=false

-if test "$IS_MINGW" = "false"; then
+AC_ARG_ENABLE(weed, [  --disable-system-weed Disable check system weed.] , disable_system_weed=yes)
+
+if test "$IS_MINGW" = "false" && "x$disable_system_weed" != "xyes"; then

 PKG_CHECK_MODULES(WEED, libweed >= 0.11.0, HAVE_SYSTEM_WEED=true, HAVE_SYSTEM_WEED=false)

--- lives-plugins/weed-plugins/Makefile.am.orig
+++ lives-plugins/weed-plugins/Makefile.am
@@ -81,7 +81,8 @@

 if HAVE_OPENCV
 farneback_analyser_libs = farneback_analyser.la
-farneback_analyser_la_LDFLAGS = $(AM_LDFLAGS) $(OPENCV_LIBS_ONLY_L) -lopencv_core -lopencv_video -lopencv_imgproc
+farneback_analyser_la_LDFLAGS = $(AM_LDFLAGS) $(OPENCV_LIBS_ONLY_L) $(OPENCV_LIBS_ONLY_OTHER) -lopencv_core -lopencv_video -lopencv_imgproc
+farneback_analyser_la_CXXFLAGS = $(OPENCV_CFLAGS)
 farneback_analyser_la_CPPFLAGS = $(AM_CPPFLAGS)
 farneback_analyser_la_SOURCES = farneback_analyser.cpp

FreeBSD's cp work different: If we have "dir1" with files "file1", "file2" and empty "dir2", then "cp -rf dir1/ dir2" copy files "file1" and "file2" to "dir2". Result: "dir2/file1", "dir2/file2". Linux's cp in same environment copy "dir1" with all files in "dir2". Result: "dir2/dir1/file1", "dir2/dir1/file2". This patch fixes this issue:

--- lives-plugins/weed-plugins/gdk/Makefile.am.orig
+++ lives-plugins/weed-plugins/gdk/Makefile.am
@@ -59,8 +59,8 @@ EXTRA_DIST=data icons

 install-data-local:
        mkdir -p "$(DESTDIR)$(fxpluginslibdir)"
-       cp -rf data/ "$(DESTDIR)$(fxpluginslibdir)" && chmod -R a+r "$(DESTDIR)$(fxpluginslibdir)/data/"
-       cp -rf icons/ "$(DESTDIR)$(fxpluginslibdir)" && chmod -R a+r "$(DESTDIR)$(fxpluginslibdir)/icons/"
+       cp -rf data "$(DESTDIR)$(fxpluginslibdir)" && chmod -R a+r "$(DESTDIR)$(fxpluginslibdir)/data"
+       cp -rf icons "$(DESTDIR)$(fxpluginslibdir)" && chmod -R a+r "$(DESTDIR)$(fxpluginslibdir)/icons"
        $(MAKE) -i install-data-local-remove-vcs-files

 install-data-local-remove-vcs-files:

Last one (you can ignore it):

--- Makefile.am.orig
+++ Makefile.am
@@ -35,7 +35,7 @@ endif
 SUBDIRS = $(OSC_SUBDIRS) intl $(WEED_SUBDIRS) src m4 lives-plugins po resources
 PACKAGE_CAPITALISED = LiVES

-docdir = "$(prefix)/share/doc/$(PACKAGE)-$(VERSION)"
+docdir = "$(prefix)/share/doc/$(PACKAGE)"
 sharedir = "$(prefix)/share"

 if HAVE_DOXYGEN

All patched for version 3.0.2.

VVD commented 3 years ago

This place (check red): изображение

salsaman commented 3 years ago

patch.txt

salsaman commented 3 years ago

When compiling for yourself, you can also use configure --enable-turbo this will create non-portable binaries whihc are tuned for your processor / architecture.

VVD commented 3 years ago

When compiling for yourself, you can also use configure --enable-turbo this will create non-portable binaries whihc are tuned for your processor / architecture.

make[3]: stopped in /tmp/work/usr/ports/multimedia/lives/work/LiVES-0acf0bc3af8e12102606c3eb577bb0a5cdfe3d01/libweed
--- libweed_gslice_la-weed.lo ---
GETTEXT=1 -DHAVE_LIBDL=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_GETENTROPY=1 -DHAVE_LINUX_JOYSTICK_H=1 -DHAVE_BZLIB_H=1 -DHAVE_LADSPA_H=1 -DHAVE_LINUX_VIDEODEV_H=1 -DHAVE_LINUX_VIDEODEV2_H=1 -DHAVE_FREI0R_H=1 -I. -isystem /usr/local/include -D_THREAD_SAFE -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -fvisibility=hidden -fPIC -DPIC -O3 -Wno-unused-function -Wno-pointer-to-int-cast -DNEED_LOCAL_WEED -DNEED_LOCAL_WEED_PLUGIN -Ofast -O3 -march=native -mtune=native -ffast-math -fno-math-errno -ftree-vectorizer-verbose=y -pthread -D_BUILD_THREADSAFE_ -DUSE_GSLICE -O2 -pipe -march=core2 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -Wall -MT libweed_gslice_la-weed.lo -MD -MP -MF .deps/libweed_gslice_la-weed.Tpo -c weed.c  -fPIC -DPIC -o .libs/libweed_gslice_la-weed.o
cc: error: unknown argument: '-ftree-vectorizer-verbose=y'
*** [libweed_gslice_la-weed.lo] Error code 1
VVD commented 3 years ago

https://stackoverflow.com/questions/17576227/equivalent-of-ftree-vectorizer-verbose-for-clang

VVD commented 3 years ago

More important build error:

In file included from machinestate.c:13:
/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
#error "<malloc.h> has been replaced by <stdlib.h>"

machinestate.c have ifdef:

#ifdef IS_FREEBSD
#include <stdlib.h>
#else
#include <malloc.h>
#endif

But it doesn't work…

Don't see how IS_FREEBSD define come from configure to sources.

VVD commented 3 years ago
--- configure.ac.orig
+++ configure.ac
@@ -91,6 +91,7 @@
 AM_CONDITIONAL(IS_LINUX_MUSL,$IS_LINUX_MUSL)
 AM_CONDITIONAL(IS_SOLARIS,$IS_SOLARIS)
 AM_CONDITIONAL(IS_MINGW,$IS_MINGW)
+AM_CONDITIONAL(IS_FREEBSD,$IS_FREEBSD)

 if test "$IS_MINGW" = "false"; then
 AC_CHECK_FILE(lives-plugins/Makefile.am,,[
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -29,6 +29,10 @@
 solaris_CFLAGS = -DIS_SOLARIS=1
 endif

+if IS_FREEBSD
+freebsd_CFLAGS = -DIS_FREEBSD=1
+endif
+
 gtk_LIBFLAGS = @GTK_LIBS_NODYNAMIC@ -pthread

 AM_CPPFLAGS = \
@@ -233,8 +237,9 @@

 AM_CFLAGS = -fPIE -Wstrict-aliasing=0 -Wall $(yuv4mpeg_CFLAGS) $(ldvgrab_CFLAGS) $(dvgrab_CFLAGS) \
        $(oil_CFLAGS) $(wayland_CFLAGS) $(transcode_CFLAGS) \
-       $(darwin_CFLAGS) $(irix_CFLAGS) $(linux_CFLAGS) $(solaris_CFLAGS) $(osc_CFLAGS) $(alsa_CFLAGS) $(png_CFLAGS) $(swscale_CFLAGS) \
-       $(jack_CFLAGS) $(pulse_CFLAGS) $(libexplain_CFLAGS) $(giw_CFLAGS) $(unicap_CFLAGS) $(libweed_CFLAGS) $(libweed_compat_CFLAGS) \
+       $(darwin_CFLAGS) $(irix_CFLAGS) $(linux_CFLAGS) $(solaris_CFLAGS) $(freebsd_CFLAGS) \
+       $(osc_CFLAGS) $(alsa_CFLAGS) $(png_CFLAGS) $(swscale_CFLAGS) $(jack_CFLAGS) $(pulse_CFLAGS) \
+       $(libexplain_CFLAGS) $(giw_CFLAGS) $(unicap_CFLAGS) $(libweed_CFLAGS) $(libweed_compat_CFLAGS) \
        -DLIVES_LIBDIR=\""$(libdir)"\" $(gtk_def) @TURBO_CFLAGS@

 if HAVE_AVFORMAT

There are several #ifdef __FreeBSD__ in code: lives-plugins/plugins/decoders/asf_decoder.c lives-plugins/plugins/decoders/decplugin.h lives-plugins/plugins/decoders/mpegts_decoder.c src/rpmalloc.c

VVD commented 3 years ago

Build error with and without --disable-system-weed, with and without installed lives (with embedded weed):

haar_analyser.cpp:439:31: error: no matching function for call to 'weed_get_out_params'
  weed_plant_t **out_params = weed_get_out_params(inst);
                              ^~~~~~~~~~~~~~~~~~~
./../weed-plugin-utils.c:563:30: note: candidate function not viable: requires 2 arguments, but 1 was provided
static inline weed_plant_t **weed_get_out_params(weed_plant_t *instance, int *nparams) {
                             ^
haar_analyser.cpp:440:30: error: no matching function for call to 'weed_get_in_params'
  weed_plant_t **in_params = weed_get_in_params(inst);
                             ^~~~~~~~~~~~~~~~~~
./../weed-plugin-utils.c:560:30: note: candidate function not viable: requires 2 arguments, but 1 was provided
static inline weed_plant_t **weed_get_in_params(weed_plant_t *instance, int *nparams) {
                             ^
haar_analyser.cpp:573:3: error: use of undeclared identifier 'weed_plugin_se_Tpackage_version'; did you mean 'weed_plugin_set_package_version'?
  weed_plugin_se_Tpackage_version(plugin_info, package_version);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  weed_plugin_set_package_version
./../weed-plugin-utils.c:109:20: note: 'weed_plugin_set_package_version' declared here
static inline void weed_plugin_set_package_version(weed_plant_t *pi, int v)
                   ^
4 warnings and 3 errors generated.
*** [haar_analyser.lo] Error code 1
salsaman commented 3 years ago

https://stackoverflow.com/questions/17576227/equivalent-of-ftree-vectorizer-verbose-for-clang

Benchmarking code, I will remove it.

salsaman commented 3 years ago
--- configure.ac.orig
+++ configure.ac
@@ -91,6 +91,7 @@
 AM_CONDITIONAL(IS_LINUX_MUSL,$IS_LINUX_MUSL)
 AM_CONDITIONAL(IS_SOLARIS,$IS_SOLARIS)
 AM_CONDITIONAL(IS_MINGW,$IS_MINGW)
+AM_CONDITIONAL(IS_FREEBSD,$IS_FREEBSD)

 if test "$IS_MINGW" = "false"; then
 AC_CHECK_FILE(lives-plugins/Makefile.am,,[
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -29,6 +29,10 @@
 solaris_CFLAGS = -DIS_SOLARIS=1
 endif

+if IS_FREEBSD
+freebsd_CFLAGS = -DIS_FREEBSD=1
+endif
+
 gtk_LIBFLAGS = @GTK_LIBS_NODYNAMIC@ -pthread

 AM_CPPFLAGS = \
@@ -233,8 +237,9 @@

 AM_CFLAGS = -fPIE -Wstrict-aliasing=0 -Wall $(yuv4mpeg_CFLAGS) $(ldvgrab_CFLAGS) $(dvgrab_CFLAGS) \
        $(oil_CFLAGS) $(wayland_CFLAGS) $(transcode_CFLAGS) \
-       $(darwin_CFLAGS) $(irix_CFLAGS) $(linux_CFLAGS) $(solaris_CFLAGS) $(osc_CFLAGS) $(alsa_CFLAGS) $(png_CFLAGS) $(swscale_CFLAGS) \
-       $(jack_CFLAGS) $(pulse_CFLAGS) $(libexplain_CFLAGS) $(giw_CFLAGS) $(unicap_CFLAGS) $(libweed_CFLAGS) $(libweed_compat_CFLAGS) \
+       $(darwin_CFLAGS) $(irix_CFLAGS) $(linux_CFLAGS) $(solaris_CFLAGS) $(freebsd_CFLAGS) \
+       $(osc_CFLAGS) $(alsa_CFLAGS) $(png_CFLAGS) $(swscale_CFLAGS) $(jack_CFLAGS) $(pulse_CFLAGS) \
+       $(libexplain_CFLAGS) $(giw_CFLAGS) $(unicap_CFLAGS) $(libweed_CFLAGS) $(libweed_compat_CFLAGS) \
        -DLIVES_LIBDIR=\""$(libdir)"\" $(gtk_def) @TURBO_CFLAGS@

 if HAVE_AVFORMAT

There are several #ifdef __FreeBSD__ in code: lives-plugins/plugins/decoders/asf_decoder.c lives-plugins/plugins/decoders/decplugin.h lives-plugins/plugins/decoders/mpegts_decoder.c src/rpmalloc.c

mallopt.h no longer used, removing it. Other ifdefs are fine, no changes needed.

salsaman commented 3 years ago

OK working on fixes.

WARNING: there is a very recent bug which can delete clips on exit ! I am working on a fix for this, please avoid testing until it is fixed.

salsaman commented 3 years ago

OK working on fixes.

WARNING: there is a very recent bug which can delete clips on exit ! I am working on a fix for this, please avoid testing until it is fixed.

OK, fixed now. only 22125016a55e440dfd65a44bfc5abf22917fb372 from half an hour ago was affected.

salsaman commented 3 years ago

All changes pushed now, .po files also updated to current.

VVD commented 3 years ago

--disable-frei0r or --enable-frei0r cause configure error:

checking that generated files are newer than configure... done
configure: error: conditional "HAVE_FREI0R" was never defined.
Usually this means the macro was only invoked conditionally.
===>  Script "configure" failed unexpectedly.
salsaman commented 3 years ago

Fixed.

VVD commented 3 years ago

Something like this?

+++ configure.ac
@@ -921,8 +921,8 @@

 dnl check for frei0r
 AC_CHECK_HEADERS(frei0r.h, HAVE_FREI0R=true, HAVE_FREI0R=false)
-AM_CONDITIONAL(HAVE_FREI0R,$HAVE_FREI0R)
 fi
+AM_CONDITIONAL(HAVE_FREI0R,$HAVE_FREI0R)

 HAVE_LDVGRAB=false
VVD commented 3 years ago

I got it! 1272 pixels! изображение patch-po_ru.po.txt

salsaman commented 3 years ago

Looks very nice !

VVD commented 3 years ago

With --enable-frei0r didn't build lib/lives/plugins/effects/realtime/weed/frei0r/frei0r.so. Without both --enable-frei0r and --disable-frei0r lib/lives/plugins/effects/realtime/weed/frei0r/frei0r.so builded.

salsaman commented 3 years ago

There is no such option as --enable-frei0r, you cannot have both --disable-package and --enable-package defined at the same time, it doesn't make sense. If you type the option --enable-frei0r, then it is actually interpreted as --disable-frei0r, rather than being ignored as you might expect.

I have also been confused by this in the past, but unfortunately that is the way that autotools works.

VVD commented 3 years ago

Work as you described.

Is it same for: alsa doxygen jack nls projectM pulse ?

VVD commented 3 years ago

With --disable-nls:

main.c:4173:3: warning: implicit declaration of function 'setlocale' is invalid in C99 [-Wimplicit-function-declaration]
  setlocale(LC_NUMERIC, "C");
  ^
main.c:4173:13: error: use of undeclared identifier 'LC_NUMERIC'
  setlocale(LC_NUMERIC, "C");
            ^

setlocale require #include <locale.h>, but in src/support.h this include is in #ifdef ENABLE_NLS block.

salsaman commented 3 years ago

Work as you described.

Is it same for: alsa doxygen jack nls projectM pulse ?

Yes.

salsaman commented 3 years ago

With --disable-nls:

main.c:4173:3: warning: implicit declaration of function 'setlocale' is invalid in C99 [-Wimplicit-function-declaration]
  setlocale(LC_NUMERIC, "C");
  ^
main.c:4173:13: error: use of undeclared identifier 'LC_NUMERIC'
  setlocale(LC_NUMERIC, "C");
            ^

setlocale require #include <locale.h>, but in src/support.h this include is in #ifdef ENABLE_NLS block.

Don't use --disable-nls, it is not supported.

VVD commented 3 years ago

Last question: is it possible to turn off V4L via configure options? If v4l isn't installed - configure script find it, if not - lives builds without support of the v4l. But is it possible to turn off support if v4l installed?

P.S. I think it's last question before release. :-]

salsaman commented 3 years ago

Why would you want to do that ? It's only a playback plugin. If you don't want just don't use it !

VVD commented 3 years ago

I'm prepare port: https://svnweb.freebsd.org/ports/head/multimedia/lives/?sortby=date And sorting out custom build options. Maybe better to make V4L as mandatory dependency.

salsaman commented 3 years ago

You mean v4l2, right ? And you know it needs a kernel module of course.

VVD commented 3 years ago
V4L_BUILD_DEPENDS=              ${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat
V4L_LIB_DEPENDS=                libv4l2.so:multimedia/libv4l
VVD commented 3 years ago

If v4l2 installed - configure script find it and use. But if v4l2 isn't installed - configure script find this too and don't use it. Is it possible to mandatory disable search or even mandatory require?

salsaman commented 3 years ago

Why is that a problem ?

salsaman commented 3 years ago

You mean if v4l2 is present, it shouldn't build v4l1 ? Maybe a good idea then.

Done.

VVD commented 3 years ago

I ask about unambiguity during configure… If I want - it use v4l2, if I don't want - it don't use v4l2 even it installed. Build result must be the same with v4l2 installed and without it, if I don't want use it.

VVD commented 3 years ago

Don't build lib/lives/plugins/playback/video/vloopback.so anymore.

VVD commented 3 years ago

Do you use IRC? Or Discord? Or Tox? A lot of simple questions resolved too long via comments on bugracker…

salsaman commented 3 years ago

Do you use IRC? Or Discord? Or Tox? A lot of simple questions resolved too long via comments on bugracker…

whatsapp ?

VVD commented 3 years ago

whatsapp ?

No. It require phone number.

salsaman commented 3 years ago

OK, I just reactivated my account on Discord, username "salsaman".

VVD commented 3 years ago

BSD World: https://discord.gg/CaZUny

salsaman commented 3 years ago

Added the following configure options: --disable-prctl --disable-wayland --disable-xrender --disable-opencv --disable-fftw3f --disable-libexplain --disable-v4l --disable-libdv --disable-ogg --disable-theora --disable-vorbis --disable-dirac

salsaman commented 3 years ago

BSD World: https://discord.gg/CaZUny

please send another invite. I left the server and now I cannot chat with you, and I cannot return to the server as the invite has now expired. Very strange app this Discord.

VVD commented 3 years ago

https://discord.gg/wbJ5wc

VVD commented 3 years ago

Thanks! Attached patch for port - waiting commit.

salsaman commented 3 years ago

Closing as fixed !