|
说在前面
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=([url]http://surfnet.dl.sourceforge.net/sourceforge/zhcon/zhcon-0.2.3.tar.gz[/url] 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
祝大家开心! |
|