From 34dd3a28727fc230ba5abbed50766d671a2b8055 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Thu, 5 Jul 2018 21:59:25 -0600 Subject: [PATCH] more build tweaks for bsd --- cinelerra-5.1/Makefile.am | 67 +++++++++++++++-------- cinelerra-5.1/bsd.bld | 4 +- cinelerra-5.1/bsd.patch | 70 ++++++++++++++++++++++-- cinelerra-5.1/cinelerra/formattools.C | 5 +- cinelerra-5.1/cinelerra/interlacemodes.C | 7 ++- cinelerra-5.1/cinelerra/recordmonitor.C | 2 + cinelerra-5.1/cinelerra/videodevice.C | 5 +- cinelerra-5.1/configure.ac | 37 +++++++++++-- 8 files changed, 159 insertions(+), 38 deletions(-) diff --git a/cinelerra-5.1/Makefile.am b/cinelerra-5.1/Makefile.am index 9b78846c..99124da1 100644 --- a/cinelerra-5.1/Makefile.am +++ b/cinelerra-5.1/Makefile.am @@ -23,16 +23,17 @@ clean-generic: inst_sh := $(CURDIR)/inst.sh -install: binstall $(sinstall) +install: bin_install $(MAK_INSTALLS) -uninstall: buninstall $(suninstall) +uninstall: bin_uninstall $(MAK_UNINSTALLS) .PHONY: binstall cinstall cuninstall dinstall export mkinstalldirs install_sh inst_sh # install to bin -binstall: install-recursive - cp -a COPYING README models Cinelerra_factory ffmpeg msg info tips bin/. +bin_install: install-recursive + cp -a COPYING README models Cinelerra_factory ffmpeg msg info tips \ + lv2_blacklist.txt bin/. sed -e 's/\/$(WANT_CIN)/g' < image/cin.desktop \ > "bin/applications/$(WANT_CIN).desktop" cp -a image/cin.svg "bin/pixmaps/$(WANT_CIN)".svg @@ -43,47 +44,69 @@ binstall: install-recursive cp -a $$d bin/plugins/picon/.; \ done -cp -a db/utils/new_db "bin/cin_db" - cp -av lv2_blacklist.txt bin/. -buninstall: +bin_uninstall: rm -rf bin # with system_build -cinstall: - cd bin; $(inst_sh) "$(DESTDIR)$(bindir)" "$(WANT_CIN)" \ - cin_db zmpeg3{cat,cc2txt,ifochk,show,toc} - cd bin; $(inst_sh) "$(DESTDIR)$(WANT_CINLIB_DIR)" \ - bdwrite cutads lv2ui - -cd bin; $(inst_sh) "$(DESTDIR)$(WANT_CINLIB_DIR)" \ - hveg2enc mpeg2enc mplex mplexlo +sys_install: $(CIN_INSTALLS) + cd bin; $(inst_sh) "$(DESTDIR)$(bindir)" "$(WANT_CIN)" bdwrite cd bin; $(inst_sh) "$(DESTDIR)$(datadir)/$(WANT_CIN)" \ - COPYING README models Cinelerra_factory ffmpeg msg info tips doc \ - lv2 lv2_blacklist.txt + COPYING README models Cinelerra_factory ffmpeg msg info tips doc cd bin/locale; $(inst_sh) "$(DESTDIR)$(localedir)" . cd bin/plugins; $(inst_sh) "$(DESTDIR)$(WANT_PLUGIN_DIR)" . - cd bin/ladspa; $(inst_sh) "$(DESTDIR)$(WANT_LADSPA_DIR)" . cd bin/applications; $(inst_sh) "$(DESTDIR)$(datadir)/applications" . cd bin/pixmaps; $(inst_sh) "$(DESTDIR)$(datadir)/pixmaps" . -cuninstall: +sys_uninstall: $(CIN_UNINSTALLS) rm -f "$(DESTDIR)$(bindir)/$(WANT_CIN)" - rm -f "$(DESTDIR)$(bindir)"/zmpeg3{cat,cc2txt,ifochk,show,toc} - rm -f "$(DESTDIR)$(bindir)/cin_db" rm -rf "$(DESTDIR)$(WANT_CINLIB_DIR)" rm -rf "$(DESTDIR)$(datadir)/$(WANT_CIN)" rm -rf "$(DESTDIR)$(localedir)"/*/"LC_MESSAGES/$(WANT_CIN).mo" rm -rf "$(DESTDIR)$(WANT_PLUGIN_DIR)" - rm -rf "$(DESTDIR)$(WANT_LADSPA_DIR)" rm -f "$(DESTDIR)$(datadir)/applications/$(WANT_CIN).desktop" rm -f "$(DESTDIR)$(datadir)/pixmaps/$(WANT_CIN)".{svg,xpm} # without system_build -dinstall: +dvl_install: cp Makefile.devel Makefile -duninstall: +dvl_uninstall: rm -f Makefile +# with-libzmpeg3 +zmp_install: + cd bin; $(inst_sh) "$(DESTDIR)$(bindir)" \ + zmpeg3{cat,cc2txt,ifochk,show,toc} + cd bin; $(inst_sh) "$(DESTDIR)$(WANT_CINLIB_DIR)" \ + hveg2enc mpeg2enc mplex mplexlo + +zmp_uninstall: + rm -f "$(DESTDIR)$(bindir)"/zmpeg3{cat,cc2txt,ifochk,show,toc} + +# with-commercial +com_install: + cd bin; $(inst_sh) "$(DESTDIR)$(bindir)" cin_db + cd bin; $(inst_sh) "$(DESTDIR)$(WANT_CINLIB_DIR)" cutads + +com_uninstall: + rm -f "$(DESTDIR)$(bindir)/cin_db" + +# with-ladspa +lad_install: + cd bin/ladspa; $(inst_sh) "$(DESTDIR)$(WANT_LADSPA_DIR)" . + +lad_uninstall: + rm -rf "$(DESTDIR)$(WANT_LADSPA_DIR)" + +# with-lv2 +lv2_install: + cd bin; $(inst_sh) "$(DESTDIR)$(WANT_CINLIB_DIR)" lv2ui + cd bin; $(inst_sh) "$(DESTDIR)$(datadir)/$(WANT_CIN)" \ + lv2 lv2_blacklist.txt + +lv2_uninstall: + val-%: @echo $($(subst val-,,$@)) diff --git a/cinelerra-5.1/bsd.bld b/cinelerra-5.1/bsd.bld index e765a0dc..3707579c 100755 --- a/cinelerra-5.1/bsd.bld +++ b/cinelerra-5.1/bsd.bld @@ -9,7 +9,7 @@ alias make=gmake ./autogen.sh CC=clang CXX=clang++ CFLAGS="-g -O2 -DFFMPEG3" ./configure --with-single-user \ --disable-static-build --without-lv2 --disable-lame --disable-twolame \ - --with-oss --without-gl --without-firewire --without-dv --without-dvb \ - --without-video4linux2 --without-xxf86vm --without-ladspa-build \ + --with-oss --without-alsa --without-gl --without-firewire --without-dv \ + --without-dvb --without-video4linux2 --without-xxf86vm --without-ladspa-build \ --without-libzmpeg --without-commercial --without-thirdparty gmake 2>&1 | tee log diff --git a/cinelerra-5.1/bsd.patch b/cinelerra-5.1/bsd.patch index 1af22512..f6841bda 100644 --- a/cinelerra-5.1/bsd.patch +++ b/cinelerra-5.1/bsd.patch @@ -1,3 +1,16 @@ +diff --git a/cinelerra-5.1/Makefile.devel b/cinelerra-5.1/Makefile.devel +index a12d8f2b..f892f648 100644 +--- a/cinelerra-5.1/Makefile.devel ++++ b/cinelerra-5.1/Makefile.devel +@@ -4,7 +4,7 @@ TOPDIR := $(CURDIR) + CFLAGS ?= -ggdb + export CFLAGS_ := $(CFLAGS) + +-cpus:=$(shell grep -c "^proc" /proc/cpuinfo) ++cpus:=$(shell sysctl -n hw.ncpu) + jobs:=-j$(shell echo $$(($(cpus) + $(cpus)/2 +2))) + MAKEJ := $(MAKE) $(jobs) + diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 18590e3a..a60c71d1 100644 --- a/cinelerra-5.1/cinelerra/Makefile @@ -216,6 +229,15 @@ index 6fba32bb..ccdb683b 100644 AC_DEFUN([CHECK_WITH], [ AC_ARG_WITH([$1], +@@ -126,7 +137,7 @@ AC_SUBST(MAK_INSTALLS) + AC_SUBST(MAK_UNINSTALLS) + + if test "x$WANT_JOBS" = "xauto"; then +- CPUS=`grep -c "^proc" /proc/cpuinfo` ++ CPUS=`sysctl -n hw.ncpu` + WANT_JOBS=`expr $CPUS + $CPUS / 2 + 2` + fi + diff --git a/cinelerra-5.1/db/tdb.h b/cinelerra-5.1/db/tdb.h index 8ee88002..9a17091e 100644 --- a/cinelerra-5.1/db/tdb.h @@ -259,10 +281,48 @@ index 40f5971f..73d47586 100644 float* get_values(); diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C -index e3400600..3cf616f8 100644 +index e3400600..b32d0a6f 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C -@@ -695,7 +695,7 @@ new_vframes(20,default_medium_7segment, +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -297,23 +298,12 @@ int BC_Resources::machine_cpus = 1; + + int BC_Resources::get_machine_cpus() + { +- int cpus = 1; +- FILE *proc = fopen("/proc/cpuinfo", "r"); +- if( proc ) { +- char string[BCTEXTLEN], *cp; +- while(!feof(proc) && fgets(string, sizeof(string), proc) ) { +- if( !strncasecmp(string, "processor", 9) && +- (cp = strchr(string, ':')) != 0 ) { +- int n = atol(cp+1) + 1; +- if( n > cpus ) cpus = n; +- } +- else if( !strncasecmp(string, "cpus detected", 13) && +- (cp = strchr(string, ':')) != 0 ) +- cpus = atol(cp+1); +- } +- fclose(proc); +- } +- return cpus; ++ int mib[2], ncpu; ++ size_t len = sizeof(ncpu); ++ mib[0] = CTL_HW; ++ mib[1] = HW_NCPU; ++ if( sysctl(mib, 2, &ncpu, &len, 0, 0) ) ncpu = 1; ++ return ncpu; + } + + void BC_Resources::new_vframes(int n, VFrame *vframes[], ...) +@@ -695,7 +685,7 @@ new_vframes(20,default_medium_7segment, generic_button_margin = 15; draw_clock_background=1; @@ -271,7 +331,7 @@ index e3400600..3cf616f8 100644 shm_reply = 1; // Initialize -@@ -1681,6 +1681,87 @@ BC_FontEntry *BC_Resources::find_fontentry(const char *displayname, int style, +@@ -1681,6 +1671,87 @@ BC_FontEntry *BC_Resources::find_fontentry(const char *displayname, int style, return style_match; } @@ -359,7 +419,7 @@ index e3400600..3cf616f8 100644 size_t BC_Resources::encode(const char *from_enc, const char *to_enc, char *input, int input_length, char *output, int output_length) { -@@ -1688,10 +1769,12 @@ size_t BC_Resources::encode(const char *from_enc, const char *to_enc, +@@ -1688,10 +1759,12 @@ size_t BC_Resources::encode(const char *from_enc, const char *to_enc, iconv_t cd; char *outbase = output; @@ -374,7 +434,7 @@ index e3400600..3cf616f8 100644 to_enc = "UTF-8"; if(input_length < 0) -@@ -1701,32 +1784,45 @@ size_t BC_Resources::encode(const char *from_enc, const char *to_enc, +@@ -1701,32 +1774,45 @@ size_t BC_Resources::encode(const char *from_enc, const char *to_enc, if(strcmp(from_enc, to_enc) && inbytes) { diff --git a/cinelerra-5.1/cinelerra/formattools.C b/cinelerra-5.1/cinelerra/formattools.C index 48701998..312f39c8 100644 --- a/cinelerra-5.1/cinelerra/formattools.C +++ b/cinelerra-5.1/cinelerra/formattools.C @@ -27,7 +27,9 @@ #include "filesystem.h" #include "formattools.h" #include "language.h" +#ifdef HAVE_DV #include "libdv.h" +#endif #include "libmjpeg.h" #include "maxchannels.h" #include "mwindow.h" @@ -260,11 +262,12 @@ void FormatTools::update_driver(int driver) format_text->update(File::formattostr(asset->format)); switch(driver) { +#ifdef HAVE_DV case CAPTURE_IEC61883: case CAPTURE_FIREWIRE: locked_compressor = (char*)CODEC_TAG_DVSD; break; - +#endif case VIDEO4LINUX2JPEG: locked_compressor = (char*)CODEC_TAG_MJPEG; break; diff --git a/cinelerra-5.1/cinelerra/interlacemodes.C b/cinelerra-5.1/cinelerra/interlacemodes.C index 4a1118ad..cb2c74d6 100644 --- a/cinelerra-5.1/cinelerra/interlacemodes.C +++ b/cinelerra-5.1/cinelerra/interlacemodes.C @@ -23,7 +23,12 @@ #define HAVE_STDINT_H #endif /* HAVE_STDINT_H */ -#include "mjpegtools/yuv4mpeg.h" +#define Y4M_UNKNOWN -1 +#define Y4M_ILACE_NONE 0 /* non-interlaced, progressive frame */ +#define Y4M_ILACE_TOP_FIRST 1 /* interlaced, top-field first */ +#define Y4M_ILACE_BOTTOM_FIRST 2 /* interlaced, bottom-field first */ +#define Y4M_ILACE_MIXED 3 /* mixed, "refer to frame header" */ + #include "interlacemodes.h" // AUTO FIX METHOD ==================== diff --git a/cinelerra-5.1/cinelerra/recordmonitor.C b/cinelerra-5.1/cinelerra/recordmonitor.C index 16a4da86..aa10ec0d 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.C +++ b/cinelerra-5.1/cinelerra/recordmonitor.C @@ -25,7 +25,9 @@ #include "condition.h" #include "cursors.h" #include "devicedvbinput.h" +#ifdef HAVE_DV #include "libdv.h" +#endif #include "edl.h" #include "edlsession.h" #include "keys.h" diff --git a/cinelerra-5.1/cinelerra/videodevice.C b/cinelerra-5.1/cinelerra/videodevice.C index e8de98ca..0a9c7799 100644 --- a/cinelerra-5.1/cinelerra/videodevice.C +++ b/cinelerra-5.1/cinelerra/videodevice.C @@ -29,7 +29,9 @@ #include "edl.h" #include "edlsession.h" #include "file.inc" +#ifdef HAVE_DV #include "libdv.h" +#endif #include "libmjpeg.h" #include "mainmenu.h" #include "mutex.h" @@ -349,11 +351,12 @@ void VideoDevice::fix_asset(Asset *asset, int driver) // Fix asset using legacy routine const char *vcodec = 0; switch(driver) { +#ifdef HAVE_DVB case CAPTURE_IEC61883: case CAPTURE_FIREWIRE: vcodec = CODEC_TAG_DVSD; break; - +#endif case VIDEO4LINUX2JPEG: vcodec = CODEC_TAG_MJPEG; break; diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index 6fba32bb..94f9b382 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -70,8 +70,6 @@ if test "x$WANT_CINBIN_BUILD" = "xyes"; then test "x$WANT_CINLIB_DIR" = "xauto" && WANT_CINLIB_DIR='$$CIN_PATH' test "x$WANT_PLUGIN_DIR" = "xauto" && WANT_PLUGIN_DIR='$$CIN_LIB/plugins' test "x$WANT_LADSPA_DIR" = "xauto" && WANT_LADSPA_DIR='$$CIN_LIB/ladspa' - sinstall=dinstall - suninstall=duninstall else lcldir=`test "x$prefix" = "xNONE" && prefix=$ac_default_prefix; \ test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"; \ @@ -94,11 +92,38 @@ else test "x$WANT_CINLIB_DIR" = "xauto" && WANT_CINLIB_DIR="$usrlib/$WANT_CIN" test "x$WANT_PLUGIN_DIR" = "xauto" && WANT_PLUGIN_DIR="$WANT_CINLIB_DIR/plugins" test "x$WANT_LADSPA_DIR" = "xauto" && WANT_LADSPA_DIR="$WANT_CINLIB_DIR/ladspa" - sinstall=cinstall - suninstall=cuninstall fi -AC_SUBST(sinstall) -AC_SUBST(suninstall) + +CIN_INSTALLS="" +CIN_UNINSTALLS="" +if test "x$WANT_LIBZMPEG" = "xyes"; then + CIN_INSTALLS+=" zmp_install" + CIN_UNINSTALLS+=" zmp_uninstall" +fi +if test "x$WANT_COMMERCIAL" = "xyes"; then + CIN_INSTALLS+=" com_install" + CIN_UNINSTALLS+=" com_uninstall" +fi +if test "x$WANT_LADSPA_BUILD" = "xyes"; then + CIN_INSTALLS+=" lad_install " + CIN_UNINSTALLS+=" lad_uninstall " +fi +if test "x$WANT_LV2" = "xyes"; then + CIN_INSTALLS+=" lv2_install " + CIN_UNINSTALLS+=" lv2_uninstall " +fi +AC_SUBST(CIN_INSTALLS) +AC_SUBST(CIN_UNINSTALLS) + +if test "x$WANT_CINBIN_BUILD" = "xyes"; then + MAK_INSTALLS="dvl_install" + MAK_UNINSTALLS="dvl_uninstall" +else + MAK_INSTALLS=" sys_install" + MAK_UNINSTALLS="sys_uninstall" +fi +AC_SUBST(MAK_INSTALLS) +AC_SUBST(MAK_UNINSTALLS) if test "x$WANT_JOBS" = "xauto"; then CPUS=`grep -c "^proc" /proc/cpuinfo` -- 2.26.2