From gaoj@cpsc.ucalgary.ca  Sun Jul 18 22:08:32 2004
Return-Path: <gaoj@cpsc.ucalgary.ca>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 69A2616A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Jul 2004 22:08:32 +0000 (GMT)
Received: from ensc.cpsc.ucalgary.ca (ensc.cpsc.ucalgary.ca [136.159.2.4])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 11EB743D46
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Jul 2004 22:08:32 +0000 (GMT)
	(envelope-from gaoj@cpsc.ucalgary.ca)
Received: from imgw1.cpsc.ucalgary.ca (imgw1.cpsc.ucalgary.ca [136.159.5.9])
	by ensc.cpsc.ucalgary.ca (8.12.11/8.12.10) with ESMTP id i6IM47eB028789
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Jul 2004 16:04:07 -0600 (MDT)
Received: from aibsd (sana-sa [136.159.7.231])
	by imgw1.cpsc.ucalgary.ca (8.12.10/8.12.10) with SMTP id i6IM42pi014670
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Jul 2004 16:04:02 -0600
Received: by aibsd (sSMTP sendmail emulation); Sun, 18 Jul 2004 16:04:02 -0600
Message-Id: <200407182204.i6IM42pi014670@imgw1.cpsc.ucalgary.ca>
Date: Sun, 18 Jul 2004 16:04:02 -0600
From: "Jie Gao" <gaoj@cpsc.ucalgary.ca>
Reply-To: Jie Gao <gaoj@cpsc.ucalgary.ca>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] chinese/xsim does not compile with coming GCC 3.4
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         69251
>Category:       ports
>Synopsis:       [PATCH] chinese/xsim does not compile with coming GCC 3.4
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    vanilla
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jul 18 22:10:17 GMT 2004
>Closed-Date:    Sun Aug 01 17:49:44 GMT 2004
>Last-Modified:  Sun Aug 01 17:49:44 GMT 2004
>Originator:     Jie Gao
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD aibsd-current 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Thu Jul 15 10:00:38 MDT 2004 gaoj@aibsd-current:/usr/obj/usr/src/sys/AIBSD i386


	
>Description:
	
chinese/xsim does not compile when using GCC 3.4 because of an internal change
in GCC. Besides, there are several other issues with this port. The patch 
included fix the following problems:

 1. Compilation failure when using GCC 3.4
 2. Does not respect ${CFLAGS}
 3. Dependancy problem: This port has preference on db4 over db3.3, i.e. when
    both are present, it uses db4. So change the dependancy from db3.3 to db4.
 4. The default installation does not create user settings, which causes write
    attempt to global settings and the consequent failure confuses users.
 5. Locale zh_CN.EUC is not present on 5.x. Swith to zh_CN.eucCN.

>How-To-Repeat:
	
>Fix:

	

--- patch-xsim begins here ---
diff -ruN xsim.old/Makefile xsim/Makefile
--- xsim.old/Makefile	Sun Jul 18 14:38:25 2004
+++ xsim/Makefile	Sun Jul 18 15:52:46 2004
@@ -16,12 +16,12 @@
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A simple and fast GBK Chinese XIM server
 
-LIB_DEPENDS=	db3.3:${PORTSDIR}/databases/db3
+LIB_DEPENDS=	db4:${PORTSDIR}/databases/db4
 
 USE_REINPLACE=	yes
 USE_XLIB=	yes
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--with-cn-locale=EUC
+CONFIGURE_ARGS=	--with-cn-locale=eucCN
 
 .include <bsd.port.pre.mk>
 
@@ -34,9 +34,14 @@
 		${WRKSRC}/xsim/IMdkit/IMConn.c
 	@${FIND} ${WRKSRC} -name xsimrc.in -or -name Makefile.in | ${XARGS} \
 		${REINPLACE_CMD} -Ee 's,@prefix@/(plugins|dat|bin),${DATADIR}/\1,g'
+	@${FIND} ${WRKSRC} ! -type d \
+		-exec ${GREP} -q _CPP_BITS_IOSBASE_H '{}' \; \
+		-exec ${REINPLACE_CMD} 's/#ifdef _CPP_BITS_IOSBASE_H/#if defined(_IOS_BASE_H) || defined(_CPP_BITS_IOSBASE_H)/g' '{}' \;
+	@${REINPLACE_CMD} "s/-O2/${CFLAGS}/g" ${WRKSRC}/configure
 
 post-install:
-	@${LN} -s ${DATADIR}/bin/xsim ${PREFIX}/bin/xsim
+	@${SED} "s|%%PREFIX%%|${PREFIX}|g" <${FILESDIR}/xsim.sh \
+		>${PREFIX}/bin/xsim && ${CHMOD} 555 ${PREFIX}/bin/xsim
 	@${MKDIR} ${DATADIR}/dat
 	@${CP} -R ${WRKDIR}/usr/local/xsim/dat/* ${DATADIR}/dat
 	@${SED} -e 's,%%X11BASE%%,${X11BASE},g' < ${PKGMESSAGE}
diff -ruN xsim.old/files/xsim.sh xsim/files/xsim.sh
--- xsim.old/files/xsim.sh	Wed Dec 31 17:00:00 1969
+++ xsim/files/xsim.sh	Sun Jul 18 15:32:37 2004
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Install user settings directory if it does not exist
+if [ ! -d ${HOME}/.xsim ]
+then
+	mkdir ${HOME}/.xsim
+	cp %%PREFIX%%/share/xsim/dat/* ${HOME}/.xsim/
+	sed "/^DICT_LOCAL/s|%%PREFIX%%/share/xsim/dat|${HOME}/.xsim|g" \
+		%%PREFIX%%/etc/xsimrc > ${HOME}/.xsim/xsimrc
+fi
+
+# Start xsim
+exec %%PREFIX%%/share/xsim/bin/xsim $*
diff -ruN xsim.old/pkg-message xsim/pkg-message
--- xsim.old/pkg-message	Sun Jul 18 14:38:25 2004
+++ xsim/pkg-message	Sun Jul 18 15:34:00 2004
@@ -12,5 +12,5 @@
 Remember to set environment varible XMODIFIERS:
  csh/tcsh: setenv XMODIFIERS @im=XSIM
  sh/bash:  export XMODIFIERS='@im=XSIM'
-and set LANG, LC_CTYPE to zh_CN.EUC.
+and set LANG, LC_CTYPE to zh_CN.eucCN.
 -------------------------------------------------------------------------------
--- patch-xsim ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->vanilla 
Responsible-Changed-By: vanilla 
Responsible-Changed-When: Thu Jul 22 03:00:05 GMT 2004 
Responsible-Changed-Why:  
I will handle this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69251 
State-Changed-From-To: open->closed 
State-Changed-By: vanilla 
State-Changed-When: Sun Aug 1 17:49:37 GMT 2004 
State-Changed-Why:  
Committed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69251 
>Unformatted:
