diff options
-rw-r--r-- | INSTALL.md | 185 |
1 files changed, 179 insertions, 6 deletions
@@ -6,6 +6,11 @@ | |||
6 | - [Homebrew](#homebrew) | 6 | - [Homebrew](#homebrew) |
7 | - [Non-Homebrew](#non-homebrew) | 7 | - [Non-Homebrew](#non-homebrew) |
8 | - [Windows](#windows) | 8 | - [Windows](#windows) |
9 | - [Cross-Compile](#windows-cross-compile) | ||
10 | - [Setting up a VM](#windows-cross-compile-vm) | ||
11 | - [Setting up the environment](#windows-cross-compile-environment) | ||
12 | - [Compiling](#windows-cross-compile-compiling) | ||
13 | - [Native](#windows-native) | ||
9 | 14 | ||
10 | - [Additional](#additional) | 15 | - [Additional](#additional) |
11 | - [Advanced configure options] (#aconf) | 16 | - [Advanced configure options] (#aconf) |
@@ -176,12 +181,182 @@ http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42 | |||
176 | <a name="windows" /> | 181 | <a name="windows" /> |
177 | ###Windows: | 182 | ###Windows: |
178 | 183 | ||
184 | <a name="windows-cross-compile" /> | ||
185 | |||
186 | ####Cross-compile | ||
187 | |||
188 | It's a bit challenging to build Tox and all of its dependencies nativly on Windows, so we will show an easier, less error and headache prone method of building it -- cross-compiling. | ||
189 | |||
190 | <a name="windows-cross-compile-vm" /> | ||
191 | #####Setting up a VM | ||
192 | |||
193 | We will assume that you don't have any VM running Linux around and will guide you from the ground up. | ||
194 | |||
195 | First, you would need to get a virtual machine and a Linux distribution image file. | ||
196 | |||
197 | For a virtual machine we will use VirtualBox. You can get it [here](https://www.virtualbox.org/wiki/Downloads). | ||
198 | |||
199 | For a Linux distribution we will use Lubuntu 14.04 32-bit, which you can get [here](https://help.ubuntu.com/community/Lubuntu/GetLubuntu). | ||
200 | |||
201 | After you have those downloaded, install the VirtualBox and create a VM in it. The default of 512mb of RAM and 8gb of dynamically-allocated virtual hard drive would be enough. | ||
202 | |||
203 | When you have created the VM, go into its **Settings** -> **System** -> **Processor** and add some cores, if you have any additional available, for faster builds. | ||
204 | |||
205 | Then, go to **Settings** -> **Storage**, click on **Empty** under **Controller: IDE**, click on the little disc icon on the right side of the window, click on **Choose a virtual CD/DVD disk file** and select the downloaded Lubuntu image file. | ||
206 | |||
207 | Start the VM and follow the installation instructions. | ||
208 | |||
209 | After Lubuntu is installed and you have booted into it, in VirtualBox menu on top of the window select **Devices** -> **Insert Guest Additions CD image...**. | ||
210 | |||
211 | Open terminal from **Lubuntu's menu** -> **Accessories**. | ||
212 | |||
213 | Execute: | ||
214 | ```bash | ||
215 | sudo apt-get update | ||
216 | sudo apt-get install build-essential -y | ||
217 | cd /media/*/*/ | ||
218 | sudo ./VBoxLinuxAdditions.run | ||
219 | ``` | ||
220 | |||
221 | After that, create a folder called `toxbuild` somewhere on your Windows system. The go to **Devices** -> **Shared Folders Settings...** in the VirtualBox menu, add the `toxbuild` folder there and set **Auto-mount** and **Make Permanent** options. | ||
222 | |||
223 | Execute: | ||
224 | ```bash | ||
225 | sudo adduser `whoami` vboxsf | ||
226 | ``` | ||
227 | Note the use of a [grave accent](http://en.wikipedia.org/wiki/Grave_accent) instead of an apostrophe. | ||
228 | |||
229 | Then just reboot the system with: | ||
230 | ```bash | ||
231 | sudo reboot | ||
232 | ``` | ||
233 | |||
234 | After the system is booted, go to **Devices** -> **Shared Clipboard** and select **Bidirectional**. Now you will be able to copy-paste text between the host and the guest systems. | ||
235 | |||
236 | Now that the virtual machine is all set up, let's move to getting build dependencies and setting up environment variables. | ||
237 | |||
238 | <a name="windows-cross-compile-environment" /> | ||
239 | #####Setting up the environment | ||
240 | |||
241 | First we will install all tools that we would need for building: | ||
242 | ```bash | ||
243 | sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm pkg-config mingw-w64 -y | ||
244 | ``` | ||
245 | |||
246 | Then we will define a few variables, **depending on which you will build either 32-bit or 64-bit Tox**. | ||
247 | |||
248 | For 32-bit Tox build, do: | ||
249 | ```bash | ||
250 | WINDOWS_TOOLCHAIN=i686-w64-mingw32 | ||
251 | LIB_VPX_TARGET=x86-win32-gcc | ||
252 | ``` | ||
253 | |||
254 | For 64-bit Tox build, do: | ||
255 | ```bash | ||
256 | WINDOWS_TOOLCHAIN=x86_64-w64-mingw32 | ||
257 | LIB_VPX_TARGET=x86_64-win64-gcc | ||
258 | ``` | ||
259 | |||
260 | This is the only difference between 32-bit and 64-bit build procedures. | ||
261 | |||
262 | For speeding up the build process do: | ||
263 | ``` | ||
264 | MAKEFLAGS=j$(nproc) | ||
265 | export MAKEFLAGS | ||
266 | ``` | ||
267 | |||
268 | And let's make a folder where we will be building everything at | ||
269 | ```bash | ||
270 | cd ~ | ||
271 | mkdir prefix | ||
272 | cd prefix | ||
273 | PREFIX_DIR=$(pwd) | ||
274 | cd .. | ||
275 | mkdir build | ||
276 | cd build | ||
277 | ``` | ||
278 | |||
279 | <a name="windows-cross-compile-compiling" /> | ||
280 | #####Compiling | ||
281 | |||
282 | Now we will build libraries needed for audio/video: VPX and Opus. | ||
283 | |||
284 | VPX: | ||
285 | ```bash | ||
286 | git clone http://git.chromium.org/webm/libvpx.git | ||
287 | cd libvpx | ||
288 | git checkout tags/v1.3.0 | ||
289 | CROSS="$WINDOWS_TOOLCHAIN"- ./configure --target="$LIB_VPX_TARGET" --prefix="$PREFIX_DIR" --disable-examples --disable-unit-tests --disable-shared --enable-static | ||
290 | make | ||
291 | make install | ||
292 | cd .. | ||
293 | ``` | ||
294 | |||
295 | Opus: | ||
296 | ```bash | ||
297 | wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz | ||
298 | tar -xf opus-1.1.tar.gz | ||
299 | cd opus-1.1 | ||
300 | ./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-extra-programs --disable-doc --disable-shared --enable-static | ||
301 | make | ||
302 | make install | ||
303 | cd .. | ||
304 | ``` | ||
305 | |||
306 | Now we will build sodium crypto library: | ||
307 | ```bash | ||
308 | git clone https://github.com/jedisct1/libsodium/ | ||
309 | cd libsodium | ||
310 | git checkout tags/0.4.5 | ||
311 | ./autogen.sh | ||
312 | ./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-shared --enable-static | ||
313 | make | ||
314 | make install | ||
315 | cd .. | ||
316 | ``` | ||
317 | |||
318 | And finally we will build Tox: | ||
319 | ```bash | ||
320 | git clone https://github.com/irungentoo/toxcore | ||
321 | cd toxcore | ||
322 | ./autogen.sh | ||
323 | ./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-ntox --disable-tests --disable-testing --with-dependency-search="$PREFIX_DIR" --disable-shared --enable-static | ||
324 | make | ||
325 | make install | ||
326 | cd .. | ||
327 | ``` | ||
328 | |||
329 | Then we make Tox shared library: | ||
330 | ```bash | ||
331 | cd "$PREFIX_DIR" | ||
332 | mkdir tmp | ||
333 | cd tmp | ||
334 | $WINDOWS_TOOLCHAIN-ar x ../lib/libtoxcore.a | ||
335 | $WINDOWS_TOOLCHAIN-ar x ../lib/libtoxav.a | ||
336 | $WINDOWS_TOOLCHAIN-ar x ../lib/libtoxdns.a | ||
337 | $WINDOWS_TOOLCHAIN-gcc -Wl,--export-all-symbols -Wl,--out-implib=libtox.dll.a -shared -o libtox.dll *.o ../lib/*.a /usr/$WINDOWS_TOOLCHAIN/lib/libwinpthread.a -lws2_32 -static-libgcc | ||
338 | ``` | ||
339 | |||
340 | And we will copy it over to the `toxbuild` directory: | ||
341 | ```bash | ||
342 | mkdir -p /media/sf_toxbuild/release/lib | ||
343 | mv libtox.dll* /media/sf_toxbuild/release/lib | ||
344 | mkdir -p /media/sf_toxbuild/release/include | ||
345 | mv ../include/tox /media/sf_toxbuild/release/include | ||
346 | ``` | ||
347 | |||
348 | That's it. Now you should have `release/lib/libtox.dll` and `release/include/tox/<headers>` in your `toxbuild` directory on the Windows system. | ||
349 | |||
350 | <a name="windows-native" /> | ||
351 | ####Native | ||
352 | |||
353 | Note that the Native instructions are incomplete, in a sense that they miss instructions needed for adding audio/video support to Tox. You also might stumble upon some unknown MinGW+msys issues while trying to build it. | ||
354 | |||
179 | You should install: | 355 | You should install: |
180 | - [MinGW](http://sourceforge.net/projects/mingw/) | 356 | - [MinGW](http://sourceforge.net/projects/mingw/) |
181 | 357 | ||
182 | When installing MinGW, make sure to select the MSYS option in the installer. | 358 | When installing MinGW, make sure to select the MSYS option in the installer. |
183 | MinGW will install an "MinGW shell" (you should get a shortcut for it), make | 359 | MinGW will install an "MinGW shell" (you should get a shortcut for it), make sure to perform all operations (i.e., generating/running configure script, compiling, etc.) from the MinGW shell. |
184 | sure to perform all operations (i.e., generating/running configure script, compiling, etc.) from the MinGW shell. | ||
185 | 360 | ||
186 | First download the source tarball from https://download.libsodium.org/libsodium/releases/ and build it. | 361 | First download the source tarball from https://download.libsodium.org/libsodium/releases/ and build it. |
187 | Assuming that you got the libsodium-0.5.0.tar.gz release: | 362 | Assuming that you got the libsodium-0.5.0.tar.gz release: |
@@ -194,8 +369,7 @@ make install | |||
194 | cd .. | 369 | cd .. |
195 | ``` | 370 | ``` |
196 | 371 | ||
197 | You can also use a precompiled win32 binary of libsodium, however you will have | 372 | You can also use a precompiled win32 binary of libsodium, however you will have to place the files in places where they can be found, i.e., dll's go to /bin headers to /include and libraries to /lib directories in your MinGW shell. |
198 | to place the files in places where they can be found, i.e., dll's go to /bin headers to /include and libraries to /lib directories in your MinGW shell. | ||
199 | 373 | ||
200 | Next, install ProjectTox-Core library, should either clone this repo by using git, or just download a [zip of current Master branch](https://github.com/irungentoo/ProjectTox-Core/archive/master.zip) and extract it somewhere. | 374 | Next, install ProjectTox-Core library, should either clone this repo by using git, or just download a [zip of current Master branch](https://github.com/irungentoo/ProjectTox-Core/archive/master.zip) and extract it somewhere. |
201 | 375 | ||
@@ -334,5 +508,4 @@ yum install ncurses-devel | |||
334 | Install on ubuntu: | 508 | Install on ubuntu: |
335 | ```bash | 509 | ```bash |
336 | sudo apt-get install ncurses-dev | 510 | sudo apt-get install ncurses-dev |
337 | ``` | 511 | ``` \ No newline at end of file |
338 | |||