Merge lp:~kalikiana/midori/hacking into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6179
Merged at revision: 6201
Proposed branch: lp:~kalikiana/midori/hacking
Merge into: lp:midori
Diff against target: 475 lines (+203/-251)
3 files modified
HACKING (+200/-169)
INSTALL (+0/-82)
tools/release (+3/-0)
To merge this branch: bzr merge lp:~kalikiana/midori/hacking
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+166137@code.launchpad.net

Commit message

Replace INSTALL/ HACKING with exported Contribute wiki page

Description of the change

Replace INSTALL/ HACKING with exported Contribute wiki page

To post a comment you must log in.
Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Would be awesome if we could strip markup somehow. Mostly <code></code> tags and [[ ]] for links.
I guess italics tag // will be tricky to match. But those two above should go as they go in the way when trying to read the text.

There is no info now about
MIDORI_TOUCHSCREEN MIDORI_EXTENSION_PATH
and G_DEBUG=all
Probably could/should be added to wiki then.

Otherwise looks good.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Both MIDORI_TOUCHSCREEN and MIDORI_EXTENSION_PATH are obsolete, you don't need them.

Revision history for this message
Cris Dywan (kalikiana) wrote :

I will add something about G_DEBUG=all to the wiki, we can polish that until release and the file will be updated as the script is run.

Revision history for this message
Paweł Forysiuk (tuxator) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'HACKING'
--- HACKING 2011-01-30 20:35:39 +0000
+++ HACKING 2013-05-29 19:40:32 +0000
@@ -1,169 +1,200 @@
1This file is licensed under the terms of the expat license, see the file EXPAT.1====== Midori - Contribute ======
22
3+ Hacking guide for Midori +3**This document is licensed under the LGPL 2.1.**
44
5- How to contribute5====== Check out the sources ======
6- Coding style6
7- Source files in the project7bzr branch lp:midori
8- Examplary source code8
99The development **trunk** (master, tip) is the latest iteration of the next release. Browse it online and look for other branches at http://code.launchpad.net/midori or http://bazaar.launchpad.net/~midori/midori/trunk/tarball download a tarball of the latest revision.
10+++ How to contribute +++10
1111//The code used to be hosted in git.xfce.org/apps/midori.//
12There are several ways to contribute to the project:12====== Join IRC chat rooms ======
1313
14For translating, have a look at the file TRANSLATE.14Join irc://irc.freenode.net/midori #midori on Freenode https://kiwiirc.com/client/irc.freenode.net/midori or use webchat to talk about Midori, discuss bugs and new ideas.
1515====== Contribute other than touching code ======
16For helping with testing and triaging bug reports, you should register with the bug tracker at https://bugs.launchpad.net/midori and join #midori on irc.freenode.net where a lot of problems are discussed. You can start right away by trying to reproduce bug reports and comment with your findings.16
1717 * http://bugs.launchpad.net/midori Go through problem reports and check Unconfirmed bugs or those lacking information and mark any duplicates you spot
18If you are interested in contributing code, there are a few options. You can join #midori to discuss a particular problem you would like to look into, or a feature you would want to implement. Opening a bug report or feature request if there isn't already one is the next step. To attract some attention, if you attached a patch or have questions, ask in #midori.18 * https://www.bountysource.com/#trackers/130181-midori Add a bounty for a feature or bug you'd like to support
1919
20+++ Coding style +++20====== Build the code ======
2121
22Indentation is 4 spaces, no tabs, preferrably at 80 to 120 columns per line to22./waf configure --prefix=/usr
23avoid automated line-breaks. Trailing whitespace is not desirable.23./waf build
2424sudo ./waf install
25Declarations go to the beginning of a block, not inline. Variables of one plain25
26type may be grouped in one declaration, pointer types may not be grouped. The26Midori can be **run without being installed**.
27asterisk goes next to the type.27
28Variables should be ordered in the order they are used.28_build/default/midori/midori
2929
30Comments explain functionality, they should not state facts. The appropriate30You can use a **temporary folder for testing** without affecting normal settings
31style is always C style /* */, not C++ style.31
3232_build/default/midori/midori -c /tmp/midoridev
33Variable and function names should be animal, animal_shelter or animalsc in33
34case it would otherwise be very long. Loop counters may be single letters.34You'll want to **unit test** the code if you're testing a new version or contributed your own changes:
35Type names should be Animal, AnimalShelter or AnimalSC. No prefixes from third35
36party projects should be used, such as GTK or WebKit, while underlines may be36xvfb-run ./waf check
37used but do not have a particular meaning.37
3838Automated daily builds in Launchpad (https://launchpad.net/~elementary-os/+archive/daily ppa:elementary-os/daily and https://launchpad.net/~midori/+archive/midori-dev ppa:midori/midori-dev) run these tests as well.
39There is a space between functions or keywords and round brackets, and curly39====== Debugging issues ======
40brackets always go on separate lines, at the indentation level of the40
41function, conditional or loop expression. Curly brackets are left out for single41Testing an installed release may reveal crashers or memory corruption which require investigating from a local build and obtaining a stacktrace (backtrace, crash log).
42statement conditionals and loops unless they notably help readability.42
43The type of a function goes on a separate line before the function.43_build/default/midori/midori -g [OPTIONAL ARGUMENTS]
44Preprocessor instructions are indented with the code they relate to.44
4545For more specific debugging output, depending on the feature in question you may use
46Code history is precious, so one should avoid renaming a lot of functions at46
47once or moving whole paragraphs only to add or remove a level of indentation.47env MIDORI_DEBUG=help _build/default/midori/midori
48Moving blocks of code around is also undesriable because it makes patches less48
49readable since the result looks like new code.49====== Coding style and quality ======
5050
5151Midori code should in general have:
52+++ Source files in the project +++52
5353 * 4 space indentation, no tabs
54Core:54 * Between 80 to 120 columns
55 Files prefixed with "midori-" in the folder "midori" make up the core. They55 * Prefer /* */ style comments
56 are essential to running the browser and mostly tailored to the browser.56 * Call variables //animal// and //animal_shelter// instead of <del>camelCase</del>
57 All header files prefixed with "midori-" are considered supported API and57 * Keep a space between functions/ keywords and round parentheses
58 can be used to implement extensions.58
59 "sokoke" is a collection of very specialized helper functions which change59For Vala:
60 from time to time as needed. In the past some of the code was moved to60
61 "katze" when it was considered generally useful.61 * Prefer //new Gtk.Widget ()// over //using Gtk; new Widget ()//
62 "socket" is a socket implementation with no dependency on other parts of62 * Stick to standard Vala-style curly parentheses on the same line
63 the core, which is used if Midori is built without an external single63 * Cuddled //} else {// and //} catch (Error error) {//
64 instance support library.64
65Panels:65For C:
66 Files in the "panels" folder are classes that implement MidoriViewable and66
67 which are loaded into the MidoriPanel at startup. These panels are in67 * Always keep { and } on their own line
68 principle optional.68
69Katze:69//Extensions may historically diverge from the standard styling on a case-by-case basis//
70 Re-usable classes and utility functions that don't depend on the core and70
71 some of that code indeed found its way into other projects.71====== Committing code ======
72Extensions:72
73 These are extensions, written in C, which are loaded optionally if the user73Tell Bazaar your name if you haven't yet
74 so chooses. Extensions can use API from "midori-" and "katze-" headers. Each74 bzr whoami "Real Name <email@address>"
75 module consists of either a single .c file or a folder with .c files.75
76Tests:76See what you did so far
77 Unit tests are run regularly to verify possible regressions or measure77 bzr diff
78 performance of implementations. Except for select cases code changes should78
79 not cause failure of unit tests.79Get an overview of changed and new files
8080 bzr status
8181
82+++ Examplary source code +++82Add new files, move/ rename or delete
8383 bzr add FILENAME
84 /*84 bzr mv OLDFILE NEWFILE
85 Copyright85 bzr rm FILENAME
86 LICENSE TEXT86
87 */87Commit all current changes - Bazaar automatically picks up edited files. //If you're used to git, think of an implicit staging area.//
8888 bzr commit -p
89 #include "foo.h"89
9090If you've done several commits
91 #include "bar.h"91 bzr log | less
9292 bzr log -p | less
93 #include <glib.h>93
9494In the case you committed something wrong or want to ammend it:
95 void95 bzr uncommit
96 foobar (FooEnum bar, const gchar* foo)96
97 {97If you end up with unrelated debugging code or other patches in the current changes, it's sometimes handy to temporarily clean up. //This may be seen as bzr's version of git stash.//
98 gint n, i;98 bzr shelve
9999 bzr commit -p
100 if (!foo)100 bzr unshelve
101 return;101
102102Remember to keep your branch updated:
103 #ifdef BAR_STRICT103 bzr pull
104 if (bar == FOO_N)104
105 {105As a general rule of thumb, ''bzr help COMMAND'' gives you an explanation of any command and ''bzr help commands'' lists all available commands.
106 g_print ("illegal value for 'bar'.\n");106
107 return;107//If you're a die-hard git user, http://zyga.github.io/git-lp/ checkout git-lp to use git commands with the Bazaar repository.//
108 }108
109 #endif109====== Push proposed changes ======
110110
111 /* this is an example */111If you haven't yet, https://launchpad.net/~/+editsshkeys check that Launchpad has your SSH key - you can create an SSH key with **Passwords and Keys** aka **Seahorse** or ''ssh-keygen -t rsa'' - and use ''bzr launchpad-login'' to make youself known to bzr locally.
112 switch (bar)112
113 {113If you checked out trunk, and added your patch(es), just **push it under your username** in Launchpad and you can **propose it for merging into trunk**. This will automatically request a **review from other developers** who can then comment on it and provide feedback.
114 case FOO_FOO:114
115 n = bar + 1;115bzr push --remember lp:~USERNAME/midori/fix-bug1120383 && bzr lp-propose-merge lp:midori
116 break;116
117 case FOO_BAR:117lp-propose-merge command may not be working on some distributions like Arch or Fedora.
118 n = bar + 10;118In case you get error like //bzr: ERROR: Unable to import library "launchpadlib": No module named launchpadlib// just use Launchpad's Web UI to propose a merge.
119 break;119
120 default:120
121 n = 1;121**What happens to all the branches?**
122 }122
123123Leave the branches alone, **approved branches are cleared automatically** by Launchpad.
124 for (i = 0; i < n; i++)124
125 {125For larger feature branches, **use the team** in Launchpad to allow other developers to work on the code with you.
126 g_print ("%s\n", foo);126
127 }127bzr push --remember lp:~midori/midori/featuritis && bzr lp-propose-merge lp:midori
128 }128
129129What if I want to help out on an **existing merge request** that I can't push to?
130Header file example:130
131131
132 /*132bzr branch ~OTHERPERSON/midori/fix-bug1120383
133 Copyright133cd fix-bug1120383
134 LICENSE TEXT134# make commits
135 */135bzr push lp:USERNAME~/midori/fix-bug1120383
136136bzr lp-propose-merge ~OTHERPERSON/midori/fix-bug1120383
137 #ifndef __FOO_H__137
138 #define __FOO_H__ 1138
139139Updating a branch that may be out of sync with trunk:
140 #ifdef HAVE_BAR_H140
141 #define BAR_STRICT141
142 #endif142bzr pull
143143bzr: ERROR: These branches have diverged
144 /* Types */144bzr merge lp:midori
145145# Hand-edit conflicting changes
146 typedef enum146bzr resolve FILENAME
147 {147# If any conflicts remain continue fixing
148 FOO_FOO,148bzr commit -m 'Merge lp:midori'
149 FOO_BAR,149
150 FOO_N150
151 } FooEnum;151Save a little bandwidth, **branch from an existing local copy** that you keep around:
152152
153 typedef struct153
154 {154bzr branch lp:midori midori
155 FooEnum foo_bar;155bzr branch midori midori.fix-bug1120383
156 } FooStruct;156cd midori.fix-bug1120383
157157bzr pull lp:midori
158 /* Declarations */158
159159====== Midori for Windows ======
160 void160===== Dependencies =====
161 foo_bar (FooEnum bar,161Midori for Windows is compiled on a Linux host and MinGW stack. For the current build Fedora 18 packages are used. Packages needed are listed below:
162 const gchar* foo);162
163163yum install gcc vala intltool
164 const gchar*164
165 foo_foo (FooStruct foo_struct,165For a native build
166 guint number,166yum install libsoup-devel webkitgtk3-devel sqlite-devel
167 gboolean flag);167
168168For cross-compilation
169 #endif /* !__FOO_H__ */169yum install mingw{32,64}-webkitgtk3 mingw{32,64}-glib-networking mingw{32,64}-gdb
170
171Packages needed when assembling the archive
172 yum install faenza-icon-theme p7zip mingw32-nsis
173
174Installing those should get you the packages needed to successfully build and develop Midori for Win32.
175
176===== Building =====
177For 32-bit builds:
178
179mingw32-env
180./configure --enable-gtk3 --prefix=/usr/i686-w64-mingw32/sys-root/mingw/
181make
182sudo make install
183
184For 64-bit builds:
185
186mingw64-env
187./configure --enable-gtk3 --prefix=/usr/x86_64-w64-mingw32/sys-root/mingw/
188make
189sudo make install
190
191Once built and tested you can assemble the Midori archive with a helper script
19232-bit build:
193env MINGW_PREFIX="/usr/i686-w64-mingw32/sys-root/mingw" ./win32/makedist/makedist.midori
19464-bit build:
195env MINGW_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw/" ./win32/makedist/makedist.midori x64
196
197===== Testing =====
198For testing your changes unfortuantely a real system is needed because Midori and WebKitGTK+ don't work properly under Wine. Even if it works some problems are not visible when using Wine, but are present when running under a real Windows system and vice versa.
199
200One way around it is to virtualize Windows on a Linux host and mount your MinGW directories as a network drive or shared folder.
170\ No newline at end of file201\ No newline at end of file
171202
=== removed file 'INSTALL'
--- INSTALL 2012-11-26 18:05:35 +0000
+++ INSTALL 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
1This file is licensed under the terms of the expat license, see the file EXPAT.
2
3+++ Installing Midori +++
4
5Building and installing Midori is straightforward.
6
7Make sure you have Python 2.4 or higher installed.
8
9Change to the Midori folder on your hard disk in a terminal.
10
11Run './waf configure'
12
13Run './waf build'
14
15You can now run Midori from the build folder like so
16
17'_build/default/midori/midori'
18
19Midori will pick up extensions and resources from the build folder;
20it will NOT use localizations.
21
22You can install it with './waf install'
23
24If you need to do a clean rebuild, you can do either './waf clean'
25in order to remove binaries or './waf distclean' which deletes generated
26configuration files as well.
27
28For further options run './waf --help'
29
30+++ Debugging Midori +++
31
32Midori is by default built with debugging symbols, make sure you have
33installed 'gdb', the GNU Debugger.
34
35It's a good idea to execute all unit test cases and see that they pass.
36
37'xvfb-run ./waf check'
38
39In this example, Xvfb is used to avoid relying on the local user setup.
40
41You can also run Midori proper as 'gdb _build/default/midori/midori'.
42
43Inside gdb, type 'run'.
44
45Try to reproduce a crash that you experienced earlier,
46this time Midori will freeze at the point of the crash.
47Switch to your terminal, type bt ('backtrace') and hit Return.
48What you obtained now is a backtrace that should include
49function names and line numbers.
50
51If the problem is a warning and not a crash, try this:
52
53'G_DEBUG=all gdb _build/default/midori/midori'
54
55If you are interested in HTTP communication, try this:
56
57'MIDORI_DEBUG=headers _build/default/midori/midori'
58
59Where 'headers' can be replaced with 'body' to get full message contents.
60
61If you are interested in (non-) touchscreen behaviour, try this:
62
63'MIDORI_TOUCHSCREEN=1 _build/default/midori/midori', or
64
65'MIDORI_TOUCHSCREEN=0 _build/default/midori/midori'
66
67If you want to "dry run" without WebKitGTK+ rendering, try this:
68
69'MIDORI_DEBUG=unarmed _build/default/midori/midori'
70
71If you want to test bookmarks, you can enable database tracing:
72
73'MIDORI_DEBUG=bookmarks _build/default/midori/midori'
74
75To disable Netscape plugins, use MOZ_PLUGIN_PATH=/.
76
77When running from the build folder, extensions will also be located
78in the build folder (setting MIDORI_EXTENSION_PATH is no longer needed).
79
80For further information a tutorial for gdb and
81reading up on how you can install debugging
82symbols for libraries used by Midori are recommended.
830
=== modified file 'tools/release'
--- tools/release 2013-05-19 14:04:16 +0000
+++ tools/release 2013-05-29 19:40:32 +0000
@@ -16,6 +16,9 @@
16 OLDVER=0.5.116 OLDVER=0.5.1
17 sed -i "s@$OLDVER@$NEWVER@g" wscript win32/makedist/midori.nsi17 sed -i "s@$OLDVER@$NEWVER@g" wscript win32/makedist/midori.nsi
18 echo; echo v$NEWVER:; bzr log --line -rtag:$OLDVER.. | sed -r 's@.+2013-[0-9]+-[0-9]+ @@' | grep -v l10n | grep -v makedist | grep -v tools/release | grep -v nsi | grep -v -E 'Update .+ translation'; echo18 echo; echo v$NEWVER:; bzr log --line -rtag:$OLDVER.. | sed -r 's@.+2013-[0-9]+-[0-9]+ @@' | grep -v l10n | grep -v makedist | grep -v tools/release | grep -v nsi | grep -v -E 'Update .+ translation'; echo
19 curl http://wiki.xfce.org/_export/raw/midori/contribute | \
20 sed -r 's@\[\[([^|]+)\|([^]]+)\]\]@\1 \2@g' | \
21 sed -r 's@<code( bash|)>|</code>@@g' > HACKING
19 curl http://wiki.xfce.org/_export/xhtml/midori/faq | \22 curl http://wiki.xfce.org/_export/xhtml/midori/faq | \
20 sed 's@This is a list of frequently asked questions@This is <a href="http://wiki.xfce.org/midori/faq">a snapshot of the online FAQ</a>@g' | \23 sed 's@This is a list of frequently asked questions@This is <a href="http://wiki.xfce.org/midori/faq">a snapshot of the online FAQ</a>@g' | \
21 sed 's@<link rel="style.*>@<link rel="stylesheet" href="faq.css" />@g' > data/faq.html24 sed 's@<link rel="style.*>@<link rel="stylesheet" href="faq.css" />@g' > data/faq.html

Subscribers

People subscribed via source and target branches

to all changes: