ports/51185: New port: chinese/stardict2
Statue
statue at freebsd.sinica.edu.tw
Fri May 9 10:50:22 UTC 2003
The following reply was made to PR ports/51185; it has been noted by GNATS.
From: statue at freebsd.sinica.edu.tw (Statue)
To: freebsd-gnats-submit at FreeBSD.org
Cc:
Subject: Re: ports/51185: New port: chinese/stardict2
Date: Fri, 9 May 2003 18:45:15 +0800 (CST)
# 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:
#
# stardict2/
# stardict2/Makefile
# stardict2/distinfo
# stardict2/files
# stardict2/pkg-descr
# stardict2/pkg-plist
# stardict2/files/patch-src::tools::olddic2newdic.c
# stardict2/files/patch-src::tools::oxford2dic.c
# stardict2/files/patch-src::tools::pydict2dic.c
#
echo c - stardict2/
mkdir -p stardict2/ > /dev/null 2>&1
echo x - stardict2/Makefile
sed 's/^X//' >stardict2/Makefile << 'END-of-stardict2/Makefile'
X# Ports collection makefile for: stardict2
X# Date created: 13 April 2003
X# Whom: Shen Chuan-Hsing <statue at freebsd.sinica.edu.tw>
X#
X# $FreeBSD$
X#
X
XPORTNAME= stardict2
XPORTVERSION= 2.0.0
XCATEGORIES= chinese
XMASTER_SITES= http://reciteword.cosoft.org.cn/yaoguang/myapps/ \
X ftp://freebsd.sinica.edu.tw/pub/statue/stardict2/
XDISTFILES= stardict-${PORTVERSION}.tar.gz \
X stardict-cdict-big5-${PORTVERSION}.tar.bz2 \
X stardict-cedict-big5-${PORTVERSION}.tar.bz2 \
X stardict-xdict-big5-${PORTVERSION}.tar.bz2 \
X stardict-xdict-ce-big5-${PORTVERSION}.tar.bz2
X
XMAINTAINER= statue at freebsd.sinica.edu.tw
XCOMMENT= English-Chinese dictionary
X
XLIB_DEPENDS= gnome-2.200:${PORTSDIR}/x11/libgnome \
X gnomeui-2.200:${PORTSDIR}/x11-toolkits/libgnomeui \
X bonobo-2.0:${PORTSDIR}/devel/libbonobo \
X bonobo-activation.4:${PORTSDIR}/devel/bonobo-activation
X
XGNU_CONFIGURE= yes
XUSE_GMAKE= yes
XUSE_X_PREFIX= yes
XUSE_BZIP2= yes
XWRKSRC= ${WRKDIR}/stardict-${PORTVERSION}
X
XMAN1= stardict.1
X
Xdo-extract:
X ${MKDIR} ${WRKDIR}
X cd ${WRKDIR} && tar zxf ${DISTDIR}/stardict-2.0.0.tar.gz && \
X tar jxf ${DISTDIR}/stardict-cdict-big5-2.0.0.tar.bz2 && \
X tar jxf ${DISTDIR}/stardict-cedict-big5-2.0.0.tar.bz2 && \
X tar jxf ${DISTDIR}/stardict-xdict-big5-2.0.0.tar.bz2 && \
X tar jxf ${DISTDIR}/stardict-xdict-ce-big5-2.0.0.tar.bz2
X
Xpost-install:
X ${MKDIR} ${PREFIX}/share/stardict/dic/
X ${INSTALL_DATA} ${WRKDIR}/stardict-cdict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/
X ${INSTALL_DATA} ${WRKDIR}/stardict-cedict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/
X ${INSTALL_DATA} ${WRKDIR}/stardict-xdict-big5-2.0.0/* ${PREFIX}/share/stardict/dic/
X ${INSTALL_DATA} ${WRKDIR}/stardict-xdict-ce-big5-2.0.0/* ${PREFIX}/share/stardict/dic/
X
X.include <bsd.port.mk>
END-of-stardict2/Makefile
echo x - stardict2/distinfo
sed 's/^X//' >stardict2/distinfo << 'END-of-stardict2/distinfo'
XMD5 (stardict-2.0.0.tar.gz) = 6ba52d96f1692a129f29601ac339ab49
XMD5 (stardict-cdict-big5-2.0.0.tar.bz2) = e66240efde994c0dc3bfd630cf9c53e5
XMD5 (stardict-cedict-big5-2.0.0.tar.bz2) = 372ae3391610634163443114382319b4
XMD5 (stardict-xdict-big5-2.0.0.tar.bz2) = 5bb8289d8381ea89d23eca60c7996519
XMD5 (stardict-xdict-ce-big5-2.0.0.tar.bz2) = 0d26411ac196cd240b266c95ede71bc2
END-of-stardict2/distinfo
echo c - stardict2/files
mkdir -p stardict2/files > /dev/null 2>&1
echo x - stardict2/pkg-descr
sed 's/^X//' >stardict2/pkg-descr << 'END-of-stardict2/pkg-descr'
XStarDict is a international dictionary that run in Gnome envornment.
XIt have powerful features such as "Glob-style pattern matching",
X"Scan seletion word","Fuzzy search" and etc.
X
XWWW: http://stardict.cosoft.org.cn/
END-of-stardict2/pkg-descr
echo x - stardict2/pkg-plist
sed 's/^X//' >stardict2/pkg-plist << 'END-of-stardict2/pkg-plist'
Xbin/stardict
Xshare/pixmaps/stardict.png
Xshare/stardict/dic/cdict-big5.dict
Xshare/stardict/dic/cdict-big5.idx.gz
Xshare/stardict/dic/cedict-big5.dict
Xshare/stardict/dic/cedict-big5.idx.gz
Xshare/stardict/dic/xdict-big5.dict
Xshare/stardict/dic/xdict-big5.idx.gz
Xshare/stardict/dic/xdict-ce-big5.dict
Xshare/stardict/dic/xdict-ce-big5.idx.gz
Xshare/stardict/skins/default/about_menu.png
Xshare/stardict/skins/default/docklet_normal.png
Xshare/stardict/skins/default/docklet_scan.png
Xshare/stardict/skins/default/docklet_stop.png
Xshare/stardict/skins/default/phonetic.png
Xshare/stardict/skins/default/skin.inf
Xshare/gnome/help/stardict/C/legal.xml
Xshare/gnome/help/stardict/C/stardict.xml
Xshare/gnome/help/stardict/C/figures/stardict_float_window.png
Xshare/gnome/help/stardict/C/figures/stardict_main_window.png
Xshare/gnome/help/stardict/C/figures/stardict_notification_area.png
Xshare/gnome/help/stardict/zh_CN/legal.xml
Xshare/gnome/help/stardict/zh_CN/stardict.xml
Xshare/gnome/help/stardict/zh_CN/figures/stardict_float_window.png
Xshare/gnome/help/stardict/zh_CN/figures/stardict_main_window.png
Xshare/gnome/help/stardict/zh_CN/figures/stardict_notification_area.png
Xshare/omf/stardict/stardict-C.omf
Xshare/omf/stardict/stardict-zh_CN.omf
Xshare/applications/stardict.desktop
Xetc/gconf/schemas/stardict.schemas
Xlib/bonobo/servers/GNOME_Stardict.server
Xetc/gconf/gconf.xml.defaults/apps/stardict/%gconf.xml
Xetc/gconf/gconf.xml.defaults/apps/stardict/float_window/%gconf.xml
Xetc/gconf/gconf.xml.defaults/schemas/apps/stardict/%gconf.xml
Xetc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window/%gconf.xml
X at dirrm share/gnome/help/stardict/zh_CN/figures
X at dirrm share/gnome/help/stardict/zh_CN
X at dirrm share/gnome/help/stardict/C/figures
X at dirrm share/gnome/help/stardict/C
X at dirrm share/gnome/help/stardict
X at dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict/float_window
X at dirrm etc/gconf/gconf.xml.defaults/schemas/apps/stardict
X at dirrm etc/gconf/gconf.xml.defaults/apps/stardict/float_window
X at dirrm etc/gconf/gconf.xml.defaults/apps/stardict
X at dirrm share/omf/stardict
X at dirrm share/stardict/dic
X at dirrm share/stardict/skins/default
X at dirrm share/stardict/skins
X at dirrm share/stardict
END-of-stardict2/pkg-plist
echo x - stardict2/files/patch-src::tools::olddic2newdic.c
sed 's/^X//' >stardict2/files/patch-src::tools::olddic2newdic.c << 'END-of-stardict2/files/patch-src::tools::olddic2newdic.c'
X--- src/tools/olddic2newdic.c.orig Sat May 3 18:48:30 2003
X+++ src/tools/olddic2newdic.c Mon May 5 04:05:05 2003
X@@ -52,28 +52,54 @@
X void convert(char *filename,char *idxheadfilename)
X {
X struct stat stats;
X+ FILE *idxheadfile;
X+ gchar *buffer;
X+ FILE *idxfile,*dicfile;
X+ gchar str[256],basename[256];
X+ long wordcount_offset;
X+ glong tmpglong=0;
X+ gboolean sametypesequence = FALSE;
X+ int fd;
X+ struct stat stStat;
X+ int iFileSize;
X+ unsigned int iCapacity,iStyle;
X+ unsigned char cIndex, cWord, cMeaning, cMark;
X+ caddr_t pFileMem;
X+ caddr_t p=pFileMem;
X+ caddr_t pMeaning, pMark;
X+ gchar *utf8_str;
X+ gsize write_size;
X+ long tmp_long,wordcount=0;
X+ int word_len, meaning_len,mark_len=0;
X+ int iLength=0;
X+ GArray *array;
X+ struct _worditem worditem;
X+ glong old_size;
X+ long offset_old=0;
X+ int i;
X+ gchar *previous_word = g_strdup(""); //there should have no word equal this.
X+ glong previous_datasize = 0;
X+ gchar *previous_data = g_strdup("");
X+ struct _worditem *pworditem;
X+
X+
X if (stat (idxheadfilename, &stats) == -1)
X {
X printf("idxhead file not exist!\n");
X return;
X }
X
X- FILE *idxheadfile;
X idxheadfile = fopen(idxheadfilename,"r");
X- gchar *buffer;
X buffer = (gchar *)g_malloc (stats.st_size + 1);
X fread (buffer, 1, stats.st_size, idxheadfile);
X fclose (idxheadfile);
X buffer[stats.st_size] = '\0';
X- gboolean sametypesequence = FALSE;
X if (strstr(buffer,"sametypesequence="))
X sametypesequence = TRUE;
X
X //in the next code we will always treat sametypesequence to be TRUE.
X //as now all old stardict dictionaries use these two feature.
X
X- FILE *idxfile,*dicfile;
X- gchar str[256],basename[256];
X
X strcpy(basename,idxheadfilename);
X basename[strlen(idxheadfilename)-8]='\0';
X@@ -86,11 +112,10 @@
X fwrite(buffer, 1, stats.st_size, idxfile);
X g_free(buffer);
X
X- long wordcount_offset = ftell(idxfile);
X- glong tmpglong=0;
X+ wordcount_offset = ftell(idxfile);
X fwrite(&(tmpglong),sizeof(glong),1,idxfile);
X
X- int fd=open(filename,O_RDONLY);
X+ fd=open(filename,O_RDONLY);
X if(fd==-1)
X {
X g_print("open fail\n");
X@@ -98,17 +123,15 @@
X }
X
X // get length of dicfile.
X- struct stat stStat;
X if(fstat(fd,&stStat)!=0)
X {
X g_print("stat fail\n");
X return;
X }
X- int iFileSize=stStat.st_size;
X+ iFileSize=stStat.st_size;
X
X // get item count
X lseek(fd,0-sizeof(int)*2,SEEK_END);
X- unsigned int iCapacity,iStyle;
X read(fd,&iCapacity,sizeof(int));
X read(fd,&iStyle,sizeof(int));
X //disable the next two line when the convert file is from the same arch machine.
X@@ -117,14 +140,14 @@
X vConvertEndian(&iStyle);
X #endif
X
X- unsigned char cIndex=(unsigned char)(iStyle>>24);
X- unsigned char cWord=(unsigned char)(iStyle>>16);
X- unsigned char cMeaning=(unsigned char)(iStyle>>8);
X- unsigned char cMark=(unsigned char)iStyle;
X+ cIndex=(unsigned char)(iStyle>>24);
X+ cWord=(unsigned char)(iStyle>>16);
X+ cMeaning=(unsigned char)(iStyle>>8);
X+ cMark=(unsigned char)iStyle;
X g_print("flag: %c %c %c\n",cIndex,cWord,cMeaning);
X
X // mmap the file to memory
X- caddr_t pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2,
X+ pFileMem=(caddr_t)mmap( (caddr_t)0,iFileSize-sizeof(int)*2,
X PROT_READ,MAP_SHARED|MAP_NORESERVE,fd,0 );
X if(pFileMem==MAP_FAILED)
X {
X@@ -133,9 +156,7 @@
X }
X
X // begin to read items.
X- caddr_t p=pFileMem;
X- caddr_t pMeaning, pMark;
X- gchar *utf8_str;
X+ p=pFileMem;
X #ifndef DISABLE_CONVERT_LOCALE
X gchar *locale_str;
X gsize locale_write_size;
X@@ -157,14 +178,7 @@
X return;*/
X
X #endif
X- gsize write_size;
X- long tmp_long,wordcount=0;
X- int word_len, meaning_len,mark_len=0;
X- int iLength=0;
X-
X- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity);
X- struct _worditem worditem;
X- glong old_size;
X+ array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),iCapacity);
X
X while(p<pFileMem+iFileSize-sizeof(int)*2 && iLength<iCapacity)
X {
X@@ -303,14 +317,6 @@
X //g_qsort_with_data(parray->pdata,parray->len,sizeof(gpointer),comparefunc,NULL);
X g_array_sort(array,comparefunc);
X
X- long offset_old=0;
X-
X- int i;
X-
X- gchar *previous_word = g_strdup(""); //there should have no word equal this.
X- glong previous_datasize = 0;
X- gchar *previous_data = g_strdup("");
X- struct _worditem *pworditem;
X for (i=0;i<array->len;i++)
X {
X pworditem = &g_array_index(array, struct _worditem, i);
END-of-stardict2/files/patch-src::tools::olddic2newdic.c
echo x - stardict2/files/patch-src::tools::oxford2dic.c
sed 's/^X//' >stardict2/files/patch-src::tools::oxford2dic.c << 'END-of-stardict2/files/patch-src::tools::oxford2dic.c'
X--- src/tools/oxford2dic.c.orig Mon May 5 04:05:50 2003
X+++ src/tools/oxford2dic.c Mon May 5 04:08:14 2003
X@@ -24,6 +24,19 @@
X {
X struct stat stats;
X FILE *oxfile,*idxfile,*dicfile;
X+ gchar *buffer;
X+ gchar *p1,*p2;
X+ glong line_num = 0;
X+ gchar *utf_str;
X+ gsize write_size;
X+ struct _worditem worditem;
X+ GArray *array;
X+ glong tmpglong=0;
X+ long offset_old;
X+ glong wordcount;
X+ glong i;
X+ gchar *previous_word = "";
X+ struct _worditem *pworditem;
X
X if (stat (filename, &stats) == -1)
X {
X@@ -32,21 +45,15 @@
X }
X oxfile = fopen(filename,"r");
X
X- gchar *buffer;
X buffer = (gchar *)g_malloc (stats.st_size + 2);
X fread (buffer, 1, stats.st_size, oxfile);
X fclose (oxfile);
X buffer[stats.st_size] = '\n';
X buffer[stats.st_size+1] = '\0';
X
X- GArray *array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),39000); //oxford.txt have 77304 lines.
X- struct _worditem worditem;
X+ array = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),39000); //oxford.txt have 77304 lines.
X
X- gchar *p1,*p2;
X- glong line_num = 0;
X p1 = buffer;
X- gchar *utf_str;
X- gsize write_size;
X
X while (1) {
X if (*p1=='\0') {
X@@ -91,17 +98,11 @@
X idxfile = fopen("oxford.idxdata","w");
X dicfile = fopen("oxford.dict","w");
X
X- glong tmpglong=0;
X fwrite(&(tmpglong),sizeof(glong),1,idxfile);
X
X
X
X- long offset_old;
X-
X- glong wordcount = array->len;
X- glong i;
X- gchar *previous_word = "";
X- struct _worditem *pworditem;
X+ wordcount = array->len;
X for (i=0;i<array->len;i++)
X {
X pworditem = &g_array_index(array, struct _worditem, i);
END-of-stardict2/files/patch-src::tools::oxford2dic.c
echo x - stardict2/files/patch-src::tools::pydict2dic.c
sed 's/^X//' >stardict2/files/patch-src::tools::pydict2dic.c << 'END-of-stardict2/files/patch-src::tools::pydict2dic.c'
X--- src/tools/pydict2dic.c.orig Fri Apr 25 18:55:55 2003
X+++ src/tools/pydict2dic.c Mon May 5 04:10:27 2003
X@@ -24,6 +24,20 @@
X {
X struct stat stats;
X FILE *pyfile,*ecidxfile,*ecdicfile,*ceidxfile,*cedicfile;
X+ gchar *buffer;
X+ GArray *ecarray;
X+ struct _worditem ecworditem;
X+ GArray *cearray;
X+ struct _worditem ceworditem;
X+ gchar *p1,*p2,*p3,*p4;
X+ gchar *utf_str;
X+ gsize write_size;
X+ glong word_len;
X+ long offset_old;
X+ glong wordcount;
X+ glong i;
X+ gchar *previous_word = "";
X+ struct _worditem *pworditem;
X
X if (stat (filename, &stats) == -1)
X {
X@@ -32,24 +46,17 @@
X }
X pyfile = fopen(filename,"r");
X
X- gchar *buffer;
X buffer = (gchar *)g_malloc (stats.st_size + 2);
X fread (buffer, 1, stats.st_size, pyfile);
X fclose (pyfile);
X buffer[stats.st_size] = '\n';
X buffer[stats.st_size+1] = '\0';
X
X- GArray *ecarray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); //pydict.lib have 177785 lines.
X- struct _worditem ecworditem;
X- GArray *cearray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785);
X- struct _worditem ceworditem;
X+ ecarray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785); //pydict.lib have 177785 lines.
X+ cearray = g_array_sized_new(FALSE,FALSE, sizeof(struct _worditem),177785);
X
X- gchar *p1,*p2,*p3,*p4;
X p1 = buffer;
X- gchar *utf_str;
X- gsize write_size;
X- glong word_len;
X-
X+
X while (1) {
X if (*p1=='\0') {
X g_print("over\n");
X@@ -142,12 +149,6 @@
X fprintf(ceidxfile,"stardict's idx file\ndictfile=pydict-big5-ce.dict\nbookname=pydict-big5-ce\nbeigin:\n");
X */
X
X- long offset_old;
X-
X- glong wordcount;
X- glong i;
X- gchar *previous_word = "";
X- struct _worditem *pworditem;
X
X wordcount = ecarray->len;
X for (i=0;i<ecarray->len;i++)
END-of-stardict2/files/patch-src::tools::pydict2dic.c
exit
More information about the freebsd-ports-bugs
mailing list