diff --git a/INSTALL.md b/INSTALL.md index adab3c05..1aed5375 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,18 +1,22 @@ #Install Instructions - [Installation](#installation) - - [Unix like](#unix) - - [OS X](#osx) - - [Homebrew](#homebrew) - - [Non-Homebrew](#non-homebrew) - - [Windows](#windows) - + - [Unix like](#unix) + - [OS X](#osx) + - [Homebrew](#homebrew) + - [Non-Homebrew](#non-homebrew) + - [Windows](#windows) + - [Cross-Compile](#windows-cross-compile) + - [Setting up a VM](#windows-cross-compile-vm) + - [Setting up the environment](#windows-cross-compile-environment) + - [Compiling](#windows-cross-compile-compiling) + - [Native](#windows-native) - [Additional](#additional) - - [Advanced configure options] (#aconf) - - [A/V support](#av) - - [libtoxav] (#libtoxav) - - [Bootstrap daemon] (#bootstrapd) - - [nTox] (#ntox) + - [Advanced configure options](#aconf) + - [A/V support](#av) + - [libtoxav](#libtoxav) + - [Bootstrap daemon](#bootstrapd) + - [nTox](#ntox) ##Installation @@ -176,12 +180,182 @@ http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42 ###Windows: + + +####Cross-compile + +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. + + +#####Setting up a VM + +We will assume that you don't have any VM running Linux around and will guide you from the ground up. + +First, you would need to get a virtual machine and a Linux distribution image file. + +For a virtual machine we will use VirtualBox. You can get it [here](https://www.virtualbox.org/wiki/Downloads). + +For a Linux distribution we will use Lubuntu 14.04 32-bit, which you can get [here](https://help.ubuntu.com/community/Lubuntu/GetLubuntu). + +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. + +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. + +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. + +Start the VM and follow the installation instructions. + +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...**. + +Open terminal from **Lubuntu's menu** -> **Accessories**. + +Execute: +```bash +sudo apt-get update +sudo apt-get install build-essential -y +cd /media/*/*/ +sudo ./VBoxLinuxAdditions.run +``` + +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. + +Execute: +```bash +sudo adduser `whoami` vboxsf +``` +Note the use of a [grave accent](http://en.wikipedia.org/wiki/Grave_accent) instead of an apostrophe. + +Then just reboot the system with: +```bash +sudo reboot +``` + +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. + +Now that the virtual machine is all set up, let's move to getting build dependencies and setting up environment variables. + + +#####Setting up the environment + +First we will install all tools that we would need for building: +```bash +sudo apt-get install build-essential libtool autotools-dev automake checkinstall check git yasm pkg-config mingw-w64 -y +``` + +Then we will define a few variables, **depending on which you will build either 32-bit or 64-bit Tox**. + +For 32-bit Tox build, do: +```bash +WINDOWS_TOOLCHAIN=i686-w64-mingw32 +LIB_VPX_TARGET=x86-win32-gcc +``` + +For 64-bit Tox build, do: +```bash +WINDOWS_TOOLCHAIN=x86_64-w64-mingw32 +LIB_VPX_TARGET=x86_64-win64-gcc +``` + +This is the only difference between 32-bit and 64-bit build procedures. + +For speeding up the build process do: +``` +MAKEFLAGS=j$(nproc) +export MAKEFLAGS +``` + +And let's make a folder where we will be building everything at +```bash +cd ~ +mkdir prefix +cd prefix +PREFIX_DIR=$(pwd) +cd .. +mkdir build +cd build +``` + + +#####Compiling + +Now we will build libraries needed for audio/video: VPX and Opus. + +VPX: +```bash +git clone http://git.chromium.org/webm/libvpx.git +cd libvpx +git checkout tags/v1.3.0 +CROSS="$WINDOWS_TOOLCHAIN"- ./configure --target="$LIB_VPX_TARGET" --prefix="$PREFIX_DIR" --disable-examples --disable-unit-tests --disable-shared --enable-static +make +make install +cd .. +``` + +Opus: +```bash +wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz +tar -xf opus-1.1.tar.gz +cd opus-1.1 +./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-extra-programs --disable-doc --disable-shared --enable-static +make +make install +cd .. +``` + +Now we will build sodium crypto library: +```bash +git clone https://github.com/jedisct1/libsodium/ +cd libsodium +git checkout tags/0.4.5 +./autogen.sh +./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-shared --enable-static +make +make install +cd .. +``` + +And finally we will build Tox: +```bash +git clone https://github.com/irungentoo/toxcore +cd toxcore +./autogen.sh +./configure --host="$WINDOWS_TOOLCHAIN" --prefix="$PREFIX_DIR" --disable-ntox --disable-tests --disable-testing --with-dependency-search="$PREFIX_DIR" --disable-shared --enable-static +make +make install +cd .. +``` + +Then we make Tox shared library: +```bash +cd "$PREFIX_DIR" +mkdir tmp +cd tmp +$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxcore.a +$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxav.a +$WINDOWS_TOOLCHAIN-ar x ../lib/libtoxdns.a +$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 +``` + +And we will copy it over to the `toxbuild` directory: +```bash +mkdir -p /media/sf_toxbuild/release/lib +mv libtox.dll* /media/sf_toxbuild/release/lib +mkdir -p /media/sf_toxbuild/release/include +mv ../include/tox /media/sf_toxbuild/release/include +``` + +That's it. Now you should have `release/lib/libtox.dll` and `release/include/tox/` in your `toxbuild` directory on the Windows system. + + +####Native + +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. + You should install: - [MinGW](http://sourceforge.net/projects/mingw/) When installing MinGW, make sure to select the MSYS option in the installer. -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. +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. First download the source tarball from https://download.libsodium.org/libsodium/releases/ and build it. Assuming that you got the libsodium-0.5.0.tar.gz release: @@ -194,8 +368,7 @@ make install cd .. ``` -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. +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. 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. @@ -335,4 +508,3 @@ Install on ubuntu: ```bash sudo apt-get install ncurses-dev ``` -