1.. _compiling:
2
3Compiling
4=========
5
6Install build dependencies
7--------------------------
8
9SL6/CentOS7
10~~~~~~~~~~~
11
12::
13
14   sudo yum install openssl-devel libxml2-devel gsoap-devel \
15                    doxygen cmake abi-compliance-checker
16
17Ubuntu
18~~~~~~
19
20::
21
22   sudo apt-get install abi-compliance-checker cmake debhelper doxygen \
23                        gsoap libgridsite-dev libssl-dev libxml2-dev pkg-config
24
25How to build
26------------
27
28Here is how to do a simple build of davix - have a look at the next section if you need to tweak some configuration option in cmake. ::
29
30  git clone https://github.com/cern-fts/davix.git
31  cd davix
32  git submodule update --recursive --init
33  mkdir build && cd build
34  cmake ..
35  make
36
37Build options
38-------------
39
40Unit tests
41~~~~~~~~~~
42
43You can run the tests with ``make test``.
44
45Functional tests
46~~~~~~~~~~~~~~~~
47
48Running functional tests requires authentication credentials, so they are not enabled by default. As a first step,
49add ``-DFUNCTIONAL_TESTS=TRUE`` to cmake.
50
51You will see that davix no longer compiles - it expects to find the file ``credentials/creds.cmake``. This
52is the file which orchestrates which functional tests are run.
53Here is an example - this is the file which runs our nightly build functional tests.
54Passwords were removed for obvious reasons. ::
55
56  ### tests using a proxy
57  test_with_proxy("davs://dpmhead-rc.cern.ch/dpm/cern.ch/home/dteam/davix-tests")
58  test_with_proxy("davs://prometheus.desy.de/VOs/dteam/davix-tests")
59
60  ### AWS S3
61  set(accesskey xxx)
62  set(secretkey xxx)
63  set(url https://some-bucket.s3.amazonaws.com/davix-tests)
64  set(alt https://s3-ap-southeast-2.amazonaws.com/some-bucket/davix-tests)
65  set(region ap-southeast-2)
66
67  # test v2
68  test_s3(${accesskey} ${secretkey} ${url} "" noalt)
69  test_s3(${accesskey} ${secretkey} ${alt} "" alt)
70
71  # test v4
72  test_s3(${accesskey} ${secretkey} ${url} ${region} noalt)
73  test_s3(${accesskey} ${secretkey} ${alt} ${region} alt)
74
75  ### CERN ceph
76  set(accesskey xxx)
77  set(secretkey xxx)
78  set(url s3s://some-bucket.cs3.cern.ch/davix-tests)
79
80  test_s3(${accesskey} ${secretkey} ${url} "" noalt)
81
82  ### Azure
83  set(azurekey xxx)
84  set(url https://some-user.blob.core.windows.net/some-bucket/davix-tests)
85
86  test_azure(${azurekey} ${url})
87
88Since this file contains sensitive information, access to it should be restricted and it should *never*
89be committed to the source repository.
90
91The ``test_with_proxy`` function uses the default grid-style proxy, ``/tmp/x509_u$uid``. It should be
92generated beforehand.
93
94To run the tests automatically, use the script under ``test/run-tests.sh``. This script further
95expects the existence of ``credentials/obtain-proxy.sh``, which is run to generate a proxy
96without any user intervention. Here is an example: ::
97
98  #!/usr/bin/env bash
99  echo "certificate_password_goes_here" | voms-proxy-init --cert $PWD/credentials/cert.p12 -pwstdin --voms dteam
100
101Using ``test/run-tests.sh``, you can run automatic functional tests in jenkins, for example.
102
103
104Generating the documentation
105----------------------------
106
107We use doxygen for the API documentation and sphinx for this how-to guide. Run ``make doc`` to generate both.
108