ports/62002: new port: graphics/zgv

Radim Kolar hsn at netmag.cz
Tue Jan 27 19:41:05 UTC 2004


>Number:         62002
>Category:       ports
>Synopsis:       new port: graphics/zgv
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 27 11:40:11 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Radim Kolar
>Release:        FreeBSD 5.2-RELEASE i386
>Organization:
Sanatana Dharma
>Environment:
System: FreeBSD asura.bsd 5.2-RELEASE FreeBSD 5.2-RELEASE #0: Thu Jan 15 18:35:03 CET 2004 root at asura.bsd:/usr/obj/usr/src/sys/GENERIC i386

>Description:
I have ported ZGV from linux to freeBSD5 using SVGALIB.  It works nicely. Rus,
i will be happy if you integrate these patches into your zgv distribution.
I am using zgv since 2.7 on Slackware 3.0

package info:
There is problem that when doing make install, info file is not registered
in directory. When doing make package and then installing from package,
everything looks file. Bug in ports build system?
My makefile is -rw-r--r--  1 root  wheel  167593 Jan 24 19:01 bsd.port.mk
	
>How-To-Repeat:
>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	zgv
#	zgv/Makefile
#	zgv/files
#	zgv/files/patch-Makefile
#	zgv/files/patch-zgv.c
#	zgv/files/patch-bdf2h.c
#	zgv/files/patch-readnbkey.c
#	zgv/files/patch-rcfile.c
#	zgv/distinfo
#	zgv/pkg-descr
#	zgv/pkg-plist
#
echo c - zgv
mkdir -p zgv > /dev/null 2>&1
echo x - zgv/Makefile
sed 's/^X//' >zgv/Makefile << 'END-of-zgv/Makefile'
X# New ports collection makefile for:	zgv
X# Date created:				2004-01-27
X# Whom:					Radim Kolar
X#
X# $FreeBSD$
X#
X
XPORTNAME=	zgv
XPORTVERSION=	5.7
XCATEGORIES=	graphics
XMASTER_SITES=	${MASTER_SITE_SUNSITE}
XMASTER_SITE_SUBDIR=	apps/graphics/viewers/svga
X
XMAINTAINER=	hsn at netmag.cz
XCOMMENT=	Graphics viewer for SVGAlib
X
XLIB_DEPENDS=	tiff.4:${PORTSDIR}/graphics/tiff \
X		vga.1:${PORTSDIR}/graphics/svgalib \
X		jpeg.9:${PORTSDIR}/graphics/jpeg \
X		png.5:${PORTSDIR}/graphics/png
X
XONLY_FOR_ARCHS=	i386
XUSE_GMAKE=	yes
XALL_TARGET=	all info
X
X.if !defined(NO_INSTALL_MANPAGES)
XMAN1=		zgv.1
X.endif
X.if !defined(NOPORTDOCS)
XINFO=		zgv
XPORTDOCS=	NEWS README SECURITY TODO
X.endif
X
Xpost-patch:
X	${RM} ${WRKSRC}/doc/zgv
X
Xdo-install:
X	${INSTALL} -c -g wheel -o root -m 4755 ${WRKSRC}/src/zgv ${PREFIX}/bin
X	${INSTALL_DATA} ${WRKSRC}/doc/sample.zgvrc ${PREFIX}/etc/zgvrc.sample
X.if !defined(NOPORTDOCS)
X	${INSTALL_DATA} ${WRKSRC}/doc/zgv ${PREFIX}/info/zgv.info
X	${MKDIR} ${DOCSDIR}
X.for i in ${PORTDOCS}
X	${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
X.endfor
X.endif
X.if !defined(NO_INSTALL_MANPAGES)
X	${INSTALL_MAN} ${WRKSRC}/doc/zgv.1 ${MAN1PREFIX}/man/man1
X.endif	
X
X.include <bsd.port.mk>
END-of-zgv/Makefile
echo c - zgv/files
mkdir -p zgv/files > /dev/null 2>&1
echo x - zgv/files/patch-Makefile
sed 's/^X//' >zgv/files/patch-Makefile << 'END-of-zgv/files/patch-Makefile'
X--- src/Makefile.orig	Sat Apr  5 21:50:50 2003
X+++ src/Makefile	Wed Jan 21 18:11:59 2004
X@@ -20,6 +20,9 @@
X endif
X 
X CFLAGS += -DRGB_DB_FILE=\"$(RGB_DB)\"
X+#add local include paths for FreeBSD
X+CFLAGS += -I/usr/local/include
X+ZGV_LIBS += -L/usr/local/lib
X 
X ZGV_LIBS += -ljpeg -lpng -ltiff -lz -lm
X ifeq ($(PCDDEF),-DPCD_SUPPORT)
END-of-zgv/files/patch-Makefile
echo x - zgv/files/patch-zgv.c
sed 's/^X//' >zgv/files/patch-zgv.c << 'END-of-zgv/files/patch-zgv.c'
X--- src/zgv.c.orig	Thu Apr 10 21:31:48 2003
X+++ src/zgv.c	Tue Jan 27 18:06:22 2004
X@@ -35,7 +35,7 @@
X #include <sys/stat.h>
X #include <sys/file.h>
X #include <sys/ioctl.h>
X-#include <sys/vt.h>
X+#include <sys/consio.h>
X #include <errno.h>
X #include "zgv_io.h"
X #include "zgv.h"
X@@ -3598,30 +3598,24 @@
X {
X static char vt_filename[128];
X struct stat sbuf;
X-struct vt_stat vts;
X-int major,minor;
X+struct vid_info info;
X int fd;
X-int num;
X+int num=-1;
X 
X /* see if terminal is a console */
X-fd=dup(2);
X-fstat(fd,&sbuf);
X-major=sbuf.st_rdev>>8;
X-zgv_vt=minor=sbuf.st_rdev&0xff;
X-close(fd);
X-if(major==4 && minor<64)
X+info.size=sizeof(info);
X+if(ioctl(0,CONS_GETINFO, &info) != -1 )
X   return(1);	/* if on a console, already ok */
X 
X-/* otherwise we need to look for a free VT, redirect std{in,err},
X- * and switch to it. If there's no free VTs, give up now.
X- */
X-
X separate_vt=1;
X 
X /* still root perms, so this shouldn't be a problem... */
X-if((fd=open("/dev/console",O_WRONLY))<0) return(0);
X-ioctl(fd,VT_GETSTATE,&vts);
X-original_vt=vts.v_active;
X+if((fd=open("/dev/console",O_WRONLY))<0)
X+ {
X+     fprintf(stderr,"zgv: can't open /dev/console.\n");
X+     return(0);
X+ }
X+ioctl(fd,VT_GETACTIVE,&original_vt);
X ioctl(fd,VT_OPENQRY,&num);
X if(num==-1) return(0);	/* no VTs free */
X 
X@@ -3629,9 +3623,8 @@
X  * own it. If so, the user's probably `genuine'.
X  * (NB: the kernel now does this, but there's no harm repeating it.)
X  */
X-snprintf(vt_filename,sizeof(vt_filename),"/dev/tty%d",original_vt);
X-stat(vt_filename,&sbuf);
X-if(getuid() && getuid()!=sbuf.st_uid)
X+snprintf(vt_filename,sizeof(vt_filename),"/dev/ttyv%x",original_vt-1);
X+if(getuid() && !stat(vt_filename,&sbuf) && getuid()!=sbuf.st_uid)
X   {
X   fprintf(stderr,
X     "zgv: you must be the owner of the current console to run zgv.\n");
X@@ -3639,24 +3632,16 @@
X   }
X 
X /* switch to the new VT */
X-ioctl(fd,VT_ACTIVATE,num);
X+if(-1==ioctl(fd,VT_ACTIVATE,num))
X+{
X+    fprintf(stderr,
X+    "zgv: I am running on virtual console %d, switch to it.\n",num);
X+}
X close(fd);
X-
X-/* This is incredibly annoying, but the 2.0.x kernel just *will not*
X- * work without it. :-(((
X- * So, this gives really weird results for `zgv -h' etc., as the parent
X- * returns immediately. Redirect stdout if this is a problem.
X- */
X-if(fork()) exit(0);
X-
X zgv_vt=num;
X-sprintf(vt_filename,"/dev/tty%d",num);
X-
X-setsid();
X-
X-if(freopen(vt_filename,"r",stdin)==NULL)	return(0);
X-if(freopen(vt_filename,"w",stderr)==NULL)	return(0);
X 
X+sprintf(vt_filename,"/dev/ttyv%x",num-1);
X+chown(vt_filename,getuid(),getgid());
X ioctl(0,VT_WAITACTIVE,num);
X 
X /* not needed, but... just in case... */
END-of-zgv/files/patch-zgv.c
echo x - zgv/files/patch-bdf2h.c
sed 's/^X//' >zgv/files/patch-bdf2h.c << 'END-of-zgv/files/patch-bdf2h.c'
X--- src/bdf2hc.orig	Thu Jun  1 16:44:48 2000
X+++ src/bdf2h.c	Wed Jan 21 18:02:46 2004
X@@ -45,14 +45,7 @@
X  */
X printf("#ifndef DEFINED_STRUCT_FONTINFO_TAG\n");
X printf("#define DEFINED_STRUCT_FONTINFO_TAG 1\n");
X-printf("\
X-struct fontinfo_tag
X-  {
X-  signed char *data;
X-  int table[96];
X-  int yofs,fh,oy;
X-  };
X-");
X+printf("\n struct fontinfo_tag\n {\n signed char *data;\n int table[96];\n int yofs,fh,oy;\n };\n");
X printf("#endif\n\n");
X 
X /* generate font data */
END-of-zgv/files/patch-bdf2h.c
echo x - zgv/files/patch-readnbkey.c
sed 's/^X//' >zgv/files/patch-readnbkey.c << 'END-of-zgv/files/patch-readnbkey.c'
X--- src/readnbkey.c.orig	Sat Apr  5 15:40:39 2003
X+++ src/readnbkey.c	Tue Jan 27 16:11:50 2004
X@@ -67,43 +67,6 @@
X 
X static int old_click_status=0,new_click_status=0;
X 
X-
X-
X-/* historically, some Linux keymaps had F11 and F12 generating the
X- * same strings as shift-F1 and shift-F2. (This made things less
X- * painful for people using keyboards with only 10 function keys.) The
X- * standard UK keymap was like this, for example. However, in the
X- * not-so-very-distant past, the standard keymaps were standardised to
X- * all (?) have distinct strings for F11 and F12, effectively shifting
X- * everything else up, and giving you two more function keys. Great,
X- * except this totally broke zgv, which assumed the F11 = shift-F1
X- * approach.
X- *
X- * So here we look for the kind of keymap we have, so we can emulate the
X- * old behaviour on `new'-style (logical, i.e. it makes sense :-)) keymaps.
X- */
X-int is_logical_keymap(int ttyfd)
X-{
X-struct kbentry ent1,ent2;
X-
X-/* this is horrible, but I really do need the scancodes to check this :-(
X- * as the mapping is done at that level.
X- */
X-ent1.kb_table=K_NORMTAB;
X-ent1.kb_index=SCANCODE_F11;
X-ent2.kb_table=K_SHIFTTAB;
X-ent2.kb_index=SCANCODE_F1;
X-
X-if(ioctl(ttyfd,KDGKBENT,&ent1) || ioctl(ttyfd,KDGKBENT,&ent2))
X-  return(0);
X-
X-if(ent1.kb_value==ent2.kb_value)
X-  return(0);
X-
X-return(1);
X-}
X-
X-
X int getnbkey(int ttyfd)
X {
X unsigned char c=0;
X@@ -122,16 +85,8 @@
X int readnbkey(int ttyfd)
X {
X static unsigned char keybuf[1024];
X-static int logical_keymap=0,first=1;
X int f,left;
X 
X-/* see comment above is_logical_keymap() for what this is for */
X-if(first)
X-  {
X-  first=0;
X-  logical_keymap=is_logical_keymap(ttyfd);
X-  }
X-
X /* this gets all the characters sent by the key into an ASCIIZ string.
X  * the no-waiting-for-keys approach depends on the way Linux dumps
X  * the string into our input all at once; this is kind of nasty,
X@@ -169,6 +124,7 @@
X  * this relies on a minimum-unique string approach rather than
X  * checking for the trailing ~ (on function keys) or NUL (on everything :-)).
X  */
X+if(keybuf[0]==0177)	return(RK_DELETE);
X if(keybuf[0]==27 && keybuf[1]=='[')
X   {
X   switch(keybuf[2])
X@@ -177,53 +133,38 @@
X     case 'B':	return(RK_CURSOR_DOWN);
X     case 'C':	return(RK_CURSOR_RIGHT);
X     case 'D':	return(RK_CURSOR_LEFT);
X-    case '[':
X-      switch(keybuf[3])
X-        {
X-        case 'A':	return(RK_F1);
X-        case 'B':	return(RK_F2);
X-        case 'C':	return(RK_F3);
X-        case 'D':	return(RK_F4);
X-        case 'E':	return(RK_F5);
X-        }
X-      break;
X-    case '1':
X-      switch(keybuf[3])
X-        {
X-        case '~':	return(RK_HOME);
X-        case '7':	return(RK_F6);
X-        case '8':	return(RK_F7);
X-        case '9':	return(RK_F8);
X-        }
X-      break;
X-    case '2':
X-      switch(keybuf[3])
X-        {
X-        case '~':	return(RK_INSERT);
X-        case '0':	return(RK_F9);
X-        case '1':	return(RK_F10);
X-        case '3':	return(RK_SHIFT_F1);	/* or F11 */
X-        case '4':	return(RK_SHIFT_F2);	/* or F12 */
X-        case '5':	return(logical_keymap?RK_SHIFT_F1:RK_SHIFT_F3);
X-        case '6':	return(logical_keymap?RK_SHIFT_F2:RK_SHIFT_F4);
X-        case '8':	return(logical_keymap?RK_SHIFT_F3:RK_SHIFT_F5);
X-        case '9':	return(logical_keymap?RK_SHIFT_F4:RK_SHIFT_F6);
X-        }
X-      break;
X-    case '3':
X-      switch(keybuf[3])
X-        {
X-        case '~':	return(RK_DELETE);
X-        case '1':	return(logical_keymap?RK_SHIFT_F5:RK_SHIFT_F7);
X-        case '2':	return(logical_keymap?RK_SHIFT_F6:RK_SHIFT_F8);
X-        case '3':	return(logical_keymap?RK_SHIFT_F7:RK_SHIFT_F9);
X-        case '4':	return(logical_keymap?RK_SHIFT_F8:RK_SHIFT_F10);
X-        }
X-      break;
X-    case '4':	return(RK_END);
X-    case '5':	return(RK_PAGE_UP);
X-    case '6':	return(RK_PAGE_DOWN);
X-    }
X+    case 'M':	return(RK_F1);
X+    case 'N':	return(RK_F2);
X+    case 'O':	return(RK_F3);
X+    case 'P':	return(RK_F4);
X+    case 'Q':	return(RK_F5);
X+    case 'R':	return(RK_F6);
X+    case 'S':	return(RK_F7);
X+    case 'T':	return(RK_F8);
X+    case 'U':	return(RK_F9);
X+    case 'V':	return(RK_F10);
X+    case 'W':	return(RK_F11);
X+    case 'X':	return(RK_F12);
X+    case 'H':	return(RK_HOME);
X+    case 'F':	return(RK_END);
X+    case 'I':	return(RK_PAGE_UP);
X+    case 'G':	return(RK_PAGE_DOWN);
X+    case 'L':	return(RK_INSERT);
X+    case 'Y':	return(RK_SHIFT_F1);
X+    case 'Z':	return(RK_SHIFT_F2);
X+    case 'a':	return(RK_SHIFT_F3);
X+    case 'b':	return(RK_SHIFT_F4);
X+    case 'c':	return(RK_SHIFT_F5);
X+    case 'd':	return(RK_SHIFT_F6);
X+    case 'e':	return(RK_SHIFT_F7);
X+    case 'f':	return(RK_SHIFT_F8);
X+    case 'g':	return(RK_SHIFT_F9);
X+    case 'h':	return(RK_SHIFT_F10);
X+    /* These keys are undeclared
X+    case 'i':	return(RK_SHIFT_F11);
X+    case 'j':	return(RK_SHIFT_F12);
X+    */
X+  }
X   }
X 
X /* otherwise... */
END-of-zgv/files/patch-readnbkey.c
echo x - zgv/files/patch-rcfile.c
sed 's/^X//' >zgv/files/patch-rcfile.c << 'END-of-zgv/files/patch-rcfile.c'
X--- src/rcfile.c.orig	Mon Jun 30 15:41:43 2003
X+++ src/rcfile.c	Tue Jan 27 19:07:05 2004
X@@ -279,7 +279,7 @@
X 
X if((in=fopen(cfgfile,"r"))!=NULL)
X   got_rcfile=1,config_file_name="~/.zgvrc";	/* shortened name for that */
X-else if((in=fopen(config_file_name="/etc/zgv.conf","r"))!=NULL)
X+else if((in=fopen(config_file_name="/usr/local/etc/zgv.conf","r"))!=NULL)
X   got_rcfile=1;
X 
X if(got_rcfile)
X@@ -821,7 +821,7 @@
X "			one file is given, the files are viewed as a\n"
X "			slideshow.\n"
X "\n"
X-"All options are processed after any ~/.zgvrc or /etc/zgv.conf file.\n"
X+"All options are processed after any ~/.zgvrc or /usr/local/etc/zgv.conf file.\n"
X "Most long options (minus the `--') can used in either file with e.g.\n"
X "`zoom on'. (But be sure to omit any quoting mentioned above in config\n"
X "files.)\n"
END-of-zgv/files/patch-rcfile.c
echo x - zgv/distinfo
sed 's/^X//' >zgv/distinfo << 'END-of-zgv/distinfo'
XMD5 (zgv-5.7.tar.gz) = 50f0127c250b6efe9c5f8850b96f3841
END-of-zgv/distinfo
echo x - zgv/pkg-descr
sed 's/^X//' >zgv/pkg-descr << 'END-of-zgv/pkg-descr'
Xzgv is an svgalib-based viewer which views GIF, JPEG, PNG,
XPBM/PGM/PPM, TIFF, BMP, TGA, PCX, mrf, XBM, and XPM files, with a
Xfull-screen file selector front-end. It can be used as a simple
Xcommand, with zgv filename(s), which bypasses the front-end. For
Xmore on how zgv works and how to use it, do `info zgv' or `man zgv'
Xonce it's installed.
X
XWWW: http://www.svgalib.org/rus/zgv/
END-of-zgv/pkg-descr
echo x - zgv/pkg-plist
sed 's/^X//' >zgv/pkg-plist << 'END-of-zgv/pkg-plist'
Xbin/zgv
Xetc/zgvrc.sample
END-of-zgv/pkg-plist
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list