diff options
-rw-r--r-- | multimedia/motion/Makefile | 137 | ||||
-rw-r--r-- | multimedia/motion/distinfo | 6 | ||||
-rw-r--r-- | multimedia/motion/files/patch-configure.in | 70 | ||||
-rw-r--r-- | multimedia/motion/files/patch-ffmpeg.c | 157 |
4 files changed, 311 insertions, 59 deletions
diff --git a/multimedia/motion/Makefile b/multimedia/motion/Makefile index c8dcaf6ba133..335c2ef30f6c 100644 --- a/multimedia/motion/Makefile +++ b/multimedia/motion/Makefile @@ -6,94 +6,121 @@ # PORTNAME= motion -PORTVERSION= 3.2.11.1 -PORTREVISION= 7 +PORTVERSION= 3.2.12 CATEGORIES= multimedia -MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20-%203.2/${PORTVERSION} - -PATCH_SITES= http://www.lavrsen.dk/twiki/pub/Motion/FreeBSDPatch/ -PATCHFILES= motion-3.2.11.1.port-freebsd.diff.gz -PATCH_DIST_STRIP= -p1 +MASTER_SITES= SF/${PORTNAME}/${PORTNAME}%20-%20${PORTVERSION:R}/${PORTVERSION} MAINTAINER= ports@FreeBSD.org COMMENT= A motion detection application -LIB_DEPENDS= jpeg.11:${PORTSDIR}/graphics/jpeg \ - avformat.1:${PORTSDIR}/multimedia/ffmpeg +LICENSE= GPLv2 -ONLY_FOR_ARCHS= i386 amd64 +LIB_DEPENDS= jpeg:${PORTSDIR}/graphics/jpeg -MAN1= motion.1 +OPTIONS_DEFINE= VIDEO LTHREAD FFMPEG MYSQL PGSQL DOCS EXAMPLES +OPTIONS_SINGLE= VIDEO +OPTIONS_SINGLE_VIDEO= BKTR PWCBSD +OPTIONS_DEFAULT= VIDEO BKTR FFMPEG +VIDEO_DESC= Video capture driver. Choose one of BKTR or PWCBSD +BKTR_DESC= BKTR based TV capture cards +PWCBSD_DESC= PWCBSD based Webcams +LTHREAD_DESC= Use LinuxThreads instead of native POSIX threads -USE_AUTOTOOLS= autoconf -GNU_CONFIGURE= yes USE_GMAKE= yes -MANCOMPRESSED= no +USE_AUTOTOOLS= autoconf +MAKE_JOBS_SAFE= yes + +CPPFLAGS+= -I${LOCALBASE}/include +LDFLAGS+= -L${LOCALBASE}/lib MAN1= motion.1 -PORTDOCS= CHANGELOG CREDITS README.FreeBSD README \ +PORTDOCS= CHANGELOG CREDITS README README.FreeBSD \ motion_guide.html PORTEXAMPLES= motion-dist.conf thread1.conf thread2.conf \ thread3.conf thread4.conf -OPTIONS= PWCBSD "PWCBSD based Webcams (disables BKTR)" off \ - BKTR "Support for TV Capture cards" on \ - LINUXTHREADS "Use LinuxThreads" off - -.include <bsd.port.pre.mk> +.include <bsd.port.options.mk> -.if !defined(WITH_BKTR) && !defined(WITH_PWCBSD) -CFLAGS+= -DWITHOUT_V4L +.if ${PORT_OPTIONS:MBKTR} +CONFIGURE_ARGS+=--with-bktr +.else +CONFIGURE_ARGS+=--without-bktr .endif -.if defined(WITH_PWCBSD) -CONFIGURE_ARGS= --with-pwcbsd +.if ${PORT_OPTIONS:MPWCBSD} BUILD_DEPENDS+= v4l_compat>=1.0.20060801:${PORTSDIR}/multimedia/v4l_compat RUN_DEPENDS+= /boot/modules/pwc.ko:${PORTSDIR}/multimedia/pwcbsd +CONFIGURE_ARGS+=--with-pwcbsd +.else +CONFIGURE_ARGS+=--without-pwcbsd +CFLAGS+= -DWITHOUT_V4L .endif -.if defined(WITH_LINUXTHREADS) -CONFIGURE_ARGS= --with-linuxthreads -LIB_DEPENDS+= lthread.[35]:${PORTSDIR}/devel/linuxthreads +.if ${PORT_OPTIONS:MLTHREAD} +LIB_DEPENDS+= lthread:${PORTSDIR}/devel/linuxthreads +CONFIGURE_ARGS+=--with-linuxthreads +.else +CONFIGURE_ARGS+=--without-linuxthreads .endif -post-patch: -# Resolve name collision with jpeg-8 - ${REINPLACE_CMD} -e 's|jpeg_mem_dest|local_jpeg_mem_dest|' \ - ${WRKSRC}/picture.c +.if ${PORT_OPTIONS:MFFMPEG} +LIB_DEPENDS+= avformat:${PORTSDIR}/multimedia/ffmpeg +CONFIGURE_ARGS+=--with-ffmpeg=${LOCALBASE} +.else +CONFIGURE_ARGS+=--without-ffmpeg +.endif -post-install: -.if !exists(${PREFIX}/etc/motion.conf) - ${INSTALL_DATA} ${PREFIX}/etc/motion.conf.sample ${PREFIX}/etc/motion.conf +.if ${PORT_OPTIONS:MMYSQL} +USE_MYSQL= yes +CONFIGURE_ARGS+=--with-mysql-lib=${LOCALBASE}/lib/mysql \ + --with-mysql-include=${LOCALBASE}/include/mysql +.else +CONFIGURE_ARGS+=--without-mysql .endif - ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME}.init-FreeBSD.sh ${PREFIX}/etc/rc.d/${PORTNAME} -.if !defined(NOPORTEXAMPLES) - ${MKDIR} ${EXAMPLESDIR} -.for f in ${PORTEXAMPLES} - ${INSTALL_DATA} ${WRKSRC}/${f} ${EXAMPLESDIR} -.endfor - @${ECHO_MSG} "===> Examples are installed in ${EXAMPLESDIR}." +.if ${PORT_OPTIONS:MPGSQL} +USE_PGSQL= yes +CONFIGURE_ARGS+=--with-pgsql-lib=${LOCALBASE}/lib \ + --with-pgsql-include=${LOCALBASE}/include +.else +CONFIGURE_ARGS+=--without-pgsql +.endif + +.include <bsd.port.pre.mk> + +.if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64" +BROKEN= Does not compile on ia64, powerpc, or sparc64 .endif -.if !defined(NOPORTDOCS) - ${MKDIR} ${DOCSDIR} +post-patch: + @${REINPLACE_CMD} -e \ + 's|/usr/local|${LOCALBASE}|g' ${WRKSRC}/configure.in +# Resolve name collision with jpeg-8 + @${REINPLACE_CMD} -e \ + 's|jpeg_mem_dest|local_jpeg_mem_dest|' ${WRKSRC}/picture.c + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/motion ${PREFIX}/bin + ${INSTALL_MAN} ${WRKSRC}/motion.1 ${MANPREFIX}/man/man1 + ${INSTALL_SCRIPT} ${WRKSRC}/motion.init-FreeBSD.sh \ + ${PREFIX}/etc/rc.d/motion + ${INSTALL_DATA} ${WRKSRC}/motion-dist.conf \ + ${PREFIX}/etc/motion.conf.sample +.if !exists(${PREFIX}/etc/motion.conf) + ${INSTALL_DATA} ${PREFIX}/etc/motion.conf.sample \ + ${PREFIX}/etc/motion.conf +.endif +.if ${PORT_OPTIONS:MDOCS} + @${MKDIR} ${DOCSDIR} .for f in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR} .endfor - @${ECHO_MSG} "===> Docs are installed in ${DOCSDIR}." -.endif - -.if defined(WITH_BKTR) - @${ECHO_MSG} "===============================================================================" - @${ECHO_MSG} "Please make sure you have bktr(4) kernel support." - @${ECHO_MSG} "===============================================================================" .endif - -.if defined(WITH_PWCBSD) - @${ECHO_MSG} "===============================================================================" - @${ECHO_MSG} "Please make sure you have pwcbsd compiled with mmap support." - @${ECHO_MSG} "===============================================================================" +.if ${PORT_OPTIONS:MEXAMPLES} + @${MKDIR} ${EXAMPLESDIR} +.for f in ${PORTEXAMPLES} + ${INSTALL_DATA} ${WRKSRC}/${f} ${EXAMPLESDIR} +.endfor .endif .include <bsd.port.post.mk> diff --git a/multimedia/motion/distinfo b/multimedia/motion/distinfo index bd561373f65e..3eae335f198f 100644 --- a/multimedia/motion/distinfo +++ b/multimedia/motion/distinfo @@ -1,4 +1,2 @@ -SHA256 (motion-3.2.11.1.tar.gz) = 73973e723c39c05cbfc5c2a90357c5dea3078c3162dfc41f303fbf40cda9e403 -SIZE (motion-3.2.11.1.tar.gz) = 417246 -SHA256 (motion-3.2.11.1.port-freebsd.diff.gz) = bf494af5525c45d8582e381816429890878c0493342c242be74014b663c089b2 -SIZE (motion-3.2.11.1.port-freebsd.diff.gz) = 3238 +SHA256 (motion-3.2.12.tar.gz) = a597f8d7ec0bf3c5fb62722c4eead59717fe01c2ae0d256c642027cea74b2f0a +SIZE (motion-3.2.12.tar.gz) = 425729 diff --git a/multimedia/motion/files/patch-configure.in b/multimedia/motion/files/patch-configure.in new file mode 100644 index 000000000000..9ac91ad3e974 --- /dev/null +++ b/multimedia/motion/files/patch-configure.in @@ -0,0 +1,70 @@ +--- configure.in.orig 2010-06-01 15:48:23.000000000 +0900 ++++ configure.in 2012-06-08 23:21:55.000000000 +0900 +@@ -316,7 +316,7 @@ + # + else if test "${FFMPEG_DIR}" = "yes"; then + # AUTODETECT STATIC/SHARED LIB +- AC_MSG_CHECKING(for ffmpeg autodetecting) ++ AC_MSG_CHECKING(for ffmpeg autodetecting libraries) + + if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then + AC_MSG_RESULT(found in /usr/lib64) +@@ -347,7 +347,7 @@ + echo "" + fi + else +- AC_MSG_CHECKING(for ffmpeg in -> [${FFMPEG_DIR}] <-) ++ AC_MSG_CHECKING(for ffmpeg libraries in -> [${FFMPEG_DIR}] <-) + if test -f ${FFMPEG_DIR}/lib/libavcodec.a -o -f ${FFMPEG_DIR}/lib/libavcodec.so && test -f ${FFMPEG_DIR}/lib/libavformat.a -o -f ${FFMPEG_DIR}/lib/libavformat.so ; then + AC_MSG_RESULT(found) + FFMPEG_OK="found" +@@ -392,9 +392,11 @@ + elif test -f ${FFMPEG_DIR}/include/libavformat/avformat.h; then + AC_MSG_RESULT(found ${FFMPEG_DIR}/include/libavformat/avformat.h) + FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include -DFFMPEG_NEW_INCLUDES" ++ AVFORMAT="-I${FFMPEG_DIR}/include/libavformat" + elif test -f ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h; then + AC_MSG_RESULT(found ${FFMPEG_DIR}/include/ffmpeg/libavformat/avformat.h) + FFMPEG_CFLAGS="-I${FFMPEG_DIR}/include/ffmpeg -DFFMPEG_NEW_INCLUDES" ++ AVFORMAT="-I${FFMPEG_DIR}/include/ffmpeg/libavformat" + else + AC_MSG_RESULT(not found) + FFMPEG_OK="no_found" +@@ -423,9 +425,11 @@ + AC_MSG_CHECKING([file_protocol is defined in ffmpeg ?]) + saved_CFLAGS=$CFLAGS + saved_LIBS=$LIBS +- CFLAGS="${FFMPEG_CFLAGS}" ++ ++ ++ CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}" + LIBS="$TEMP_LIBS" +- ++ + AC_COMPILE_IFELSE( + [ + #include <avformat.h> +@@ -442,7 +446,8 @@ + ] + ) + CFLAGS=$saved_CFLAGS +- LIBS=$saved_LIBS ++ LIBS=$saved_LIBS ++ + fi + fi + fi +@@ -1067,6 +1072,13 @@ + LIBS="${TEMP_LIBS}" + LDFLAGS="${TEMP_LDFLAGS}" + ++ ++AC_CHECK_FUNC(avformat_alloc_context, AC_DEFINE([have_avformat_alloc_context],1,[Define to 1 if you have avformat_alloc_context support])) ++AC_CHECK_FUNC(av_avformat_alloc_context, AC_DEFINE([have_av_avformat_alloc_context],1,[Define to 1 if you have av_avformat_alloc_context support])) ++AC_CHECK_FUNC(av_register_protocol2, AC_DEFINE([have_av_register_protocol2],1,[Define to 1 if you have av_register_protocol2 support])) ++AC_CHECK_FUNC(av_register_protocol, AC_DEFINE([have_av_register_protocol],1,[Define to 1 if you have av_register_protocol support])) ++ ++ + # + # Add the right exec path for rc scripts + # diff --git a/multimedia/motion/files/patch-ffmpeg.c b/multimedia/motion/files/patch-ffmpeg.c new file mode 100644 index 000000000000..0055667f7e55 --- /dev/null +++ b/multimedia/motion/files/patch-ffmpeg.c @@ -0,0 +1,157 @@ +--- ffmpeg.c.orig 2010-06-01 15:48:23.000000000 +0900 ++++ ffmpeg.c 2012-06-08 23:21:55.000000000 +0900 +@@ -36,6 +36,11 @@ + # endif /* __GNUC__ */ + #endif /* LIBAVCODEC_BUILD > 4680 */ + ++#if defined LIBAVFORMAT_VERSION_MAJOR && defined LIBAVFORMAT_VERSION_MINOR ++#if LIBAVFORMAT_VERSION_MAJOR < 53 && LIBAVFORMAT_VERSION_MINOR < 45 ++ #define GUESS_NO_DEPRECATED ++#endif ++#endif + + #if LIBAVFORMAT_BUILD >= 4616 + /* The API for av_write_frame changed with FFmpeg version 0.4.9pre1. +@@ -227,11 +232,13 @@ + mpeg1_file_protocol.url_seek = file_protocol.url_seek; + mpeg1_file_protocol.url_close = file_protocol.url_close; + +- /* Register the append file protocol. */ +-#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8) ++/* Register the append file protocol. */ ++#ifdef have_av_register_protocol2 ++ av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol)); ++#elif defined have_av_register_protocol + av_register_protocol(&mpeg1_file_protocol); + #else +- register_protocol(&mpeg1_file_protocol); ++# warning av_register_protocolXXX missing + #endif + } + +@@ -258,7 +265,11 @@ + /* We use "mpeg1video" for raw mpeg1 format. Using "mpeg" would + * result in a muxed output file, which isn't appropriate here. + */ +- of = guess_format("mpeg1video", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("mpeg1video", NULL, NULL); ++#endif + if (of) { + /* But we want the trailer to be correctly written. */ + of->write_trailer = mpeg1_write_trailer; +@@ -270,24 +281,44 @@ + #endif + } else if (strcmp(codec, "mpeg4") == 0) { + ext = ".avi"; +- of = guess_format("avi", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("avi", NULL, NULL); ++#endif + } else if (strcmp(codec, "msmpeg4") == 0) { + ext = ".avi"; +- of = guess_format("avi", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("avi", NULL, NULL); ++#endif + if (of) { + /* Manually override the codec id. */ + of->video_codec = CODEC_ID_MSMPEG4V2; + } + } else if (strcmp(codec, "swf") == 0) { + ext = ".swf"; +- of = guess_format("swf", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("swf", NULL, NULL); ++#endif + } else if (strcmp(codec, "flv") == 0) { + ext = ".flv"; +- of = guess_format("flv", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("flv", NULL, NULL); ++#endif + of->video_codec = CODEC_ID_FLV1; + } else if (strcmp(codec, "ffv1") == 0) { + ext = ".avi"; +- of = guess_format("avi", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("avi", NULL, NULL); ++#endif + if (of) { + /* Use the FFMPEG Lossless Video codec (experimental!). + Requires strict_std_compliance to be <= -2 */ +@@ -295,7 +326,11 @@ + } + } else if (strcmp(codec, "mov") == 0) { + ext = ".mov"; +- of = guess_format("mov", NULL, NULL); ++#ifdef GUESS_NO_DEPRECATED ++ of = guess_format("mpeg1video", NULL, NULL); ++#else ++ of = av_guess_format("mov", NULL, NULL); ++#endif + } else { + motion_log(LOG_ERR, 0, "ffmpeg_video_codec option value %s is not supported", codec); + return NULL; +@@ -340,7 +375,13 @@ + snprintf(ffmpeg->codec, sizeof(ffmpeg->codec), "%s", ffmpeg_video_codec); + + /* allocation the output media context */ ++#ifdef have_avformat_alloc_context ++ ffmpeg->oc = avformat_alloc_context(); ++#elif defined have_av_avformat_alloc_context ++ ffmpeg->oc = av_alloc_format_context(); ++#else + ffmpeg->oc = av_mallocz(sizeof(AVFormatContext)); ++#endif + + if (!ffmpeg->oc) { + motion_log(LOG_ERR, 1, "Memory error while allocating output media context"); +@@ -377,7 +418,11 @@ + + ffmpeg->c = c = AVSTREAM_CODEC_PTR(ffmpeg->video_st); + c->codec_id = ffmpeg->oc->oformat->video_codec; ++#if LIBAVCODEC_VERSION_MAJOR < 53 + c->codec_type = CODEC_TYPE_VIDEO; ++#else ++ c->codec_type = AVMEDIA_TYPE_VIDEO; ++#endif + is_mpeg1 = c->codec_id == CODEC_ID_MPEG1VIDEO; + + if (strcmp(ffmpeg_video_codec, "ffv1") == 0) +@@ -646,7 +691,11 @@ + if (ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE) { + /* raw video case. The API will change slightly in the near future for that */ + #ifdef FFMPEG_AVWRITEFRAME_NEWAPI ++#if LIBAVCODEC_VERSION_MAJOR < 53 + pkt.flags |= PKT_FLAG_KEY; ++#else ++ pkt.flags |= AV_PKT_FLAG_KEY; ++#endif + pkt.data = (uint8_t *)pic; + pkt.size = sizeof(AVPicture); + ret = av_write_frame(ffmpeg->oc, &pkt); +@@ -667,7 +716,11 @@ + #ifdef FFMPEG_AVWRITEFRAME_NEWAPI + pkt.pts = AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->pts; + if (AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->key_frame) { ++#if LIBAVCODEC_VERSION_MAJOR < 53 + pkt.flags |= PKT_FLAG_KEY; ++#else ++ pkt.flags |= AV_PKT_FLAG_KEY; ++#endif + } + pkt.data = ffmpeg->video_outbuf; + pkt.size = out_size;
\ No newline at end of file |