LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 8391|回复: 27

给zhcon打了个patch,附上PKGBUILD

[复制链接]
发表于 2005-10-23 14:55:19 | 显示全部楼层 |阅读模式
说在前面
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的文件里:
  1. Only in zhcon-0.2.3-patched: archlinuxpkg.patch
  2. diff -aur zhcon-0.2.3/doc/Makefile.in zhcon-0.2.3-patched/doc/Makefile.in
  3. --- zhcon-0.2.3/doc/Makefile.in        2003-04-17 19:29:47.000000000 +0800
  4. +++ zhcon-0.2.3-patched/doc/Makefile.in        2005-10-23 01:49:00.000000000 +0800
  5. @@ -226,11 +226,11 @@


  6. install-data-local:
  7. -        $(mkinstalldirs) $(mandir)/man1/
  8. -        $(INSTALL_DATA) $(srcdir)/zhcon.1 $(mandir)/man1/zhcon.1
  9. +        $(mkinstalldirs) $(DESTDIR)/$(mandir)/man1/
  10. +        $(INSTALL_DATA) $(srcdir)/zhcon.1 $(DESTDIR)/$(mandir)/man1/zhcon.1

  11. uninstall-local:
  12. -        -rm -f $(mandir)/man1/zhcon.1
  13. +        -rm -f $(DESTDIR)/$(mandir)/man1/zhcon.1
  14. # Tell versions [3.59,3.63) of GNU make to not export all variables.
  15. # Otherwise a system limit (for SysV at least) may be exceeded.
  16. .NOEXPORT:
  17. diff -aur zhcon-0.2.3/font/Makefile.am zhcon-0.2.3-patched/font/Makefile.am
  18. --- zhcon-0.2.3/font/Makefile.am        2002-05-12 11:58:59.000000000 +0800
  19. +++ zhcon-0.2.3-patched/font/Makefile.am        2005-10-23 01:47:07.000000000 +0800
  20. @@ -1,8 +1,8 @@
  21. EXTRA_DIST = *.bpsf

  22. install-data-local:
  23. -        $(mkinstalldirs) $(libdir)/zhcon/font/
  24. -        $(INSTALL_DATA) $(srcdir)/*.bpsf $(libdir)/zhcon/font/
  25. +        $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/font/
  26. +        $(INSTALL_DATA) $(srcdir)/*.bpsf $(DESTDIR)/$(libdir)/zhcon/font/

  27. uninstall-local:
  28. -        -rm -f $(libdir)/zhcon/font/*.bpsf
  29. +        -rm -f $(DESTDIR)/$(libdir)/zhcon/font/*.bpsf
  30. diff -aur zhcon-0.2.3/font/Makefile.in zhcon-0.2.3-patched/font/Makefile.in
  31. --- zhcon-0.2.3/font/Makefile.in        2003-04-17 19:29:47.000000000 +0800
  32. +++ zhcon-0.2.3-patched/font/Makefile.in        2005-10-23 01:53:55.000000000 +0800
  33. @@ -222,11 +222,11 @@


  34. install-data-local:
  35. -        $(mkinstalldirs) $(libdir)/zhcon/font/
  36. -        $(INSTALL_DATA) $(srcdir)/*.bpsf $(libdir)/zhcon/font/
  37. +        $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/font/
  38. +        $(INSTALL_DATA) $(srcdir)/*.bpsf $(DESTDIR)/$(libdir)/zhcon/font/

  39. uninstall-local:
  40. -        -rm -f $(libdir)/zhcon/font/*.bpsf
  41. +        -rm -f $(DESTDIR)/$(libdir)/zhcon/font/*.bpsf
  42. # Tell versions [3.59,3.63) of GNU make to not export all variables.
  43. # Otherwise a system limit (for SysV at least) may be exceeded.
  44. .NOEXPORT:
  45. diff -aur zhcon-0.2.3/input/Makefile.am zhcon-0.2.3-patched/input/Makefile.am
  46. --- zhcon-0.2.3/input/Makefile.am        2002-05-12 11:58:31.000000000 +0800
  47. +++ zhcon-0.2.3-patched/input/Makefile.am        2005-10-23 01:47:46.000000000 +0800
  48. @@ -1,8 +1,8 @@
  49. EXTRA_DIST = *.mb

  50. install-data-local:
  51. -        $(mkinstalldirs) $(libdir)/zhcon/input/
  52. -        $(INSTALL_DATA) $(srcdir)/*.mb $(libdir)/zhcon/input/
  53. +        $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/input/
  54. +        $(INSTALL_DATA) $(srcdir)/*.mb $(DESTDIR)/$(libdir)/zhcon/input/

  55. uninstall-local:
  56. -        -rm -f $(libdir)/zhcon/input/*.mb
  57. +        -rm -f $(DESTDIR)/$(libdir)/zhcon/input/*.mb
  58. diff -aur zhcon-0.2.3/input/Makefile.in zhcon-0.2.3-patched/input/Makefile.in
  59. --- zhcon-0.2.3/input/Makefile.in        2003-04-17 19:29:47.000000000 +0800
  60. +++ zhcon-0.2.3-patched/input/Makefile.in        2005-10-23 01:48:11.000000000 +0800
  61. @@ -222,11 +222,11 @@


  62. install-data-local:
  63. -        $(mkinstalldirs) $(libdir)/zhcon/input/
  64. -        $(INSTALL_DATA) $(srcdir)/*.mb $(libdir)/zhcon/input/
  65. +        $(mkinstalldirs) $(DESTDIR)/$(libdir)/zhcon/input/
  66. +        $(INSTALL_DATA) $(srcdir)/*.mb $(DESTDIR)/$(libdir)/zhcon/input/

  67. uninstall-local:
  68. -        -rm -f $(libdir)/zhcon/input/*.mb
  69. +        -rm -f $(DESTDIR)/$(libdir)/zhcon/input/*.mb
  70. # Tell versions [3.59,3.63) of GNU make to not export all variables.
  71. # Otherwise a system limit (for SysV at least) may be exceeded.
  72. .NOEXPORT:
  73. diff -aur zhcon-0.2.3/src/display/fblinear24.cpp zhcon-0.2.3-patched/src/display/fblinear24.cpp
  74. --- zhcon-0.2.3/src/display/fblinear24.cpp        2002-05-12 11:58:28.000000000 +0800
  75. +++ zhcon-0.2.3-patched/src/display/fblinear24.cpp        2005-10-23 04:33:20.000000000 +0800
  76. @@ -203,11 +203,13 @@
  77.              d1 = (-(*cdat >> 3 & 1) & eorx) ^ bgx;
  78.              d2 = (-(*cdat >> 2 & 1) & eorx) ^ bgx;
  79.              fb_writel(d1 | (d2<<24), dest32++);
  80. -            fb_writew(d2>>8, ((__u16*)dest32)++);
  81. +            fb_writew(d2>>8, (__u16*)dest32);
  82. +            dest32++;
  83.          }
  84.          if (pFont->w & 1) {
  85.              d3 = (-(*cdat >> 1 & 1) & eorx) ^ bgx;
  86. -            fb_writew(d3, ((__u16*)dest32)++);
  87. +            fb_writew(d3, (__u16*)dest32);
  88. +            dest32++;
  89.              fb_writeb(d3>>16, (__u8*)dest32);
  90.          }
  91.          cdat++;
  92. diff -aur zhcon-0.2.3/src/display/fblinear8.cpp zhcon-0.2.3-patched/src/display/fblinear8.cpp
  93. --- zhcon-0.2.3/src/display/fblinear8.cpp        2002-05-12 11:58:28.000000000 +0800
  94. +++ zhcon-0.2.3-patched/src/display/fblinear8.cpp        2005-10-23 04:44:31.000000000 +0800
  95. @@ -102,7 +102,8 @@
  96.              fb_writel((nibbletab_cfb8[*cdat >> 4] & eorx) ^ bgx, dest32++);
  97.          }
  98.          if (pFont->w & 2) {
  99. -            fb_writew((nibbletab_cfb8[*cdat & 0xc] & eorx) ^ bgx, ((__u16*)dest32)++);
  100. +            fb_writew((nibbletab_cfb8[*cdat & 0xc] & eorx) ^ bgx, (__u16*)dest32);
  101. +            dest32++;
  102.          }
  103.          if (pFont->w & 1) {
  104.              fb_writeb((*cdat & 2) ? fg : bg, (__u8*)dest32);
  105. diff -aur zhcon-0.2.3/src/Makefile.am zhcon-0.2.3-patched/src/Makefile.am
  106. --- zhcon-0.2.3/src/Makefile.am        2003-04-17 19:27:28.000000000 +0800
  107. +++ zhcon-0.2.3-patched/src/Makefile.am        2005-10-23 01:23:00.000000000 +0800
  108. @@ -8,7 +8,7 @@
  109. SUBDIRS = display

  110. install-exec-local:
  111. -        chmod 4755 $(bindir)/zhcon
  112. +        chmod 4755 $(DESTDIR)/usr/bin/zhcon

  113. install-data-local:
  114.         $(mkinstalldirs) $(DESTDIR)/etc
  115. diff -aur zhcon-0.2.3/src/Makefile.in zhcon-0.2.3-patched/src/Makefile.in
  116. --- zhcon-0.2.3/src/Makefile.in        2003-04-17 19:29:48.000000000 +0800
  117. +++ zhcon-0.2.3-patched/src/Makefile.in        2005-10-23 01:23:16.000000000 +0800
  118. @@ -474,7 +474,8 @@


  119. install-exec-local:
  120. -        chmod 4755 $(bindir)/zhcon
  121. +        chmod 4755 $(DESTDIR)/usr/bin/zhcon
  122. +        #chmod 4755 $(bindir)/zhcon

  123. install-data-local:
  124.         $(mkinstalldirs) $(DESTDIR)/etc
复制代码

把下面的内容保存为PKGBUILD文件:
  1. # Contributor: Lin, Zihui <zihui.lin@gmail.com>
  2. pkgname=zhcon
  3. pkgver=0.2.3
  4. pkgrel=0
  5. pkgdesc="a fast console CJK environment"
  6. url="http://sourceforge.net/projects/zhcond"
  7. license="GPL"
  8. depends=('gpm' 'pth' 'gcc')
  9. makedepends=('glibc' 'gpm' 'pth' 'gcc')
  10. install=
  11. source=([url]http://surfnet.dl.sourceforge.net/sourceforge/zhcon/zhcon-0.2.3.tar.gz[/url] archlinuxpkg.patch)

  12. build() {
  13.         patch -p0 -i ../archlinuxpkg.patch
  14.           cd $startdir/src/$pkgname-$pkgver
  15.             ./configure --prefix=/usr
  16.               make || return 1
  17.                 make DESTDIR=$startdir/pkg install
  18.         }
复制代码
然后把这两个文件放到一个目录里,目录名随便起一个就行(比如zhcon)。
然后用root在这个目录里执行makepkg命令:

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

祝大家开心!
发表于 2005-10-23 15:37:51 | 显示全部楼层
Great! 很好!
回复 支持 反对

使用道具 举报

发表于 2005-10-23 16:04:56 | 显示全部楼层
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;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-23 16:58:10 | 显示全部楼层
我错了。 谢谢日月大哥指正
patch在一楼那里已经改过来了,dest32是取值后再自身加1。之前那个patch我试运行过,似乎没什么问题,再修改后,现在的程序逻辑应该一致了。
回复 支持 反对

使用道具 举报

发表于 2005-10-24 10:30:53 | 显示全部楼层
为什么我运行makepkg就报告如下错误呢?
: command not found:
'/PKGBUILD: line 13: syntax error near unexpected token `{
'/PKGBUILD: line 13: `build() {
) does not exist.l scriptlet (
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-24 13:44:55 | 显示全部楼层
我把PKGBUILD用"CODE"的格式再粘贴了一遍,又试着取消代码里的“自动分析超链接”选项,但是没见作用,PKGBUILD显示得不好。
这样好了,我把patch和PKGBUILD这两个文件打了个包,发在附件里了,南蛮,能再试试吗?谢谢~

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2005-10-24 18:21:30 | 显示全部楼层
成功了,爽死了,多谢了。
回复 支持 反对

使用道具 举报

发表于 2005-10-24 19:03:53 | 显示全部楼层
等了很久了,终于有人做这个大贡献了,真是万分感谢,马上回去试试。
回复 支持 反对

使用道具 举报

发表于 2005-10-24 22:56:16 | 显示全部楼层
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?
回复 支持 反对

使用道具 举报

发表于 2005-10-25 08:56:56 | 显示全部楼层
你是用root用户编译的吗?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表