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