Lines 1-31
Link Here
|
1 |
{% begin %} |
1 |
{% begin %} |
2 |
lib LibCrypto |
2 |
lib LibCrypto |
3 |
{% if flag?(:win32) %} |
3 |
LIBRESSL_VERSION = "0.0.0" |
4 |
{% from_libressl = false %} |
4 |
OPENSSL_VERSION = {{ ssl_version }} |
5 |
{% ssl_version = nil %} |
|
|
6 |
{% for dir in Crystal::LIBRARY_PATH.split(';') %} |
7 |
{% unless ssl_version %} |
8 |
{% config_path = "#{dir.id}\\openssl_VERSION" %} |
9 |
{% if config_version = read_file?(config_path) %} |
10 |
{% ssl_version = config_version.chomp %} |
11 |
{% end %} |
12 |
{% end %} |
13 |
{% end %} |
14 |
{% ssl_version ||= "0.0.0" %} |
15 |
{% else %} |
16 |
{% from_libressl = (`hash pkg-config 2> /dev/null || printf %s false` != "false") && |
17 |
(`test -f $(pkg-config --silence-errors --variable=includedir libcrypto)/openssl/opensslv.h || printf %s false` != "false") && |
18 |
(`printf "#include <openssl/opensslv.h>\nLIBRESSL_VERSION_NUMBER" | ${CC:-cc} $(pkg-config --cflags --silence-errors libcrypto || true) -E -`.chomp.split('\n').last != "LIBRESSL_VERSION_NUMBER") %} |
19 |
{% ssl_version = `hash pkg-config 2> /dev/null && pkg-config --silence-errors --modversion libcrypto || printf %s 0.0.0`.split.last.gsub(/[^0-9.]/, "") %} |
20 |
{% end %} |
21 |
|
22 |
{% if from_libressl %} |
23 |
LIBRESSL_VERSION = {{ ssl_version }} |
24 |
OPENSSL_VERSION = "0.0.0" |
25 |
{% else %} |
26 |
LIBRESSL_VERSION = "0.0.0" |
27 |
OPENSSL_VERSION = {{ ssl_version }} |
28 |
{% end %} |
29 |
end |
5 |
end |
30 |
{% end %} |
6 |
{% end %} |
31 |
|
7 |
|
Lines 34-40
Link Here
|
34 |
@[Link("crypt32")] # CertOpenStore, ... |
10 |
@[Link("crypt32")] # CertOpenStore, ... |
35 |
@[Link("user32")] # GetProcessWindowStation, GetUserObjectInformationW, _MessageBoxW |
11 |
@[Link("user32")] # GetProcessWindowStation, GetUserObjectInformationW, _MessageBoxW |
36 |
{% else %} |
12 |
{% else %} |
37 |
@[Link(ldflags: "`command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'`")] |
13 |
@[Link(ldflags: "-LCRYSTAL_SSL_LDFLAGS -lcrypto")] |
38 |
{% end %} |
14 |
{% end %} |
39 |
lib LibCrypto |
15 |
lib LibCrypto |
40 |
alias Char = LibC::Char |
16 |
alias Char = LibC::Char |