Automatically link to OpenSSL::SSL OpenSSL::Crypto under add_android_openssl_libraries().
Also, start using add_library() to add OpenSSL libraries to the project. If the OpenSSL targets are not defined, add them with add_library() and set OPENSSL_LIB_DIR and OPENSSL_INCLUDE_DIR and store the paths to the shared libraries in the cache so that add_android_openssl_libraries() can re-use them later if OpenSSL targets are already defined.
OpenSSL has the configuration option shlib_variant, so we can use that instead.
This works for version 1.x and 3.x, so it would make the build script more similar between the two versions.
Also, this avoid issues that can come from patchelf, as this patch comes after a bug found in patchelf 0.18 that created wrongly aligned libraries. See https://github.com/NixOS/patchelf/issues/492.
* The script now supports zsh and bash to allow building from macOS and
Linux with builtin zsh and bash version 3 or 4.
* It now uses curl instead of wget, wget is not builtin on macOS.
* Use the default NDk path from the Android SDK.
* Allow to set custom build and output folders.
* The various build folders for each version are now kept around under
the 'build' folder.
* At the same time add the build folder to .gitignore.
* Create relative symlinks #61.
Changes include:
* Rename CMakeLists.txt to android_openssl.cmake
* Move the CMake code into a function android_add_openssl_to_targets(), so that the caller can decide what targets get the OpenSSL libs
* update README
The previous refactoring commit 841f289 changed that command by
prepending relative path to the libs files, and that seem to break
what we try to achieve with patchelf. This reverts that part.
If building for an OpenSSL version that doesn't start with 3.1.x, like
3.0.7, the script fails to set ANDROID_API value and the build fails.
This makes the script more inclusive for other OpenSSL 3.x.x versions.
* Refactor the build script to be more readable by using funcitons
* Forward configure and build output to log files
* Add more progress messages and print only stderr to the
console while building
* Build Openssl 1.1 for API 21 and OpenSSL 3.1 for 23
* Tested the script on macOS (needs bash version 4+)