bsd build script and patch
[goodguy/history.git] / cinelerra-5.1 / bsd.patch
1 diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile
2 index 18590e3a..a60c71d1 100644
3 --- a/cinelerra-5.1/cinelerra/Makefile
4 +++ b/cinelerra-5.1/cinelerra/Makefile
5 @@ -395,6 +395,7 @@ LIBS += -lfontconfig -lfreetype
6  LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavresample -lavutil
7  LIBS += -lswresample -lswscale
8  LIBS += -lvpx -lwebp -lwebpmux
9 +LIBS += -lintl -liconv -lexecinfo
10  
11  LIBS += $(if $(filter fftw,$(static_pkgs)), -lfftw3)
12  LIBS += $(if $(filter flac,$(static_pkgs)), -lFLAC)
13 @@ -476,6 +477,7 @@ LV2OBJS = \
14  endif
15  
16  CFLAGS := \
17 +       -I/usr/local/include \
18         -I$(GUICAST) \
19         -I$(LIBZMPEG3) \
20         $(static_incs) \
21 @@ -523,15 +525,15 @@ all:      $(OUTPUT) $(CUTADS) $(BDWRITE) $(LV2UI)
22  $(OUTPUT): $(OBJS) $(THEME_DATA) $(DCRAW) $(LIBRARIES)
23         $(LINKER) `cat $(OBJDIR)/objs`
24         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(OUTPUT) $(OUTPUT_G))
25 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
26 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT))
27         ln -f -s ../bin/$(WANT_CIN) ci
28  
29  ifneq ($(WANT_COMMERCIAL),no)
30  $(CUTADS):     $(CUTOBJS) $(CUTLIBS) $(LIBRARIES)
31 -       @echo g++ -o $@ $(CUTOBJS)
32 -       @g++ $(CFLAGS) -pthread -o $@ $(CUTOBJS) $(CUTLIBS) $(LIBS)
33 +       @echo $(CXX) -o $@ $(CUTOBJS)
34 +       @$(CXX) $(CFLAGS) -pthread -o $@ $(CUTOBJS) $(CUTLIBS) $(LIBS)
35         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(CUTADS) $(CUTADS).debuginfo)
36 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(CUTADS))
37 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(CUTADS))
38  
39  install-cutads:
40         cp -av $(OBJDIR)/cutads $(BINDIR)/.
41 @@ -540,18 +542,18 @@ install:  install-cutads
42  endif
43  
44  $(BDWRITE):    $(BDWOBJS) $(LIBRARIES)
45 -       @echo g++ -o $@ $(BDWOBJS)
46 -       @g++ $(CFLAGS) -pthread -o $@ $(BDWOBJS) $(LIBS)
47 +       @echo $(CXX) -o $@ $(BDWOBJS)
48 +       @$(CXX) $(CFLAGS) -pthread -o $@ $(BDWOBJS) $(LIBS)
49         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(BDWRITE) $(BDWRITE).debuginfo)
50 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(BDWRITE))
51 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(BDWRITE))
52  
53  install-bdwrite:
54         cp -av $(OBJDIR)/bdwrite $(BINDIR)/.
55  install:       install-bdwrite
56  
57  ydiff: ydiff.C $(LIBRARIES)
58 -       @echo g++ -o $@ ydiff.C
59 -       @g++ $(CFLAGS) ydiff.C -o $@ $(LIBS)
60 +       @echo $(CXX) -o $@ ydiff.C
61 +       @$(CXX) $(CFLAGS) ydiff.C -o $@ $(LIBS)
62  
63  clean:
64         rm -rf $(OBJDIR)
65 @@ -585,7 +587,7 @@ $(OBJDIR)/lv2ui: $(LV2OBJS)
66         @echo $(CXX) \`cat $(OBJDIR)/c_flags\` $^ -o $@
67         @$(CXX) `cat $(OBJDIR)/c_flags` $^ -o $@ $(LIBS) $(GTK2_LIBS)
68         $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(LV2UI) $(LV2UI).debuginfo)
69 -       $(if $(findstring -ggdb,$(CFLAGS)),,strip $(LV2UI))
70 +       #$(if $(findstring -ggdb,$(CFLAGS)),,strip $(LV2UI))
71  
72  .PHONY:        lv2ui
73  lv2ui: $(LV2UI)
74 diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C
75 index 27f728ad..9215090d 100644
76 --- a/cinelerra-5.1/cinelerra/bdcreate.C
77 +++ b/cinelerra-5.1/cinelerra/bdcreate.C
78 @@ -25,8 +25,8 @@
79  #include <unistd.h>
80  #include <fcntl.h>
81  #include <errno.h>
82 -#include <sys/stat.h>
83 -#include <sys/statfs.h>
84 +#include <sys/param.h>
85 +#include <sys/mount.h>
86  
87  // BD Creation
88  
89 diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C
90 index 6a2b4ca3..78cf9bef 100644
91 --- a/cinelerra-5.1/cinelerra/bdwrite.C
92 +++ b/cinelerra-5.1/cinelerra/bdwrite.C
93 @@ -38,7 +38,7 @@
94  #include <stdint.h>
95  #include <stdlib.h>
96  #include <string.h>
97 -#include <endian.h>
98 +#include <sys/endian.h>
99  #include <limits.h>
100  #include <sys/stat.h>
101  // work arounds (centos)
102 diff --git a/cinelerra-5.1/cinelerra/cutads.C b/cinelerra-5.1/cinelerra/cutads.C
103 index ac58d56a..f6690cf2 100644
104 --- a/cinelerra-5.1/cinelerra/cutads.C
105 +++ b/cinelerra-5.1/cinelerra/cutads.C
106 @@ -23,14 +23,6 @@
107  using namespace std;
108  #define fail(s) do { printf("fail %s%s:%d\n",__func__,#s,__LINE__); return 1; } while(0)
109  
110 -/* missing from system headers, no /usr/include <linux/ioprio.h>
111 - *   IOPRIO_WHO_PROCESS, IOPRIO_CLASS_SHIFT, IOPRIO_CLASS_IDLE */
112 -enum { IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, };
113 -#define IO_CLASS(n) (((int)(n)) << 13)
114 -#define IO_WHO_PROCESS  1
115 -#include <sys/syscall.h>
116 -#include <asm/unistd.h>
117 -
118  // commercial edge detection:
119  // must have audio < min_audio
120  //   and within +- check_margin seconds of low audio
121 @@ -55,11 +47,6 @@ class Video;
122  class Audio;
123  class Scan;
124  
125 -static int ioprio_set(int which, int who, int ioprio)
126 -{
127 -       return syscall(SYS_ioprio_set, which, who, ioprio);
128 -}
129 -
130  static inline int clip(int v, int mn, int mx)
131  {
132    return v<mn ? mn : v>mx ? mx : v;
133 @@ -617,7 +604,6 @@ class Scan
134         const char *asset_path;
135         static void set_priority(int pr, int io) {
136                 setpriority(PRIO_PROCESS, 0, pr);  // lowest cpu priority
137 -               ioprio_set(IO_WHO_PROCESS, 0, IO_CLASS(io));
138         }
139         class low_priority { public:
140                 low_priority() { set_priority(19, IOPRIO_CLASS_IDLE); }
141 diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C
142 index 1014baf5..f38094e9 100644
143 --- a/cinelerra-5.1/cinelerra/dvdcreate.C
144 +++ b/cinelerra-5.1/cinelerra/dvdcreate.C
145 @@ -24,8 +24,8 @@
146  #include <unistd.h>
147  #include <fcntl.h>
148  #include <errno.h>
149 -#include <sys/stat.h>
150 -#include <sys/statfs.h>
151 +#include <sys/param.h>
152 +#include <sys/mount.h>
153  
154  
155  #define DVD_PAL_4x3    0
156 diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C
157 index 03348e0a..552a140d 100644
158 --- a/cinelerra-5.1/cinelerra/file.C
159 +++ b/cinelerra-5.1/cinelerra/file.C
160 @@ -1584,7 +1584,10 @@ int File::record_fd()
161  void File::get_exe_path(char *result, char *bnp)
162  {
163  // Get executable path, basename
164 -       int len = readlink("/proc/self/exe", result, BCTEXTLEN-1);
165 +       char exe_path[BCTEXTLEN];
166 +       sprintf(exe_path,"/proc/%d/file",getpid());
167 +       int len = readlink(exe_path, result, BCTEXTLEN-1);
168 +
169         if( len >= 0 ) {
170                 result[len] = 0;
171                 char *ptr = strrchr(result, '/');
172 diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C
173 index 3d21d2af..f3064199 100644
174 --- a/cinelerra-5.1/cinelerra/indexfile.C
175 +++ b/cinelerra-5.1/cinelerra/indexfile.C
176 @@ -70,7 +70,7 @@
177  
178  #include <sys/types.h>
179  #include <sys/stat.h>
180 -#include <linux/iso_fs.h>
181 +#include <isofs/cd9660/iso.h>
182  
183  // check for isofs volume_id for dvd/cdrom
184  
185 diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac
186 index 6fba32bb..ccdb683b 100644
187 --- a/cinelerra-5.1/configure.ac
188 +++ b/cinelerra-5.1/configure.ac
189 @@ -16,15 +16,26 @@ CFG_CFLAGS+=" -Wno-unused-result"
190  CFG_CFLAGS+=" -Wno-stringop-overflow"
191  CFG_CFLAGS+=" -Wno-format-truncation"
192  CFG_CFLAGS+=" -Wno-format-overflow"
193 +CFG_CFLAGS+=" -Wno-unknown-warning-option"
194  CFG_CFLAGS+=" -Wno-parentheses"
195  CFG_CFLAGS+=" -Wno-stringop-truncation"
196 +CFG_CFLAGS+=" -Wno-gnu-designator"
197 +CFG_CFLAGS+=" -Wno-missing-braces"
198 +CFG_CFLAGS+=" -Wno-overloaded-virtual"
199 +CFG_CFLAGS+=" -Wno-self-assign-field"
200 +CFG_CFLAGS+=" -Wno-sometimes-uninitialized"
201 +CFG_CFLAGS+=" -Wno-tautological-pointer-compare"
202 +CFG_CFLAGS+=" -Wno-unused-function"
203 +CFG_CFLAGS+=" -Wno-unused-private-field"
204 +CFG_CFLAGS+=" -Wno-infinite-recursion"
205  CFG_CFLAGS+=" -D__STDC_CONSTANT_MACROS"
206  CFG_CFLAGS+=" -D__STDC_LIMIT_MACROS"
207  CFG_CFLAGS+=" -DPNG_SKIP_SETJMP_CHECK=1"
208  CFG_CFLAGS+=" -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
209 -CFG_CFLAGS+=" -I/usr/include/freetype2"
210 -CFG_CFLAGS+=" -I/usr/include/uuid"
211 -CFG_CFLAGS+=" -I/usr/include/mjpegtools"
212 +CFG_CFLAGS+=" -I/usr/local/include"
213 +CFG_CFLAGS+=" -I/usr/local/include/freetype2 -I/usr/include/freetype2"
214 +CFG_CFLAGS+=" -I/usr/local/include/uuid -I/usr/include/uuid"
215 +CFG_CFLAGS+=" -I/usr/local/include/mjpegtools -I/usr/include/mjpegtools"
216  
217  AC_DEFUN([CHECK_WITH], [
218  AC_ARG_WITH([$1],
219 diff --git a/cinelerra-5.1/db/tdb.h b/cinelerra-5.1/db/tdb.h
220 index 8ee88002..9a17091e 100644
221 --- a/cinelerra-5.1/db/tdb.h
222 +++ b/cinelerra-5.1/db/tdb.h
223 @@ -32,7 +32,7 @@ inline void operator delete[](void *t,size_t n) { free(t); }
224  #endif
225  
226  #define ZMEDIA
227 -#define ZFUTEX
228 +//#define ZFUTEX
229  #ifdef ZFUTEX
230  #include <unistd.h>
231  #include <endian.h>
232 diff --git a/cinelerra-5.1/guicast/bclistbox.h b/cinelerra-5.1/guicast/bclistbox.h
233 index f5994d53..c73169bb 100644
234 --- a/cinelerra-5.1/guicast/bclistbox.h
235 +++ b/cinelerra-5.1/guicast/bclistbox.h
236 @@ -185,7 +185,9 @@ public:
237  
238  // take_focus - used by the suggestion box to keep it from taking focus from the
239  // textbox
240 -       int activate(int take_focus = 1);
241 +       int activate() {  return activate(1); }
242 +       int activate(int take_focus);
243 +
244         int activate(int x, int y, int w=-1, int h=-1);
245         int deactivate();
246         int is_active();
247 diff --git a/cinelerra-5.1/guicast/bcpan.h b/cinelerra-5.1/guicast/bcpan.h
248 index 40f5971f..73d47586 100644
249 --- a/cinelerra-5.1/guicast/bcpan.h
250 +++ b/cinelerra-5.1/guicast/bcpan.h
251 @@ -93,7 +93,8 @@ public:
252                 int &stick_x,
253                 int &stick_y);
254         static int rdtoxy(int &x, int &y, int a, int virtual_r);
255 -       int activate(int popup_x = -1, int popup_y = -1);
256 +       int activate(int popup_x, int popup_y);
257 +       int activate() { return activate(-1,-1); }
258         int deactivate();
259         float* get_values();
260  
261 diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C
262 index e3400600..3cf616f8 100644
263 --- a/cinelerra-5.1/guicast/bcresources.C
264 +++ b/cinelerra-5.1/guicast/bcresources.C
265 @@ -695,7 +695,7 @@ new_vframes(20,default_medium_7segment,
266         generic_button_margin = 15;
267         draw_clock_background=1;
268  
269 -       use_shm = -1;
270 +       use_shm = 0;
271         shm_reply = 1;
272  
273  // Initialize
274 @@ -1681,6 +1681,87 @@ BC_FontEntry *BC_Resources::find_fontentry(const char *displayname, int style,
275         return style_match;
276  }
277  
278 +
279 +class utf8conv {
280 +       uint8_t *obfr, *out, *oend;
281 +       uint8_t *ibfr, *inp, *iend;
282 +public:
283 +       utf8conv(void *out, int olen, void *inp, int ilen) {
284 +               this->obfr = this->out = (uint8_t*)out;
285 +               this->oend = this->out + olen;
286 +               this->ibfr = this->inp = (uint8_t*)inp;
287 +               this->iend = this->inp + ilen;
288 +       }
289 +       int cur() { return inp>=iend ? -1 : *inp; }
290 +       int next() { return inp>=iend ? -1 : *inp++; }
291 +       int next(int ch) { return out>=oend ? -1 : *out++ = ch; }
292 +       int ilen() { return inp-ibfr; }
293 +       int olen() { return out-obfr; }
294 +       int wnext();
295 +       int wnext(unsigned int v);
296 +};
297 +
298 +int utf8conv::
299 +wnext(unsigned int v)
300 +{
301 +  if( v < 0x00000080 ) { next(v);  return 1; }
302 +  int n = v < 0x00000800 ? 2 : v < 0x00010000 ? 3 :
303 +          v < 0x00200000 ? 4 : v < 0x04000000 ? 5 : 6;
304 +  int m = (0xff00 >> n), i = n-1;
305 +  next((v>>(6*i)) | m);
306 +  while( --i >= 0 ) next(((v>>(6*i)) & 0x3f) | 0x80);
307 +  return n;
308 +}
309 +
310 +int utf8conv::
311 +wnext()
312 +{
313 +  int v = 0, n = 0, ch = next();
314 +  if( ch == '\\' ) {
315 +    switch( (ch=next()) ) {
316 +    case 'n': return '\n';
317 +    case 't': return '\t';
318 +    case 'r': return '\r';
319 +    case 'b': return '\b';
320 +    case 'f': return '\f';
321 +    case 'v': return '\v';
322 +    case 'a': return '\a';
323 +    case '0': case '1': case '2': case '3':
324 +    case '4': case '5': case '6': case '7':
325 +      v = ch - '0';
326 +      for( int i=3; --i>0; v=v*8+ch, next() )
327 +        if( (ch=cur()-'0') < 0 || ch >= 8 ) break;
328 +      return v;
329 +    case 'x':  n = 2;  break;
330 +    case 'u':  n = 4;  break;
331 +    case 'U':  n = 8;  break;
332 +    default: return ch;
333 +    }
334 +    for( int i=n; --i>=0; v=v*16+ch, next() ) {
335 +      if( (ch=cur()-'0')>=0 && ch<10 ) continue;
336 +      if( (ch-='A'-'0'-10)>=10 && ch<16 ) continue;
337 +      if( (ch-='a'-'A')<10 || ch>=16 ) break;
338 +    }
339 +  }
340 +  else if( ch >= 0x80 ) {
341 +    static const unsigned char byts[] = {
342 +      1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 5,
343 +    };
344 +    int i = ch - 0xc0;
345 +    n = i<0 ? 0 : byts[i/4];
346 +    for( v=ch, i=n; --i>=0; v+=next() ) v <<= 6;
347 +    static const unsigned int ofs[6] = {
348 +      0x00000000U, 0x00003080U, 0x000E2080U,
349 +      0x03C82080U, 0xFA082080U, 0x82082080U
350 +    };
351 +    v -= ofs[n];
352 +  }
353 +  else
354 +    v = ch;
355 +  return v;
356 +}
357 +
358 +
359  size_t BC_Resources::encode(const char *from_enc, const char *to_enc,
360         char *input, int input_length, char *output, int output_length)
361  {
362 @@ -1688,10 +1769,12 @@ size_t BC_Resources::encode(const char *from_enc, const char *to_enc,
363         iconv_t cd;
364         char *outbase = output;
365  
366 -       if(!from_enc || *from_enc == 0)
367 +       if( !from_enc || *from_enc == 0 ||
368 +           !strcmp(from_enc,"UTF8") || !strcmp(from_enc, "US-ASCII") )
369                 from_enc = "UTF-8";
370  
371 -       if(!to_enc || *to_enc == 0)
372 +       if( !to_enc || *to_enc == 0 ||
373 +           !strcmp(to_enc,"UTF8") || !strcmp(to_enc, "US-ASCII") )
374                 to_enc = "UTF-8";
375  
376         if(input_length < 0)
377 @@ -1701,32 +1784,45 @@ size_t BC_Resources::encode(const char *from_enc, const char *to_enc,
378  
379         if(strcmp(from_enc, to_enc) && inbytes)
380         {
381 -               if((cd = iconv_open(to_enc, from_enc)) == (iconv_t)-1)
382 +               if( !strcmp(from_enc, "UTF-8") && !strcmp(to_enc,"UTF32LE") ) {
383 +                       utf8conv uc(0,0, input,inbytes);
384 +                       uint32_t *op = (uint32_t *)output;
385 +                       uint32_t *ep = (uint32_t *)(output+output_length);
386 +                       for( int wch; op<ep && (wch=uc.wnext())>=0; *op++=wch );
387 +                       output = (char *)op;
388 +                       outbytes = (char*)ep - output;
389 +               }
390 +               else if( !strcmp(from_enc, "UTF32LE") && !strcmp(to_enc,"UTF-8") ) {
391 +                       utf8conv uc(output,output_length, 0,0);
392 +                       uint32_t *ip = (uint32_t *)input;
393 +                       uint32_t *ep = (uint32_t *)(input+inbytes);
394 +                       for( ; ip<ep && uc.wnext(*ip)>=0; ++ip );
395 +                       output += uc.olen();
396 +                       outbytes = output_length-uc.olen();
397 +               }
398 +               else if((cd = iconv_open(to_enc, from_enc)) == (iconv_t)-1)
399                 {
400                         printf(_("Conversion from %s to %s is not available\n"),
401                                 from_enc, to_enc);
402                         return 0;
403                 }
404 -
405 -               outbytes = output_length - 1;
406 -
407 -               iconv(cd, &input, &inbytes, &output, &outbytes);
408 -
409 -               iconv_close(cd);
410 -               inbytes = output - outbase;
411 +               else {
412 +                       outbytes = output_length - 1;
413 +                       iconv(cd, &input, &inbytes, &output, &outbytes);
414 +                       iconv_close(cd);
415 +               }
416         }
417         else if(inbytes)
418         {
419                 memcpy(output,  input, inbytes);
420 +               output += inbytes;
421                 outbytes -= inbytes;
422         }
423 -       for(int i = 0; i < 4; i++)
424 -       {
425 +       if( outbytes > sizeof(uint32_t) )
426 +               outbytes = sizeof(uint32_t);
427 +       for(int i = 0; i < outbytes; i++)
428                 output[i] = 0;
429 -               if(outbytes-- == 0)
430 -                       break;
431 -       }
432 -       return inbytes;
433 +       return output - outbase;
434  }
435  
436  void BC_Resources::encode_to_utf8(char *buffer, int buflen)
437 diff --git a/cinelerra-5.1/guicast/bcsignals.C b/cinelerra-5.1/guicast/bcsignals.C
438 index ed50cfb1..f1b894ba 100644
439 --- a/cinelerra-5.1/guicast/bcsignals.C
440 +++ b/cinelerra-5.1/guicast/bcsignals.C
441 @@ -37,9 +37,11 @@
442  #include <sys/stat.h>
443  #include <unistd.h>
444  #include <sys/ioctl.h>
445 -#include <sys/prctl.h>
446  #include <sys/types.h>
447  
448 +#define dirent64 dirent
449 +#define readdir64 readdir
450 +
451  BC_Signals* BC_Signals::global_signals = 0;
452  static int signal_done = 0;
453  
454 @@ -279,18 +281,6 @@ static void handle_exit(int signum)
455  
456  void BC_Signals::set_sighup_exit(int enable)
457  {
458 -       if( enable ) {
459 -// causes SIGHUP to be generated when parent dies
460 -               signal(SIGHUP, handle_exit);
461 -               prctl(PR_SET_PDEATHSIG, SIGHUP, 0,0,0);
462 -// prevents ^C from signalling child when attached to gdb
463 -               setpgid(0, 0);
464 -               if( isatty(0) ) ioctl(0, TIOCNOTTY, 0);
465 -       }
466 -       else {
467 -               signal(SIGHUP, signal_entry);
468 -               prctl(PR_SET_PDEATHSIG, 0,0,0,0);
469 -       }
470  }
471  
472  BC_Signals::BC_Signals()
473 @@ -383,11 +373,13 @@ const char* BC_Signals::sig_to_str(int number)
474  #include <sys/wait.h>
475  #include "thread.h"
476  
477 +#define SC_(r)sc_##r
478 +
479  #if __i386__
480 -#define IP eip
481 +#define IP SC_(eip)
482  #endif
483  #if __x86_64__
484 -#define IP rip
485 +#define IP SC_(rip)
486  #endif
487  #ifndef IP
488  #error gotta have IP
489 @@ -473,26 +465,5 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
490  
491         fprintf(fp,"\n\n");
492         if( fp != stdout ) fclose(fp);
493 -       char cmd[1024], *cp = cmd;
494 -       cp += sprintf(cp, "exec gdb /proc/%d/exe -p %d --batch --quiet "
495 -               "-ex \"thread apply all info registers\" "
496 -               "-ex \"thread apply all bt full\" "
497 -               "-ex \"quit\"", pid, pid);
498 -       if( fp != stdout )
499 -               cp += sprintf(cp," >> \"%s\"", fn);
500 -       cp += sprintf(cp," 2>&1");
501 -//printf("handle_dump:: pid=%d, cmd='%s'  fn='%s'\n",pid,cmd,fn);
502 -        pid = vfork();
503 -        if( pid < 0 ) {
504 -               fprintf(stderr,"** can't start gdb, dump abondoned\n");
505 -               return;
506 -       }
507 -       if( pid > 0 ) {
508 -               waitpid(pid,0,0);
509 -               fprintf(stderr,"** dump complete\n");
510 -               return;
511 -       }
512 -        char *const argv[4] = { (char*) "/bin/sh", (char*) "-c", cmd, 0 };
513 -        execvp(argv[0], &argv[0]);
514  }
515  
516 diff --git a/cinelerra-5.1/guicast/filesystem.C b/cinelerra-5.1/guicast/filesystem.C
517 index ebc2007d..9d6452cb 100644
518 --- a/cinelerra-5.1/guicast/filesystem.C
519 +++ b/cinelerra-5.1/guicast/filesystem.C
520 @@ -33,6 +33,8 @@
521  #include <unistd.h>
522  #include <utime.h>
523  
524 +#define dirent64 dirent
525 +#define readdir64 readdir
526  
527  #include "filesystem.h"
528  
529 diff --git a/cinelerra-5.1/guicast/thread.C b/cinelerra-5.1/guicast/thread.C
530 index dff53e61..321ab4fc 100644
531 --- a/cinelerra-5.1/guicast/thread.C
532 +++ b/cinelerra-5.1/guicast/thread.C
533 @@ -55,13 +55,6 @@ void* Thread::entrypoint(void *parameters)
534         pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
535         thread->cancel_enabled = false;
536  
537 -// Set realtime here seince it doesn't work in start
538 -       if( thread->realtime && getuid() == 0 ) {
539 -               struct sched_param param = { sched_priority : 1 };
540 -               if(pthread_setschedparam(thread->tid, SCHED_RR, &param) < 0)
541 -                       perror("Thread::entrypoint pthread_attr_setschedpolicy");
542 -       }
543 -
544         thread->run();
545         thread->finished = true;
546         if( !thread->synchronous ) {
547 diff --git a/cinelerra-5.1/guicast/thread.h b/cinelerra-5.1/guicast/thread.h
548 index 216ecd2b..8ebec237 100644
549 --- a/cinelerra-5.1/guicast/thread.h
550 +++ b/cinelerra-5.1/guicast/thread.h
551 @@ -27,7 +27,7 @@
552  #include <unistd.h>
553  #include <sys/syscall.h>
554  
555 -static inline int gettid() { return syscall(SYS_gettid, 0, 0, 0); }
556 +static inline long gettid() { return (long)pthread_self(); }
557  
558  // The thread does not autodelete by default.
559  // If autodelete is 1 the thread autodeletes.
560 diff --git a/cinelerra-5.1/plugins/Makefile b/cinelerra-5.1/plugins/Makefile
561 index 6ed357c7..56081181 100644
562 --- a/cinelerra-5.1/plugins/Makefile
563 +++ b/cinelerra-5.1/plugins/Makefile
564 @@ -31,7 +31,6 @@ DIRS = $(OPENCV_OBJS) \
565         brightness \
566         burn \
567         C41 \
568 -       cdripper \
569         chromakey \
570         chromakeyhsv \
571         color3way \
572 @@ -161,6 +160,8 @@ DIRS = $(OPENCV_OBJS) \
573  #      denoisemjpeg \
574  # duplicate
575  #      vocoder \
576 +# not in bsd
577 +#      cdripper \
578  
579  PLUGIN_DIR = $(BINDIR)/plugins
580  DATA = $(PLUGIN_DIR)/fonts $(PLUGIN_DIR)/shapes
581 diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C
582 index fefbbdb1..045e96d4 100644
583 --- a/cinelerra-5.1/plugins/titler/titler.C
584 +++ b/cinelerra-5.1/plugins/titler/titler.C
585 @@ -57,8 +57,7 @@
586  #include <stdint.h>
587  #include <stdio.h>
588  #include <string.h>
589 -#include <endian.h>
590 -#include <byteswap.h>
591 +#include <sys/endian.h>
592  #include <iconv.h>
593  #include <sys/stat.h>
594  #include <fontconfig/fontconfig.h>