(no commit message)
[ikiwiki.git] / docs / howtos / HowToUpdateChromium / index.mdwn
1 **NOTE: This page is work in progress**
2
3 ## Introduction
4
5 [[Chromium|https://www.chromium.org/]] is a massive piece of software that includes a number of third-party programs and libraries at a specific version, probably to have a controlled environments for builds and runtime.
6
7 The following "channels" are supported currently, among which there is no BSD so custom patches are needed. See [[Chromium channels|https://www.chromium.org/getting-involved/dev-channel]]
8
9 The chromium port is called "www/chromium/" in FreeBSD ports and so it is in DPorts but, as of the time of this writing, the DPorts version is slightly different since we require changes to the FreeBSD Makefile we cannot do in our overlay (Makefile.DragonFly)
10
11 ## Third-party software
12
13 ### Compiler, linker and standard C++ library
14
15 Chromium uses LLVM's clang to build and lld for the linkage phase. It also uses [[libc++|https://libcxx.llvm.org/]] as standard C++ library. They use a very specific version of this tools which an be obtained with their own scripts and utilities.
16
17 For more information on how to build Chromium from source for other platforms see [[here|https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang.md]].
18
19 ### List of third-party software
20
21 The list of third-party software is a long one, you can check it [[here|https://cs.chromium.org/chromium/src/third_party/]].
22
23 ## Current update procedure
24
25 This is how we are performing the Chromium updates right now, contributions/ideas are very welcome :-)
26
27 ### Repository location and contributions
28
29 The "DragonFly Chromium" repository is located in server **crater**, where all the source repositories are located. There is also a clone of them in server **leaf**. You can access the [[dragonfly's gitweb page|https://gitweb.dragonflybsd.org/]] to browse the code without the need of cloning it. The repository is called _chromium-dfly.git_.
30
31 We recommend cloning from crater just in case the mirroring on leaf fails for some reason:
32
33     
34     # git clone git://crater.dragonflybsd.org/chromium-dfly.git
35     Cloning into 'chromium-dfly'...
36     remote: Counting objects: 469609, done.
37     remote: Compressing objects: 100% (254827/254827), done.
38     [....]
39     
40
41 Only DragonFly committers can push to this repository in crater, you can specify a different url for pushing so that the SSH keys is only used for _git-push_, see below an example of _.git/config_:
42
43     
44     [remote "crater"]                                                                                                    
45             url = git://crater.dragonflybsd.org/chromium-dfly.git
46             pushurl = ssh://crater.dragonflybsd.org/repository/git/chromium-dfly.git
47             fetch = +refs/heads/*:refs/remotes/crater/*
48     
49
50 Anyone can submit patches, just go to [[our bug tracker and send an issue for the tracker "Submit"|https://bugs.dragonflybsd.org/projects/dragonfly/issues/new]].
51
52 ### Repository layout
53
54 Vanilla Chromium versions are imported from tarballs to branches named like "chromium-[exact-version]", see below the current ones:
55
56
57     # git branch -a | fgrep crater/chromium
58       remotes/crater/chromium-60.0.3112.113
59       remotes/crater/chromium-60.0.3112.116
60       remotes/crater/chromium-67.0.3396.87
61       remotes/crater/chromium-68.0.3440.106
62
63 The FreeBSD branches are named like: _[major chromium version]-freebsd_  . In case there are several Chromium branches with the same major version, then the last part of the version is used, see below the current ones:
64
65
66     # git branch -a | grep freebsd |grep crater
67       remotes/crater/60.113-freebsd
68       remotes/crater/67-freebsd
69
70 In the above the branch _"60.113-freebsd"_ is based on the vanilla chromium branch _"chromium-60.0.3112.113"_ . As for _"chromium-67.0.3396.87"_ there is only one chromium-67 so the FreeBSD branch is called "67-freebsd".
71
72 The DragonFly branches are named like: _[major chromium version]-dfly_ . In case there are several Chromium branches with the same major version the same as for FreeBSD applies. For DragonFly there might be user-specific branches. See below the current ones:
73
74
75     # git branch -a | grep dfly |grep crater
76       remotes/crater/60-dfly
77       remotes/crater/67-dfly
78
79 ### Importing a new Chromium version
80
81 Normally we would import the next Chromium version that is in FreeBSD ports. In this example we're going to use version _68.0.3440.106_. The download URL is: [[https://commondatastorage.googleapis.com/chromium-browser-official/chromium-68.0.3440.106.tar.xz|https://commondatastorage.googleapis.com/chromium-browser-official/chromium-68.0.3440.106.tar.xz]].
82
83 * Create a new branch based on a previous one for the import, remove all its contents and amend the commit message:
84
85         # cd chromium-dfly
86         # git checkout -b chromium-68.0.3440.106 crater/chromium-60.0.3112.113
87         # rm -fr *
88         # rm .*
89         # git commit -a --amend --allow-empty -m 'Initial import chromium-68.0.3440.106'
90
91 * Import the tarball to your newly created branch:
92
93         # tar --strip-components 1 --xzf /usr/distfiles/chromium-68.0.3440.106.tar.xz
94         # git add -f .
95         # git commit --amend -m 'Initial import chromium-68.0.3440.106'
96
97 * Push the new branch to crater (if you are a DragonFly developer) and maybe prune old branches if they are older than 4 releases:
98
99         # git push crater chromium-68.0.3440.106
100
101 ### Creating the '-freebsd' branch
102
103 This requires either a checkout of FreeBSD ports or at least the www/chromium directory from it. **Make sure you are working with the correct Chromium version!**
104
105     # fgrep PORTVERSION ~/s/freebsd-ports/www/chromium/Makefile
106     PORTVERSION=    68.0.3440.106
107
108 Now create a branch for FreeBSD:
109
110     # cd chromium-dfly
111     # git checkout -b 68-freebsd crater/chromium-68.0.3440.106
112
113 Apply all FreeBSD patches to your new branch. Make sure all patches apply cleanly, there should be no .rej files and all .orig files should be removed. If there are any .orig files originally in the Chromium repo you can either decide to remove them or restore them:
114
115     # git rev-parse --abbrev-ref HEAD
116     68-freebsd
117     # sh -c 'for p in ~/s/freebsd-ports/www/chromium/patch*; do patch -p0 < $p; done'
118     # find . -iname "*.rej"
119     # find . -iname "*.orig" -delete
120
121 Now all FreeBSD patches should be in, make sure the 'git status' command shows a sane list, that there is no files left behind, etc. Also 'git status --ignored' and 'git ls-files -mo' should have the same amount of iles:
122
123     # git status --ignored | less
124     # git ls-files -mo |wc -l                                               
125      609
126     # git status --ignored --porcelain | wc -l
127      609
128
129 All changes should be committed with one rule: one file per commit, since it makes merges more granular and there are potentially a lot of merges to be done. Please note that the command below will take a while since the repo is quite big:
130
131     # sh -c 'for f in $(git ls-files -mo); do git add $f ; git commit -m "$f"; done'
132     #
133
134 Once you're sure all patches have been applied correctly and that the commits contain exactly one file (they should if you ran the command above) you can push the freebsd branch to crater:
135
136     # git push --set-upstream crater 68-freebsd
137     Enumerating objects: 4672, done.
138     Counting objects: 100% (4672/4672), done.
139     [...]
140      * [new branch]            68-freebsd -> 68-freebsd
141     Branch '68-freebsd' set up to track remote branch '68-freebsd' from 'crater'.
142
143 ### Creating the 'dfly' branch
144
145 Once the _'-freebsd'_ branch is created with all the FreeBSD patches for the specific Chromium version on it, you can create the _'-dfly'_ branch from it.
146
147         
148     # git checkout -b 68-dfly 68-freebsd
149     
150
151 ## Appendix
152
153 ### Tools
154
155 The Chromium project offers a cross-reference tool which is extremely useful when working on Chromium source code: [[Chromium Search Code|https://cs.chromium.org/]]