@node Build instructions for Ubuntu 12.04 using Git
@section Build instructions for Ubuntu 12.04 using Git

@menu
* Install the required build tools::
* Install libgcrypt 1.6 and libgpg-error::
* Install gnutls with DANE support::
* Install libgnurl::
* Install libmicrohttpd from Git::
* Install libextractor from Git::
* Install GNUnet dependencies::
* Build GNUnet::
* Install the GNUnet-gtk user interface from Git::
@end menu

@node  Install the required build tools
@subsection  Install the required build tools

First, make sure Git is installed on your system:

@example
$ sudo apt-get install git
@end example

Install the essential buildtools:

@example
$ sudo apt-get install automake autopoint autoconf libtool
@end example

@node Install libgcrypt 1.6 and libgpg-error
@subsection Install libgcrypt 1.6 and libgpg-error

@ref{generic source installation - libgpg-error}

@node Install gnutls with DANE support
@subsection Install gnutls with DANE support

@itemize @bullet
@item @ref{generic source installation - nettle}
@item @ref{generic source installation - ldns}
@item @ref{generic source installation - libunbound/unbound}
@item @ref{generic source installation - gnutls}
@item @ref{generic source installation - libgcrypt}
@end itemize

@node Install libgnurl
@subsection Install libgnurl

Follow the @ref{generic source installation - libgnurl}.

@node Install libmicrohttpd from Git
@subsection Install libmicrohttpd from Git

@example
$ git clone https://gnunet.org/git/libmicrohttpd
$ cd libmicrohttpd/
$ ./bootstrap
$ ./configure
$ sudo make install ; cd ..
@end example

@node  Install libextractor from Git
@subsection  Install libextractor from Git

Install libextractor dependencies:

@example
$ sudo apt-get install zlib1g-dev libgsf-1-dev libmpeg2-4-dev \
 libpoppler-dev libvorbis-dev libexiv2-dev libjpeg-dev \
 libtiff-dev libgif-dev libvorbis-dev libflac-dev libsmf-dev \
 g++
@end example

Build libextractor:

@example
$ git clone https://gnunet.org/git/libextractor
$ cd libextractor
$ ./bootstrap
$ ./configure
$ sudo make install ; cd ..
@end example

@node Install GNUnet dependencies
@subsection Install GNUnet dependencies

@example
$ sudo apt-get install libidn11-dev libunistring-dev libglpk-dev \
 libpulse-dev libbluetooth-dev libsqlite-dev
@end example

Install libopus:

@example
$ wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
$ tar xf opus-1.1.tar.gz
$ cd opus-1.1/
$ ./configure
$ sudo make install ; cd ..
@end example

Choose one or more database backends:

SQLite3:
@example
$ sudo apt-get install libsqlite3-dev
@end example
MySQL:
@example
$ sudo apt-get install libmysqlclient-dev
@end example
PostgreSQL:
@example
$ sudo apt-get install libpq-dev postgresql
@end example



@node Build GNUnet
@subsection Build GNUnet



@menu
* Configuring the installation path::
* Configuring the system::
* Installing components requiring sudo permission::
* Build::
@end menu

@node Configuring the installation path
@subsubsection Configuring the installation path

You can specify the location of the GNUnet installation by setting the
prefix when calling the configure script with @code{--prefix=DIRECTORY}

@example
$ export PATH=$PATH:DIRECTORY/bin
@end example

@node Configuring the system
@subsubsection Configuring the system

Please make sure NOW that you have created a user and group 'gnunet'
and additionally a group 'gnunetdns':

@example
$ sudo addgroup gnunet
$ sudo addgroup gnunetdns
$ sudo adduser gnunet
@end example

Each GNUnet user should be added to the 'gnunet' group (may
require fresh login to come into effect):

@example
$ sudo useradd -G  gnunet
@end example

@node Installing components requiring sudo permission
@subsubsection Installing components requiring sudo permission

Some components, like the nss plugin required for GNS, may require root
permissions. To allow these few components to be installed use:

@example
$ ./configure --with-sudo
@end example

@node Build
@subsubsection Build

@example
$ git clone https://gnunet.org/git/gnunet/
$ cd gnunet/
$ ./bootstrap
@end example

Use the required configure call including the optional installation prefix
@code{PREFIX} or the sudo permissions:

@example
$ ./configure [ --with-sudo | --with-prefix=PREFIX ]
@end example

@example
$ make; sudo make install
@end example

After installing it, you need to create an empty configuration file:

@example
mkdir ~/.gnunet; touch ~/.gnunet/gnunet.conf
@end example

And finally you can start GNUnet with:

@example
$ gnunet-arm -s
@end example

@node Install the GNUnet-gtk user interface from Git
@subsection Install the GNUnet-gtk user interface from Git


Install depencies:

@example
$ sudo apt-get install libgtk-3-dev libunique-3.0-dev libgladeui-dev \
 libqrencode-dev
@end example

Build GNUnet (with an optional prefix) and execute:

@example
$ git clone https://gnunet.org/git/gnunet-gtk/
$ cd gnunet-gtk/
$ ./bootstrap
$ ./configure [--prefix=PREFIX] --with-gnunet=DIRECTORY
$ make; sudo make install
@end example

@node Build Instructions for Microsoft Windows Platforms
@section Build Instructions for Microsoft Windows Platforms

@menu
* Introduction to building on MS Windows::
* Requirements::
* Dependencies & Initial Setup::
* GNUnet Installation::
* Adjusting Windows for running and testing GNUnet::
* Building the GNUnet Installer::
* Using GNUnet with Netbeans on Windows::
@end menu

@node Introduction to building on MS Windows
@subsection Introduction to building on MS Windows


This document is a guide to building GNUnet and its dependencies on
Windows platforms. GNUnet development is mostly done under GNU/Linux and
especially git checkouts may not build out of the box.
We regret any inconvenience, and if you have problems, please report
them.

@node Requirements
@subsection Requirements

The Howto is based upon a @strong{Windows Server 2008 32bit}
@strong{Installation}, @strong{sbuild} and thus a
@uref{http://www.mingw.org/wiki/MSYS, MSYS+MinGW}
(W32-GCC-Compiler-Suite + Unix-like Userland) installation. sbuild
is a convenient set of scripts which creates a working msys/mingw
installation and installs most dependencies required for GNUnet.

As of the point of the creation of these instructions,
GNUnet @strong{requires} a Windows @strong{Server} 2003 or
newer for full feature support.
Windows Vista and later will also work, but
@strong{non-server version can not run a VPN-Exit-Node} as the NAT
features have been removed as of Windows Vista.

@c TODO: We should document Windows 10!
@c It seems like the situation hasn't changed with W10

@node Dependencies & Initial Setup
@subsection Dependencies & Initial Setup


@itemize @bullet

@item
Install a fresh version of @strong{Python 2.x}, even if you are using a
x64-OS, install a 32-bit version for use with sbuild.
Python 3.0 is currently incompatible.

@item
Install your favorite @uref{http://code.google.com/p/tortoisegit/, git} &
@uref{http://tortoisesvn.net/, subversion}-clients.

@item
You will also need some archive-manager like
@uref{http://www.7-zip.org/, 7zip}.

@item
Pull a copy of sbuild to a directory of your choice, which will be used
in the remainder of this guide. For now, we will use
@file{c:\gnunet\sbuild\}

@item
in @file{sbuild\src\mingw\mingw32-buildall.sh}, comment out the packages
@strong{gnunet-svn} and @strong{gnunet-gtk-svn}, as we don't want sbuild
to compile/install those for us.

@item
Follow LRN's sbuild installation instructions.-
@end itemize

Please note that sbuild may (or will most likely) fail during
installation, thus you really HAVE to @strong{check the logfiles} created
during the installation process.
Certain packages may fail to build initially due to missing dependencies,
thus you may have to
@strong{substitute those with binary-versions initially}. Later on once
dependencies are satisfied you can re-build the newer package versions.

@strong{It is normal that you may have to repeat this step multiple times
and there is no uniform way to fix all compile-time issues, as the
build-process of many of the dependencies installed are rather unstable
on win32 and certain releases may not even compile at all.}

Most dependencies for GNUnet have been set up by sbuild, thus we now
should add the @file{bin/} directories in your new msys and mingw
installations to PATH. You will want to create a backup of your finished
msys-environment by now.

@node GNUnet Installation
@subsection GNUnet Installation

First, we need to launch our msys-shell, you can do this via

@file{C:\gnunet\sbuild\msys\msys.bat}

You might wish to take a look at this file and adjust some
login-parameters to your msys environment.

Also, sbuild added two pointpoints to your msys-environment, though those
might remain invisible:

@itemize @bullet

@item
/mingw, which will mount your mingw-directory from sbuild/mingw and the
other one is

@item
/src which contains all the installation sources sbuild just compiled.
@end itemize

Check out the current GNUnet sources (git HEAD) from the
GNUnet repository "gnunet.git", we will do this in your home directory:

@code{git clone https://gnunet.org/git/gnunet/ ~/gnunet}

Now, we will first need to bootstrap the checked out installation and then
configure it accordingly.

@example
cd ~/gnunet
./bootstrap
STRIP=true CPPFLAGS="-DUSE_IPV6=1 -DW32_VEH" CFLAGS="$CFLAGS -g -O2" \
./configure --prefix=/ --docdir=/share/doc/gnunet \
--with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw \
--with-libcurl=/mingw --with-extractor=/mingw --with-sqlite=/mingw \
--with-microhttpd=/mingw --with-plibc=/mingw --enable-benchmarks \
--enable-expensivetests --enable-experimental --with-qrencode=/mingw \
--enable-silent-rules --enable-experimental 2>&1 | tee -a ./configure.log
@end example

The parameters above will configure for a reasonable GNUnet installation
to the your msys-root directory.
Depending on which features your would like to build or you may need to
specify additional dependencies. Sbuild installed most libs into
the /mingw subdirectory, so remember to prefix library locations with
this path.

Like on a unixoid system, you might want to use your home directory as
prefix for your own GNUnet installation for development, without tainting
the buildenvironment. Just change the "prefix" parameter to point towards
~/ in this case.

Now it's time to compile GNUnet as usual. Though this will take some time,
so you may fetch yourself a coffee or some Mate now...

@example
make ; make install
@end example

@node Adjusting Windows for running and testing GNUnet
@subsection Adjusting Windows for running and testing GNUnet

Assuming the build succeeded and you
@strong{added the bin directory of your GNUnet to PATH}, you can now use
your gnunet-installation as usual.
Remember that UAC or the windows firewall may popup initially, blocking
further execution of gnunet until you acknowledge them.

You will also have to take the usual steps to get peer-to-peer (p2p)
software running properly (port forwarding, ...),
and GNUnet will require administrative permissions as it may even
install a device-driver (in case you are using gnunet-vpn and/or
gnunet-exit).

@node Building the GNUnet Installer
@subsection Building the GNUnet Installer

The GNUnet installer is made with
@uref{http://nsis.sourceforge.net/, NSIS}.
The installer script is located in @file{contrib\win} in the
GNUnet source tree.

@node Using GNUnet with Netbeans on Windows
@subsection Using GNUnet with Netbeans on Windows

TODO

@node Build instructions for Debian 7.5
@section Build instructions for Debian 7.5


These are the installation instructions for Debian 7.5. They were tested
using a minimal, fresh Debian 7.5 AMD64 installation without non-free
software (no contrib or non-free).
By "minimal", we mean that during installation, we did not select any
desktop environment, servers or system utilities during the "tasksel"
step. Note that the packages and the dependencies that we will install
during this chapter take about 1.5 GB of disk space.
Combined with GNUnet and space for objects during compilation, you should
not even attempt this unless you have about 2.5 GB free after the minimal
Debian installation.
Using these instructions to build a VM image is likely to require a
minimum of 4-5 GB for the VM (as you will likely also want a desktop
manager).

GNUnet's security model assumes that your @file{/home} directory is
encrypted. Thus, if possible, you should encrypt your home partition
(or per-user home directory).

Naturally, the exact details of the starting state for your installation
should not matter much. For example, if you selected any of those
installation groups you might simply already have some of the necessary
packages installed.
We did this for testing, as this way we are less likely to forget to
mention a required package.
Note that we will not install a desktop environment, but of course you
will need to install one to use GNUnet's graphical user interfaces.
Thus, it is suggested that you simply install the desktop environment of
your choice before beginning with the instructions.



@menu
* Update::
* Stable? Hah!::
* Update again::
* Installing packages::
* Installing dependencies from source::
* Installing GNUnet from source::
* But wait there is more!::
@end menu

@node Update
@subsection Update

After any installation, you should begin by running

@example
# apt-get update ; apt-get upgrade
@end example

to ensure that all of your packages are up-to-date. Note that the "#" is
used to indicate that you need to type in this command as "root"
(or prefix with "sudo"), whereas "$" is used to indicate typing in a
command as a normal user.

@node Stable? Hah!
@subsection Stable? Hah!

Yes, we said we start with a Debian 7.5 "stable" system. However, to
reduce the amount of compilation by hand, we will begin by allowing the
installation of packages from the testing and unstable distributions as
well.
We will stick to "stable" packages where possible, but some packages will
be taken from the other distributions.
Start by modifying @file{/etc/apt/sources.list} to contain the
following (possibly adjusted to point to your mirror of choice):

@example
# These were there before:
deb http://ftp.de.debian.org/debian/ wheezy main
deb-src http://ftp.de.debian.org/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
deb http://ftp.de.debian.org/debian/ wheezy-updates main
deb-src http://ftp.de.debian.org/debian/ wheezy-updates main

# Add these lines (feel free to adjust the mirror):
deb http://ftp.de.debian.org/debian/ testing main
deb http://ftp.de.debian.org/debian/ unstable main
@end example

The next step is to create/edit your @file{/etc/apt/preferences}
file to look like this:

@example
Package: *
Pin: release a=stable,n=wheezy
Pin-Priority: 700

Package: *
Pin: release o=Debian,a=testing
Pin-Priority: 650

Package: *
Pin: release o=Debian,a=unstable
Pin-Priority: 600
@end example

You can read more about Apt Preferences here and here.
Note that other pinnings are likely to also work for GNUnet, the key
thing is that you need some packages from unstable (as shown below).
However, as unstable is unlikely to be comprehensive (missing packages)
or might be problematic (crashing packages), you probably want others
from stable and/or testing.

@node Update again
@subsection Update again

Now, run again@

@example
# apt-get update@
# apt-get upgrade@
@end example

to ensure that all your new distribution indices are downloaded, and
that your pinning is correct: the upgrade step should cause no changes
at all.

@node Installing packages
@subsection Installing packages

We begin by installing a few Debian packages from stable:@

@example
# apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \
  libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev \
  texlive libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev \
  libbz2-dev libexiv2-dev libflac-dev libgif-dev libglib2.0-dev \
  libgtk-3-dev libmagic-dev libjpeg8-dev libmpeg2-4-dev libmp4v2-dev \
  librpm-dev libsmf-dev libtidy-dev libtiff5-dev libvorbis-dev \
  libogg-dev zlib1g-dev g++ gettext libgsf-1-dev libunbound-dev \
  libqrencode-dev libgladeui-dev nasm texlive-latex-extra \
  libunique-3.0-dev gawk miniupnpc libfuse-dev libbluetooth-dev
@end example

After that, we install a few more packages from unstable:@

@example
# apt-get install -t unstable nettle-dev libgstreamer1.0-dev \
  gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
  libgstreamer-plugins-base1.0-dev
@end example

@node Installing dependencies from source
@subsection Installing dependencies from source

Next, we need to install a few dependencies from source.
You might want to do this as a "normal" user and only run the
@code{make install} steps as root (hence the @code{sudo} in the
commands below). Also, you do this from any
directory. We begin by downloading all dependencies, then extracting the
sources, and finally compiling and installing the libraries.

For these steps, follow the instructions given in the
installation from source instruction in this order:

@itemize @bullet
@item @ref{generic source installation - libav}
@item @ref{generic source installation - libextractor}
@item @ref{generic source installation - libgpg-error}
@item @ref{generic source installation - libgcrypt}
@item @ref{generic source installation - gnutls}
@item @ref{generic source installation - libmicrohttpd}
@item @ref{generic source installation - libgnurl}
@end itemize

@node Installing GNUnet from source
@subsection Installing GNUnet from source


For this, simply follow the generic installation instructions from
here.

@node But wait there is more!
@subsection But wait there is more!

So far, we installed all of the packages and dependencies required to
ensure that all of GNUnet would be built.
However, while for example the plugins to interact with the MySQL or
Postgres databases have been created, we did not actually install or
configure those databases. Thus, you will need to install
and configure those databases or stick with the default Sqlite database.
Sqlite is usually fine for most applications, but MySQL can offer better
performance and Postgres better resillience.


@node Installing GNUnet from Git on Ubuntu 14.4
@section Installing GNUnet from Git on Ubuntu 14.4

@strong{Install the required build tools:}

@example
$ sudo apt-get install git automake autopoint autoconf
@end example

@strong{Install the required dependencies}

@example
$ sudo apt-get install libltdl-dev libgpg-error-dev libidn11-dev \
 libunistring-dev libglpk-dev libbluetooth-dev libextractor-dev \
 libmicrohttpd-dev libgnutls28-dev
@end example

@strong{Choose one or more database backends}

@itemize @bullet

@item SQLite3:

@example
$ sudo apt-get install libsqlite3-dev
@end example

@item MySQL:

@example
$ sudo apt-get install libmysqlclient-dev
@end example

@item PostgreSQL:

@example
$ sudo apt-get install libpq-dev postgresql
@end example

@end itemize

@strong{Install the optional dependencies for gnunet-conversation:}

@example
$ sudo apt-get install gstreamer1.0 libpulse-dev libopus-dev
@end example

@strong{Install the libgrypt 1.6.1:}

@itemize @bullet

@item For Ubuntu 14.04:

@example
$ sudo apt-get install libgcrypt20-dev
@end example

@item For Ubuntu older 14.04:

@example
$ wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.1.tar.bz2
$ tar xf libgcrypt-1.6.1.tar.bz2
$ cd libgcrypt-1.6.1
$ ./configure
$ sudo make install
$ cd ..
@end example

@end itemize

@strong{Install libgnurl}

@strong{Install GNUnet}

@example
$ git clone https://gnunet.org/git/gnunet/
$ cd gnunet/
$ ./bootstrap
@end example

If you want to:

@itemize @bullet

@item Install to a different directory:

@example
--prefix=PREFIX
@end example

@item
Have sudo permission, but do not want to compile as root:

@example
--with-sudo
@end example

@item
Want debug message enabled:

@example
--enable-logging=verbose
@end example

@end itemize


@example
$ ./configure [ --with-sudo | --prefix=PREFIX | --enable-logging=verbose]
$ make; sudo make install
@end example

After installing it, you need to create an empty configuration file:

@example
touch ~/.config/gnunet.conf
@end example

And finally you can start GNUnet with

@example
$ gnunet-arm -s
@end example

@node Build instructions for Debian 8
@section Build instructions for Debian 8
@c FIXME: I -> we

These are the installation instructions for Debian 8. They were tested
sing a fresh Debian 8 AMD64 installation without non-free software (no
contrib or non-free). During installation, I only selected "lxde" for the
desktop environment.
Note that the packages and the dependencies that we will install during
this chapter take about 1.5 GB of disk space. Combined with GNUnet and
space for objects during compilation, you should not even attempt this
unless you have about 2.5 GB free after the Debian installation.
Using these instructions to build a VM image is likely to require a
minimum of 4-5 GB for the VM (as you will likely also want a desktop
manager).

GNUnet's security model assumes that your @code{/home} directory is
encrypted.
Thus, if possible, you should encrypt your entire disk, or at least just
your home partition (or per-user home directory).

Naturally, the exact details of the starting state for your installation
should not matter much.
For example, if you selected any of those installation groups you might
simply already have some of the necessary packages installed. Thus, it is
suggested that you simply install the desktop environment of your choice
before beginning with the instructions.


@menu
* Update Debian::
* Installing Debian Packages::
* Installing Dependencies from Source2::
* Installing GNUnet from Source2::
* But wait (again) there is more!::
@end menu

@node Update Debian
@subsection Update Debian

After any installation, you should begin by running

@example
# apt-get update
# apt-get upgrade
@end example

to ensure that all of your packages are up-to-date. Note that the "#" is
used to indicate that you need to type in this command as "root" (or
prefix with "sudo"), whereas "$" is used to indicate typing in a command
as a normal user.

@node Installing Debian Packages
@subsection Installing Debian Packages

We begin by installing a few Debian packages from stable:

@example
# apt-get install gcc make python-zbar libltdl-dev libsqlite3-dev \
libunistring-dev libopus-dev libpulse-dev openssl libglpk-dev texlive \
libidn11-dev libmysqlclient-dev libpq-dev libarchive-dev libbz2-dev \
libflac-dev libgif-dev libglib2.0-dev libgtk-3-dev libmpeg2-4-dev \
libtidy-dev libvorbis-dev libogg-dev zlib1g-dev g++ gettext \
libgsf-1-dev libunbound-dev libqrencode-dev libgladeui-dev nasm \
texlive-latex-extra libunique-3.0-dev gawk miniupnpc libfuse-dev \
libbluetooth-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
libgstreamer-plugins-base1.0-dev nettle-dev libextractor-dev \
libgcrypt20-dev libmicrohttpd-dev
@end example

@node Installing Dependencies from Source2
@subsection Installing Dependencies from Source2

Yes, we said we start with a Debian 8 "stable" system, but because Debian
linked GnuTLS without support for DANE, we need to compile a few things,
in addition to GNUnet, still by hand. Yes, you can run GNUnet using the
respective Debian packages, but then you will not get DANE support.

Next, we need to install a few dependencies from source. You might want
to do this as a "normal" user and only run the @code{make install} steps
as root (hence the @code{sudo} in the commands below). Also, you do this
from any directory. We begin by downloading all dependencies, then
extracting the sources, and finally compiling and installing the
libraries:

@example
$ wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.12.tar.xz
$ tar xvf gnutls-3.3.12.tar.xz
$ cd gnutls-3.3.12 ; ./configure ; make ; sudo make install ; cd ..
@end example

For the installation and compilation of libgnurl/gnURL refer to
the generic installation section,
@xref{generic source installation - libgnurl}.

@node Installing GNUnet from Source2
@subsection Installing GNUnet from Source2

For this, simply follow the generic installation instructions from@
here.

@node But wait (again) there is more!
@subsection But wait (again) there is more!

So far, we installed all of the packages and dependencies required to
ensure that all of GNUnet would be built. However, while for example the
plugins to interact with the MySQL or Postgres databases have been
created, we did not actually install or configure those databases.
Thus, you will need to install and configure those databases or stick
with the default Sqlite database. Sqlite is usually fine for most
applications, but MySQL can offer better performance and Postgres better
resillience.

@node Build instructions for macOS
@section Build instructions for macOS
@c FIXME: I -> we

These are the installation guidelines for macOS.
They were tested on macOS High Sierra.

@menu
* Installing dependencies::
* Compile from Source::
@end menu

@node Installing dependencies
@subsection Installing dependencies

First, install XCode in the newest version.
See https://developer.apple.com/xcode/.

Install Homebrew (https://brew.sh) and then install the dependencies listed above.
If a dependency does not exists in brew, you need to compile it from source.

@example
# brew install <dependency>
@end example

@node Compile from Source
@subsection Compile from Source

Before you start building GNUnet, you need to setup your environment.
This means that you have to make sure the proper tools are used in the build process.
For example, after installing texinfo you need to make sure the new texinfo is actually used:

@example
# echo 'export PATH="/usr/local/opt/texinfo/bin:$PATH"' >> ~/.bash_profile 
@end example

Note: brew tells you the appropriate command when executing

@example
# brew info texinfo
@end example

This may also be necessary for the gettext package.

Before you start compiling, you need to make sure gcc is used and not the clang compile of your macOS system.
On my system, gcc was actually ``gcc-7'' and gcc pointed to the clang compiler.

@example
# export CC=gcc-7
@end example

After this the standard compile instructions apply.

@c @node Build instructions for OpenBSD 6.2
@c @section Build instructions for OpenBSD 6.2

@node Outdated build instructions for previous revisions
@section Outdated build instructions for previous revisions

This chapter contains a collection of outdated, older installation guides.
They are mostly intended to serve as a starting point for writing
up-to-date instructions and should not be expected to work for
GNUnet 0.10.x.
A set of older installation instructions can also be found in the
file @file{doc/outdated-and-old-installation-instructions.txt} in the
source tree of GNUnet.

This file covers old instructions which no longer receive security
updates or any kind of support.

@menu
* Installing GNUnet 0.10.1 on Ubuntu 14.04::
* Building GLPK for MinGW::
* GUI build instructions for Ubuntu 12.04 using Subversion::
@c * Installation with gnunet-update::
* Instructions for Microsoft Windows Platforms (Old)::
@end menu


@node Installing GNUnet 0.10.1 on Ubuntu 14.04
@subsection Installing GNUnet 0.10.1 on Ubuntu 14.04

Install the required dependencies:

@example
$ sudo apt-get install libltdl-dev libgpg-error-dev libidn11-dev \
 libunistring-dev libglpk-dev libbluetooth-dev libextractor-dev \
 libmicrohttpd-dev libgnutls28-dev
@end example

Choose one or more database backends:

@itemize @bullet

@item SQLite3

@example
 $ sudo apt-get install libsqlite3-dev@
@end example

@item MySQL

@example
$ sudo apt-get install libmysqlclient-dev@
@end example

@item PostgreSQL

@example
 $ sudo apt-get install libpq-dev postgresql@
@end example

@end itemize

Install the optional dependencies for gnunet-conversation:

@example
 $ sudo apt-get install gstreamer1.0 libpulse-dev libopus-dev
@end example

Install libgcrypt 1.6:

@itemize @bullet

@item For Ubuntu 14.04:

@example
$ sudo apt-get install libgcrypt20-dev
@end example

@item For Ubuntu older than 14.04:

@example
wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.1.tar.bz2
$ tar xf libgcrypt-1.6.1.tar.bz2
$ cd libgcrypt-1.6.1
$ ./configure
$ sudo make install
$ cd ..
@end example
@end itemize

Install libgnurl:

@pxref{generic source installation - libgnurl}.

Install GNUnet:

@example
$ wget http://ftpmirror.gnu.org/gnunet/gnunet-0.10.1.tar.gz
$ tar xf gnunet-0.10.1.tar.gz
$ cd gnunet-0.10.1
@end example

If you want to:

@itemize @bullet

@item
Install to a different directory:

@example
--prefix=PREFIX
@end example

@item
Have sudo permission, but do not want to compile as root:

@example
--with-sudo
@end example

@item
Want debug message enabled:

@example
--enable-logging=verbose
@end example

@end itemize

@example
$ ./configure [ --with-sudo | --prefix=PREFIX | --enable-logging=verbose]
$ make; sudo make install
@end example

After installing it, you need to create an empty configuration file:

@example
touch ~/.config/gnunet.conf
@end example

And finally you can start GNUnet with

@example
$ gnunet-arm -s
@end example

@node Building GLPK for MinGW
@subsection Building GLPK for MinGW

GNUnet now requires the GNU Linear Programming Kit (GLPK).
Since there's is no package you can install with @code{mingw-get} you
have to compile it from source:

@itemize @bullet

@item Download the latest version from
@uref{http://ftp.gnu.org/gnu/glpk/}

@item Unzip the downloaded source tarball using your favourite
unzipper application In the MSYS shell

@item change to the respective directory

@item Configure glpk for "i686-pc-mingw32":

@example
./configure '--build=i686-pc-mingw32'
@end example

@item run

@example
make install check
@end example

@end itemize

MinGW does not automatically detect the correct buildtype so you have to
specify it manually.


@node GUI build instructions for Ubuntu 12.04 using Subversion
@subsection GUI build instructions for Ubuntu 12.04 using Subversion

After installing GNUnet you can continue installing the GNUnet GUI tools:

First, install the required dependencies:

@example
$ sudo apt-get install libgladeui-dev libqrencode-dev
@end example

Please ensure that the GNUnet shared libraries can be found by the linker.
If you installed GNUnet libraries in a non standard path
(say GNUNET_PREFIX=/usr/local/lib/), you can

@itemize @bullet

@item set the environmental variable permanently to:

@example
LD_LIBRARY_PATH=$GNUNET_PREFIX
@end example

@item or add @code{$GNUNET_PREFIX} to @file{/etc/ld.so.conf}

@end itemize

Now you can checkout and compile the GNUnet GUI tools:

@example
$ git clone https://gnunet.org/git/gnunet-gtk
$ cd gnunet-gtk
$ ./bootstrap
$ ./configure --prefix=$GNUNET_PREFIX/.. --with-gnunet=$GNUNET_PREFIX/..
$ make install
@end example

@node Instructions for Microsoft Windows Platforms (Old)
@subsection Instructions for Microsoft Windows Platforms (Old)

This document is a @b{DEPRECATED} installation guide for GNUnet on
Windows.
It will not work for recent GNUnet versions, but maybe it will be of
some use if problems arise.

The Windows build uses a UNIX emulator for Windows,
@uref{http://www.mingw.org/, MinGW}, to build the executable modules.
These modules run natively on Windows and do not require additional
emulation software besides the usual dependencies.

GNUnet development is mostly done under GNU/Linux and especially git
checkouts may not build out of the box.
We regret any inconvenience, and if you have problems, please report them.

@menu
* Hardware and OS requirements::
* Software installation::
* Building libextractor and GNUnet::
* Installer::
* Source::
@end menu

@node Hardware and OS requirements
@subsubsection Hardware and OS requirements

@itemize @bullet
@item Pentium II or equivalent processor, @geq{} 350 MHz
@item 128 MB RAM
@item 600 MB free disk space
@item Windows 2000 or Windows XP are recommended
@end itemize

@node Software installation
@subsubsection Software installation

@itemize @bullet

@item
@strong{Compression software}@

The software packages GNUnet depends on are usually compressed using UNIX
tools like @command{tar}, @command{gzip}, @command{xzip} and
@command{bzip2}.
If you do not already have an utility that is able to extract such
archives, get @uref{http://www.7-zip.org/, 7-Zip}.

@item
@strong{UNIX environment}@

The MinGW project provides the compiler toolchain that is used to build
GNUnet.
Get the following packages from the
@uref{http://sourceforge.net/projects/mingw/files/, MinGW} project:

@itemize @bullet

@item GCC core
@item GCC g++
@item MSYS
@item MSYS Developer Tool Kit (msysDTK)
@item MSYS Developer Tool Kit - msys-autoconf (bin)
@item MSYS Developer Tool Kit - msys-automake (bin)
@item MinGW Runtime
@item MinGW Utilities
@item Windows API
@item Binutils
@item make
@item pdcurses
@item GDB (snapshot)
@end itemize

@itemize @bullet


@item Install MSYS (to c:\mingw, for example.)@
Do @strong{not} use spaces in the pathname.
For example, avoid a location such as @file{c:\program files\mingw}.

@item Install MinGW runtime, utilities and GCC to a subdirectory
(to @file{c:\mingw\mingw}, for example)

@item Install the Development Kit to the MSYS directory
(@file{c:\mingw})

@item Create a batch file bash.bat in your MSYS directory with
the files:

@example
bin\sh.exe --login
@end example

This batch file opens a shell which is used to invoke the build
processes.
MinGW's standard shell (@command{msys.bat}) is not suitable
because it opens a separate console window.
On Vista, @command{bash.bat} needs to be run as Administrator.

@item
Start @command{bash.sh} and rename
@file{c:\mingw\mingw\lib\libstdc++.la} to avoid problems:

@example
mv /usr/mingw/lib/libstdc++.la /usr/mingw/lib/libstdc++.la.broken
@end example

@item
Unpack the Windows API to the MinGW directory (@file{c:\mingw\mingw\}) and
remove the declaration of DATADIR from
(@file{c:\mingw\mingw\include\objidl.h} (lines 55-58)

@item
Unpack autoconf, automake to the MSYS directory (@file{c:\mingw})

@item
Install all other packages to the MinGW directory (@file{c:\mingw\mingw\})
@end itemize


@item @strong{GNU Libtool}@
GNU Libtool is required to use shared libraries.
Get the prebuilt package from here and unpack it to the
MinGW directory (@file{c:\mingw})

@item @strong{Pthreads}@
GNUnet uses the portable POSIX thread library for multi-threading:

@itemize @bullet

@item Save
@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/libpthreadGC2.a, libpthreadGC2.a}
(x86) or
@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/libpthreadGC2.a, libpthreadGC2.a}
(x64) as libpthread.a into the @file{lib}
directory (@file{c:\mingw\mingw\lib\libpthread.a}).

@item Save
@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/pthreadGC2.dll, pthreadGC2.dll}
(x86) or
@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/pthreadGC2.dll, libpthreadGC2.a}
(x64) into the MinGW @file{bin} directory (@file{c:\mingw\mingw\bin}).

@item Download all header files from
@uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/, include/}
to the @file{include} directory (@file{c:\mingw\mingw\include}).
@end itemize


@item @strong{GNU MP}@
GNUnet uses the GNU Multiple Precision library for special cryptographic
operations. Get the GMP binary package from the
@uref{http://sourceforge.net/projects/mingwrep/, MinGW repository} and
unpack it to the MinGW directory (@file{c:\mingw\mingw})

@item @strong{GNU Gettext}@
GNU gettext is used to provide national language support.
Get the prebuilt package from hereand unpack it to the MinGW
directory (@file{c:\mingw\mingw})

@item @strong{GNU iconv}@
GNU Libiconv is used for character encoding conversion.
Get the prebuilt package from here and unpack it to the MinGW
directory (@file{c:\mingw\mingw}).

@item @strong{SQLite}@
GNUnet uses the SQLite database to store data.
Get the prebuilt binary from here and unpack it to your MinGW directory.

@item @strong{MySQL}@
As an alternative to SQLite, GNUnet also supports MySQL.

@itemize @bullet

@item Get the binary installer from the
@uref{http://dev.mysql.com/downloads/mysql/4.1.html#Windows, MySQL project}
(version 4.1), install it and follow the instructions in
@file{README.mysql}.

@item  Create a temporary build directory (@file{c:\mysql})

@item Copy the directories @file{include\} and @file{lib\} from the
MySQL directory to the new directory

@item Get the patches from
@uref{http://bugs.mysql.com/bug.php?id=8906&files=1, Bug #8906} and
@uref{http://bugs.mysql.com/bug.php?id=8872&files=1, Bug #8872} (the
latter is only required for MySQL

@example
patch -p 0
@end example

@item Move @file{lib\opt\libmysql.dll} to @file{lib\libmysql.dll}

@item  Change to @file{lib\} and create an import library:

@example
dlltool --input-def ../include/libmySQL.def \
--dllname libmysql.dll \
--output-lib libmysqlclient.a -k
@end example

@item  Copy include\* to include\mysql\

@item  Pass @code{--with-mysql=/c/mysql} to
@command{./configure} and copy @file{libmysql.dll}
to your PATH or GNUnet's @file{bin} directory
@end itemize


@item @strong{GTK+}@
@command{gnunet-fs-gtk} and @command{libextractor} depend on GTK.
Get the the binary and developer packages of @command{atk},
@command{glib}, @command{gtk}, @command{iconv},
@command{gettext-runtime}, @command{pango} from
@uref{ftp://ftp.gtk.org/pub/gtk/v2.6/win32, gtk.org} and unpack them
to the MinGW directory (@file{c:\mingw\mingw}).
@c FIXME: The URL below for pkg-config seems wrong.
Get @uref{http://www.gtk.org/download/win32.php, pkg-config} and
@command{libpng} and unpack them to the MinGW directory
(@file{c:\mingw\mingw}).
Here is an all-in-one package for the
@uref{http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.24/gtk+-bundle_2.24.10-20120208_win32.zip, gtk+dependencies}
. Do not overwrite any existing files!

@item @strong{Glade}@
@command{gnunet-*-gtk} and @command{gnunet-setup} were created using
this interface builder

@itemize @bullet

@item Get the Glade and libglade (-bin and -devel) packages
(without GTK!) from
@uref{http://gladewin32.sourceforge.net/, GladeWin32} and unpack them to
the MinGW directory (@file{c:\mingw\mingw}).

@item Get @command{libxml} from here and unpack it to the MinGW
directory (@file{c:\mingw\mingw}).
@end itemize

@c FIXME: URLs
@item @strong{zLib}@
@command{libextractor} requires @command{zLib} to decompress some file
formats. GNUnet uses it to (de)compress meta-data.
Get zLib from here (Signature) and unpack it to the MinGW directory
(@file{c:\mingw\mingw}).

@item @strong{Bzip2}@
@command{libextractor} also requires @command{Bzip2} to
decompress some file formats.
Get the Bzip2 (binary and developer package) from
@uref{http://gnuwin32.sourceforge.net/packages/bzip2.htm, GnuWin32} and
unpack it to the MinGW directory (@file{c:\mingw\mingw}).

@item @strong{Libgcrypt}@
@command{Libgcrypt} provides the cryptographic functions used by GNUnet.
Get Libgcrypt from @uref{ftp://ftp.gnupg.org/gcrypt/libgcrypt/, here},
compile and place it in the MinGW directory
(@file{c:\mingw\mingw}). Currently libgcrypt @geq{} 1.4.2 is required to
compile GNUnet.

@item @strong{PlibC}@
PlibC emulates Unix functions under Windows. Get PlibC from here and
unpack it to the MinGW directory (c:\mingw\mingw)

@item @strong{OGG Vorbis}@
@command{OGG Vorbis} is used to extract meta-data from @file{.ogg} files.
Get the packages
@uref{http://www.gnunet.org/libextractor/download/win/libogg-1.1.4.zip, libogg}
and
@uref{http://www.gnunet.org/libextractor/download/win/libvorbis-1.2.3.zip, libvorbis}
from the
@uref{http://ftp.gnu.org/gnu/libextractor/libextractor-w32-1.0.0.zip, libextractor win32 build}
and unpack them to the MinGW directory (c:\mingw\mingw).

@item @strong{Exiv2}@
(lib)Exiv2 is used to extract meta-data from files with Exiv2 meta-data.
Download
@uref{http://www.gnunet.org/libextractor/download/win/exiv2-0.18.2.zip, Exiv2}
and unpack it to the MSYS directory (c:\mingw).
@end itemize

@node Building libextractor and GNUnet
@subsubsection Building libextractor and GNUnet

Before you compile @command{libextractor} or @command{GNUnet},
be sure to set @code{PKG_CONFIG_PATH}:

@example
export PKG_CONFIG_PATH=/mingw/lib/pkgconfig
@end example

@noindent
@xref{GNUnet Installation Handbook}, for basic instructions on building
@command{libextractor} and @command{GNUnet}.
By default, all modules that are created in this way contain
debug information and are quite large. To compile release versions
(small and fast) set the variable @code{CFLAGS}:

@example
export CFLAGS='-O2 -march=pentium -fomit-frame-pointer'
./configure --prefix=$HOME --with-extractor=$HOME
@end example

@node Installer
@subsubsection Installer

The GNUnet installer is made with
@uref{http://nsis.sourceforge.net/, NSIS}. The installer script is
located in @file{contrib\win} in the GNUnet source tree.

@node Source
@subsubsection Source

@c FIXME: URL... or: WHERE is HERE?
The sources of all dependencies are available here.
