1 Building Conscrypt 2 ================== 3 4 Before you begin, you'll first need to properly configure the [Prerequisites](#Prerequisites) as 5 described below. 6 7 Then to build, run: 8 9 ```bash 10 $ ./gradlew build 11 ``` 12 13 To install the artifacts to your Maven local repository for use in your own project, run: 14 15 ```bash 16 $ ./gradlew install 17 ``` 18 19 Prerequisites 20 ------------- 21 Conscrypt requires that you have __Java__, __BoringSSL__ and the __Android SDK__ configured as 22 described below. 23 24 #### Java 25 The build requires that you have the `JAVA_HOME` environment variable pointing to a valid JDK. 26 27 #### Android SDK 28 [Download and install](https://developer.android.com/studio/install.html) the latest Android SDK 29 and set the `ANDROID_HOME` environment variable to point to the root of the SDK 30 (e.g. `export ANDROID_HOME=/usr/local/me/Android/Sdk`). 31 32 #### BoringSSL 33 Before you can build BoringSSL, you'll first need to set up its 34 [prerequisites](https://boringssl.googlesource.com/boringssl/+/HEAD/BUILDING.md#Build-Prerequisites). 35 36 Once the environment is properly configured, follow the steps below for your platform. 37 38 ##### Download 39 Checkout BoringSSL to a directory of your choice and then build as follows: 40 41 ```bash 42 git clone https://boringssl.googlesource.com/boringssl 43 cd boringssl 44 45 # Also need to set an environment variable to point to the installation location. 46 export BORINGSSL_HOME=$PWD 47 ``` 48 49 ##### Building on Linux/OS-X 50 To build in the 64-bit version on a 64-bit machine: 51 ```bash 52 mkdir build64 53 cd build64 54 cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ 55 -DCMAKE_BUILD_TYPE=Release \ 56 -DCMAKE_ASM_FLAGS=-Wa,--noexecstack \ 57 -GNinja .. 58 ninja 59 ``` 60 61 To make a 32-bit build on a 64-bit machine: 62 ```base 63 mkdir build32 64 cd build32 65 cmake -DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake \ 66 -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ 67 -DCMAKE_BUILD_TYPE=Release \ 68 -DCMAKE_ASM_FLAGS="-Wa,--noexecstack -m32 -msse2" \ 69 -GNinja .. 70 ninja 71 ``` 72 73 ##### Building on Windows 74 This assumes that you have Microsoft Visual Studio 2015 installed along 75 with Windows 8.1 SDK and your machine is capable of compiling 64-bit. 76 Visual Studio 2015 sets the `VS140COMNTOOLS` environment variable upon 77 installation. 78 79 To build in 64-bit mode, set up with this command line: 80 81 ```bat 82 call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 8.1 83 mkdir build64 84 cd build64 85 ``` 86 87 To build in 32-bit mode, set up with this command line: 88 89 ```bat 90 call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86 8.1 91 mkdir build32 92 cd build32 93 ``` 94 95 In either the 64-bit or 32-bit case, run this afterward: 96 97 ```bat 98 cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ^ 99 -DCMAKE_BUILD_TYPE=Release ^ 100 -DCMAKE_C_FLAGS_RELEASE=/MT ^ 101 -DCMAKE_CXX_FLAGS_RELEASE=/MT ^ 102 -GNinja .. 103 ninja 104 ``` 105 106