(This post was originally written in Hungarian by Adam Kovacs for his blog. Thanks Adam!)
Want to start hacking on the LibreOffice source code? Start here! Follow the steps in this guide to enable automatic verification, so that you can submit your changes to the LibreOffice Git repository. If your code patches are accepted by other developers in the project, they will be added to the code for the next version, and then everyone in the world who uses LibreOffice will benefit from them.
This description does not include the submission (commit and push) of the patch, but only creates the preconditions for it.
If you get stuck at one of the points, reading these links can help:
Step 1 – Download the code
Create a directory (folder) for LibreOffice somewhere on your computer. At the command prompt (in a terminal in Linux, or eg Cygwin in Windows), access this folder and run the following command:
git clone https://gerrit.libreoffice.org/core libreoffice
- You do not have to run “git init” after “git clone”
- Just run the “git clone” command for the steps listed here; you don’t have to start autogen.sh and the compilation, unless you want to test your code modifications
Step 2 – Registering with Git
Git is a distributed version-control system for tracking changes in source code during software development. Register at: https://github.com.
Step 3 – Registering with Gerrit
What is a Gerrit? It complements Git. You can view patch files, messages, the results of the automatic tests of modifications, comments from senior programmers on the web interface, and whether your submitted patch has been accepted.
Register at: https://gerrit.libreoffice.org.
Fill in the following: username (no spaces and accents, example: adamkovacs), name (example: Adam Kovacs), email (example: email@example.com). These can be found in the “Profile” and “Contact information” menu items.
Step 4 – Create SSH key
ssh-keygen -C 'firstname.lastname@example.org'
ssh-keygen.exe -C 'email@example.com'
After you run the command, you should also enter a password if you still have access to the files generated by the command, for example to commit code in your name. (The password will be required for “./logerrit submit master”, for example.)
Step 5 – Copying SSH public key into Gerrit
Copy the full contents of the id_rsa.pub file in the ~/.ssh/ folder into Gerrit by selecting SSH Public Keys.
In the ~/.ssh/ folder, create a file named “config” with this content:
Host logerrit gerrit.libreoffice.org
(It may be that port 22 (SSH( is disabled at some workplaces or public networks.)
You may need to run the following command in ~/.ssh/:
This sets a write and read (4 + 2) permission for your own username, and no permissions (0) for your group and the outside world.
Step 6 – Local Git repository
Set up your local Git repository with the username and email address as set in Gerrit, with the following commands after entering your LibreOffice directory:
git config --global user.name "Sajat Nev"
git config --global user.email "firstname.lastname@example.org"
Use the “git config –list command” to retrieve the current settings. If they don’t include a name and email address, we haven’t set up anything yet. But with the “git config user.name” and “git config user.email” commands, you can more clearly verify this.
The file named config in the .git directory that’s inside the LibreOffice directory should look like this:
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
url = ssh://email@example.com:29418/core
fetch = +refs/heads/*:refs/remotes/origin/*
remote = origin
merge = refs/heads/master
name = Gerriten Megadott Nev
email = gerriten_megadott_email_cim
active = true
url = ssh://firstname.lastname@example.org:29418/dictionaries
ignore = all
active = true
url = ssh://email@example.com:29418/help
ignore = all
active = true
url = ssh://firstname.lastname@example.org:29418/translations
ignore = all
The above commands may not have changed anything in this file, in which case you can manually overwrite the file, or enter the directory containing the file and issue this command:
Then try the previous “git config” commands again.
You might want to change the default text editor, if you don’t want to use Vi(m). Run the following command to change to Nano, for instance:
git config --global core.editor nano
Then, after running the “git commit command”, Nano starts instead of Vi(m).
Step 7 – Test Gerrit!
The following commands should run successfully:
ssh -vvvv logerrit
If they do not run successfully, check out the error messages to see what commands you should run – and also visit the links in the introduction to this guide.
Step 8 – Legal notice
This text should be sent by mail to LibreOffice@lists.freedesktop.org:
All rights reserved for LibreOffice may be licensed under the MPLv2 / LGPLv3 + dual license.
…with the subject line “ license statement”. (More details here.) Note: please only send the statement no earlier than when you post your first submission to Gerrit, and ensure you have permission from your parents!
And now you’re set up to hack on the LibreOffice source code! We’ll follow up this guide with more tutorials soon, so keep an eye on the blog…