Skip to content

Commit

Permalink
Optimize embedded BoringSSL build (cossacklabs#447)
Browse files Browse the repository at this point in the history
Don't build unnecessary libraries, binaries, tests, etc. Build only two
static libraries that we need. This results in considerable time saving
during the builds: BoringSSL contains quite a few tests and tools which
we do not run and use, yet they get built.

Native
------

Before:

    $ time make all ENGINE=boringssl

    real    4m36.341s
    user    3m44.060s
    sys     0m33.924s

After:

    $ time make all ENGINE=boringssl

    real    1m56.910s
    user    1m29.960s
    sys     0m19.392s

Nuff said.

Android
-------

Before:

    $ time ./gradlew --no-daemon --no-parallel --max-workers=2 assembleDebug

    real    34m46.028s
    user    29m9.580s
    sys     6m39.280s

After:

    $ time ./gradlew --no-daemon --no-parallel --max-workers=2 assembleDebug

    real    12m46.028s
    user    9m1.880s
    sys     2m52.020s

Admittedly, the difference may be smaller--as we still have to wait for
Gradle to download the whole Internet during Android build--but that's
still a significant improvement because there are four architectures
that we need to build BoringSSL for.
  • Loading branch information
ilammy committed Apr 3, 2019
1 parent 6b12df0 commit 3728950
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/soter/boringssl/soter.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ $(BIN_PATH)/boringssl/crypto/libcrypto.a $(BIN_PATH)/boringssl/decrepit/libdecre
@echo "building embedded BoringSSL..."
@mkdir -p $(BIN_PATH)/boringssl
@cd $(BIN_PATH)/boringssl && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-fpic" ../../third_party/boringssl/src
@$(MAKE) -C $(BIN_PATH)/boringssl
@$(MAKE) -C $(BIN_PATH)/boringssl crypto decrepit
1 change: 1 addition & 0 deletions third_party/boringssl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ android {
"-DANDROID_NATIVE_API_LEVEL=21",
"-DCMAKE_BUILD_TYPE=Release",
"-GNinja"
targets "crypto", "decrepit"
}
}
}
Expand Down

0 comments on commit 3728950

Please sign in to comment.