LinuxSir.Org  
| 网站首页 | 论坛帮助 |

欢迎来到LinuxSir.Org!
您还未登录,请登录后查看论坛,或者点击论坛上方的注册链接注册新账号。


发表新主题 回复
精华主题  
主题工具
旧 05-10-23, 14:55 第 1 帖
echofrompat
 
echofrompat 的头像
 
 
注册会员  
  注册日期: Feb 2004
  帖子: 790
  精华: 2
 

标题: 给zhcon打了个patch,附上PKGBUILD


说在前面
zhcon不支持我的utf8编码,所以一直没有用。最近看到很多兄弟提到zhcon,还有一个用gentoo的网友也问我zhcon的编译问题。今天正好有时间,我把zhcon的代码看一看,做了点小改动,让03年的代码在我的系统里编译通过了。

我的系统
引用:
[pig@aepig zhcon]$ gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.2/configure --prefix=/usr --enable-shared --enable-languages=c,c++,objc --enable-threads=posix --enable-__cxa_atexit
Thread model: posix
gcc version 4.0.2
引用:
[pig@aepig zhcon]$ uname -a
Linux aepig 2.6.13-ARCH #1 SMP Fri Sep 30 13:08:16 CEST 2005 i686 Mobile Intel(R) Pentium(R) 4 - M CPU 2.20GHz GenuineIntel GNU/Linux
制作zhcon的arch包
把下面的内容保存在一个名为archlinuxpkg.patch的文件里:
代码:
Only in zhcon-0.2.3-patched: archlinuxpkg.patch diff -aur zhcon-0.2.3/doc/Makefile.in zhcon-0.2.3-patched/doc/Makefile.in --- zhcon-0.2.3/doc/Makefile.in 2003-04-17 19:29:47.000000000 +0800 +++ zhcon-0.2.3-patched/doc/Makefile.in 2005-10-23 01:49:00.000000000 +0800 @@ -226,11 +226,11 @@ install-data-local: - $(mkinstalldirs) $(mandir)/man1/ - $(INSTALL_DATA) $(srcdir)/zhcon.1 $(mandir)/man1/zhcon.1 + $(mkinstalldirs) $(DESTDIR)/$(mandir)/man1/ + $(INSTALL_DATA) $(srcdir)/zhcon.1 $(DESTDIR)/$(mandir)/man1/zhcon.1 uninstall-local: - -rm -f $(mandir)/man1/zhcon.1 + -rm -f $(DESTDIR)/$(mandir)/man1/zhcon.1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -aur zhcon-0.2.3/font/Makefile.am zhcon-0.2.3-patched/font/Makefile.am --- zhcon-0.2.3/font/Makefile.am 2002-05-12 11:58:59.000000000 +0800 +++ zhcon-0.2.3-patched/font/Makefile.am 2005-10-23 01:47:07.000000000 +0800 @@ -1,8 +1,8 @@ EXTRA_DIST = *.bpsf install-data-local: - $(mkinstalldirs) $(libdir)/zhcon/font/ - $(INSTALL_DATA) $(srcdir)/*.bpsf $(libdir)/zhcon/font/ + $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/font/ + $(INSTALL_DATA) $(srcdir)/*.bpsf $(DESTDIR)/$(libdir)/zhcon/font/ uninstall-local: - -rm -f $(libdir)/zhcon/font/*.bpsf + -rm -f $(DESTDIR)/$(libdir)/zhcon/font/*.bpsf diff -aur zhcon-0.2.3/font/Makefile.in zhcon-0.2.3-patched/font/Makefile.in --- zhcon-0.2.3/font/Makefile.in 2003-04-17 19:29:47.000000000 +0800 +++ zhcon-0.2.3-patched/font/Makefile.in 2005-10-23 01:53:55.000000000 +0800 @@ -222,11 +222,11 @@ install-data-local: - $(mkinstalldirs) $(libdir)/zhcon/font/ - $(INSTALL_DATA) $(srcdir)/*.bpsf $(libdir)/zhcon/font/ + $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/font/ + $(INSTALL_DATA) $(srcdir)/*.bpsf $(DESTDIR)/$(libdir)/zhcon/font/ uninstall-local: - -rm -f $(libdir)/zhcon/font/*.bpsf + -rm -f $(DESTDIR)/$(libdir)/zhcon/font/*.bpsf # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -aur zhcon-0.2.3/input/Makefile.am zhcon-0.2.3-patched/input/Makefile.am --- zhcon-0.2.3/input/Makefile.am 2002-05-12 11:58:31.000000000 +0800 +++ zhcon-0.2.3-patched/input/Makefile.am 2005-10-23 01:47:46.000000000 +0800 @@ -1,8 +1,8 @@ EXTRA_DIST = *.mb install-data-local: - $(mkinstalldirs) $(libdir)/zhcon/input/ - $(INSTALL_DATA) $(srcdir)/*.mb $(libdir)/zhcon/input/ + $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/input/ + $(INSTALL_DATA) $(srcdir)/*.mb $(DESTDIR)/$(libdir)/zhcon/input/ uninstall-local: - -rm -f $(libdir)/zhcon/input/*.mb + -rm -f $(DESTDIR)/$(libdir)/zhcon/input/*.mb diff -aur zhcon-0.2.3/input/Makefile.in zhcon-0.2.3-patched/input/Makefile.in --- zhcon-0.2.3/input/Makefile.in 2003-04-17 19:29:47.000000000 +0800 +++ zhcon-0.2.3-patched/input/Makefile.in 2005-10-23 01:48:11.000000000 +0800 @@ -222,11 +222,11 @@ install-data-local: - $(mkinstalldirs) $(libdir)/zhcon/input/ - $(INSTALL_DATA) $(srcdir)/*.mb $(libdir)/zhcon/input/ + $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/input/ + $(INSTALL_DATA) $(srcdir)/*.mb $(DESTDIR)/$(libdir)/zhcon/input/ uninstall-local: - -rm -f $(libdir)/zhcon/input/*.mb + -rm -f $(DESTDIR)/$(libdir)/zhcon/input/*.mb # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff -aur zhcon-0.2.3/src/display/fblinear24.cpp zhcon-0.2.3-patched/src/display/fblinear24.cpp --- zhcon-0.2.3/src/display/fblinear24.cpp 2002-05-12 11:58:28.000000000 +0800 +++ zhcon-0.2.3-patched/src/display/fblinear24.cpp 2005-10-23 04:33:20.000000000 +0800 @@ -203,11 +203,13 @@ d1 = (-(*cdat >> 3 & 1) & eorx) ^ bgx; d2 = (-(*cdat >> 2 & 1) & eorx) ^ bgx; fb_writel(d1 | (d2<<24), dest32++); - fb_writew(d2>>8, ((__u16*)dest32)++); + fb_writew(d2>>8, (__u16*)dest32); + dest32++; } if (pFont->w & 1) { d3 = (-(*cdat >> 1 & 1) & eorx) ^ bgx; - fb_writew(d3, ((__u16*)dest32)++); + fb_writew(d3, (__u16*)dest32); + dest32++; fb_writeb(d3>>16, (__u8*)dest32); } cdat++; diff -aur zhcon-0.2.3/src/display/fblinear8.cpp zhcon-0.2.3-patched/src/display/fblinear8.cpp --- zhcon-0.2.3/src/display/fblinear8.cpp 2002-05-12 11:58:28.000000000 +0800 +++ zhcon-0.2.3-patched/src/display/fblinear8.cpp 2005-10-23 04:44:31.000000000 +0800 @@ -102,7 +102,8 @@ fb_writel((nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx, dest32++); } if (pFont->w & 2) { - fb_writew((nibbletab_cfb8[*cdat & 0xc] & eorx) ^ bgx, ((__u16*)dest32)++); + fb_writew((nibbletab_cfb8[*cdat & 0xc] & eorx) ^ bgx, (__u16*)dest32); + dest32++; } if (pFont->w & 1) { fb_writeb((*cdat & 2) ? fg : bg, (__u8*)dest32); diff -aur zhcon-0.2.3/src/Makefile.am zhcon-0.2.3-patched/src/Makefile.am --- zhcon-0.2.3/src/Makefile.am 2003-04-17 19:27:28.000000000 +0800 +++ zhcon-0.2.3-patched/src/Makefile.am 2005-10-23 01:23:00.000000000 +0800 @@ -8,7 +8,7 @@ SUBDIRS = display install-exec-local: - chmod 4755 $(bindir)/zhcon + chmod 4755 $(DESTDIR)/usr/bin/zhcon install-data-local: $(mkinstalldirs) $(DESTDIR)/etc diff -aur zhcon-0.2.3/src/Makefile.in zhcon-0.2.3-patched/src/Makefile.in --- zhcon-0.2.3/src/Makefile.in 2003-04-17 19:29:48.000000000 +0800 +++ zhcon-0.2.3-patched/src/Makefile.in 2005-10-23 01:23:16.000000000 +0800 @@ -474,7 +474,8 @@ install-exec-local: - chmod 4755 $(bindir)/zhcon + chmod 4755 $(DESTDIR)/usr/bin/zhcon + #chmod 4755 $(bindir)/zhcon install-data-local: $(mkinstalldirs) $(DESTDIR)/etc
把下面的内容保存为PKGBUILD文件:
代码:
# Contributor: Lin, Zihui <zihui.lin@gmail.com> pkgname=zhcon pkgver=0.2.3 pkgrel=0 pkgdesc="a fast console CJK environment" url="http://sourceforge.net/projects/zhcond" license="GPL" depends=('gpm' 'pth' 'gcc') makedepends=('glibc' 'gpm' 'pth' 'gcc') install= source=(http://surfnet.dl.sourceforge.net/so...n-0.2.3.tar.gz archlinuxpkg.patch) build() { patch -p0 -i ../archlinuxpkg.patch cd $startdir/src/$pkgname-$pkgver ./configure --prefix=/usr make || return 1 make DESTDIR=$startdir/pkg install }
然后把这两个文件放到一个目录里,目录名随便起一个就行(比如zhcon)。
然后用root在这个目录里执行makepkg命令:

#makepkg
最后,用pacman安装:
#pacman -A zhcon-0.2.3-0.pkg.tar.gz
卸载时也是用pacman:
#pacman -R zhcon

祝大家开心! :)

此帖于 05-10-24 13:55 被 echofrompat 编辑.
  echofrompat 当前离线   回复时引用此帖
旧 05-10-23, 15:37 第 2 帖
zerolin 帅哥
 
zerolin 的头像
 
 
注册会员  
  注册日期: Aug 2003
  帖子: 1,137
  精华: 9
 

Great! 很好!







__________________
To believe yourself to be brave is to be brave; it is the only essential thing

-Mark Twain
  zerolin 当前离线   回复时引用此帖
旧 05-10-23, 16:04 第 3 帖
sunmoon1997
 
sunmoon1997 的头像
 
 
★☆版主★☆  
  注册日期: Mar 2004
  帖子: 1,744
  精华: 9
 

NOTE:
((__u16*)dest32)++) != ((__u16*)dest32)+1)

fb_writew((nibbletab_cfb8[*cdat & 0xc] & eorx) ^ bgx, ((__u16*)dest32)++);
==>
fb_writew((nibbletab_cfb8[*cdat & 0xc] & eorx) ^ bgx, ((__u16*)dest32));
dest32 = ((__u16*)dest32) + 1;







__________________
sunmoon1997@localhost ~ $ emerge --info
Portage 2.1_rc1-r2 (default-linux/amd64/2006.0, gcc-4.0.3, glibc-2.4-r2, 2.6.16-gentoo-r6 x86_64)
=================================================================
System uname: 2.6.16-gentoo-r6 x86_64 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.12.0_pre19

Can you understand linux?
Can you foresee the future of linux?

此帖于 05-10-23 16:13 被 sunmoon1997 编辑.
  sunmoon1997 当前离线   回复时引用此帖
旧 05-10-23, 16:58 第 4 帖
echofrompat
 
echofrompat 的头像
 
 
注册会员  
  注册日期: Feb 2004
  帖子: 790
  精华: 2
 

我错了。 :$ 谢谢日月大哥指正
patch在一楼那里已经改过来了,dest32是取值后再自身加1。之前那个patch我试运行过,似乎没什么问题,再修改后,现在的程序逻辑应该一致了。
  echofrompat 当前离线   回复时引用此帖
旧 05-10-24, 10:30 第 5 帖
南蛮.net
 
 
 
注册会员  
  注册日期: Jun 2005
  帖子: 17
  精华: 0
 

为什么我运行makepkg就报告如下错误呢?
: command not found:
'/PKGBUILD: line 13: syntax error near unexpected token `{
'/PKGBUILD: line 13: `build() {
) does not exist.l scriptlet (
  南蛮.net 当前离线   回复时引用此帖
旧 05-10-24, 13:44 第 6 帖
echofrompat
 
echofrompat 的头像
 
 
注册会员  
  注册日期: Feb 2004
  帖子: 790
  精华: 2
 

我把PKGBUILD用"CODE"的格式再粘贴了一遍,又试着取消代码里的“自动分析超链接”选项,但是没见作用,PKGBUILD显示得不好。
这样好了,我把patch和PKGBUILD这两个文件打了个包,发在附件里了,南蛮,能再试试吗?谢谢~
上传的附件
文件类型: gz zhcon_pkg.tar.gz (1.5 KB, 288 次查看)

此帖于 05-10-24 13:55 被 echofrompat 编辑.
  echofrompat 当前离线   回复时引用此帖
旧 05-10-24, 18:21 第 7 帖
南蛮.net
 
 
 
注册会员  
  注册日期: Jun 2005
  帖子: 17
  精华: 0
 

成功了,爽死了,多谢了。
  南蛮.net 当前离线   回复时引用此帖
旧 05-10-24, 19:03 第 8 帖
hyacinth
 
hyacinth 的头像
 
 
注册会员  
  注册日期: May 2003
  帖子: 39
  精华: 0
 

等了很久了,终于有人做这个大贡献了,真是万分感谢,马上回去试试。
  hyacinth 当前离线   回复时引用此帖
旧 05-10-24, 22:56 第 9 帖
hyacinth
 
hyacinth 的头像
 
 
注册会员  
  注册日期: May 2003
  帖子: 39
  精华: 0
 

Making all in src
make[2]: Entering directory `/home/zhcon/zhcon_pkg/src/zhcon-0.2.3/src'
Making all in display
make[3]: Entering directory `/home/zhcon/zhcon_pkg/src/zhcon-0.2.3/src/display'
source='fbdev.cpp' object='fbdev.o' libtool=no \
depfile='.deps/fbdev.Po' tmpdepfile='.deps/fbdev.TPo' \
depmode=gcc3 /bin/sh ../../depcomp \
g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../src -march=i686 -O2 -pipe -funsigned-char -march=i686 -DNDEBUG -Wall -c -o fbdev.o `test -f fbdev.cpp || echo './'`fbdev.cpp
/usr/local/include/pthread.h:285: error: conflicting declaration 'typedef struct pthread_st* pthread_t'
/usr/include/bits/pthreadtypes.h:150: error: 'pthread_t' has a previous declaration as 'typedef long unsigned int pthread_t'
/usr/local/include/pthread.h:286: error: conflicting declaration 'typedef struct pthread_attr_st* pthread_attr_t'
/usr/include/bits/pthreadtypes.h:52: error: 'pthread_attr_t' has a previous declaration as 'typedef struct __pthread_attr_s pthread_attr_t'
/usr/local/include/pthread.h:287: error: conflicting declaration 'typedef int pthread_key_t'
/usr/include/bits/pthreadtypes.h:80: error: 'pthread_key_t' has a previous declaration as 'typedef unsigned int pthread_key_t'
/usr/local/include/pthread.h:289: error: conflicting declaration 'typedef int pthread_mutexattr_t'
/usr/include/bits/pthreadtypes.h:100: error: 'pthread_mutexattr_t' has a previous declaration as 'typedef struct pthread_mutexattr_t pthread_mutexattr_t'
/usr/local/include/pthread.h:290: error: conflicting declaration 'typedef struct pthread_mutex_st* pthread_mutex_t'
/usr/include/bits/pthreadtypes.h:93: error: 'pthread_mutex_t' has a previous declaration as 'typedef struct pthread_mutex_t pthread_mutex_t'
/usr/local/include/pthread.h:291: error: conflicting declaration 'typedef int pthread_condattr_t'
/usr/include/bits/pthreadtypes.h:77: error: 'pthread_condattr_t' has a previous declaration as 'typedef struct pthread_condattr_t pthread_condattr_t'
/usr/local/include/pthread.h:292: error: conflicting declaration 'typedef struct pthread_cond_st* pthread_cond_t'
/usr/include/bits/pthreadtypes.h:70: error: 'pthread_cond_t' has a previous declaration as 'typedef struct pthread_cond_t pthread_cond_t'
/usr/local/include/pthread.h:293: error: conflicting declaration 'typedef int pthread_rwlockattr_t'
/usr/include/bits/pthreadtypes.h:126: error: 'pthread_rwlockattr_t' has a previous declaration as 'typedef struct pthread_rwlockattr_t pthread_rwlockattr_t'
/usr/local/include/pthread.h:294: error: conflicting declaration 'typedef struct pthread_rwlock_st* pthread_rwlock_t'
/usr/include/bits/pthreadtypes.h:118: error: 'pthread_rwlock_t' has a previous declaration as 'typedef struct _pthread_rwlock_t pthread_rwlock_t'
make[3]: *** [fbdev.o] Error 1
make[3]: Leaving directory `/home/zhcon/zhcon_pkg/src/zhcon-0.2.3/src/display'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/zhcon/zhcon_pkg/src/zhcon-0.2.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/zhcon/zhcon_pkg/src/zhcon-0.2.3'
make: *** [all] Error 2
==> ERROR: Build Failed. Aborting...

What's the meaning of the information? How can I do?
  hyacinth 当前离线   回复时引用此帖
旧 05-10-25, 08:56 第 10 帖
南蛮.net
 
 
 
注册会员  
  注册日期: Jun 2005
  帖子: 17
  精华: 0
 

你是用root用户编译的吗?
  南蛮.net 当前离线   回复时引用此帖
旧 05-10-26, 10:04 第 11 帖
echofrompat
 
echofrompat 的头像
 
 
注册会员  
  注册日期: Feb 2004
  帖子: 790
  精华: 2
 

hyacinth,
我的系统里没有/usr/local/include/pthread.h这个头文件。不知道你那边是不是手动安装了新的pthread库?Archlinux里,/usr/local/include应该放的是应用程序的头文件啊。或者您先用root执行ldconfig,然后再试着编译一次?谢谢先~
P.S. 你的gcc是4.0的吗?

此帖于 05-10-26 10:07 被 echofrompat 编辑.
  echofrompat 当前离线   回复时引用此帖
旧 05-10-28, 20:20 第 12 帖
hyacinth
 
hyacinth 的头像
 
 
注册会员  
  注册日期: May 2003
  帖子: 39
  精华: 0
 

我的gcc不是4.0的,一定要4.0的啊?那我升到4.0试试。
  hyacinth 当前离线   回复时引用此帖
旧 05-10-29, 18:45 第 13 帖
echofrompat
 
echofrompat 的头像
 
 
注册会员  
  注册日期: Feb 2004
  帖子: 790
  精华: 2
 

gcc 不一定是要4.0的。只是gcc从3.4开始就加强了对语法的检查,所以在编译以前老的代码时可能会报错。
我想你的问题在于链接上。似乎你的pthread库有问题。
其他兄弟都可以编译通过吗?
  echofrompat 当前离线   回复时引用此帖
旧 06-01-06, 08:32 第 14 帖
sxjccxq
 
 
 
注册会员  
  注册日期: Oct 2005
  帖子: 31
  精华: 0
 

用上了,真好!谢谢!
  sxjccxq 当前离线   回复时引用此帖
旧 06-01-06, 12:39 第 15 帖
philix
 
philix 的头像
 
 
注册会员  
  注册日期: Mar 2005
  我的住址: 湖北宜昌
  帖子: 320
  精华: 0
 

你的补丁是起什么作用的?
是否现在可以支持utf-8了?
现在有没有支持utf-8且有中文输入法且不用给内核找补丁的终端??







__________________
^
^
^
财路: www.cailu.org

--------------------------------------------------
  philix 当前离线   回复时引用此帖
发表新主题 回复


主题工具

发帖规则
您 [不可以] 发表新主题
您 [不可以] 回复主题
您 [不可以] 上传附件
您 [不可以] 编辑您的帖子

已 [启用] BB 代码
已 [启用] 表情符号
已 [启用] IMG 代码
已 [禁用] HTML 代码
[论坛跳转…]


所有时间均为[北京时间]。现在的时间是 09:11


Powered by vBulletin 版本 3.6.8
版权所有 ©2000 - 2012, Jelsoft Enterprises Ltd.
官方中文技术支持: vBulletin 中文
版权所有 ©2002 - 2011, LinuxSir.Org