Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / blds / netbsd.patch
1 diff --git a/cinelerra-5.1/Makefile.devel b/cinelerra-5.1/Makefile.devel
2 index 55313308..ad671f57 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/blds/bsd.bld b/cinelerra-5.1/blds/bsd.bld
15 index 165cc00b..b6c5f96b 100755
16 --- a/cinelerra-5.1/blds/bsd.bld
17 +++ b/cinelerra-5.1/blds/bsd.bld
18 @@ -2,18 +2,21 @@
19  #use: patch -p2 < bsd.patch
20  export CONFIG_SHELL=/bin/bash
21  export MAKE=gmake
22 -export C_INCLUDE_PATH=/usr/local/include
23 +export C_INCLUDE_PATH=/usr/local/include:/usr/X11R7/include:/usr/pkg/include:/usr/pkg/include/ffmpeg4
24  export CPLUS_INCLUDE_PATH=/usr/local/include
25  export LIBRARY_PATH=/usr/local/lib
26 +export LDFLAGS="-L/usr/X11R7/lib -L/usr/pkg/lib"
27 +export CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/ffmpeg4 -pthread -I/usr/pkg/include -I/usr/pkg/include/OpenEXR -I/usr/pkg/include -I/usr/pkg/include/Imath"
28 +
29  alias make=gmake
30  ( ./autogen.sh
31 -  BSD=1 CC=clang CXX=clang++ CFLAGS="-g -O2 -DFFMPEG3" \
32 +  BSD=1 CC=gcc CXX=g++ CFLAGS="-g -fpermissive -O2 -DFFMPEG3" \
33    ./configure --with-single-user \
34      --disable-static-build --without-lv2 --disable-lame --disable-twolame \
35      --with-oss --without-alsa --without-firewire --without-dv --without-dvb \
36      --without-video4linux2 --without-xxf86vm --without-ladspa-build \
37      --without-libzmpeg --without-commercial --without-thirdparty \
38 -    --without-vaapi --without-vdpau --without-shuttle --without-shuttle-usb \
39 +    --without-vaapi --without-openexr --with-jobs=4 --without-vdpau --without-shuttle --without-shuttle-usb \
40      --without-x10tv --without-wintv
41     gmake
42     gmake install ) 2>&1 | tee log
43 diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile
44 index 1c10fc03..8bfbc754 100644
45 --- a/cinelerra-5.1/cinelerra/Makefile
46 +++ b/cinelerra-5.1/cinelerra/Makefile
47 @@ -435,7 +435,7 @@ LIBS := $(LIBRARIES)
48  ifeq ($(WANT_CIN_3RDPARTY),no)
49  LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavutil
50  LIBS += -lswresample -lswscale
51 -LIBS += -lintl -liconv
52 +LIBS += -lintl -lpng16
53  LIBS += -lexecinfo
54
55  LIBS += $(shared_libs)
56 @@ -500,14 +500,15 @@ CFLAGS += -DUSE_ALPHA
57  else
58
59  LDFLAGS1 = -Wl,-export-dynamic -g
60 -LDFLAGS2 = $(LDFLAGS)
61 +LDFLAGS2 = $(LDFLAGS)
62 +LDFLAGS3 = -L/usr/X11R7/lib -L/usr/pkg/lib/ffmpeg4 -L/usr/pkg/lib
63  LINKER = $(CXX) -o $(OUTPUT)
64
65  endif
66
67  $(shell mkdir -p $(OBJDIR))
68  $(shell echo $(CFLAGS) > $(OBJDIR)/c_flags)
69 -$(shell echo $(LDFLAGS1) $(OBJS) $(THEME_DATA) $(DCRAW) $(LIBS) $(LDFLAGS2) > $(OBJDIR)/objs)
70 +$(shell echo $(LDFLAGS3) $(LDFLAGS1) $(OBJS) $(THEME_DATA) $(DCRAW) $(LIBS) $(LDFLAGS2) > $(OBJDIR)/objs)
71
72  all:   $(OUTPUT) $(CUTADS) $(BDWRITE) $(LV2UI)
73
74 @@ -517,7 +518,7 @@ all:        $(OUTPUT) $(CUTADS) $(BDWRITE) $(LV2UI)
75  $(OUTPUT): $(OBJS) $(THEME_DATA) $(DCRAW) $(LIBRARIES)
76         $(LINKER) `cat $(OBJDIR)/objs`
77         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(OUTPUT) $(OUTPUT_G))
78 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
79 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
80         ln -f -s ../bin/$(WANT_CIN) ci
81
82  ifneq ($(WANT_COMMERCIAL),no)
83 @@ -535,7 +536,7 @@ endif
84
85  $(BDWRITE):    $(BDWOBJS) $(LIBRARIES)
86         @echo $(CXX) -o $@ $(BDWOBJS)
87 -       @$(CXX) $(CFLAGS) -pthread -o $@ $(BDWOBJS) $(LIBS)
88 +       @$(CXX) $(CFLAGS) -pthread -o $@ $(BDWOBJS) $(LIBS) $(LDFLAGS3)
89         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(BDWRITE) $(BDWRITE).debuginfo)
90         $(if $(findstring -ggdb,$(CFLAGS)),,strip $(BDWRITE))
91
92 diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C
93 index 150f835d..fc313c72 100644
94 --- a/cinelerra-5.1/cinelerra/bdcreate.C
95 +++ b/cinelerra-5.1/cinelerra/bdcreate.C
96 @@ -24,8 +24,12 @@
97  #include <unistd.h>
98  #include <fcntl.h>
99  #include <errno.h>
100 -#include <sys/stat.h>
101 -#include <sys/statfs.h>
102 +#include <sys/param.h>
103 +#include <sys/mount.h>
104 +
105 +#ifndef statfs
106 +#define statfs statvfs
107 +#endif
108
109  // BD Creation
110
111 diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C
112 index 6a2b4ca3..78cf9bef 100644
113 --- a/cinelerra-5.1/cinelerra/bdwrite.C
114 +++ b/cinelerra-5.1/cinelerra/bdwrite.C
115 @@ -38,7 +38,7 @@
116  #include <stdint.h>
117  #include <stdlib.h>
118  #include <string.h>
119 -#include <endian.h>
120 +#include <sys/endian.h>
121  #include <limits.h>
122  #include <sys/stat.h>
123  // work arounds (centos)
124 diff --git a/cinelerra-5.1/cinelerra/ci b/cinelerra-5.1/cinelerra/ci
125 index bc987833..22858982 120000
126 --- a/cinelerra-5.1/cinelerra/ci
127 +++ b/cinelerra-5.1/cinelerra/ci
128 @@ -1 +1 @@
129 -../bin/cinelerra
130 \ No newline at end of file
131 +../bin/cin
132 \ No newline at end of file
133 diff --git a/cinelerra-5.1/cinelerra/cutads.C b/cinelerra-5.1/cinelerra/cutads.C
134 index ac58d56a..f6690cf2 100644
135 --- a/cinelerra-5.1/cinelerra/cutads.C
136 +++ b/cinelerra-5.1/cinelerra/cutads.C
137 @@ -23,14 +23,6 @@
138  using namespace std;
139  #define fail(s) do { printf("fail %s%s:%d\n",__func__,#s,__LINE__); return 1; } while(0)
140
141 -/* missing from system headers, no /usr/include <linux/ioprio.h>
142 - *   IOPRIO_WHO_PROCESS, IOPRIO_CLASS_SHIFT, IOPRIO_CLASS_IDLE */
143 -enum { IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, };
144 -#define IO_CLASS(n) (((int)(n)) << 13)
145 -#define IO_WHO_PROCESS  1
146 -#include <sys/syscall.h>
147 -#include <asm/unistd.h>
148 -
149  // commercial edge detection:
150  // must have audio < min_audio
151  //   and within +- check_margin seconds of low audio
152 @@ -55,11 +47,6 @@ class Video;
153  class Audio;
154  class Scan;
155
156 -static int ioprio_set(int which, int who, int ioprio)
157 -{
158 -       return syscall(SYS_ioprio_set, which, who, ioprio);
159 -}
160 -
161  static inline int clip(int v, int mn, int mx)
162  {
163    return v<mn ? mn : v>mx ? mx : v;
164 @@ -617,7 +604,6 @@ class Scan
165         const char *asset_path;
166         static void set_priority(int pr, int io) {
167                 setpriority(PRIO_PROCESS, 0, pr);  // lowest cpu priority
168 -               ioprio_set(IO_WHO_PROCESS, 0, IO_CLASS(io));
169         }
170         class low_priority { public:
171                 low_priority() { set_priority(19, IOPRIO_CLASS_IDLE); }
172 diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C
173 index 6ecb270b..822f0665 100644
174 --- a/cinelerra-5.1/cinelerra/dvdcreate.C
175 +++ b/cinelerra-5.1/cinelerra/dvdcreate.C
176 @@ -24,9 +24,12 @@
177  #include <unistd.h>
178  #include <fcntl.h>
179  #include <errno.h>
180 -#include <sys/stat.h>
181 -#include <sys/statfs.h>
182 +#include <sys/param.h>
183 +#include <sys/mount.h>
184
185 +#ifndef statfs
186 +#define statfs statvfs
187 +#endif
188
189  #define DVD_PAL_4x3    0
190  #define DVD_PAL_16x9   1
191 diff --git a/cinelerra-5.1/cinelerra/exportedl.C b/cinelerra-5.1/cinelerra/exportedl.C
192 index cac86bcf..0af68abd 100644
193 --- a/cinelerra-5.1/cinelerra/exportedl.C
194 +++ b/cinelerra-5.1/cinelerra/exportedl.C
195 @@ -42,6 +42,7 @@
196
197  #include <ctype.h>
198  #include <string.h>
199 +#include <libgen.h>
200
201  ExportEDLAsset::ExportEDLAsset(MWindow *mwindow, EDL *edl)
202  {
203 diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C
204 index 03941d9a..694c36bb 100644
205 --- a/cinelerra-5.1/cinelerra/file.C
206 +++ b/cinelerra-5.1/cinelerra/file.C
207 @@ -1620,7 +1620,14 @@ int File::record_fd()
208  void File::get_exe_path(char *result, char *bnp)
209  {
210  // Get executable path, basename
211 +#ifdef __FreeBSD__
212 +       char exe_path[BCTEXTLEN];
213 +       sprintf(exe_path,"/proc/%d/file",getpid());
214 +       int len = readlink(exe_path, result, BCTEXTLEN-1);
215 +#endif
216 +#if defined __NetBSD__ || defined __linux__ || defined __TERMUX__
217         int len = readlink("/proc/self/exe", result, BCTEXTLEN-1);
218 +#endif
219         if( len >= 0 ) {
220                 result[len] = 0;
221                 char *ptr = strrchr(result, '/');
222 diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C
223 index 977ad1cb..29a93ad0 100644
224 --- a/cinelerra-5.1/cinelerra/indexfile.C
225 +++ b/cinelerra-5.1/cinelerra/indexfile.C
226 @@ -70,9 +70,7 @@
227
228  #include <sys/types.h>
229  #include <sys/stat.h>
230 -#ifdef HAVE_ISOFS
231 -#include <linux/iso_fs.h>
232 -#endif
233 +#include <isofs/cd9660/iso.h>
234
235  // check for isofs volume_id for dvd/cdrom
236
237 diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
238 index c7394b7b..4f965048 100644
239 --- a/cinelerra-5.1/configure.ac
240 +++ b/cinelerra-5.1/configure.ac
241 @@ -22,14 +22,25 @@ CFG_CFLAGS+=" -Wno-unused-result"
242  CFG_CFLAGS+=" -Wno-stringop-overflow"
243  CFG_CFLAGS+=" -Wno-format-truncation"
244  CFG_CFLAGS+=" -Wno-format-overflow"
245 +CFG_CFLAGS+=" -Wno-unknown-warning-option"
246  CFG_CFLAGS+=" -Wno-parentheses"
247  CFG_CFLAGS+=" -Wno-stringop-truncation"
248 +CFG_CFLAGS+=" -Wno-gnu-designator"
249 +CFG_CFLAGS+=" -Wno-missing-braces"
250 +CFG_CFLAGS+=" -Wno-overloaded-virtual"
251 +CFG_CFLAGS+=" -Wno-self-assign-field"
252 +CFG_CFLAGS+=" -Wno-sometimes-uninitialized"
253 +CFG_CFLAGS+=" -Wno-tautological-pointer-compare"
254 +CFG_CFLAGS+=" -Wno-unused-function"
255 +CFG_CFLAGS+=" -Wno-unused-private-field"
256 +CFG_CFLAGS+=" -Wno-infinite-recursion"
257  CFG_CFLAGS+=" -D__STDC_CONSTANT_MACROS"
258  CFG_CFLAGS+=" -D__STDC_LIMIT_MACROS"
259  CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
260  CFG_CFLAGS+=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
261 -CFG_CFLAGS+=" -I/usr/include -I/usr/local/include"
262 -CFG_CFLAGS+=" -I/usr/include/freetype2 -I/usr/local/include/freetype2"
263 +CFG_CFLAGS+=" -I/usr/pkg/include/ffmpeg4 -I/usr/pkg/include/uuid"
264 +CFG_CFLAGS+=" -I/usr/include -I/usr/local/include -I/usr/pkg/include/ -I/usr/X11R7/include"
265 +CFG_CFLAGS+=" -I/usr/X11R7/include/freetype2/ -I/usr/include/freetype2 -I/usr/local/include/freetype2"
266  CFG_CFLAGS+=" -I/data/data/com.termux/files/usr/include/freetype2"
267  CFG_CFLAGS+=" -I/usr/include/uuid -I/usr/local/include/uuid"
268  CFG_CFLAGS+=" -I/data/data/com.termux/files/usr/include/uuid -I/usr/local/include/uuid"
269 @@ -1178,6 +1189,13 @@ if test "x$CFG_LDFLAGS" != "x" ; then
270    echo ""
271  fi
272
273 +if test "x$BSD" != "x" ; then
274 +  echo "CFLAGS += -DNO_PRCTL"
275 +  echo "CFLAGS += -DNO_TID"
276 +  echo "CFLAGS += -DNO_GDB"
277 +  echo "CFLAGS += -DNO_BTRACE"
278 +  echo "CFLAGS += -DNO_CTX"
279 +fi
280  if test "x$CYGWIN" != "x" ; then
281    echo 'FF_PATH ?= /usr/local'
282    echo 'LDFLAGS += -L$(FF_PATH)/lib'
283 @@ -1191,12 +1209,7 @@ if test "x$CYGWIN" != "x" ; then
284    echo "CFLAGS += -DNO_XSELECT"
285    echo ""
286  else
287 -  LDFLAGS+=" -z noexecstack"
288 -fi
289 -if test "x$BSD" != "x" ; then
290 -  echo "CFLAGS += -DNO_PRCTL"
291 -  echo "CFLAGS += -DNO_TID"
292 -  echo "CFLAGS += -DNO_GDB"
293 +  LDFLAGS+=" -L/usr/X11R7/lib, -L/usr/pkg/lib,  -z noexecstack"
294  fi
295
296  if test "x$WANT_X264_HIDEPTH" = "xyes" ; then
297 diff --git a/cinelerra-5.1/db/tdb.h b/cinelerra-5.1/db/tdb.h
298 index 24c8617c..74881ff0 100644
299 --- a/cinelerra-5.1/db/tdb.h
300 +++ b/cinelerra-5.1/db/tdb.h
301 @@ -33,7 +33,7 @@ inline void operator delete[](void *t,size_t n) { free(t); }
302  #endif
303
304  #define ZMEDIA
305 -#define ZFUTEX
306 +//#define ZFUTEX
307  #ifdef ZFUTEX
308  #include <unistd.h>
309  #include <endian.h>
310 diff --git a/cinelerra-5.1/guicast/Makefile b/cinelerra-5.1/guicast/Makefile
311 index 57cfb21f..e16d13a6 100644
312 --- a/cinelerra-5.1/guicast/Makefile
313 +++ b/cinelerra-5.1/guicast/Makefile
314 @@ -5,6 +5,10 @@ ifeq ($(OBJDIR), i686)
315  BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B i386 -I binary -O elf32-i386\""
316  endif
317
318 +ifeq ($(OBJDIR), i386)
319 +BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B i386 -I binary -O elf32-i386\""
320 +endif
321 +
322  ifeq ($(OBJDIR), x86_64)
323  BOOTSTRAPFLAGS := -DBOOTSTRAP="\"objcopy -B i386 -I binary -O elf64-x86-64\""
324  endif
325 @@ -118,7 +122,7 @@ $(OBJDIR)/pngtoh: pngtoh.c
326         $(CC) -O2 pngtoh.c -o $(OBJDIR)/pngtoh
327
328  $(OBJDIR)/pngtoraw: pngtoraw.c
329 -       $(CC) -O2 pngtoraw.c -o $(OBJDIR)/pngtoraw -lpng -lz
330 +       $(CC) -O2 pngtoraw.c -o $(OBJDIR)/pngtoraw `pkg-config --libs libpng` -lz
331
332  clean:
333         rm -rf $(OBJDIR)
334 diff --git a/cinelerra-5.1/guicast/bclistbox.h b/cinelerra-5.1/guicast/bclistbox.h
335 index ce34ffc4..0e38913d 100644
336 --- a/cinelerra-5.1/guicast/bclistbox.h
337 +++ b/cinelerra-5.1/guicast/bclistbox.h
338 @@ -187,7 +187,9 @@ public:
339
340  // take_focus - used by the suggestion box to keep it from taking focus from the
341  // textbox
342 -       int activate(int take_focus = 1);
343 +       int activate() {  return activate(1); }
344 +       int activate(int take_focus);
345 +
346         int activate(int x, int y, int w=-1, int h=-1);
347         int deactivate();
348         int is_active();
349 diff --git a/cinelerra-5.1/guicast/bcpan.h b/cinelerra-5.1/guicast/bcpan.h
350 index 40f5971f..73d47586 100644
351 --- a/cinelerra-5.1/guicast/bcpan.h
352 +++ b/cinelerra-5.1/guicast/bcpan.h
353 @@ -93,7 +93,8 @@ public:
354                 int &stick_x,
355                 int &stick_y);
356         static int rdtoxy(int &x, int &y, int a, int virtual_r);
357 -       int activate(int popup_x = -1, int popup_y = -1);
358 +       int activate(int popup_x, int popup_y);
359 +       int activate() { return activate(-1,-1); }
360         int deactivate();
361         float* get_values();
362
363 diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C
364 index cdac6305..de912dd1 100644
365 --- a/cinelerra-5.1/guicast/bcresources.C
366 +++ b/cinelerra-5.1/guicast/bcresources.C
367 @@ -39,6 +39,7 @@
368  #include <iconv.h>
369  #include <sys/ipc.h>
370  #include <sys/shm.h>
371 +#include <sys/sysctl.h>
372  #include <X11/extensions/XShm.h>
373  #include <fontconfig/fontconfig.h>
374  #include <fontconfig/fcfreetype.h>
375 @@ -298,23 +299,12 @@ int BC_Resources::machine_cpus = 1;
376
377  int BC_Resources::get_machine_cpus()
378  {
379 -       int cpus = 1;
380 -       FILE *proc = fopen("/proc/cpuinfo", "r");
381 -       if( proc ) {
382 -               char string[BCTEXTLEN], *cp;
383 -               while(!feof(proc) && fgets(string, sizeof(string), proc) ) {
384 -                       if( !strncasecmp(string, "processor", 9) &&
385 -                           (cp = strchr(string, ':')) != 0 ) {
386 -                               int n = atol(cp+1) + 1;
387 -                               if( n > cpus ) cpus = n;
388 -                       }
389 -                       else if( !strncasecmp(string, "cpus detected", 13) &&
390 -                           (cp = strchr(string, ':')) != 0 )
391 -                               cpus = atol(cp+1);
392 -               }
393 -               fclose(proc);
394 -       }
395 -       return cpus;
396 +       int mib[2], ncpu;
397 +       size_t len = sizeof(ncpu);
398 +       mib[0] = CTL_HW;
399 +       mib[1] = HW_NCPU;
400 +       if( sysctl(mib, 2, &ncpu, &len, 0, 0) ) ncpu = 1;
401 +       return ncpu;
402  }
403
404  void BC_Resources::new_vframes(int n, VFrame *vframes[], ...)
405 @@ -367,8 +357,8 @@ BC_Resources::BC_Resources(float x_scale, float y_scale)
406         BC_WindowBase::resources = this;
407         synchronous = 0;
408         vframe_shm = 0;
409 -       use_shm = -1;
410 -       shm_reply = 1;
411 +       use_shm = 0;
412 +       shm_reply = 0;
413
414         if( x_scale <= 0 ) x_scale = 1;
415         if( y_scale <= 0 ) y_scale = x_scale;
416 diff --git a/cinelerra-5.1/guicast/bcsignals.C b/cinelerra-5.1/guicast/bcsignals.C
417 index 858ba409..f43a64b9 100644
418 --- a/cinelerra-5.1/guicast/bcsignals.C
419 +++ b/cinelerra-5.1/guicast/bcsignals.C
420 @@ -403,70 +403,74 @@ const char* BC_Signals::sig_to_str(int number)
421  #include <sys/wait.h>
422  #include "thread.h"
423
424 +#define SC_(r)mc_##r
425 +
426 +#if 0
427  #if __i386__
428 -#define IP eip
429 -#define sigregs_t sigcontext
430 +#define IP SC_(eip)
431 +#define sigregs_t mcontext_t
432
433  static void reg_dump(FILE *fp,sigregs_t *rp)
434  {
435         fprintf(fp,"REGS:\n");
436 -       fprintf(fp,"  gs: %04x:%04x\n", rp->gs,rp->__gsh);
437 -       fprintf(fp,"  fs: %04x:%04x\n", rp->fs,rp->__fsh);
438 -       fprintf(fp,"  es: %04x:%04x\n", rp->es,rp->__esh);
439 -       fprintf(fp,"  ds: %04x:%04x\n", rp->ds,rp->__dsh);
440 -       fprintf(fp," edi: %14p %d\n", (void*)rp->edi,rp->edi);
441 -       fprintf(fp," esi: %14p %d\n", (void*)rp->esi,rp->esi);
442 -       fprintf(fp," ebp: %14p %d\n", (void*)rp->ebp,rp->ebp);
443 -       fprintf(fp," esp: %14p %d\n", (void*)rp->esp,rp->esp);
444 -       fprintf(fp," ebx: %14p %d\n", (void*)rp->ebx,rp->ebx);
445 -       fprintf(fp," edx: %14p %d\n", (void*)rp->edx,rp->edx);
446 -       fprintf(fp," ecx: %14p %d\n", (void*)rp->ecx,rp->ecx);
447 -       fprintf(fp," eax: %14p %d\n", (void*)rp->eax,rp->eax);
448 -       fprintf(fp," trapno: %14p %d\n", (void*)rp->trapno,rp->trapno);
449 -       fprintf(fp," err: %14p %d\n", (void*)rp->err,rp->err);
450 -       fprintf(fp," eip: %14p %d\n", (void*)rp->eip,rp->eip);
451 -       fprintf(fp," cs: %04xd : %04x\n", rp->cs,rp->__csh);
452 -       fprintf(fp," eflags: %14p %d\n", (void*)rp->eflags,rp->eflags);
453 -       fprintf(fp," esp_at_signal: %p %d\n", (void*)rp->esp_at_signal,rp->esp_at_signal);
454 -       fprintf(fp," ss: %04xd : %04x\n", rp->ss,rp->__ssh);
455 -       fprintf(fp," oldmask: %14p %d\n", (void*)rp->oldmask,rp->oldmask);
456 -       fprintf(fp," cr2: %14p %d\n", (void*)rp->cr2,rp->cr2);
457 +       fprintf(fp,"  gs: %04x:%04x\n", rp->mc_gs,rp->mc_gs);
458 +       fprintf(fp,"  fs: %04x:%04x\n", rp->mc_fs,rp->mc_fs);
459 +       fprintf(fp,"  es: %04x:%04x\n", rp->mc_es,rp->mc_es);
460 +       fprintf(fp,"  ds: %04x:%04x\n", rp->mc_ds,rp->mc_ds);
461 +       fprintf(fp," edi: %14p %d\n", (void*)rp->mc_edi,rp->mc_edi);
462 +       fprintf(fp," esi: %14p %d\n", (void*)rp->mc_esi,rp->mc_esi);
463 +       fprintf(fp," ebp: %14p %d\n", (void*)rp->mc_ebp,rp->mc_ebp);
464 +       fprintf(fp," esp: %14p %d\n", (void*)rp->mc_esp,rp->mc_esp);
465 +       fprintf(fp," ebx: %14p %d\n", (void*)rp->mc_ebx,rp->mc_ebx);
466 +       fprintf(fp," edx: %14p %d\n", (void*)rp->mc_edx,rp->mc_edx);
467 +       fprintf(fp," ecx: %14p %d\n", (void*)rp->mc_ecx,rp->mc_ecx);
468 +       fprintf(fp," eax: %14p %d\n", (void*)rp->mc_eax,rp->mc_eax);
469 +       fprintf(fp," trapno: %14p %d\n", (void*)rp->mc_trapno,rp->mc_trapno);
470 +       fprintf(fp," err: %14p %d\n", (void*)rp->mc_err,rp->mc_err);
471 +       fprintf(fp," eip: %14p %d\n", (void*)rp->mc_eip,rp->mc_eip);
472 +       fprintf(fp," cs: %04x\n", (unsigned)rp->mc_cs);
473 +       fprintf(fp," eflags: %14p %d\n", (void*)rp->mc_eflags,rp->mc_eflags);
474 +       fprintf(fp," esp_at_signal: %p %d\n", (void*)rp->mc_esp_at_signal,rp->mc_esp_at_signal);
475 +       fprintf(fp," ss: %04xd : %04x\n", rp->mc_ss,rp->mc_ss);
476 +//     fprintf(fp," oldmask: %14p %d\n", (void*)rp->mc_oldmask,rp->mc_oldmask);
477 +//     fprintf(fp," cr2: %14p %d\n", (void*)rp->mc_cr2,rp->mc_cr2);
478         fprintf(fp,"\n");
479  }
480  #endif
481 +#endif
482
483  #if __x86_64__
484 -#define IP rip
485 -#define sigregs_t sigcontext
486 +#define IP SC_(rip)
487 +#define sigregs_t mcontext_t
488
489  static void reg_dump(FILE *fp,sigregs_t *rp)
490  {
491         fprintf(fp,"REGS:\n");
492 -       fprintf(fp,"  r8: %20p %jd\n", (void*)rp->r8,rp->r8);
493 -       fprintf(fp,"  r9: %20p %jd\n", (void*)rp->r9,rp->r9);
494 -       fprintf(fp," r10: %20p %jd\n", (void*)rp->r10,rp->r10);
495 -       fprintf(fp," r11: %20p %jd\n", (void*)rp->r11,rp->r11);
496 -       fprintf(fp," r12: %20p %jd\n", (void*)rp->r12,rp->r12);
497 -       fprintf(fp," r13: %20p %jd\n", (void*)rp->r13,rp->r13);
498 -       fprintf(fp," r14: %20p %jd\n", (void*)rp->r14,rp->r14);
499 -       fprintf(fp," r15: %20p %jd\n", (void*)rp->r15,rp->r15);
500 -       fprintf(fp," rdi: %20p %jd\n", (void*)rp->rdi,rp->rdi);
501 -       fprintf(fp," rsi: %20p %jd\n", (void*)rp->rsi,rp->rsi);
502 -       fprintf(fp," rbp: %20p %jd\n", (void*)rp->rbp,rp->rbp);
503 -       fprintf(fp," rbx: %20p %jd\n", (void*)rp->rbx,rp->rbx);
504 -       fprintf(fp," rdx: %20p %jd\n", (void*)rp->rdx,rp->rdx);
505 -       fprintf(fp," rax: %20p %jd\n", (void*)rp->rax,rp->rax);
506 -       fprintf(fp," rcx: %20p %jd\n", (void*)rp->rcx,rp->rcx);
507 -       fprintf(fp," rsp: %20p %jd\n", (void*)rp->rsp,rp->rsp);
508 -       fprintf(fp," rip: %20p %jd\n", (void*)rp->rip,rp->rip);
509 -       fprintf(fp," eflags: %14p %jd\n", (void*)rp->eflags,rp->eflags);
510 -       fprintf(fp,"  cs: %04x\n", rp->cs);
511 -       fprintf(fp,"  gs: %04x\n", rp->gs);
512 -       fprintf(fp,"  fs: %04x\n", rp->fs);
513 -       fprintf(fp," err: %20p %jd\n", (void*)rp->err,rp->err);
514 -       fprintf(fp," trapno: %20p %jd\n", (void*)rp->trapno,rp->trapno);
515 -       fprintf(fp," oldmask: %20p %jd\n", (void*)rp->oldmask,rp->oldmask);
516 -       fprintf(fp," cr2: %20p %jd\n", (void*)rp->cr2,rp->cr2);
517 +       fprintf(fp,"  r8: %20p %jd\n", (void*)rp->mc_r8,rp->mc_r8);
518 +       fprintf(fp,"  r9: %20p %jd\n", (void*)rp->mc_r9,rp->mc_r9);
519 +       fprintf(fp," r10: %20p %jd\n", (void*)rp->mc_r10,rp->mc_r10);
520 +       fprintf(fp," r11: %20p %jd\n", (void*)rp->mc_r11,rp->mc_r11);
521 +       fprintf(fp," r12: %20p %jd\n", (void*)rp->mc_r12,rp->mc_r12);
522 +       fprintf(fp," r13: %20p %jd\n", (void*)rp->mc_r13,rp->mc_r13);
523 +       fprintf(fp," r14: %20p %jd\n", (void*)rp->mc_r14,rp->mc_r14);
524 +       fprintf(fp," r15: %20p %jd\n", (void*)rp->mc_r15,rp->mc_r15);
525 +       fprintf(fp," rdi: %20p %jd\n", (void*)rp->mc_rdi,rp->mc_rdi);
526 +       fprintf(fp," rsi: %20p %jd\n", (void*)rp->mc_rsi,rp->mc_rsi);
527 +       fprintf(fp," rbp: %20p %jd\n", (void*)rp->mc_rbp,rp->mc_rbp);
528 +       fprintf(fp," rbx: %20p %jd\n", (void*)rp->mc_rbx,rp->mc_rbx);
529 +       fprintf(fp," rdx: %20p %jd\n", (void*)rp->mc_rdx,rp->mc_rdx);
530 +       fprintf(fp," rax: %20p %jd\n", (void*)rp->mc_rax,rp->mc_rax);
531 +       fprintf(fp," rcx: %20p %jd\n", (void*)rp->mc_rcx,rp->mc_rcx);
532 +       fprintf(fp," rsp: %20p %jd\n", (void*)rp->mc_rsp,rp->mc_rsp);
533 +       fprintf(fp," rip: %20p %jd\n", (void*)rp->mc_rip,rp->mc_rip);
534 +       fprintf(fp," eflags: %14p %u\n", (void*)((unsigned long)rp->mc_flags),rp->mc_flags);
535 +       fprintf(fp,"  cs: %04x\n", (unsigned)rp->mc_cs);
536 +       fprintf(fp,"  gs: %04x\n", (unsigned)rp->mc_gs);
537 +       fprintf(fp,"  fs: %04x\n", (unsigned)rp->mc_fs);
538 +       fprintf(fp," err: %20p %jd\n", (void*)rp->mc_err,rp->mc_err);
539 +       fprintf(fp," trapno: %20p %d\n", (void*)((unsigned long)rp->mc_trapno),rp->mc_trapno);
540 +//     fprintf(fp," oldmask: %20p %jd\n", (void*)rp->mc_oldmask,rp->mc_oldmask);
541 +//     fprintf(fp," cr2: %20p %jd\n", (void*)rp->mc_cr2,rp->mc_cr2);
542         fprintf(fp,"\n");
543  }
544
545 @@ -500,7 +504,7 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
546         void *ip = 0;
547  #ifndef NO_CTX
548         ucontext_t *uc = (ucontext_t *)sc;
549 -       struct sigregs_t *c = (struct sigregs_t *)&uc->uc_mcontext;
550 +       sigregs_t *c = (sigregs_t *)&uc->uc_mcontext;
551         ip = (void *)c->IP;
552  #endif
553         fprintf(stderr,"** %s at %p in pid %d, tid %d\n",
554 diff --git a/cinelerra-5.1/guicast/bctrace.C b/cinelerra-5.1/guicast/bctrace.C
555 index 7e453925..2d08b46b 100644
556 --- a/cinelerra-5.1/guicast/bctrace.C
557 +++ b/cinelerra-5.1/guicast/bctrace.C
558 @@ -309,7 +309,7 @@ void BC_Trace::dump_traces(FILE *fp)
559         }
560  }
561
562 -void trace_info::set_owner() { owner = pthread_self(); }
563 +void trace_info::set_owner() { owner = (unsigned long)pthread_self(); }
564  void trace_info::unset_owner() { owner = 0; }
565
566  void BC_Trace::dump_locks(FILE *fp)
567 @@ -322,7 +322,7 @@ void BC_Trace::dump_locks(FILE *fp)
568                 fprintf(fp,"    %p %s, %s %p%s",
569                         p->info, p->title, p->loc,
570                         (void*)p->tid, p->is_owner ? " *" : "");
571 -               if( p->info->owner && p->info->owner != p->tid )
572 +               if( p->info->owner && p->info->owner != (unsigned long)p->tid )
573                         fprintf(fp," %p", (void*)p->info->owner);
574                 fprintf(fp,"\n");
575         }
576 diff --git a/cinelerra-5.1/guicast/filesystem.h b/cinelerra-5.1/guicast/filesystem.h
577 index c976135b..56137025 100644
578 --- a/cinelerra-5.1/guicast/filesystem.h
579 +++ b/cinelerra-5.1/guicast/filesystem.h
580 @@ -26,6 +26,9 @@
581  #include "bcwindowbase.inc"
582  #include "sizes.h"
583
584 +#define dirent64 dirent
585 +#define readdir64 readdir
586 +
587  class FileItem
588  {
589  public:
590 diff --git a/cinelerra-5.1/guicast/thread.C b/cinelerra-5.1/guicast/thread.C
591 index 9908a628..768ca61d 100644
592 --- a/cinelerra-5.1/guicast/thread.C
593 +++ b/cinelerra-5.1/guicast/thread.C
594 @@ -58,13 +58,6 @@ void* Thread::entrypoint(void *parameters)
595         pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
596         thread->cancel_enabled = false;
597
598 -// Set realtime here since it doesn't work in start
599 -       if( thread->realtime && getuid() == 0 ) {
600 -               struct sched_param param = { sched_priority : 1 };
601 -               if(pthread_setschedparam(thread->tid, SCHED_RR, &param) < 0)
602 -                       perror("Thread::entrypoint pthread_attr_setschedpolicy");
603 -       }
604 -
605         thread->run();
606         thread->finished = true;
607         if( !thread->synchronous ) {
608 diff --git a/cinelerra-5.1/plugins/Makefile b/cinelerra-5.1/plugins/Makefile
609 index c4a5fd43..9713b59e 100644
610 --- a/cinelerra-5.1/plugins/Makefile
611 +++ b/cinelerra-5.1/plugins/Makefile
612 @@ -37,7 +37,6 @@ DIRS = $(OPENCV_OBJS) \
613         brightness \
614         burn \
615         C41 \
616 -       cdripper \
617         chorus \
618         chromakey \
619         chromakeyhsv \
620 @@ -183,6 +182,8 @@ DIRS = $(OPENCV_OBJS) \
621  #      denoisemjpeg \
622  # duplicate
623  #      vocoder \
624 +# not in bsd
625 +#      cdripper \
626
627  PLUGIN_DIR = $(BINDIR)/plugins
628  DATA = $(PLUGIN_DIR)/fonts $(PLUGIN_DIR)/shapes $(PLUGIN_DIR)/scopes
629 diff --git a/cinelerra-5.1/plugins/shapewipe/Makefile b/cinelerra-5.1/plugins/shapewipe/Makefile
630 index b5e19639..b494009b 100644
631 --- a/cinelerra-5.1/plugins/shapewipe/Makefile
632 +++ b/cinelerra-5.1/plugins/shapewipe/Makefile
633 @@ -1,7 +1,7 @@
634  include ../../plugin_defs
635
636  OBJS = $(OBJDIR)/shapewipe.o
637 -LFLAGS += -lpng
638 +LFLAGS += `pkg-config --libs libpng`
639
640  PLUGIN = shapewipe
641
642 diff --git a/cinelerra-5.1/plugins/titler/Makefile b/cinelerra-5.1/plugins/titler/Makefile
643 index 3e520ac7..44b43a33 100644
644 --- a/cinelerra-5.1/plugins/titler/Makefile
645 +++ b/cinelerra-5.1/plugins/titler/Makefile
646 @@ -7,7 +7,7 @@ PLUGIN = titler
647  CFLAGS += -Wall
648
649  ifneq ($(STATIC_LIBRARIES), y)
650 -LFLAGS += -lfreetype
651 +LFLAGS += `pkg-config --libs freetype`
652  endif
653
654  include ../../plugin_config
655 diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C
656 index 06fb7938..1a2e35fe 100644
657 --- a/cinelerra-5.1/plugins/titler/titler.C
658 +++ b/cinelerra-5.1/plugins/titler/titler.C
659 @@ -57,8 +57,7 @@
660  #include <stdint.h>
661  #include <stdio.h>
662  #include <string.h>
663 -#include <endian.h>
664 -#include <byteswap.h>
665 +#include <sys/endian.h>
666  #include <iconv.h>
667  #include <sys/stat.h>
668  #include <fontconfig/fontconfig.h>