Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2016 16:09:52 +0000 (UTC)
From:      Stephen Montgomery-Smith <stephen@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r426602 - in head/cad/netgen: . files
Message-ID:  <201611201609.uAKG9qr9046505@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: stephen
Date: Sun Nov 20 16:09:52 2016
New Revision: 426602
URL: https://svnweb.freebsd.org/changeset/ports/426602

Log:
  - When FFMPEG=on, link to multimedia/ffmpeg.
  - Respect PREFIX.
  - Conversion for avcodec_encode_video().
  
  PR:		ports/214199
  PR:		ports/214644

Added:
  head/cad/netgen/files/patch-ng_ngpkg.cpp   (contents, props changed)
Deleted:
  head/cad/netgen/files/patch-ng_ng.tcl
  head/cad/netgen/files/patch-ng_ngappinit.cpp
Modified:
  head/cad/netgen/Makefile
  head/cad/netgen/files/patch-configure

Modified: head/cad/netgen/Makefile
==============================================================================
--- head/cad/netgen/Makefile	Sun Nov 20 16:06:05 2016	(r426601)
+++ head/cad/netgen/Makefile	Sun Nov 20 16:09:52 2016	(r426602)
@@ -3,6 +3,7 @@
 
 PORTNAME=	netgen
 PORTVERSION=	5.3.1
+PORTREVISION=	3
 CATEGORIES=	cad
 MASTER_SITES=	SF/netgen-mesher/netgen-mesher/${PORTVERSION:C|\.[[:digit:]]+$||}/
 
@@ -15,13 +16,13 @@ LIB_DEPENDS=	libTix8.4.3.so:x11-toolkits
 OCC_BROKEN=	Does not compile because of issues with cad/opencascade
 
 USE_LDCONFIG=	yes
-USES=		gmake jpeg libtool tk:tea
-USE_GL=		yes
-USE_XORG=	xmu xi
+USES=		gmake jpeg libtool localbase tk:tea
+USE_GL=		gl glu
+USE_XORG=	x11 xmu xi
 MAKE_JOBS_UNSAFE=	yes
-LDFLAGS+=	-L${LOCALBASE}/lib
-CPPFLAGS+=	-I${LOCALBASE}/include -I${LOCALBASE}/lib/Togl-1.7
+CPPFLAGS+=	-isystem ${LOCALBASE}/lib/Togl-1.7
 CONFIGURE_ARGS=	--enable-jpeglib
+INSTALL_TARGET=	install-strip
 
 FETCH_BEFORE_ARGS+=	-o ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}
 
@@ -36,7 +37,7 @@ OCC_LIB_DEPENDS=	libTKernel.so:cad/openc
 OCC_CXXFLAGS=		-DOCCGEOMETRY -DHAVE_CONFIG_H -D${ARCH} -I${LOCALBASE}/include/OpenCASCADE
 OCC_CONFIGURE_ON=	--enable-occ
 
-FFMPEG_LIB_DEPENDS=	libavcodec0.so:multimedia/ffmpeg0
+FFMPEG_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg
 FFMPEG_CONFIGURE_ON=	--enable-ffmpeg
 
 MACHINE=	${OPSYS:tu}
@@ -48,14 +49,11 @@ MAKE_ENV=	TK_VER=${TK_VER} TCL_VER=${TCL
 		TK_INCLUDEDIR="${TK_INCLUDEDIR}"	\
 		MACHINE=${MACHINE} MAKE=${MAKE_CMD}
 
-pre-configure:
-	@${REINPLACE_CMD} -e "s|%%DATADIR%%|${DATADIR}|"	\
+post-patch:
+	@${REINPLACE_CMD} -e '/ngdir/s,"\.","${PREFIX}/bin",' \
+		${WRKSRC}/ng/ng.tcl \
 		${WRKSRC}/ng/ngappinit.cpp
 
-post-configure:
-	@${REINPLACE_CMD} -e "s|%%LOCALBASE%%|${LOCALBASE}|"	\
-		${WRKSRC}/configure
-
 post-install:
 #	copy some additional headers for build cad/salome-netgenplugin
 	${MKDIR} ${STAGEDIR}${DATADIR}/include

Modified: head/cad/netgen/files/patch-configure
==============================================================================
--- head/cad/netgen/files/patch-configure	Sun Nov 20 16:06:05 2016	(r426601)
+++ head/cad/netgen/files/patch-configure	Sun Nov 20 16:09:52 2016	(r426602)
@@ -153,15 +153,3 @@
        need_version=no
        need_lib_prefix=no
        ;;
-@@ -15534,9 +15534,9 @@ fi
- ffmpegon=false
- # Check whether --enable-ffmpeg was given.
- if test "${enable_ffmpeg+set}" = set; then :
--  enableval=$enable_ffmpeg; FFMPEG_INCLUDES="-DFFMPEG -D__STDC_CONSTANT_MACROS"
-+  enableval=$enable_ffmpeg; FFMPEG_INCLUDES="-I/usr/local/include/ffmpeg0 -DFFMPEG -D__STDC_CONSTANT_MACROS"
- 
--        FFMPEG_LIBS="-lavutil -lavformat -lavcodec -lavutil -lswscale -lz -lbz2"
-+        FFMPEG_LIBS="-L/usr/local/lib/ffmpeg0 -lavutil0 -lavformat0 -lavcodec0 -lavutil0 -lswscale -lz -lbz2"
- 
-         if test "$enableval" = yes; then ffmpegon=true; else ffmpegon=false; fi
- 

Added: head/cad/netgen/files/patch-ng_ngpkg.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cad/netgen/files/patch-ng_ngpkg.cpp	Sun Nov 20 16:09:52 2016	(r426602)
@@ -0,0 +1,93 @@
+--- ng/ngpkg.cpp.orig	2014-08-29 09:54:01 UTC
++++ ng/ngpkg.cpp
+@@ -2266,7 +2266,7 @@ namespace netgen
+     static int gopsize = DEFAULT_GOP_SIZE;
+     static int bframes = DEFAULT_B_FRAMES;
+     static int MPGbufsize = DEFAULT_MPG_BUFSIZE;
+-    static CodecID codec_id = CODEC_ID_MPEG1VIDEO;
++    static AVCodecID codec_id = AV_CODEC_ID_MPEG1VIDEO;
+     static FILE *MPGfile;
+     static buffer_t buff;
+     static struct SwsContext *img_convert_ctx;
+@@ -2338,7 +2338,7 @@ namespace netgen
+         context->time_base = s;
+         context->gop_size = gopsize;
+         context->max_b_frames = bframes;
+-        context->pix_fmt = PIX_FMT_YUV420P;
++        context->pix_fmt = AV_PIX_FMT_YUV420P;
+         context->flags |= CODEC_FLAG_PSNR;
+ 
+         // if( avcodec_open( context, codec ) < 0 ) {
+@@ -2351,7 +2351,7 @@ namespace netgen
+           return TCL_ERROR;
+         }
+ 
+-        YUVpicture = avcodec_alloc_frame();
++        YUVpicture = av_frame_alloc();
+ 
+         YUVpicture->data[0] = buff.YUV;
+         YUVpicture->data[1] = buff.YUV + PIXsize;
+@@ -2360,7 +2360,7 @@ namespace netgen
+         YUVpicture->linesize[1] = nx / 2;
+         YUVpicture->linesize[2] = nx / 2;
+ 
+-        RGBpicture = avcodec_alloc_frame();
++        RGBpicture = av_frame_alloc();
+ 
+         RGBpicture->data[0] = buff.RGB;
+         RGBpicture->data[1] = buff.RGB;
+@@ -2405,8 +2405,8 @@ namespace netgen
+         // Convert to YUV:
+         //----------------
+         if( img_convert_ctx == NULL )
+-          img_convert_ctx = sws_getContext( nx, ny, PIX_FMT_RGB24,
+-                                            nx, ny, PIX_FMT_YUV420P,
++          img_convert_ctx = sws_getContext( nx, ny, AV_PIX_FMT_RGB24,
++                                            nx, ny, AV_PIX_FMT_YUV420P,
+                                             SWS_BICUBIC, NULL, NULL, NULL );
+         
+         if( img_convert_ctx == NULL ) {
+@@ -2420,8 +2420,15 @@ namespace netgen
+ 
+         // Encode frame:
+         //--------------
+-        bytes = avcodec_encode_video( context, buff.MPG,
+-                                      MPGbufsize, YUVpicture );
++        AVPacket pkt;
++        av_init_packet( &pkt );
++        pkt.data = buff.MPG;
++        pkt.size = MPGbufsize;
++
++        int got_packet = 0;
++        int ret = avcodec_encode_video2( context, &pkt, YUVpicture,
++                                         &got_packet );
++        bytes = ret ? ret : pkt.size;
+         count_frames++;
+         print_info( count_frames, context, bytes );
+         fwrite( buff.MPG, 1, bytes, MPGfile );
+@@ -2442,8 +2449,15 @@ namespace netgen
+ 
+         // Get the delayed frames, if any:
+         //--------------------------------
++        AVPacket pkt;
++        av_init_packet( &pkt );
++        pkt.data = buff.MPG;
++        pkt.size = MPGbufsize;
++
++        int got_packet = 0;
+         for( ; bytes; ) {
+-          bytes = avcodec_encode_video( context, buff.MPG, MPGbufsize, NULL );
++          int ret = avcodec_encode_video2( context, &pkt, NULL, &got_packet );
++          bytes = ret ? ret : pkt.size;
+           count_frames++;
+           print_info( count_frames, context, bytes );
+           fwrite( buff.MPG, 1, bytes, MPGfile );
+@@ -2451,7 +2465,7 @@ namespace netgen
+ 
+         // Add sequence end code:
+         //-----------------------
+-        if( codec_id == CODEC_ID_MPEG1VIDEO ) {
++        if( codec_id == AV_CODEC_ID_MPEG1VIDEO ) {
+           buff.MPG[0] = 0x00;
+           buff.MPG[1] = 0x00;
+           buff.MPG[2] = 0x01;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611201609.uAKG9qr9046505>