]> de.git.xonotic.org Git - xonotic/xonotic.wiki.git/blob - Repository_Access.md
make it shorter
[xonotic/xonotic.wiki.git] / Repository_Access.md
1 Repository Access and Compiling
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 ***
7
8 Setting up the development environment
9 --------------------------------------
10
11 You first need tools to download and compile the Xonotic game data. Make sure you have at least 2 GB memory to compile.
12
13 ### Linux
14
15 **Ubuntu Dependencies**:
16
17     sudo apt-get install autoconf build-essential curl git-core libasound2-dev libclalsadrv-dev libgmp-dev libjpeg-turbo8-dev libsdl2-dev libsdl2-image-dev libtool libxcb-xf86dri0-dev libxext-dev libxpm-dev libxxf86dga-dev libxxf86vm-dev p7zip-full unzip wget x11proto-xf86dga-dev x11proto-xf86dri-dev x11proto-xf86vidmode-dev xserver-xorg-dev zlib1g-dev
18
19 Note: On Debian, use `libjpeg8-dev` if `libjpeg-turbo8-dev` isn’t available in the package repositories.
20
21 **Fedora** and other **RPM based** distro dependencies:
22
23     x11-proto-devel libalsa2-static-devel libjpeg62-devel libjpeg62-static-devel libSDL2-devel
24
25 **Archlinux** dependencies:
26
27     sudo pacman -S alsa-lib curl libjpeg-turbo libmodplug libpng libvorbis libxpm libxxf86dga libxxf86vm sdl2 unzip wget
28
29 ### Windows
30
31 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.
32
33 Once you have completed the installation, launch the MSYS2 shell by running `mingw64.exe` (instead of the default msys2.exe) by default located at `C:\msys64` and install the needed **dependencies** with this command:
34
35     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}
36
37 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.
38
39 You can now use this shell to continue on with the guide and clone the Xonotic repositories.
40
41 ### MacOS
42
43 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/)
44
45 ***
46
47 Cloning the repository and compiling
48 ------------------------------------
49
50 To begin downloading:
51
52     git clone git://git.xonotic.org/xonotic/xonotic.git  # download main repo
53     cd xonotic
54     ./all update -l best  # download all other repos (data + game logic, maps, etc.)
55
56 The **git://** protocol uses port **9418**, which may be a problem if you’re behind a **strict firewall**. You may instead use the clone url http://git.xonotic.org/xonotic/xonotic.git (however, using the git protocol directly is preferred for performance reasons).
57
58 For Windows users: once finished cloning move to the main repository (`cd xonotic`) and checkout the branch Mario/Win64 with the command:
59
60     git checkout -b Mario/win64 origin/Mario/win64
61
62 Now the game can be compiled and run with the following commands:
63
64     ./all compile -r
65     ./all run
66
67 **Note:** if you encounter en error similar to darkplaces#111, try `./all clean && ./all compile -r -0`.
68
69 You can use just `./all compile` to create a slower build with debug symbols but usually you want `-r`.
70
71 The `./all run` or `./all compile` line can be followed by one of `glx` (Linux native), `sdl` (input/sound managed by SDL), `agl` (macOS native), `wgl` (Windows native), or `dedicated` (for server hosting) to choose which executable to run or compile. E.g. `./all compile -r dedicated`.
72
73 The `run` command can also be followed by standard DarkPlaces commandline arguments:
74
75     ./all run +vid_fullscreen 0
76
77 To update your Git clone:
78
79     cd xonotic
80     ./all checkout  # switch to main branch on all repos (usually master)
81     ./all update  # pull and prune
82     ./all compile -r  # recompile what changed
83
84 **Note:** The compiled binary will have a faint watermark with the git revision. To remove it completely put `set menu_watermark ""` into your `autoexec.cfg`.
85
86 **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.
87
88 ***
89
90 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).
91
92 ***
93
94 Contributing and getting write access
95 -------------------------------------
96
97 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:
98 \* data/qcsrc/warpzonelib - dual licensed as “GPLv2 or later” or MIT license.
99 In case the code you pushed was not written by you, it is your responsibility to ensure proper licensing.
100
101 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.
102
103 ### Windows/Linux/OS X
104
105 Get a checkout (see above), and do:
106
107     ./all keygen
108
109 and follow the instructions that are shown. Be sure that you've done:
110
111     ./all update -p
112
113 After that, you can write to the repositories using the usual git commands (commit, push, ...).
114
115 Alternatively, you can use the helper script `all`.
116 It supports the following commands:
117
118     ./all update
119
120 This command updates all the Xonotic repositories.
121
122     ./all branch
123
124 Lists the branches you are currently on, in the respective repositories.
125
126     ./all branches
127
128 Lists all the branches known for all the respective repositories.
129
130     ./all compile
131
132 Compiles the game, assuming that you have the required libs installed. Don't forget `-r` if you wanna actually play the game with decent fps.
133
134     ./all checkout BRANCH
135
136 Switch to that branch in all repositories where its available.
137
138     ./all commit
139
140 This command commits and pushes your local changes.
141
142     ./all run xonotic
143
144 Starts the Xonotic client
145
146     ./all run dedicated xonotic
147
148 Starts a Xonotic dedicated server
149
150 General contributor guidelines
151 ------------------------------
152
153 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).
154 2.  Try naming 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.
155
156 Further git information
157 -----------------------
158
159 About tracking remote branches:
160 http://git-scm.com/book/en/v2/Git-Branching-Remote-Branches
161
162 This wiki’s [Git](Git) page.
163
164 A tutorial to Git for SVN users:
165 http://git-scm.org/course/svn.html