Skip to content

Commit

Permalink
Fix OpenSSL binding C preprocesor hack failing on absence of headers (#…
Browse files Browse the repository at this point in the history
…5973)

* Fixed openssl/lib_crypto to not fail when openssl headers are not present on the system

* Fixed openssl/lib_crypto to not output errors if the C preprocessor hack fails
  • Loading branch information
Ata Kuyumcu authored and RX14 committed Apr 20, 2018
1 parent ef528a5 commit af2e23d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/openssl/lib_crypto.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# An extra zero is appended to the output of LIBRESSL_VERSION to make it 0 when LibreSSL does not exist on the system.
# Any comparisons to it should be affixed with an extra zero as well e.g. `(LIBRESSL_VERSION_NUMBER >= 0x2050500F0)`.
LIBRESSL_VERSION = {{ system("echo \"#include <openssl/opensslv.h>\nLIBRESSL_VERSION_NUMBER\" | " +
(env("CC") || "cc") + " " + `pkg-config --cflags --silence-errors libssl || true`.chomp.stringify + " -E -").chomp.split('\n').last.split('L').first.id + "0" }}
(env("CC") || "cc") + " " + `pkg-config --cflags --silence-errors libssl || true`.chomp.stringify + " -E - 2>&1 > /dev/null || echo ''").chomp.split('\n').last.split('L').first.id + "0" }}
OPENSSL_VERSION = {{ system("echo \"#include <openssl/opensslv.h>\nOPENSSL_VERSION_NUMBER\" | " +
(env("CC") || "cc") + " " + `pkg-config --cflags --silence-errors libssl || true`.chomp.stringify + " -E -").chomp.split('\n').last.split('L').first.id }}
(env("CC") || "cc") + " " + `pkg-config --cflags --silence-errors libssl || true`.chomp.stringify + " -E - 2>&1 > /dev/null || echo ''").chomp.split('\n').last.split('L').first.id + "0" }}
end
{% end %}

Expand Down

0 comments on commit af2e23d

Please sign in to comment.