]> git.xonotic.org Git - xonotic/xonotic.wiki.git/blob - Repository_Access.md
Update Compiling: add libtool dependency
[xonotic/xonotic.wiki.git] / Repository_Access.md
1 Compiling and Contributing
2 ==========================
3
4 Xonotic uses [several Git repositories](Git). The `all` script in the main repo manages them, builds Xonotic and runs it. Each repo can also contain feature branches next to the stable `master` branch, check them out for WIP features.
5
6 Build Requirements
7 ------------------
8
9 Make sure you have at least 2GB memory to compile.  This is enough for a git server, but 6GB is required to play using a git client.
10
11 [About 12GB of disk space is required for the git repositories.](Git)
12
13 ### Linux
14
15 Note: `curl` isn't required but it's strongly recommended for downloading maps when playing online, `wget` is not supported for this.  
16
17 Note: The `all` script requires either `wget` or `curl`.
18
19
20 **Ubuntu** dependencies:
21
22     sudo apt-get install autoconf build-essential curl git libtool libgmp-dev libjpeg-turbo8-dev libsdl2-dev libxpm-dev xserver-xorg-dev zlib1g-dev unzip zip
23
24 Note: On Debian, use `libjpeg62-turbo-dev` if `libjpeg-turbo8-dev` isn’t available in the package repositories.
25
26 Note: `libasound2-dev libxext-dev libxxf86vm-dev p7zip-full unzip wget x11proto-xf86vidmode-dev` might be needed but are probably already installed. `libclalsadrv-dev libsdl2-image-dev libxcb-xf86dri0-dev libxxf86dga-dev x11proto-xf86dga-dev x11proto-xf86dri-dev` should no longer be needed.
27
28 **Fedora** and other **RPM based** distro dependencies:
29
30     autoconf automake gcc-c++ gmp-devel libjpeg-turbo-devel libtool SDL2-devel curl
31
32 Note: `x11-proto-devel` or `xorg-x11-proto-devel` might be needed but might be already installed.
33
34 **Archlinux** dependencies:
35
36     sudo pacman -S alsa-lib curl git libjpeg-turbo libmodplug libpng libvorbis libxpm xorgproto libxxf86vm sdl2 unzip zip
37
38 ### Windows
39
40 By default, Windows has no real environment to handle the necessary scripting and compiling tools for building Xonotic. So, what we have to do is install something called [MSYS2](http://www.msys2.org) to allow us to have a similar environment as on Linux. Download 64 bit version of MSYS2 (msys2-x86_64-xxxxxx.exe) and follow installation instructions.
41
42 Once you have completed the installation, close the current MSYS2 shell and launch a MSYS2 MINGW64 shell by running mingw64.exe (instead of the default msys2.exe) located at C:\msys64 and install the needed dependencies with this command:
43
44     pacman --needed -S git curl zip unzip p7zip make automake autoconf libtool gcc gmp-devel mingw-w64-x86_64-{toolchain,gmp,SDL2,libjpeg-turbo,libpng,libogg}
45
46 It is recommended that you make a shortcut to MSYS2 MINGW64 shell (simply right click mingw64.exe and hit “Create Shortcut”) for easier access on your desktop or in your start menu.
47
48 You can now use this shell to continue on with the guide and clone the Xonotic repositories.
49
50 ### macOS
51
52 You must first install **XCode** which comes on your installation DVD or can be downloaded from the Apple website. This package provides tools like **Git and GCC**, which are needed for successful checkout and compilation of Xonotic. Some versions of XCode come with Git and others don’t - if you don’t have Git after installing XCode get it here: [XCode installer](http://sourceforge.net/projects/git-osx-installer/files/)
53
54 Cloning the Repository and Compiling
55 ------------------------------------
56
57 To begin downloading:
58
59     git clone https://gitlab.com/xonotic/xonotic.git  # download main repo
60     cd xonotic
61     ./all update -l best  # download all other repos (data + game logic, maps, etc.)
62
63 Now the game can be compiled and run with the following commands:
64
65     ./all compile -r
66     ./all run
67
68 **Note:** if you encounter en error similar to darkplaces#111, try `./all clean && ./all compile -r -0`.
69
70 You can use `./all compile -d` to create a slower unoptimized build with debug symbols but usually you want `-r` (which is also the new default).
71
72 The `./all run` or `./all compile` line can be followed by `dedicated` to build or run the executable for server hosting. E.g. `./all compile -r dedicated`.
73
74 The `run` command can also be followed by standard DarkPlaces commandline arguments:
75
76     ./all run +vid_fullscreen 0
77
78 To update your Git clone:
79
80     cd xonotic
81     ./all checkout  # switch to main branch on all repos (usually master)
82     ./all update  # pull and prune
83     ./all compile -r  # recompile what changed
84
85 **Note:** If you intend to play on public servers, you should probably also enable the nexcompat repo to download additional textures that are used on some older unofficial maps. Use `touch data/xonotic-nexcompat.pk3dir.yes` and `./all update`. For mappers: these textures should NOT be used on new maps.
86
87 ***
88
89 If you run into issues with the latest version you can easily revert to an older one. Since most bugs are caused by the game code rather that the engine, you just need to downgrade that repository. Inside the main xonotic repository, use `cd data/xonotic-data.pk3dir` and then `git checkout <some older commit>`. After that go back `cd -` and `./all compile` (with the optional `-r` flag).
90
91 Contributing and Getting Write Access
92 -------------------------------------
93
94 Cloning (one of) our repos and submitting MRs from there (as in any other project) works but you won't be able to use our CI setup for the data repo (which seems to need a custom runner). It's therefore a good idea to join the Xonotic group and get push access - then you can create branches in our repos and use our CI.
95
96 A condition for write (push) access is that you agree that any code or data you push will be licensed under the General Public License, version 2, with or without the “or any later version” clause. In case the directory the changes apply to contains a LICENSE or COPYING file indicating another license, then your pushed code has to be dual licensed appropriately. Subdirectories currently having a dual license:
97
98 * `data/xonotic-data.pk3dir/qcsrc/lib/warpzone` - dual licensed as “GPLv2 or later” or MIT license.
99
100 In case the code you pushed was not written by you, it is your responsibility to ensure proper licensing.
101
102 To apply for write access, add your SSH key to your GitLab account and ask for access in #xonotic on the FreeNode IRC network or [request access](https://docs.gitlab.com/ce/user/group/index.html#request-access-to-a-group) using the GitLab interface.
103
104 ### Windows/Linux/macOS
105
106 Get a checkout (see above), and do:
107
108     ./all keygen
109
110 and follow the instructions that are shown. Be sure that you've done:
111
112     ./all update -p
113
114 After that, you can write to the repositories using the usual git commands (commit, push, ...).
115
116 Alternatively, you can use the helper script `all`.
117 It supports the following commands:
118
119     ./all update
120
121 This command updates all the Xonotic repositories.
122
123     ./all branch
124
125 Lists the branches you are currently on, in the respective repositories.
126
127     ./all branches
128
129 Lists all the branches known for all the respective repositories.
130
131     ./all compile
132
133 Compiles the game, assuming that you have the required libs installed.
134
135     ./all checkout BRANCH
136
137 Switch to that branch in all repositories where its available.
138
139     ./all commit
140
141 This command commits and pushes your local changes.
142
143     ./all run
144
145 Starts the Xonotic client
146
147     ./all run dedicated
148
149 Starts a Xonotic dedicated server
150
151 General Contributor Guidelines
152 ------------------------------
153
154 1.  Before creating your local branch and committing to it, make sure you’ve configured your user settings such as your name which will display in the logs (in TortoiseGit: Settings > Git > Config).
155 2.  You should name your branch myname/mychange for each patch. For instance, if your name is Alex and the change you are committing is a menu fix, use something like alex/menufix.
156
157 Git guides
158 -----------------------
159
160 Git basics on [this wiki page](Git).
161
162 About tracking remote branches:
163 http://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
164
165 A tutorial to Git for SVN users:
166 https://git.wiki.kernel.org/index.php/GitSvnCrashCourse