update bsd patch/bld for yuri
[goodguy/cinelerra.git] / cinelerra-5.1 / blds / bsd.patch
1 diff --git a/cinelerra-5.1/Makefile.devel b/cinelerra-5.1/Makefile.devel
2 index 5531330..ad671f5 100644
3 --- a/cinelerra-5.1/Makefile.devel
4 +++ b/cinelerra-5.1/Makefile.devel
5 @@ -4,7 +4,7 @@ TOPDIR := $(CURDIR)
6  CFLAGS ?= -ggdb
7  export CFLAGS_ := $(CFLAGS)
8  
9 -cpus:=$(shell grep -c "^proc" /proc/cpuinfo)
10 +cpus:=$(shell sysctl -n hw.ncpu)
11  jobs:=-j$(shell echo $$(($(cpus) + $(cpus)/2 +2)))
12  MAKEJ := $(MAKE) $(jobs)
13  
14 diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile
15 index 7e69a50..792fe6e 100644
16 --- a/cinelerra-5.1/cinelerra/Makefile
17 +++ b/cinelerra-5.1/cinelerra/Makefile
18 @@ -424,16 +424,16 @@ endif
19  
20  LIBS := $(LIBRARIES)
21  
22 -ifneq ($(WANT_CIN_3RDPARTY),no)
23 -LIBS += $(libraries)
24 -else
25 +ifeq ($(WANT_CIN_3RDPARTY),no)
26 +LIBS += $(shared_libs)
27 +LIBS += $(system_libs)
28  
29 -LIBS += -lpthread -lm -lbz2 -llzma -lz -lpng -luuid
30 -LIBS += -lX11 -lXau -lXdmcp -lXext -lXfixes -lXv -lXinerama
31 +LIBS += -lintl -liconv
32  LIBS += -lfontconfig -lfreetype
33  LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavresample -lavutil
34  LIBS += -lswresample -lswscale
35  LIBS += -lvpx -lwebp -lwebpmux
36 +LIBS += -lexecinfo
37  
38  LIBS += $(if $(filter fftw,$(static_pkgs)), -lfftw3)
39  LIBS += $(if $(filter flac,$(static_pkgs)), -lFLAC)
40 @@ -452,8 +452,12 @@ LIBS += $(if $(filter x264,$(static_pkgs)), -lx264)
41  LIBS += $(if $(filter x265,$(static_pkgs)), -lx265)
42  LIBS += $(if $(filter libvpx,$(static_pkgs)), -lvpx)
43  
44 +else
45 +LIBS += $(libraries)
46 +#endif
47 +
48  ifneq ($(WANT_GL),no)
49 -LIBS += -lGL -lGLU -lGLX
50 +LIBS += -lGL -lGLU
51  endif
52  ifneq ($(WANT_XFT),no)
53  LIBS += -lXft
54 @@ -470,9 +474,6 @@ endif
55  ifneq ($(WANT_FIREWIRE),no)
56  LIBS += -lavc1394 -lraw1394 -liec61883 -lrom1394
57  endif
58 -ifneq ($(WANT_DVB),no)
59 -LIBS += -ldv
60 -endif
61  ifneq ($(WANT_DL),no)
62  LIBS += -ldl
63  endif
64 @@ -515,6 +516,7 @@ LV2OBJS = \
65  endif
66  
67  CFLAGS := \
68 +       -I/usr/local/include \
69         -I$(GUICAST) \
70         -I$(LIBZMPEG3) \
71         $(static_incs) \
72 @@ -562,15 +564,15 @@ all:      $(OUTPUT) $(CUTADS) $(BDWRITE) $(LV2UI)
73  $(OUTPUT): $(OBJS) $(THEME_DATA) $(DCRAW) $(LIBRARIES)
74         $(LINKER) `cat $(OBJDIR)/objs`
75         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(OUTPUT) $(OUTPUT_G))
76 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
77 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
78         ln -f -s ../bin/$(WANT_CIN) ci
79  
80  ifneq ($(WANT_COMMERCIAL),no)
81  $(CUTADS):     $(CUTOBJS) $(CUTLIBS) $(LIBRARIES)
82 -       @echo g++ -o $@ $(CUTOBJS)
83 -       @g++ $(CFLAGS) -pthread -o $@ $(CUTOBJS) $(CUTLIBS) $(LIBS)
84 +       @echo $(CXX) -o $@ $(CUTOBJS)
85 +       @$(CXX) $(CFLAGS) -pthread -o $@ $(CUTOBJS) $(CUTLIBS) $(LIBS)
86         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(CUTADS) $(CUTADS).debuginfo)
87 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(CUTADS))
88 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(CUTADS))
89  
90  install-cutads:
91         cp -av $(OBJDIR)/cutads $(BINDIR)/.
92 @@ -579,18 +581,18 @@ install:  install-cutads
93  endif
94  
95  $(BDWRITE):    $(BDWOBJS) $(LIBRARIES)
96 -       @echo g++ -o $@ $(BDWOBJS)
97 -       @g++ $(CFLAGS) -pthread -o $@ $(BDWOBJS) $(LIBS)
98 +       @echo $(CXX) -o $@ $(BDWOBJS)
99 +       @$(CXX) $(CFLAGS) -pthread -o $@ $(BDWOBJS) $(LIBS)
100         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(BDWRITE) $(BDWRITE).debuginfo)
101 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(BDWRITE))
102 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(BDWRITE))
103  
104  install-bdwrite:
105         cp -av $(OBJDIR)/bdwrite $(BINDIR)/.
106  install:       install-bdwrite
107  
108  ydiff: ydiff.C $(LIBRARIES)
109 -       @echo g++ -o $@ ydiff.C
110 -       @g++ $(CFLAGS) ydiff.C -o $@ $(LIBS)
111 +       @echo $(CXX) -o $@ ydiff.C
112 +       @$(CXX) $(CFLAGS) ydiff.C -o $@ $(LIBS)
113  
114  shdmp: shdmp.C
115         @g++ $(CFLAGS) shdmp.C -o $@
116 @@ -625,7 +627,7 @@ $(OBJDIR)/lv2ui: $(LV2OBJS)
117         @echo $(CXX) \`cat $(OBJDIR)/c_flags\` $^ -o $@
118         @$(CXX) `cat $(OBJDIR)/c_flags` $^ -o $@ $(LIBS) $(GTK2_LIBS)
119         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(LV2UI) $(LV2UI).debuginfo)
120 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(LV2UI))
121 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(LV2UI))
122  
123  .PHONY:        lv2ui
124  lv2ui: $(LV2UI)
125 diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C
126 index e18ebee..eade28a 100644
127 --- a/cinelerra-5.1/cinelerra/bdcreate.C
128 +++ b/cinelerra-5.1/cinelerra/bdcreate.C
129 @@ -24,8 +24,8 @@
130  #include <unistd.h>
131  #include <fcntl.h>
132  #include <errno.h>
133 -#include <sys/stat.h>
134 -#include <sys/statfs.h>
135 +#include <sys/param.h>
136 +#include <sys/mount.h>
137  
138  // BD Creation
139  
140 diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C
141 index 6a2b4ca..78cf9be 100644
142 --- a/cinelerra-5.1/cinelerra/bdwrite.C
143 +++ b/cinelerra-5.1/cinelerra/bdwrite.C
144 @@ -38,7 +38,7 @@
145  #include <stdint.h>
146  #include <stdlib.h>
147  #include <string.h>
148 -#include <endian.h>
149 +#include <sys/endian.h>
150  #include <limits.h>
151  #include <sys/stat.h>
152  // work arounds (centos)
153 diff --git a/cinelerra-5.1/cinelerra/cutads.C b/cinelerra-5.1/cinelerra/cutads.C
154 index ac58d56..f6690cf 100644
155 --- a/cinelerra-5.1/cinelerra/cutads.C
156 +++ b/cinelerra-5.1/cinelerra/cutads.C
157 @@ -23,14 +23,6 @@
158  using namespace std;
159  #define fail(s) do { printf("fail %s%s:%d\n",__func__,#s,__LINE__); return 1; } while(0)
160  
161 -/* missing from system headers, no /usr/include <linux/ioprio.h>
162 - *   IOPRIO_WHO_PROCESS, IOPRIO_CLASS_SHIFT, IOPRIO_CLASS_IDLE */
163 -enum { IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, };
164 -#define IO_CLASS(n) (((int)(n)) << 13)
165 -#define IO_WHO_PROCESS  1
166 -#include <sys/syscall.h>
167 -#include <asm/unistd.h>
168 -
169  // commercial edge detection:
170  // must have audio < min_audio
171  //   and within +- check_margin seconds of low audio
172 @@ -55,11 +47,6 @@ class Video;
173  class Audio;
174  class Scan;
175  
176 -static int ioprio_set(int which, int who, int ioprio)
177 -{
178 -       return syscall(SYS_ioprio_set, which, who, ioprio);
179 -}
180 -
181  static inline int clip(int v, int mn, int mx)
182  {
183    return v<mn ? mn : v>mx ? mx : v;
184 @@ -617,7 +604,6 @@ class Scan
185         const char *asset_path;
186         static void set_priority(int pr, int io) {
187                 setpriority(PRIO_PROCESS, 0, pr);  // lowest cpu priority
188 -               ioprio_set(IO_WHO_PROCESS, 0, IO_CLASS(io));
189         }
190         class low_priority { public:
191                 low_priority() { set_priority(19, IOPRIO_CLASS_IDLE); }
192 diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C
193 index f4587fc..dd0c883 100644
194 --- a/cinelerra-5.1/cinelerra/dvdcreate.C
195 +++ b/cinelerra-5.1/cinelerra/dvdcreate.C
196 @@ -24,8 +24,8 @@
197  #include <unistd.h>
198  #include <fcntl.h>
199  #include <errno.h>
200 -#include <sys/stat.h>
201 -#include <sys/statfs.h>
202 +#include <sys/param.h>
203 +#include <sys/mount.h>
204  
205  
206  #define DVD_PAL_4x3    0
207 diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C
208 index 1fec188..c9180a0 100644
209 --- a/cinelerra-5.1/cinelerra/file.C
210 +++ b/cinelerra-5.1/cinelerra/file.C
211 @@ -1545,7 +1545,10 @@ int File::record_fd()
212  void File::get_exe_path(char *result, char *bnp)
213  {
214  // Get executable path, basename
215 -       int len = readlink("/proc/self/exe", result, BCTEXTLEN-1);
216 +       char exe_path[BCTEXTLEN];
217 +       sprintf(exe_path,"/proc/%d/file",getpid());
218 +       int len = readlink(exe_path, result, BCTEXTLEN-1);
219 +
220         if( len >= 0 ) {
221                 result[len] = 0;
222                 char *ptr = strrchr(result, '/');
223 diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C
224 index 3c6fd97..61abc67 100644
225 --- a/cinelerra-5.1/cinelerra/indexfile.C
226 +++ b/cinelerra-5.1/cinelerra/indexfile.C
227 @@ -70,7 +70,7 @@
228  
229  #include <sys/types.h>
230  #include <sys/stat.h>
231 -#include <linux/iso_fs.h>
232 +#include <isofs/cd9660/iso.h>
233  
234  // check for isofs volume_id for dvd/cdrom
235  
236 diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
237 index bd75cbb..b2bcc2f 100644
238 --- a/cinelerra-5.1/cinelerra/mwindow.C
239 +++ b/cinelerra-5.1/cinelerra/mwindow.C
240 @@ -268,7 +268,9 @@ MWindow::~MWindow()
241         delete beeper;
242         delete create_bd;       create_bd = 0;
243         delete create_dvd;      create_dvd = 0;
244 +#ifdef HAVE_SHUTTLE
245         delete shuttle;         shuttle = 0;
246 +#endif
247  #ifdef HAVE_WINTV
248         delete wintv;           wintv = 0;
249  #endif
250 diff --git a/cinelerra-5.1/cinelerra/shuttle.h b/cinelerra-5.1/cinelerra/shuttle.h
251 index 6793a03..06406d5 100644
252 --- a/cinelerra-5.1/cinelerra/shuttle.h
253 +++ b/cinelerra-5.1/cinelerra/shuttle.h
254 @@ -1,5 +1,6 @@
255  #ifndef __SHUTTLE_H__
256  #define __SHUTTLE_H__
257 +#ifdef HAVE_SHUTTLE
258  
259  #include "arraylist.h"
260  #include "bcwindowbase.inc"
261 @@ -20,8 +21,7 @@
262  // delay in ms before processing each XTest event
263  // CurrentTime means no delay
264  #define DELAY CurrentTime
265 -// playback max speed -64x .. 64x
266 -#define SHUTTLE_MAX_SPEED 64.
267 +
268  #define SHUTTLE_INTERFACE 0
269  
270  // protocol for events from the shuttlepro HUD device
271 @@ -257,3 +257,4 @@ public:
272  };
273  
274  #endif
275 +#endif
276 diff --git a/cinelerra-5.1/cinelerra/shuttle.inc b/cinelerra-5.1/cinelerra/shuttle.inc
277 index 5919e9d..db6b37f 100644
278 --- a/cinelerra-5.1/cinelerra/shuttle.inc
279 +++ b/cinelerra-5.1/cinelerra/shuttle.inc
280 @@ -9,4 +9,7 @@ class Translation;
281  class Translations;
282  class Shuttle;
283  
284 +// playback max speed -64x .. 64x
285 +#define SHUTTLE_MAX_SPEED 64.
286 +
287  #endif
288 diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
289 index 9268807..a22c944 100644
290 --- a/cinelerra-5.1/configure.ac
291 +++ b/cinelerra-5.1/configure.ac
292 @@ -18,8 +18,18 @@ CFG_CFLAGS+=" -Wno-unused-result"
293  CFG_CFLAGS+=" -Wno-stringop-overflow"
294  CFG_CFLAGS+=" -Wno-format-truncation"
295  CFG_CFLAGS+=" -Wno-format-overflow"
296 +CFG_CFLAGS+=" -Wno-unknown-warning-option"
297  CFG_CFLAGS+=" -Wno-parentheses"
298  CFG_CFLAGS+=" -Wno-stringop-truncation"
299 +CFG_CFLAGS+=" -Wno-gnu-designator"
300 +CFG_CFLAGS+=" -Wno-missing-braces"
301 +CFG_CFLAGS+=" -Wno-overloaded-virtual"
302 +CFG_CFLAGS+=" -Wno-self-assign-field"
303 +CFG_CFLAGS+=" -Wno-sometimes-uninitialized"
304 +CFG_CFLAGS+=" -Wno-tautological-pointer-compare"
305 +CFG_CFLAGS+=" -Wno-unused-function"
306 +CFG_CFLAGS+=" -Wno-unused-private-field"
307 +CFG_CFLAGS+=" -Wno-infinite-recursion"
308  CFG_CFLAGS+=" -D__STDC_CONSTANT_MACROS"
309  CFG_CFLAGS+=" -D__STDC_LIMIT_MACROS"
310  CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
311 @@ -141,7 +151,7 @@ AC_SUBST(MAK_INSTALLS)
312  AC_SUBST(MAK_UNINSTALLS)
313  
314  if test "x$WANT_JOBS" = "xauto"; then
315 -  CPUS=`grep -c "^proc" /proc/cpuinfo`
316 +  CPUS=`sysctl -n hw.ncpu`
317    WANT_JOBS=`expr $CPUS + $CPUS / 2 + 2`
318  fi
319  
320 diff --git a/cinelerra-5.1/db/tdb.h b/cinelerra-5.1/db/tdb.h
321 index 8ee8800..9a17091 100644
322 --- a/cinelerra-5.1/db/tdb.h
323 +++ b/cinelerra-5.1/db/tdb.h
324 @@ -32,7 +32,7 @@ inline void operator delete[](void *t,size_t n) { free(t); }
325  #endif
326  
327  #define ZMEDIA
328 -#define ZFUTEX
329 +//#define ZFUTEX
330  #ifdef ZFUTEX
331  #include <unistd.h>
332  #include <endian.h>
333 diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile
334 index 201c5a4..1c3822f 100644
335 --- a/cinelerra-5.1/guicast/Makefile
336 +++ b/cinelerra-5.1/guicast/Makefile
337 @@ -95,7 +95,7 @@ $(shell echo $(OBJS) > $(OBJDIR)/objs)
338  all: $(OUTPUT) $(UTILS)
339  
340  $(BCXFER):     bccmdl.py bcxfer.C bcxfer.h
341 -       python < ./bccmdl.py
342 +       python2.7 < ./bccmdl.py
343         +$(MAKE) -C xfer
344  
345  $(OUTPUT): $(OBJS) $(BCXFER)
346 diff --git a/cinelerra-5.1/guicast/bclistbox.h b/cinelerra-5.1/guicast/bclistbox.h
347 index ce34ffc..0e38913 100644
348 --- a/cinelerra-5.1/guicast/bclistbox.h
349 +++ b/cinelerra-5.1/guicast/bclistbox.h
350 @@ -187,7 +187,9 @@ public:
351  
352  // take_focus - used by the suggestion box to keep it from taking focus from the
353  // textbox
354 -       int activate(int take_focus = 1);
355 +       int activate() {  return activate(1); }
356 +       int activate(int take_focus);
357 +
358         int activate(int x, int y, int w=-1, int h=-1);
359         int deactivate();
360         int is_active();
361 diff --git a/cinelerra-5.1/guicast/bcpan.h b/cinelerra-5.1/guicast/bcpan.h
362 index 40f5971..73d4758 100644
363 --- a/cinelerra-5.1/guicast/bcpan.h
364 +++ b/cinelerra-5.1/guicast/bcpan.h
365 @@ -93,7 +93,8 @@ public:
366                 int &stick_x,
367                 int &stick_y);
368         static int rdtoxy(int &x, int &y, int a, int virtual_r);
369 -       int activate(int popup_x = -1, int popup_y = -1);
370 +       int activate(int popup_x, int popup_y);
371 +       int activate() { return activate(-1,-1); }
372         int deactivate();
373         float* get_values();
374  
375 diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C
376 index 1d52855..c8d93bd 100644
377 --- a/cinelerra-5.1/guicast/bcresources.C
378 +++ b/cinelerra-5.1/guicast/bcresources.C
379 @@ -39,6 +39,7 @@
380  #include <iconv.h>
381  #include <sys/ipc.h>
382  #include <sys/shm.h>
383 +#include <sys/sysctl.h>
384  #include <X11/extensions/XShm.h>
385  #include <fontconfig/fontconfig.h>
386  #include <fontconfig/fcfreetype.h>
387 @@ -298,23 +299,12 @@ int BC_Resources::machine_cpus = 1;
388  
389  int BC_Resources::get_machine_cpus()
390  {
391 -       int cpus = 1;
392 -       FILE *proc = fopen("/proc/cpuinfo", "r");
393 -       if( proc ) {
394 -               char string[BCTEXTLEN], *cp;
395 -               while(!feof(proc) && fgets(string, sizeof(string), proc) ) {
396 -                       if( !strncasecmp(string, "processor", 9) &&
397 -                           (cp = strchr(string, ':')) != 0 ) {
398 -                               int n = atol(cp+1) + 1;
399 -                               if( n > cpus ) cpus = n;
400 -                       }
401 -                       else if( !strncasecmp(string, "cpus detected", 13) &&
402 -                           (cp = strchr(string, ':')) != 0 )
403 -                               cpus = atol(cp+1);
404 -               }
405 -               fclose(proc);
406 -       }
407 -       return cpus;
408 +       int mib[2], ncpu;
409 +       size_t len = sizeof(ncpu);
410 +       mib[0] = CTL_HW;
411 +       mib[1] = HW_NCPU;
412 +       if( sysctl(mib, 2, &ncpu, &len, 0, 0) ) ncpu = 1;
413 +       return ncpu;
414  }
415  
416  void BC_Resources::new_vframes(int n, VFrame *vframes[], ...)
417 @@ -367,8 +357,8 @@ BC_Resources::BC_Resources(float x_scale, float y_scale)
418         BC_WindowBase::resources = this;
419         synchronous = 0;
420         vframe_shm = 0;
421 -       use_shm = -1;
422 -       shm_reply = 1;
423 +       use_shm = 0;
424 +       shm_reply = 0;
425  
426         if( x_scale <= 0 ) x_scale = 1;
427         if( y_scale <= 0 ) y_scale = x_scale;
428 diff --git a/cinelerra-5.1/guicast/bcsignals.C b/cinelerra-5.1/guicast/bcsignals.C
429 index c68e39a..457254a 100644
430 --- a/cinelerra-5.1/guicast/bcsignals.C
431 +++ b/cinelerra-5.1/guicast/bcsignals.C
432 @@ -37,9 +37,11 @@
433  #include <sys/stat.h>
434  #include <unistd.h>
435  #include <sys/ioctl.h>
436 -#include <sys/prctl.h>
437  #include <sys/types.h>
438  
439 +#define dirent64 dirent
440 +#define readdir64 readdir
441 +
442  BC_Signals* BC_Signals::global_signals = 0;
443  static int signal_done = 0;
444  
445 @@ -279,18 +281,6 @@ static void handle_exit(int signum)
446  
447  void BC_Signals::set_sighup_exit(int enable)
448  {
449 -       if( enable ) {
450 -// causes SIGHUP to be generated when parent dies
451 -               signal(SIGHUP, handle_exit);
452 -               prctl(PR_SET_PDEATHSIG, SIGHUP, 0,0,0);
453 -// prevents ^C from signalling child when attached to gdb
454 -               setpgid(0, 0);
455 -               if( isatty(0) ) ioctl(0, TIOCNOTTY, 0);
456 -       }
457 -       else {
458 -               signal(SIGHUP, signal_entry);
459 -               prctl(PR_SET_PDEATHSIG, 0,0,0,0);
460 -       }
461  }
462  
463  BC_Signals::BC_Signals()
464 @@ -383,70 +373,72 @@ const char* BC_Signals::sig_to_str(int number)
465  #include <sys/wait.h>
466  #include "thread.h"
467  
468 +#define SC_(r)mc_##r
469 +
470  #if __i386__
471 -#define IP eip
472 -#define sigregs_t sigcontext
473 +#define IP SC_(eip)
474 +#define sigregs_t mcontext_t
475  
476  static void reg_dump(FILE *fp,sigregs_t *rp)
477  {
478         fprintf(fp,"REGS:\n");
479 -       fprintf(fp,"  gs: %04x:%04x\n", rp->gs,rp->__gsh);
480 -       fprintf(fp,"  fs: %04x:%04x\n", rp->fs,rp->__fsh);
481 -       fprintf(fp,"  es: %04x:%04x\n", rp->es,rp->__esh);
482 -       fprintf(fp,"  ds: %04x:%04x\n", rp->ds,rp->__dsh);
483 -       fprintf(fp," edi: %14p %d\n", (void*)rp->edi,rp->edi);
484 -       fprintf(fp," esi: %14p %d\n", (void*)rp->esi,rp->esi);
485 -       fprintf(fp," ebp: %14p %d\n", (void*)rp->ebp,rp->ebp);
486 -       fprintf(fp," esp: %14p %d\n", (void*)rp->esp,rp->esp);
487 -       fprintf(fp," ebx: %14p %d\n", (void*)rp->ebx,rp->ebx);
488 -       fprintf(fp," edx: %14p %d\n", (void*)rp->edx,rp->edx);
489 -       fprintf(fp," ecx: %14p %d\n", (void*)rp->ecx,rp->ecx);
490 -       fprintf(fp," eax: %14p %d\n", (void*)rp->eax,rp->eax);
491 -       fprintf(fp," trapno: %14p %d\n", (void*)rp->trapno,rp->trapno);
492 -       fprintf(fp," err: %14p %d\n", (void*)rp->err,rp->err);
493 -       fprintf(fp," eip: %14p %d\n", (void*)rp->eip,rp->eip);
494 -       fprintf(fp," cs: %04xd : %04x\n", rp->cs,rp->__csh);
495 -       fprintf(fp," eflags: %14p %d\n", (void*)rp->eflags,rp->eflags);
496 -       fprintf(fp," esp_at_signal: %p %d\n", (void*)rp->esp_at_signal,rp->esp_at_signal);
497 -       fprintf(fp," ss: %04xd : %04x\n", rp->ss,rp->__ssh);
498 -       fprintf(fp," oldmask: %14p %d\n", (void*)rp->oldmask,rp->oldmask);
499 -       fprintf(fp," cr2: %14p %d\n", (void*)rp->cr2,rp->cr2);
500 +       fprintf(fp,"  gs: %04x:%04x\n", rp->mc_gs,rp->mc_gs);
501 +       fprintf(fp,"  fs: %04x:%04x\n", rp->mc_fs,rp->mc_fs);
502 +       fprintf(fp,"  es: %04x:%04x\n", rp->mc_es,rp->mc_es);
503 +       fprintf(fp,"  ds: %04x:%04x\n", rp->mc_ds,rp->mc_ds);
504 +       fprintf(fp," edi: %14p %d\n", (void*)rp->mc_edi,rp->mc_edi);
505 +       fprintf(fp," esi: %14p %d\n", (void*)rp->mc_esi,rp->mc_esi);
506 +       fprintf(fp," ebp: %14p %d\n", (void*)rp->mc_ebp,rp->mc_ebp);
507 +       fprintf(fp," esp: %14p %d\n", (void*)rp->mc_esp,rp->mc_esp);
508 +       fprintf(fp," ebx: %14p %d\n", (void*)rp->mc_ebx,rp->mc_ebx);
509 +       fprintf(fp," edx: %14p %d\n", (void*)rp->mc_edx,rp->mc_edx);
510 +       fprintf(fp," ecx: %14p %d\n", (void*)rp->mc_ecx,rp->mc_ecx);
511 +       fprintf(fp," eax: %14p %d\n", (void*)rp->mc_eax,rp->mc_eax);
512 +       fprintf(fp," trapno: %14p %d\n", (void*)rp->mc_trapno,rp->mc_trapno);
513 +       fprintf(fp," err: %14p %d\n", (void*)rp->mc_err,rp->mc_err);
514 +       fprintf(fp," eip: %14p %d\n", (void*)rp->mc_eip,rp->mc_eip);
515 +       fprintf(fp," cs: %04x\n", (unsigned)rp->mc_cs);
516 +       fprintf(fp," eflags: %14p %d\n", (void*)rp->mc_eflags,rp->mc_eflags);
517 +       fprintf(fp," esp_at_signal: %p %d\n", (void*)rp->mc_esp_at_signal,rp->mc_esp_at_signal);
518 +       fprintf(fp," ss: %04xd : %04x\n", rp->mc_ss,rp->mc_ss);
519 +//     fprintf(fp," oldmask: %14p %d\n", (void*)rp->mc_oldmask,rp->mc_oldmask);
520 +//     fprintf(fp," cr2: %14p %d\n", (void*)rp->mc_cr2,rp->mc_cr2);
521         fprintf(fp,"\n");
522  }
523  #endif
524  
525  #if __x86_64__
526 -#define IP rip
527 -#define sigregs_t sigcontext
528 +#define IP SC_(rip)
529 +#define sigregs_t mcontext_t
530  
531  static void reg_dump(FILE *fp,sigregs_t *rp)
532  {
533         fprintf(fp,"REGS:\n");
534 -       fprintf(fp,"  r8: %20p %jd\n", (void*)rp->r8,rp->r8);
535 -       fprintf(fp,"  r9: %20p %jd\n", (void*)rp->r9,rp->r9);
536 -       fprintf(fp," r10: %20p %jd\n", (void*)rp->r10,rp->r10);
537 -       fprintf(fp," r11: %20p %jd\n", (void*)rp->r11,rp->r11);
538 -       fprintf(fp," r12: %20p %jd\n", (void*)rp->r12,rp->r12);
539 -       fprintf(fp," r13: %20p %jd\n", (void*)rp->r13,rp->r13);
540 -       fprintf(fp," r14: %20p %jd\n", (void*)rp->r14,rp->r14);
541 -       fprintf(fp," r15: %20p %jd\n", (void*)rp->r15,rp->r15);
542 -       fprintf(fp," rdi: %20p %jd\n", (void*)rp->rdi,rp->rdi);
543 -       fprintf(fp," rsi: %20p %jd\n", (void*)rp->rsi,rp->rsi);
544 -       fprintf(fp," rbp: %20p %jd\n", (void*)rp->rbp,rp->rbp);
545 -       fprintf(fp," rbx: %20p %jd\n", (void*)rp->rbx,rp->rbx);
546 -       fprintf(fp," rdx: %20p %jd\n", (void*)rp->rdx,rp->rdx);
547 -       fprintf(fp," rax: %20p %jd\n", (void*)rp->rax,rp->rax);
548 -       fprintf(fp," rcx: %20p %jd\n", (void*)rp->rcx,rp->rcx);
549 -       fprintf(fp," rsp: %20p %jd\n", (void*)rp->rsp,rp->rsp);
550 -       fprintf(fp," rip: %20p %jd\n", (void*)rp->rip,rp->rip);
551 -       fprintf(fp," eflags: %14p %jd\n", (void*)rp->eflags,rp->eflags);
552 -       fprintf(fp,"  cs: %04x\n", rp->cs);
553 -       fprintf(fp,"  gs: %04x\n", rp->gs);
554 -       fprintf(fp,"  fs: %04x\n", rp->fs);
555 -       fprintf(fp," err: %20p %jd\n", (void*)rp->err,rp->err);
556 -       fprintf(fp," trapno: %20p %jd\n", (void*)rp->trapno,rp->trapno);
557 -       fprintf(fp," oldmask: %20p %jd\n", (void*)rp->oldmask,rp->oldmask);
558 -       fprintf(fp," cr2: %20p %jd\n", (void*)rp->cr2,rp->cr2);
559 +       fprintf(fp,"  r8: %20p %jd\n", (void*)rp->mc_r8,rp->mc_r8);
560 +       fprintf(fp,"  r9: %20p %jd\n", (void*)rp->mc_r9,rp->mc_r9);
561 +       fprintf(fp," r10: %20p %jd\n", (void*)rp->mc_r10,rp->mc_r10);
562 +       fprintf(fp," r11: %20p %jd\n", (void*)rp->mc_r11,rp->mc_r11);
563 +       fprintf(fp," r12: %20p %jd\n", (void*)rp->mc_r12,rp->mc_r12);
564 +       fprintf(fp," r13: %20p %jd\n", (void*)rp->mc_r13,rp->mc_r13);
565 +       fprintf(fp," r14: %20p %jd\n", (void*)rp->mc_r14,rp->mc_r14);
566 +       fprintf(fp," r15: %20p %jd\n", (void*)rp->mc_r15,rp->mc_r15);
567 +       fprintf(fp," rdi: %20p %jd\n", (void*)rp->mc_rdi,rp->mc_rdi);
568 +       fprintf(fp," rsi: %20p %jd\n", (void*)rp->mc_rsi,rp->mc_rsi);
569 +       fprintf(fp," rbp: %20p %jd\n", (void*)rp->mc_rbp,rp->mc_rbp);
570 +       fprintf(fp," rbx: %20p %jd\n", (void*)rp->mc_rbx,rp->mc_rbx);
571 +       fprintf(fp," rdx: %20p %jd\n", (void*)rp->mc_rdx,rp->mc_rdx);
572 +       fprintf(fp," rax: %20p %jd\n", (void*)rp->mc_rax,rp->mc_rax);
573 +       fprintf(fp," rcx: %20p %jd\n", (void*)rp->mc_rcx,rp->mc_rcx);
574 +       fprintf(fp," rsp: %20p %jd\n", (void*)rp->mc_rsp,rp->mc_rsp);
575 +       fprintf(fp," rip: %20p %jd\n", (void*)rp->mc_rip,rp->mc_rip);
576 +       fprintf(fp," eflags: %14p %u\n", (void*)((unsigned long)rp->mc_flags),rp->mc_flags);
577 +       fprintf(fp,"  cs: %04x\n", (unsigned)rp->mc_cs);
578 +       fprintf(fp,"  gs: %04x\n", (unsigned)rp->mc_gs);
579 +       fprintf(fp,"  fs: %04x\n", (unsigned)rp->mc_fs);
580 +       fprintf(fp," err: %20p %jd\n", (void*)rp->mc_err,rp->mc_err);
581 +       fprintf(fp," trapno: %20p %d\n", (void*)((unsigned long)rp->mc_trapno),rp->mc_trapno);
582 +//     fprintf(fp," oldmask: %20p %jd\n", (void*)rp->mc_oldmask,rp->mc_oldmask);
583 +//     fprintf(fp," cr2: %20p %jd\n", (void*)rp->mc_cr2,rp->mc_cr2);
584         fprintf(fp,"\n");
585  }
586  
587 @@ -476,7 +468,7 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
588  //     if( uid != 0 ) return;
589         ucontext_t *uc = (ucontext_t *)sc;
590         int pid = getpid(), tid = gettid();
591 -       struct sigregs_t *c = (struct sigregs_t *)&uc->uc_mcontext;
592 +       sigregs_t *c = (sigregs_t *)&uc->uc_mcontext;
593         uint8_t *ip = (uint8_t *)c->IP;
594         fprintf(stderr,"** %s at %p in pid %d, tid %d\n",
595                 n==SIGSEGV? "segv" : n==SIGINT? "intr" : "trap",
596 @@ -545,26 +537,5 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
597         reg_dump(fp, c);
598         fprintf(fp,"\n\n");
599         if( fp != stdout ) fclose(fp);
600 -       char cmd[1024], *cp = cmd;
601 -       cp += sprintf(cp, "exec gdb /proc/%d/exe -p %d --batch --quiet "
602 -               "-ex \"thread apply all info registers\" "
603 -               "-ex \"thread apply all bt full\" "
604 -               "-ex \"quit\"", pid, pid);
605 -       if( fp != stdout )
606 -               cp += sprintf(cp," >> \"%s\"", fn);
607 -       cp += sprintf(cp," 2>&1");
608 -//printf("handle_dump:: pid=%d, cmd='%s'  fn='%s'\n",pid,cmd,fn);
609 -        pid = vfork();
610 -        if( pid < 0 ) {
611 -               fprintf(stderr,"** can't start gdb, dump abondoned\n");
612 -               return;
613 -       }
614 -       if( pid > 0 ) {
615 -               waitpid(pid,0,0);
616 -               fprintf(stderr,"** dump complete\n");
617 -               return;
618 -       }
619 -        char *const argv[4] = { (char*) "/bin/sh", (char*) "-c", cmd, 0 };
620 -        execvp(argv[0], &argv[0]);
621  }
622  
623 diff --git a/cinelerra-5.1/guicast/bctrace.C b/cinelerra-5.1/guicast/bctrace.C
624 index 7e45392..2d08b46 100644
625 --- a/cinelerra-5.1/guicast/bctrace.C
626 +++ b/cinelerra-5.1/guicast/bctrace.C
627 @@ -309,7 +309,7 @@ void BC_Trace::dump_traces(FILE *fp)
628         }
629  }
630  
631 -void trace_info::set_owner() { owner = pthread_self(); }
632 +void trace_info::set_owner() { owner = (unsigned long)pthread_self(); }
633  void trace_info::unset_owner() { owner = 0; }
634  
635  void BC_Trace::dump_locks(FILE *fp)
636 @@ -322,7 +322,7 @@ void BC_Trace::dump_locks(FILE *fp)
637                 fprintf(fp,"    %p %s, %s %p%s",
638                         p->info, p->title, p->loc,
639                         (void*)p->tid, p->is_owner ? " *" : "");
640 -               if( p->info->owner && p->info->owner != p->tid )
641 +               if( p->info->owner && p->info->owner != (unsigned long)p->tid )
642                         fprintf(fp," %p", (void*)p->info->owner);
643                 fprintf(fp,"\n");
644         }
645 diff --git a/cinelerra-5.1/guicast/filesystem.C b/cinelerra-5.1/guicast/filesystem.C
646 index ebc2007..9d6452c 100644
647 --- a/cinelerra-5.1/guicast/filesystem.C
648 +++ b/cinelerra-5.1/guicast/filesystem.C
649 @@ -33,6 +33,8 @@
650  #include <unistd.h>
651  #include <utime.h>
652  
653 +#define dirent64 dirent
654 +#define readdir64 readdir
655  
656  #include "filesystem.h"
657  
658 diff --git a/cinelerra-5.1/guicast/thread.C b/cinelerra-5.1/guicast/thread.C
659 index dff53e6..321ab4f 100644
660 --- a/cinelerra-5.1/guicast/thread.C
661 +++ b/cinelerra-5.1/guicast/thread.C
662 @@ -55,13 +55,6 @@ void* Thread::entrypoint(void *parameters)
663         pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
664         thread->cancel_enabled = false;
665  
666 -// Set realtime here since it doesn't work in start
667 -       if( thread->realtime && getuid() == 0 ) {
668 -               struct sched_param param = { sched_priority : 1 };
669 -               if(pthread_setschedparam(thread->tid, SCHED_RR, &param) < 0)
670 -                       perror("Thread::entrypoint pthread_attr_setschedpolicy");
671 -       }
672 -
673         thread->run();
674         thread->finished = true;
675         if( !thread->synchronous ) {
676 diff --git a/cinelerra-5.1/guicast/thread.h b/cinelerra-5.1/guicast/thread.h
677 index 7ad81b2..8ebec23 100644
678 --- a/cinelerra-5.1/guicast/thread.h
679 +++ b/cinelerra-5.1/guicast/thread.h
680 @@ -27,10 +27,7 @@
681  #include <unistd.h>
682  #include <sys/syscall.h>
683  
684 -// glibc >= 2.30 provides gettid() in unistd
685 -#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30)
686 -static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); }
687 -#endif
688 +static inline long gettid() { return (long)pthread_self(); }
689  
690  // The thread does not autodelete by default.
691  // If autodelete is 1 the thread autodeletes.
692 diff --git a/cinelerra-5.1/plugins/Makefile b/cinelerra-5.1/plugins/Makefile
693 index 22bc7dd..3459bd0 100644
694 --- a/cinelerra-5.1/plugins/Makefile
695 +++ b/cinelerra-5.1/plugins/Makefile
696 @@ -36,7 +36,6 @@ DIRS = $(OPENCV_OBJS) \
697         brightness \
698         burn \
699         C41 \
700 -       cdripper \
701         chorus \
702         chromakey \
703         chromakeyhsv \
704 @@ -176,6 +175,8 @@ DIRS = $(OPENCV_OBJS) \
705  #      denoisemjpeg \
706  # duplicate
707  #      vocoder \
708 +# not in bsd
709 +#      cdripper \
710  
711  PLUGIN_DIR = $(BINDIR)/plugins
712  DATA = $(PLUGIN_DIR)/fonts $(PLUGIN_DIR)/shapes
713 diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C
714 index 88d6501..fe4a652 100644
715 --- a/cinelerra-5.1/plugins/titler/titler.C
716 +++ b/cinelerra-5.1/plugins/titler/titler.C
717 @@ -57,8 +57,7 @@
718  #include <stdint.h>
719  #include <stdio.h>
720  #include <string.h>
721 -#include <endian.h>
722 -#include <byteswap.h>
723 +#include <sys/endian.h>
724  #include <iconv.h>
725  #include <sys/stat.h>
726  #include <fontconfig/fontconfig.h>