git: 4a010b3d9ad9 - main - graphics/cfdg: Update to 3.3 and unbreak

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Wed, 20 Oct 2021 06:52:24 UTC
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4a010b3d9ad9bcc9e662339f8be1c9c15c2bdafb

commit 4a010b3d9ad9bcc9e662339f8be1c9c15c2bdafb
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2021-10-04 14:17:33 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-10-20 06:42:56 +0000

    graphics/cfdg: Update to 3.3 and unbreak
    
    Also transfer maintainership.
    
    PR:             258927, 259278
---
 graphics/cfdg/Makefile                        | 36 +++++++------
 graphics/cfdg/distinfo                        |  5 +-
 graphics/cfdg/files/patch-Makefile            | 78 +++++++++++++++++++++++----
 graphics/cfdg/files/patch-src-common_cfdg.ypp | 11 ++++
 4 files changed, 101 insertions(+), 29 deletions(-)

diff --git a/graphics/cfdg/Makefile b/graphics/cfdg/Makefile
index 61cb5bbff022..e438d4769070 100644
--- a/graphics/cfdg/Makefile
+++ b/graphics/cfdg/Makefile
@@ -1,38 +1,42 @@
 # Created by: Anatoly Borodin <anatoly.borodin@gmail.com>
 
 PORTNAME=	cfdg
-PORTVERSION=	2.2.2
-PORTREVISION=	2
+PORTVERSION=	3.3
 CATEGORIES=	graphics math
 MASTER_SITES=	http://www.contextfreeart.org/download/ \
 		http://glyphic.s3.amazonaws.com/cfa/download/
 DISTNAME=	ContextFreeSource${PORTVERSION}
 
-MAINTAINER=	anatoly.borodin@gmail.com
+MAINTAINER=	fuz@fuz.su
 COMMENT=	Context Free Design Grammar compiler
 
 LICENSE=	GPLv2+
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-BROKEN_FreeBSD_13=	does not build: error: conflicting types for 'yyget_leng'
-BROKEN_FreeBSD_14=	does not build: error: conflicting types for 'yyget_leng'
+LIB_DEPENDS=	libicuuc.so:devel/icu \
+		libpng.so:graphics/png
 
-LIB_DEPENDS=	libpng.so:graphics/png
+USES=		bison gmake tar:xz
+MAKE_ARGS=	prefix=${PREFIX} \
+		DESTDIR=${STAGEDIR}
+TEST_TARGET=	check
+NO_WRKSUBDIR=	yes
+PLIST_FILES=	bin/cfdg \
+		share/man/man1/cfdg.1.gz
 
-WRKSRC=		${WRKDIR}/${DISTNAME}${EXTRACT_SUFX}
+PORTEXAMPLES=	*.cfdg
 
-USES=		gmake tar:tgz
-PLIST_FILES=	bin/cfdg
+OPTIONS_DEFINE=	EXAMPLES FFMPEG
+OPTIONS_DEFAULT=	FFMPEG
+FFMPEG_LIB_DEPENDS=	libavformat.so:multimedia/ffmpeg \
+			libx264.so:multimedia/libx264
+FFMPEG_MAKE_ARGS=	WANT_FFMPEG=yes
 
-PORTEXAMPLES=	*
-
-OPTIONS_DEFINE=	EXAMPLES
-
-do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/cfdg ${STAGEDIR}${PREFIX}/bin
+post-patch:
+	${REINPLACE_CMD} -e 's,/usr/local,${LOCALBASE},' ${WRKSRC}/Makefile
 
 do-install-EXAMPLES-on:
 	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
-	${INSTALL_DATA} ${WRKSRC}/input/* ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/input/*.cfdg ${STAGEDIR}${EXAMPLESDIR}
 
 .include <bsd.port.mk>
diff --git a/graphics/cfdg/distinfo b/graphics/cfdg/distinfo
index 426dc506e36f..1b64578873fd 100644
--- a/graphics/cfdg/distinfo
+++ b/graphics/cfdg/distinfo
@@ -1,2 +1,3 @@
-SHA256 (ContextFreeSource2.2.2.tgz) = 2524726ee9a5df7c7dd4ce31364fad8fe2fcad930e0d88af5cf2c6148017705e
-SIZE (ContextFreeSource2.2.2.tgz) = 1635320
+TIMESTAMP = 1633352475
+SHA256 (ContextFreeSource3.3.tar.xz) = f0b9b3622d7e729d867a5e5a9f8d1e9a134f019215fdde553c11b523416291c8
+SIZE (ContextFreeSource3.3.tar.xz) = 2684008
diff --git a/graphics/cfdg/files/patch-Makefile b/graphics/cfdg/files/patch-Makefile
index c99dea41750e..15e6c8f49045 100644
--- a/graphics/cfdg/files/patch-Makefile
+++ b/graphics/cfdg/files/patch-Makefile
@@ -1,20 +1,76 @@
---- ./Makefile.orig	2010-09-13 06:15:25.000000000 +0200
-+++ ./Makefile	2011-06-18 21:42:16.000000000 +0200
-@@ -54,7 +54,7 @@
+--- Makefile.orig	2020-04-10 19:38:18 UTC
++++ Makefile
+@@ -34,7 +34,7 @@ MAN_DIR = $(DESTDIR)$(prefix)/share/man
+ # Library directories for FFmpeg and libpng
+ #
+ 
+-LIB_DIRS = /usr/local/lib
++LIB_DIRS = /usr/local/lib $(shell libpng-config --libdir)
+ 
+ #
+ # Sources and Objects
+@@ -69,30 +69,20 @@ INPUT_SRCS = ciliasun_v2.cfdg demo1_v2.cfdg demo2_v2.c
+     welcome.cfdg ziggy.cfdg
+ 
+ 
+-LIBS = png m
++LIBS = m
+ 
+-# Use the first one for clang and the second one for gcc
+-ifeq ($(shell uname -s), Darwin)
+-  LIBS += c++ icucore
+-else
+-  LIBS += stdc++ atomic icui18n icuuc icudata
+-endif
++LIBS += stdc++ icui18n icuuc icudata
+ 
+ #
+ # FFmpeg support
+ #
+-# Uncomment these lines to enable FFmpeg support
+-#
++ifeq ($(WANT_FFMPEG), yes)
++ COMMON_SRCS += ffCanvas.cpp
++ LIBS += avformat avcodec swscale swresample avutil z m x264 pthread dl
++else
++ COMMON_SRCS += ffCanvasDummy.cpp
++endif
+ 
+-# COMMON_SRCS += ffCanvas.cpp
+-# LIBS += avformat avcodec swscale swresample avutil z m x264 pthread dl
+-
+-#
+-# Comment out this line to enable FFmpeg support
+-#
+-
+-COMMON_SRCS += ffCanvasDummy.cpp
+-
+ SRCS = $(DERIVED_SRCS) $(COMMON_SRCS) $(UNIX_SRCS)
+ 
+ #
+@@ -113,6 +103,7 @@ DEPS = $(patsubst %.o,%.d,$(OBJS))
+ 
+ LINKFLAGS += $(patsubst %,-L%,$(LIB_DIRS))
+ LINKFLAGS += $(patsubst %,-l%,$(LIBS))
++LINKFLAGS += $(shell libpng-config --libs)
+ LINKFLAGS += -fexceptions
+ 
+ deps: $(OBJ_DIR) $(DEPS)
+@@ -133,7 +124,7 @@ $(OBJS): $(OBJ_DIR)/Sentry
  # Under Cygwin replace strip $@ with strip $@.exe
  
  cfdg: $(OBJS)
--	$(LINK.o) $^ -L/usr/local/lib -lstdc++ -lpng -lz -fexceptions -o $@
-+	$(CXX) $^ $(shell libpng-config --ldflags) -lm -fexceptions -o $@
+-	$(LINK.o) $^ $(LINKFLAGS) -o $@
++	$(CXX) $^ $(LINKFLAGS) -o $@
  	strip $@
  
  
-@@ -105,7 +105,7 @@
+@@ -196,7 +187,7 @@ check: cfdg
  #
  
- CPPFLAGS += $(patsubst %,-I%,$(INC_DIRS))
--CPPFLAGS += -O3 -Wall
-+CPPFLAGS += -O3 -Wall $(shell libpng-config --cflags)
- #CPPFLAGS += -ggdb
+ CXXFLAGS += $(patsubst %,-I%,$(INC_DIRS))
+-CXXFLAGS += -O2 -Wall -Wextra -march=native -Wno-parentheses -std=c++14
++CXXFLAGS += -Wall -Wextra -Wno-parentheses -std=c++14
+ CXXFLAGS += -g -D_GLIBCXX_USE_C99_MATH=1
+ CPPFLAGS += -DNDEBUG
  
- $(OBJ_DIR)/%.o : %.cpp
diff --git a/graphics/cfdg/files/patch-src-common_cfdg.ypp b/graphics/cfdg/files/patch-src-common_cfdg.ypp
new file mode 100644
index 000000000000..f94bb67debde
--- /dev/null
+++ b/graphics/cfdg/files/patch-src-common_cfdg.ypp
@@ -0,0 +1,11 @@
+--- src-common/cfdg.ypp.orig	2021-10-04 13:54:54 UTC
++++ src-common/cfdg.ypp
+@@ -31,7 +31,7 @@
+ %skeleton "lalr1.cc"                          /*  -*- C++ -*- */
+ %require "3.0"
+ %defines
+-%define parser_class_name {CfdgParser}
++%define api.parser.class {CfdgParser}
+ %locations
+ %expect 3
+ //%debug