Subject: pkg/24053: some bug fixes for graphics/magicpoint
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <hira@po6.nsk.ne.jp>
List: netbsd-bugs
Date: 01/11/2004 19:20:31
>Number:         24053
>Category:       pkg
>Synopsis:       some bug fixes for graphics/magicpoint
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 11 10:21:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Kouichirou Hiratsuka
>Release:        NetBSD 1.6ZH
>Organization:
>Environment:
System: NetBSD firefly.localdomain 1.6ZH NetBSD 1.6ZH (FIREFLY.MP) #72: Sun Jan 11 01:27:47 JST 2004 hiratuka@firefly.localdomain:/usr/src/sys/arch/i386/compile/FIREFLY.MP i386
Architecture: i386
Machine: i386
>Description:
	This is some bug fixes for graphics/magicpoint.

	1. fix ifdef symbol in parse.c
	XFT2 -> USE_XFT2

	2. fix codeset names for iconv_open(3) in draw.c
	Two codeset names of `UTF8' and `iso2022jp' don't work on NetBSD.

	3. fix comparison bug in draw.c
	A integer value should not be compared with a iconv_t variable
	directly. With gcc3 following program prints `success'. It needs a
	cast.

	iconv_t icv = (iconv_t)-1;
	if (icv < 0)
	      printf("error\n");
	else
	      printf("success\n");

	4. fix PR pkg/24030
	It's a problem of configure script. If pkg-config exists, even if
	libpng.pc does not exist, compilation flags for linpng are decided by
	pkg-config. In this case, it must check png header and library.

	if type pkg-config > /dev/null 2>&1; then
	   if pkg-config libpng; then
	      # get flags by pkg-config
	   fi
	else
	   # check for png header and library
	fi

	I changed this as follows and it works fine.

	if type pkg-config > /dev/null 2>&1 && pkg-config libpng; then
	   # get flags by pkg-config
	else
	   # check for png header and library
	fi

>How-To-Repeat:
>Fix:
--- graphics/magicpoint/distinfo.orig	2003-09-12 01:09:40.000000000 +0900
+++ graphics/magicpoint/distinfo	2004-01-11 04:21:37.000000000 +0900
@@ -2,5 +2,7 @@
 
 SHA1 (magicpoint-1.10a.tar.gz) = 7510ee965316cb52eac7a430f0e19a87a337fe5c
 Size (magicpoint-1.10a.tar.gz) = 843657 bytes
-SHA1 (patch-aa) = 06415f6277a10320aa5bc7df6dd1e8af9858fd54
+SHA1 (patch-aa) = f4d97279e878a58900ceff5ea07c61ca678e61f5
 SHA1 (patch-ac) = 1b2de41c2a8da28c9023552eff676c40069630fe
+SHA1 (patch-ad) = d6dd11bee4091de4f1c8d5fffa61987d16a063e1
+SHA1 (patch-ae) = b8c48eddee83f78b24cd10e864e94c3dd39c552f
--- graphics/magicpoint/patches/patch-aa.orig	2003-09-12 01:09:40.000000000 +0900
+++ graphics/magicpoint/patches/patch-aa	2004-01-11 04:21:08.000000000 +0900
@@ -1,8 +1,7 @@
-$NetBSD: patch-aa,v 1.9 2003/09/11 16:09:40 jmmv Exp $
 
---- configure.orig	2003-05-28 07:34:23.000000000 +0200
-+++ configure
-@@ -4108,7 +4108,7 @@ if test "$mgp_use_freetype" = "yes"; the
+--- configure.orig	2003-05-28 14:34:23.000000000 +0900
++++ configure	2004-01-11 04:18:35.000000000 +0900
+@@ -4108,7 +4108,7 @@
    # XXX: freetype2 may use freetype-config
   	echo "$as_me:$LINENO: checking for freetype1 library/header" >&5
  echo $ECHO_N "checking for freetype1 library/header... $ECHO_C" >&6
@@ -11,7 +10,27 @@
   		ac_cv_ft_lib=no
   		ac_cv_ft_include=no
  		shlib1=`echo $dir/lib/libttf.so* | head -1 | sed -e 's/.*\///'`
-@@ -4643,7 +4643,7 @@ echo "${ECHO_T}$mgp_use_vflib" >&6
+@@ -4379,15 +4379,13 @@
+ echo "$as_me:$LINENO: result: $mgp_use_xft2" >&5
+ echo "${ECHO_T}$mgp_use_xft2" >&6
+ if test "$mgp_use_xft2" = "yes"; then
+-  if type pkg-config > /dev/null 2>&1; then
+-     if pkg-config xft; then
+-        OPTFLAGS="`pkg-config --cflags xft` $OPTFLAGS"
+-        LIBS="$LIBS `pkg-config --libs xft`"
+-        cat >>confdefs.h <<\_ACEOF
++  if type pkg-config > /dev/null 2>&1 && pkg-config xft; then
++     OPTFLAGS="`pkg-config --cflags xft` $OPTFLAGS"
++     LIBS="$LIBS `pkg-config --libs xft`"
++     cat >>confdefs.h <<\_ACEOF
+ #define USE_XFT2 1
+ _ACEOF
+ 
+-     fi
+   else
+ 	echo "$as_me:$LINENO: checking for xft2 and ft2 and fc header.." >&5
+ echo $ECHO_N "checking for xft2 and ft2 and fc header..... $ECHO_C" >&6
+@@ -4643,7 +4641,7 @@
  if test "$mgp_use_vflib" = "yes"; then
  	echo "$as_me:$LINENO: checking for VFlib library/header" >&5
  echo $ECHO_N "checking for VFlib library/header... $ECHO_C" >&6
@@ -20,16 +39,38 @@
  		ac_cv_vf_libname=VFlib
  		ac_cv_vf_libdir=no
  		ac_cv_vf_hdrdir=no
-@@ -4867,7 +4867,7 @@ _ACEOF
+@@ -4815,6 +4813,7 @@
+ 		    /usr/local/lib /usr/local/etc /etc \
+ 		    /usr/local/libdata/vflib /usr/local/share/VFlib \
+ 		    /usr/local/share/VFlib/* \
++		    ${prefix}/share/VFlib/* \
+ 		    ../../VFlib* ../VFlib* VFlib*; do
+ 			if test -d $ac_dir -a -f $ac_dir/vfontcap; then
+ 				ac_cv_vf_fontcap=$ac_dir/vfontcap;
+@@ -4857,17 +4856,15 @@
+ 	fi
+ fi
  
-   fi
+-if type pkg-config > /dev/null 2>&1; then
+-  if pkg-config libpng; then
+-     LIBS="$LIBS `pkg-config --libs libpng`"
+-     OPTFLAGS="$OPTFLAGS `pkg-config --cflags libpng`"
+-     cat >>confdefs.h <<\_ACEOF
++if type pkg-config > /dev/null 2>&1 && pkg-config libpng; then
++  LIBS="$LIBS `pkg-config --libs libpng`"
++  OPTFLAGS="$OPTFLAGS `pkg-config --cflags libpng`"
++  cat >>confdefs.h <<\_ACEOF
+ #define USE_PNG 1
+ _ACEOF
+ 
+-  fi
  else
 -  for i in /usr/pkg /usr/local /usr; do
 +  for i in ${BUILDLINK_DIR}; do
  	if test -f $i/include/png.h; then
  		if test -f $i/lib/libpng.a ; then
  			DEPLIBS="$DEPLIBS $i/lib/libpng.a"
-@@ -5010,7 +5010,7 @@ fi
+@@ -5010,7 +5007,7 @@
    done
  fi
  
@@ -38,7 +79,7 @@
  	if test -f $i/include/libmng.h; then
  		if test -f $i/lib/libmng.a ; then
  			DEPLIBS="$DEPLIBS $i/lib/libmng.a"
-@@ -5647,7 +5647,7 @@ fi
+@@ -5647,7 +5644,7 @@
  		echo 'FATAL: You need libungif to use gif images.  pass proper LIBS to configure.'
  		exit 1
  	fi
@@ -47,7 +88,28 @@
  		if test -f $i/include/gif_lib.h; then
  			gif_h_ok=yes
  			OPTFLAGS="$OPTFLAGS -I$i/include"
-@@ -5757,7 +5757,7 @@ fi
+@@ -5677,16 +5674,14 @@
+ echo "$as_me:$LINENO: result: $mgp_imlib" >&5
+ echo "${ECHO_T}$mgp_imlib" >&6
+ if test $mgp_imlib = "yes"; then
+-  if type pkg-config > /dev/null 2>&1; then
+-     if pkg-config imlib; then
+-        LIBS="$LIBS `pkg-config --libs imlib`"
+-        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
+-	cat >>confdefs.h <<\_ACEOF
++  if type pkg-config > /dev/null 2>&1 && pkg-config imlib; then
++     LIBS="$LIBS `pkg-config --libs imlib`"
++     OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
++     cat >>confdefs.h <<\_ACEOF
+ #define USE_IMLIB 1
+ _ACEOF
+ 
+ 	USE_IMLIB=1
+-     fi
+   else
+ 	echo "$as_me:$LINENO: checking for Imlib_init in -lImlib" >&5
+ echo $ECHO_N "checking for Imlib_init in -lImlib... $ECHO_C" >&6
+@@ -5757,7 +5752,7 @@
  		echo 'FATAL: You need libImlib to use Imlib loading.  pass proper LIBS to configure.'
  		exit 1
  	fi
--- graphics/magicpoint/patches/patch-ad.orig	2003-12-18 19:40:52.000000000 +0900
+++ graphics/magicpoint/patches/patch-ad	2003-12-18 19:40:52.000000000 +0900
@@ -0,0 +1,12 @@
+
+--- parse.c.orig	2003-11-24 21:49:38.000000000 +0900
++++ parse.c	2003-11-24 21:50:13.000000000 +0900
+@@ -848,7 +848,7 @@
+ 	tmpint[2]->cti_value = DEFAULT_VGAP;
+ 	tmpint[3] = ctlalloc1(CTL_QUALITY);
+ 	tmpint[3]->cti_value = DEFAULT_BQUALITY;
+-#ifdef XFT2
++#ifdef USE_XFT2
+ 	tmpint[4] = ctlalloc1(CTL_OPAQUE);
+ 	tmpint[4]->cti_value = DEFAULT_OPAQUE;
+ #endif
--- graphics/magicpoint/patches/patch-ae.orig	2003-12-18 19:40:52.000000000 +0900
+++ graphics/magicpoint/patches/patch-ae	2003-12-18 19:40:52.000000000 +0900
@@ -0,0 +1,23 @@
+
+--- draw.c.orig	2003-05-14 16:45:35.000000000 +0900
++++ draw.c	2003-11-25 08:03:15.000000000 +0900
+@@ -4498,7 +4498,7 @@
+ 	struct ctrl *cp;
+ 	char *fontname = NULL;
+ 	int i;
+-	static char etab[3][20] = { "iso2022jp", "gb2312", "ksc5601"};
++	static char etab[3][20] = { "iso-2022-jp", "gb2312", "ksc5601"};
+ 	static char rtab[3][20] = { "jisx208", "gb2312", "ksc5601"};
+ 	static char prefix[3][20] = { "\033$B", "\033$A", "\033$(C"};
+ 	char buf16[1024], *p16;
+@@ -4529,8 +4529,8 @@
+ 		}
+ 		if (i == 3) return NULL; /* cannot find codeset */
+ 		sprintf(buf16, "%s%s\0", prefix[i], p);  	
+-		if (!icv[i]) icv[i] = iconv_open("UTF8", etab[i]);
+-		if (icv[i] < 0){
++		if (icv[i] == (iconv_t)0) icv[i] = iconv_open("UTF-8", etab[i]);
++		if (icv[i] == (iconv_t)-1){
+ 			fprintf(stderr, "your iconv doesn't support %s\n", etab[i]);
+ 			return NULL;
+ 		}
>Release-Note:
>Audit-Trail:
>Unformatted: