Migrated sunpinyin-2.0's repo to github

由于mercurial对rename的糟糕支持,导致我们现在的repository太大了,用户初次clone时间太长,严重打击普通开发者了解代码和参与项目的热情 :)。因此,sunpinyin开发团队经过慎重的考虑,决定将sunpinyin2的代码,挪到github上面。

非常感谢JJgod介绍了fast-export这套工具集,以及git-filter-branch(1)的使用技巧,使得我们这次的导入十分顺畅。因为在导入时,删除了sunpinyin和许多renamed的二进制文件,现在repository的大小基本在8M左右。因此在build时,会从open-gram项目上得到必要的数据文件。余下的步骤,和以前一样。


我在这里把mac平台上的构建再介绍一下:

首先安装MacPorts,以安装必要的autotools软件包:

$ sudo /opt/local/bin/port install glib2 sqlite3
$ export PATH=$PATH:/Developer/usr/bin:/opt/local/bin
(为了将来方便,可将此行加入到~/.bash_profile中)

接下来,从github上check out项目的代码:

$ git clone git://github.com/sunpinyin/sunpinyin.git

然后进入到sunpinyin目录中,执行autogen.sh

$ cd sunpinyin
$ ACLOCAL_FLAGS=-I/opt/local/share/aclocal ./autogen.sh \
> --enable-debug --disable-ibus

因为系统自带的libtool版本不兼容,需要使用MacPorts的glibtoolize重新生成一下libtool,否则无法进行链接,

$ /opt/local/bin/glibtoolize --force --copy
$ ./configure --enable-debug --disable-ibus
$ make

最后就是build基于IMKit的输入法前端了,

$ cd wrapper/macos
$ make clean; make
$ sudo make install

现在,sunpinyin-2.0应该已经安装到系统中了,需要re-login才可以看到这个输入法。


另外,jjgod还为mac平台上的build,加入了cmake的方式,

$ cd sunpinyin
$ mkdir cmakebuild
$ cd cmakebuild
$ cmake ../
$ make genpyt && make lexicon
$ cd ../wrapper/macos
$ make
$ sudo make install

其中 cmake 负责生成 config.h 和 host_os.h (替代 configure 的作用),并编译 genpyt 和词表 (替代 sunpinyin2/build/Makefile.am 的作用),SunPinyin.app 仍然由 Xcode 生成。但是目前需要先有一个lm_sc.t3g的文件,这个文件可以从 lm_sc.t3g.le下载,并重命名为lm_sc.t3g,放到data目录中。

The power of Mercurial Queues extension

When I work in a Mercurial local workspace, to fix one bug or add a new feature, I'd like to track my modifications in versioning way, so I did local check-ins on every milestone. While when I push the changes to parent workspace, all the changesets (even some trivial changes, e.g., fixing typo:$) will be saved to parent workspace.

I once used the most stupid way, having two local copies, one is for development, another one is for pushing to parent. Then I found one tip to concatenate multiple changesets into one changeset, but it still needs an extra clone. Finally, I met the MQ extension.

Refer to the tutorial, you would find it's really close to what you want.

Here I list the most important tips:

  • To initialize the patch versioned repository:
  • hg qinit -c

  • To convert all applied MQ patches into permanent changesets: (Note, after the conversion, you may not rollback the last changeset)
  • hg qdelete -r qbase:qtip

  • Synchronizing with upstream (which is much simpler than the steps in MqMerge, and does not introduce extra "merge marker" changeset)
  • hg qpop -a
    hg pull -u
    hg qpush -a