Closed ilammy closed 4 years ago
@vixentael, I’ve updated release docs to include tests for new options.
Note that this PR updates the template from which the formula is generated during the release. Since Homebrew does not support branches or something like that, the easiest way to manually test this with current master branch is to check out the formula file and install it like this:
brew install path/to/libthemis.rb --HEAD [options]
Add support for installing JavaThemis via package managers. JavaThemis needs JNI library so let’s make it available. While we’re here, let’s make ThemisPP available as well.
Install ThemisPP
--with-cpp
Add an option to install ThemisPP support when installing Themis. Options are frowned upon in the main Homebrew repository, but we're not there. It would be a waste to have two separate packages that download the same source tarball. In case of ThemisPP we don’t even need to compile anything, that's just copying C++ headers (and you need to install Themis Core for them anyway).
Install Themis JNI
--with-java
Another option to install Themis JNI library which requires Themis Core to operate. Now we do need to compile something.
Java is not available as Homebrew package in the main repo. However, it's possible to install it via Casks. Unfortunately, we cannot depend on casks, so it's assumed that the system has Java installed when using the
--with-java
option.Currently Themis JNI library is tightly coupled with the core library so they have to compiled together using the same private header files. Therefore we use options, not a separate package.
Warn about JNI installation path
Unfortunately for macOS, Homebrew is not able to install Themis JNI library into any location accessible to Java by default. Usually the following locations are used by Oracle Java:
$HOME/Library/Java/Extensions
/Library/Java/Extensions
/Network/Library/Java/Extensions
/System/Library/Java/Extensions
/usr/lib/java
$PWD
Homebrew does not support running with root access. We'd need to have a proper macOS installer in order to write to /Library. Other locations are either inaccessible due to SIP or unrealistic. "This is life".
Therefore, print a warning for the user who will likely need to set up their application build properly in order to use the Themis Java.
The magic spell to print
java.library.path
is taken from the main Themis makefile.Test ThemisPP installation
Just a simple test for ThemisPP, making sure that the library is accessible and the headers are visible in the system.
Test Themis JNI installation
Now we test Themis JNI library installation. This library is not intended to be used separately, so we don't test the API. We only need to make sure that it can be loaded by Java. Note how we setup "java.library.path" for that.