README.md
author Dirk Zimmermann <dirk@pep-project.org>
Thu, 11 Jan 2018 10:38:17 +0100
changeset 3713 5d3fb251f4ce
parent 3709 83acfd4e316f
child 3721 19578de1d90b
permissions -rw-r--r--
IOS-569 readme general.xcconfig
dirk@59
     1
# How to build
dirk@59
     2
dirk@59
     3
## Prerequisites
dirk@59
     4
dirk@813
     5
### Package managers
dirk@813
     6
dirk@1148
     7
MacPorts for installing all dependencies:
dirk@813
     8
dirk@813
     9
Install [MacPorts](https://www.macports.org/) for your
dirk@813
    10
[version of OS X/macOS](https://www.macports.org/install.php).
dirk@813
    11
hernani@156
    12
### Install CAcert root certificates
hernani@156
    13
hernani@156
    14
Import the root certificates of the community-driven CAcert project
hernani@157
    15
in order to deal with the Mercurial repositories via https; for Mac
hernani@158
    16
OS X follow (the GUI or commandline) instructions provided:
hernani@156
    17
hernani@156
    18
http://wiki.cacert.org/FAQ/ImportRootCert#Mac_OS_X
hernani@156
    19
hernani@158
    20
Before using, please check the authenticity of the certificate(s)
hernani@159
    21
downloaded.
hernani@158
    22
hernani@158
    23
The fingerprints should be:
hernani@158
    24
hernani@158
    25
* Class 1 PKI Key (SHA1): 13:5C:EC:36:F4:9C:B8:E9:3B:1A:B2:70:CD:80:88:46:76:CE:8F:33 
hernani@158
    26
* Class 3 PKI Key (SHA1): AD:7C:3F:64:FC:44:39:FE:F4:E9:0B:E8:F4:7C:6C:FA:8A:AD:FD:CE
hernani@158
    27
hernani@158
    28
(Cf. http://www.cacert.org/index.php?id=3)
hernani@158
    29
dirk@211
    30
### Dependencies of prerequisites
dirk@211
    31
dirk@1148
    32
For building the engine, you need a working python2 environment
dirk@1148
    33
and all dependencies:
dirk@1148
    34
dirk@1148
    35
```
dirk@1225
    36
sudo port install python27
dirk@1148
    37
sudo port install asn1c
dirk@1148
    38
sudo port install py27-lxml
dirk@1148
    39
dirk@1148
    40
sudo port install python_select
dirk@1224
    41
sudo port select python python27
dirk@3524
    42
dirk@3524
    43
sudo port install autoconf
dirk@3524
    44
sudo port install libtool
dirk@3524
    45
sudo port install automake
dirk@1148
    46
```
dirk@211
    47
dirk@609
    48
### Other dependecies
dirk@609
    49
dirk@2074
    50
#### Note
dirk@2074
    51
dirk@2074
    52
If you have not installed the CA Cert certificates, replace `cacert` in hostnames
dirk@2074
    53
with `letsencrypt`.
dirk@2074
    54
dirk@609
    55
#### pEpEngine: [yml2](https://fdik.org/yml/toolchain)
dirk@609
    56
dirk@609
    57
Clone into your home directory:
dirk@609
    58
dirk@609
    59
```
dirk@609
    60
pushd ~
dirk@609
    61
hg clone https://cacert.pep.foundation/dev/repos/yml2/
dirk@609
    62
popd
dirk@609
    63
```
dirk@609
    64
ana@683
    65
## Setup instructions
dirk@113
    66
dirk@59
    67
```
dirk@59
    68
mkdir ~/src
dirk@59
    69
cd ~/src
dirk@59
    70
dirk@3471
    71
git clone https://letsencrypt.pep-security.lu/gitlab/misc/ldns/
dirk@3160
    72
git clone https://github.com/fdik/libetpan.git
dirk@3186
    73
git clone https://github.com/x2on/OpenSSL-for-iPhone.git
xavier@3310
    74
git clone https://github.com/SwipeCellKit/SwipeCellKit.git
dirk@3544
    75
git clone https://github.com/openid/AppAuth-iOS
andreas@3530
    76
git clone ssh://git@git.pep-security.lu:23000/iOS/pEp-Translate.git
dirk@59
    77
dirk@62
    78
hg clone https://cacert.pep.foundation/dev/repos/pantomime-iOS/
dirk@59
    79
hg clone https://cacert.pep.foundation/dev/repos/netpgp-et
dirk@59
    80
hg clone https://cacert.pep.foundation/dev/repos/pEpEngine
dirk@2171
    81
hg clone https://cacert.pep.foundation/dev/repos/pEpObjCAdapter
dirk@2171
    82
hg clone https://cacert.pep.foundation/dev/repos/MessageModel/
dirk@1787
    83
hg clone https://cacert.pep.foundation/dev/repos/libAccountSettings/
dirk@59
    84
dirk@62
    85
hg clone https://cacert.pep-security.ch/dev/repos/pEp_for_iOS/
dirk@59
    86
```
dirk@83
    87
dirk@2074
    88
Note that pEpEngine includes a static libcurl. For
dirk@83
    89
rebuilding see the respective scripts. But you should not have to do that for iOS.
dirk@113
    90
dirk@3611
    91
### Create OAuth2 configurations
dirk@3611
    92
dirk@3611
    93
You need to create the missing struct pEpForiOS/Util/OAuth2/OAuth2GmailConfig.swift
dirk@3611
    94
that adheres to OAuth2ConfigurationProtocol.
dirk@3611
    95
dirk@3611
    96
The struct is referenced by Xcode, but does not exist, because an OAuth2 configuration is considered secret.
dirk@3611
    97
dirk@3611
    98
```
dirk@3611
    99
struct OAuth2GmailConfig: OAuth2ConfigurationProtocol {
dirk@3611
   100
    let oauth2Type = OAuth2Type.google
dirk@3611
   101
    let clientID = ""
dirk@3611
   102
    let redirectURL = URL(string: "myscheme:blah")!
dirk@3611
   103
    let scopes = [""]
dirk@3611
   104
}
dirk@3611
   105
```
dirk@3611
   106
andreas@1802
   107
### Build Project
andreas@1802
   108
andreas@1802
   109
Open pEpForiOS.xcworkspace and build schema "pEp".
dirk@1148
   110
dirk@949
   111
### Unit Tests
dirk@113
   112
dirk@3709
   113
The non-existing file referenced in the unit test project, ./pEpForiOSTests/Util/TestData.swift, must be
dirk@3709
   114
created, with a class named TestData, derived from TestDataBase. Override populateAccounts().
dirk@986
   115
dirk@2655
   116
The tests will not compile without a syntactically correct TestData.swift that inherits from TestDataBase.
dirk@211
   117
dirk@113
   118
```
dirk@1777
   119
cp pEpForiOSTests/Util/TestData_sample.swift pEpForiOSTests/Util/TestData.swift
dirk@113
   120
```
dirk@3707
   121
### UI Tests
dirk@3707
   122
dirk@3708
   123
There is a file referenced in the UI test project, UITestData. You need to create it
dirk@3708
   124
(./pEpForiOSUITests/UITestData.swift), and implement it according to the protocol UITestDataProtocol.
dirk@3709
   125
dirk@3709
   126
The UI tests will not compile without it.
dirk@3713
   127
dirk@3713
   128
### general.xcconfig
dirk@3713
   129
dirk@3713
   130
Create general.xcconfig in the root of the project, with those contents:
dirk@3713
   131
dirk@3713
   132
```
dirk@3713
   133
GMAIL_CLIENT_ID=<your client ID here>
dirk@3713
   134
GMAIL_REDIRECT_URL=<your redirect URL here>
dirk@3713
   135
```