forked from c-aries/utt-wubi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HACKING
198 lines (180 loc) · 6.41 KB
/
HACKING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
ANNOUNCEMENT
============
If you want to hack on the Utt Project, you'll need to have
the following packages installed:
- GNU autoconf 2.67
- GNU automake 1.11
- GNU libtool 2.2.10
- GNU gettext 0.18
- intltool 0.40.6
These should be available by ftp from ftp.gnu.org or any of the
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
URL & REPO
==========
http://ftp.gnu.org/gnu/autoconf/autoconf-2.67.tar.bz2
http://ftp.gnu.org/gnu/automake/automake-1.11.tar.bz2
http://ftp.gnu.org/gnu/libtool/libtool-2.2.10.tar.gz
http://ftp.se.debian.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.bz2
http://ftp.gnu.org/pub/gnu/m4/m4-1.4.14.tar.bz2
http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.tar.gz
http://ftp.gnu.org/gnu/texinfo/texinfo-4.9.tar.bz2
http://downloads.sourceforge.net/project/libpng/zlib/1.2.5/zlib-1.2.5.tar.bz2
http://ftp.acc.umu.se/pub/gnome/sources/glib/2.26/glib-2.26.0.tar.bz2
http://cairographics.org/releases/pixman-0.18.4.tar.gz
http://download.savannah.gnu.org/releases/freetype/freetype-2.4.8.tar.bz2
http://sourceforge.net/projects/libpng/files/libpng12/1.2.46/libpng-1.2.46.tar.bz2
http://downloads.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz
http://www.fontconfig.org/release/fontconfig-2.8.0.tar.gz
http://cairographics.org/releases/cairo-1.8.10.tar.gz
http://ftp.acc.umu.se/pub/gnome/sources/pango/1.28/pango-1.28.3.tar.bz2
http://www.ijg.org/files/jpegsrc.v8b.tar.gz
ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.2.tar.gz
http://ftp.gnome.org/pub/gnome/sources/atk/1.30/atk-1.30.0.tar.bz2
http://ftp.acc.umu.se/pub/gnome/sources/gtk+/2.20/gtk+-2.20.1.tar.bz2
http://ftp.gnome.org/pub/GNOME/sources/glade3/3.6/glade3-3.6.7.tar.bz2
ftp://ftp.gnome.org/pub/GNOME/sources/GConf/2.28/GConf-2.28.1.tar.bz2
http://developer.gnome.org/gtk/2.24/api-index-full.html
http://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c?h=gtk-2-20#n5973
http://standards.freedesktop.org/desktop-entry-spec/latest/
COMMON CONFIGURE OPTION
=======================
$ ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared
$ make
$ make DESTDIR=`pwd`/dest install # check the installation
$ find dest
# make install
# cd /usr/share/info
# rm dir
# gzip *
# for f in *
> do
> install-info --info-file=$f --dir-file=dir
> done
$
ENVIRONMENT & SPECIAL CONFIGURATION
===================================
$ cat opt.gtk2.env
export PKG_CONFIG_PATH=/opt/gtk2/lib/pkgconfig
export LD_LIBRARY_PATH=/opt/gtk2/lib
export PATH=/opt/gtk2/bin:$PATH
export MANPATH=/opt/gtk2/man:/opt/gtk2/share/man:/usr/share/man
export INFOPATH=/opt/gtk2/info:/opt/gtk2/share/info:/usr/share/info
export CFLAGS="-I/opt/gtk2/include"
export LDFLAGS="-L/opt/gtk2/lib"
$ . opt.gtk2.env
$ ./configure --prefix=/opt/gtk2 && make && make DESTDIR=`pwd`/dest install && make install
= =b> to build a pure develop enviroment, you need to exam result after every step
$ pkg-config --cflags --libs glib-2.0
$ ldd /opt/gtk2/lib/libgio-2.0.so.0.2600.0
= =b> you can reference http://developer.gnome.org/gtk3/stable/gtk-building.html
AUTOTOOLS
=========
$ info automake-1.11 "Creating amhello"
= =b> compile softwares from source at "URL & REPO" below, then install
$ mkdir m4
$ autoscan
$ mv configure.scan configure.ac
= =b> edit configure.ac
$ autoreconf --install
$ autoheader
$ aclocal
$ autoconf
$ automake --add-missing
$ automake
$ make distcheck
= =b> may be this is better
$ make distcheck DESTDIR=`pwd`/../dest
USING GETTEXT AND INTLTOOL
==========================
Location: http://oriya.sarovar.org/docs/gettext/node6.html
Location: http://www.heiner-eichmann.de/autotools/using_gettext.html
* init
xgettext -d utt -s -k_ -o po/utt.pot src/article.c
msginit -l "zh_CN.utf8" -o utt.po -i utt.pot
msgfmt -c -v -o utt.mo utt.po
cp utt.mo /usr/share/locale/zh_CN/LC_MESSAGES/
* merge
msgmerge -s -U utt.po utt.pot
* cat
msgcat -s -o zh_CN.po zh_CN.po~ ~/git/utt-old/utt-0.2/po/utt.po
* gettextize
$ cat LINGUAS
zh_CN
$ cp utt.po zh_CN.po
* or use intltoolize
$ grep -i macro configure.ac
AC_CONFIG_MACRO_DIR([m4])
$ intltoolize --copy
$ cat po/POTFILES.in
[encoding: UTF-8]
src/article.c
[type: gettext/glade]data/article-ui.xml
$ cat po/POTFILES.skip
data/utt.desktop.in
$ grep translatable data/article-ui.xml | head -n 1
<property name="title" translatable="yes">Artical Typing Traning</property>
$ make -C po utt.pot
$ cd po; msgmerge -s -U zh_CN.po utt.pot; cd ..
= =b> edit zh_CN.po
$ make -C po update-po
= =b> you can install gettext po-mode.el in the gettext tar ball
step 0. edit po/POTFILES.in
step 1. rm po/utt-wubi.pot
step 2. make -C po utt-wubi.pot
step 3. cd po; msgmerge -s -U zh_CN.po utt-wubi.pot;
step 4. edit zh_CN.po
GitHub SSH
==========
Take utt.git as an example
* initialization
$ git config --global user.name "c-aries"
$ git config --global user.email "[email protected]"
$ ssh-keygen -C '[email protected]' -t rsa
$ cat ~/.ssh/id_rsa.pub
$ ssh-agent
$ ssh-add
$ ssh -v [email protected]
$ git remote add origin [email protected]:c-aries/utt.git
$ git push -u origin master
* checkout from network
$ git clone [email protected]:c-aries/utt.git
* update from network
$ git pull
* commit to network
$ git push
* remote branch
$ git remote add wubi [email protected]:c-aries/utt.git
$ git push -u wubi wubi
$ git checkout wubi
$ git pull
$ git fetch origin wubi:wubi
* upstream
Assume your name is babyaries, fork from c-aries at github, then
$ git clone https://github.com/babyaries/utt-wubi.git
$ git remote add upstream https://github.com/c-aries/utt-wubi.git
$ git remote
$ git fetch upstream
$ git merge upstream/master
or use github "pull request" button
$ git push
Username:
Password:
= =b> This is your github account password
= =b> If you don't use github, you can use email, send him patch, ask the upstreamer to "remote add", "fetch", "merge"
If you have the upsterm account, you can push yourself
$ git remote set-url origin [email protected]:c-aries/utt-wubi.git
$ git push upstream
>> https://help.github.com/articles/using-pull-requests
* tags
$ git tag -d v0.1 #delete locally
$ git push origin :v0.4 #delete at github
$ git tag -a -m "release version 0.1" v0.1 #tag locallly
$ git push --tags #push to github
$ git log --oneline --decorate --graph
>> http://gitref.org/branching/#tag
TIPS
====
0. reading source code
run "make tags" at the topmost directory will generate a "TAGS" file.
It offers you the ability to read source code with GNU Emacs.
If you use vim, just run "make ctags".