From afcb45d9134587b1b8096081f92b4f81ec346877 Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianasulu@gmail.com>
Date: Thu, 12 Aug 2021 22:50:19 +0300
Subject: [PATCH] Fix mpeg2enc build/install (was broken by termux series)

---
 cinelerra-5.1/thirdparty/Makefile             |  4 ++--
 .../thirdparty/src/mjpegtools-2.1.0.patch5    | 21 ++++++++++---------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/cinelerra-5.1/thirdparty/Makefile b/cinelerra-5.1/thirdparty/Makefile
index 1060c5f0..abffcb58 100644
--- a/cinelerra-5.1/thirdparty/Makefile
+++ b/cinelerra-5.1/thirdparty/Makefile
@@ -397,8 +397,8 @@ clean:
 	rm -rf $(BLD)
 
 install:
-#	cp -a $(ver_mjpegtools)/mpeg2enc/mpeg2enc $(BINDIR)/.
-#	cp -a $(ver_mjpegtools)/mplex/mplex $(BINDIR)/.
+	cp -a $(ver_mjpegtools)/mpeg2enc/mpeg2enc $(BINDIR)/.
+	cp -a $(ver_mjpegtools)/mplex/mplex $(BINDIR)/.
 else
 # not WANT_CIN_3RDPARTY
 all:
diff --git a/cinelerra-5.1/thirdparty/src/mjpegtools-2.1.0.patch5 b/cinelerra-5.1/thirdparty/src/mjpegtools-2.1.0.patch5
index cbb9d408..4d390edf 100644
--- a/cinelerra-5.1/thirdparty/src/mjpegtools-2.1.0.patch5
+++ b/cinelerra-5.1/thirdparty/src/mjpegtools-2.1.0.patch5
@@ -1,11 +1,12 @@
---- mjpegtools-2.1.0/mpeg2enc/Makefile.am.orig	2021-07-23 14:01:12.127564691 +0300
-+++ mjpegtools-2.1.0/mpeg2enc/Makefile.am	2021-07-23 14:01:42.959564693 +0300
-@@ -3,7 +3,7 @@
- # and mpeg2enc command line wrapper.
- #
+--- ./mpeg2enc/seqencoder.cc.orig	2021-08-12 22:15:24.907277309 +0300
++++ ./mpeg2enc/seqencoder.cc	2021-08-12 22:17:49.471277317 +0300
+@@ -198,7 +198,9 @@
+ {
+ 	EncoderJob *job;
+ 	mjpeg_debug( "Worker thread started" );
++#if !defined (__TERMUX__)
+     pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL );
++#endif
  
--bin_PROGRAMS = mpeg2enc 
-+#bin_PROGRAMS = mpeg2enc 
- 
- mpeg2encpp_MMXSSE_INLINE = \
- 	fdct_x86.c \
+ 	for(;;)
+ 	{
-- 
2.32.0

