Bug 184827 - graphics/zgv: Fix build with clang
Summary: graphics/zgv: Fix build with clang
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pawel Pekala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-16 18:10 UTC by tkato432
Modified: 2013-12-20 12:00 UTC (History)
0 users

See Also:


Attachments
file.diff (4.02 KB, patch)
2013-12-16 18:10 UTC, tkato432
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tkato432 2013-12-16 18:10:06 UTC
- Fix build with clang
- Add LICENSE
- Add amd64 to ONLY_FOR_ARCHS
- Add option for SDL support

New file:
files/patch-zgv_io.c
pkg-plist
Comment 1 Pawel Pekala freebsd_committer 2013-12-20 10:50:47 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pawel

I'll take it.
Comment 2 dfilter service freebsd_committer 2013-12-20 11:57:08 UTC
Author: pawel
Date: Fri Dec 20 11:56:54 2013
New Revision: 336998
URL: http://svnweb.freebsd.org/changeset/ports/336998

Log:
  - Fix build with clang
  - Add LICENSE
  - Add amd64 to ONLY_FOR_ARCHS
  - Add option for SDL support
  - Switch to pkg-plist
  - Support staging
  
  PR:		ports/184827
  Submitted by:	KATO Tsuguru <tkato432@yahoo.com>

Added:
  head/graphics/zgv/files/patch-zgv_io.c   (contents, props changed)
  head/graphics/zgv/pkg-plist   (contents, props changed)
Modified:
  head/graphics/zgv/Makefile   (contents, props changed)

Modified: head/graphics/zgv/Makefile
==============================================================================
--- head/graphics/zgv/Makefile	Fri Dec 20 11:53:44 2013	(r336997)
+++ head/graphics/zgv/Makefile	Fri Dec 20 11:56:54 2013	(r336998)
@@ -5,49 +5,67 @@ PORTNAME=	zgv
 PORTVERSION=	5.9
 PORTREVISION=	5
 CATEGORIES=	graphics
-MASTER_SITES=	${MASTER_SITE_SUNSITE}
-MASTER_SITE_SUBDIR=	apps/graphics/viewers/svga
+MASTER_SITES=	SUNSITE/apps/graphics/viewers/svga
 
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Graphics viewer for SVGAlib
 
-LIB_DEPENDS=	tiff.4:${PORTSDIR}/graphics/tiff \
-		vga.1:${PORTSDIR}/graphics/svgalib \
-		jpeg.11:${PORTSDIR}/graphics/jpeg \
-		png15:${PORTSDIR}/graphics/png
+LICENSE=	GPLv2 # (or later)
 
-ONLY_FOR_ARCHS=	i386
-USE_GMAKE=	yes
+LIB_DEPENDS=	libjpeg.so:${PORTSDIR}/graphics/jpeg \
+		libpng15.so:${PORTSDIR}/graphics/png \
+		libtiff.so:${PORTSDIR}/graphics/tiff
+
+OPTIONS_DEFINE=	SDL
+
+USES=		gmake
 ALL_TARGET=	zgv info
-MAKE_ENV=	ZGV_LIBS="${LDFLAGS}"
-BINMODE=	4755
 
-PLIST_FILES=	bin/zgv etc/zgvrc.sample
-.if !defined(NO_INSTALL_MANPAGES)
-MAN1=		zgv.1
-.endif
-.if !defined(NOPORTDOCS)
-INFO=		zgv
-PORTDOCS=	NEWS README SECURITY TODO INSTALL
+CPPFLAGS+=	-I${LOCALBASE}/include
+LDFLAGS+=	-L${LOCALBASE}/lib
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MSDL}
+USE_SDL=	sdl
+MAKE_ENV+=	BACKEND=SDL
+CPPFLAGS+=	$$(${SDL_CONFIG} --cflags)
+LDFLAGS+=	$$(${SDL_CONFIG} --libs)
+.else
+LIB_DEPENDS+=	libvga.so:${PORTSDIR}/graphics/svgalib
+MAKE_ENV+=	BACKEND=SVGALIB
+ONLY_FOR_ARGS=	i386 amd64
 .endif
 
-NO_STAGE=	yes
+post-extract:
+	@${RM} ${WRKSRC}/doc/zgv
+
 post-patch:
-	${RM} ${WRKSRC}/doc/zgv
-	@${REINPLACE_CMD} -e 's|ZGV_LIBS=|ZGV_LIBS+=|' ${WRKSRC}/src/Makefile
+	@${REINPLACE_CMD} -e \
+		's|^CC=|#CC=|g ; \
+		 s|^CFLAGS=|#CFLAGS=|g ; \
+		 s|^BACKEND=|#BACKEND=|g ; \
+		 s|^PREFIX=|#PREFIX=|g ; \
+		 s|/usr/X11R6|$${LOCALBASE}|g' ${WRKSRC}/config.mk
+	@${REINPLACE_CMD} -e \
+		's|-I/usr/local/include|$${CPPFLAGS}|g ; \
+		 s|-L/usr/local/lib|$${LDFLAGS}|g ; \
+		 s|=-lSDL|=|g' ${WRKSRC}/src/Makefile
+	@${GREP} -lR "SDL/SDL" ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} -e \
+		 's|SDL/SDL|SDL|g'
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/src/zgv ${PREFIX}/bin
-	${INSTALL_DATA} ${WRKSRC}/doc/sample.zgvrc ${PREFIX}/etc/zgvrc.sample
-.if !defined(NOPORTDOCS)
-	${INSTALL_DATA} ${WRKSRC}/doc/zgv ${PREFIX}/${INFO_PATH}/zgv.info
-	${MKDIR} ${DOCSDIR}
-.for i in ${PORTDOCS}
-	${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
+	(cd ${WRKSRC}/src && ${INSTALL_PROGRAM} zgv \
+		${STAGEDIR}${PREFIX}/bin/zgv)
+	(cd ${WRKSRC}/doc && ${INSTALL_MAN} zgv.1 \
+		${STAGEDIR}${MANPREFIX}/man/man1/zgv.1)
+	(cd ${WRKSRC}/doc && ${INSTALL_DATA} sample.zgvrc \
+		${STAGEDIR}${PREFIX}/etc/zgvrc.sample)
+	(cd ${WRKSRC}/doc && ${INSTALL_DATA} zgv \
+		${STAGEDIR}${PREFIX}/${INFO_PATH}/zgvrc.info)
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+.for i in NEWS README SECURITY TODO INSTALL
+	(cd ${WRKSRC} && ${INSTALL_DATA} ${i} ${STAGEDIR}${DOCSDIR})
 .endfor
-.endif
-.if !defined(NO_INSTALL_MANPAGES)
-	${INSTALL_MAN} ${WRKSRC}/doc/zgv.1 ${MAN1PREFIX}/man/man1
-.endif
 
 .include <bsd.port.mk>

Added: head/graphics/zgv/files/patch-zgv_io.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/zgv/files/patch-zgv_io.c	Fri Dec 20 11:56:54 2013	(r336998)
@@ -0,0 +1,11 @@
+--- src/zgv_io.c.orig
++++ src/zgv_io.c
+@@ -645,7 +645,7 @@
+         case SDLK_INSERT:	return(RK_INSERT);
+         case SDLK_DELETE:	return(RK_DELETE);
+         case SDLK_RETURN:	return(RK_ENTER);
+-        default:
++        default: ;
+           /* stop complaints */
+         }
+ 

Added: head/graphics/zgv/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/zgv/pkg-plist	Fri Dec 20 11:56:54 2013	(r336998)
@@ -0,0 +1,12 @@
+@mode 4555
+bin/zgv
+@mode
+etc/zgvrc.sample
+info/zgvrc.info
+man/man1/zgv.1.gz
+%%PORTDOCS%%%%DOCSDIR%%/INSTALL
+%%PORTDOCS%%%%DOCSDIR%%/NEWS
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/SECURITY
+%%PORTDOCS%%%%DOCSDIR%%/TODO
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Pawel Pekala freebsd_committer 2013-12-20 11:57:10 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!