View | Details | Raw Unified | Return to bug 262581 | Differences between
and this patch

Collapse All | Expand All

(-)src/openssl/lib_ssl.cr (-26 / +2 lines)
Lines 6-37 Link Here
6
6
7
{% begin %}
7
{% begin %}
8
  lib LibSSL
8
  lib LibSSL
9
    {% if flag?(:win32) %}
9
    LIBRESSL_VERSION = "0.0.0"
10
      {% from_libressl = false %}
10
    OPENSSL_VERSION = {{ ssl_version }}
11
      {% ssl_version = nil %}
12
      {% for dir in Crystal::LIBRARY_PATH.split(';') %}
13
        {% unless ssl_version %}
14
          {% config_path = "#{dir.id}\\openssl_VERSION" %}
15
          {% if config_version = read_file?(config_path) %}
16
            {% ssl_version = config_version.chomp %}
17
          {% end %}
18
        {% end %}
19
      {% end %}
20
      {% ssl_version ||= "0.0.0" %}
21
    {% else %}
22
      {% from_libressl = (`hash pkg-config 2> /dev/null || printf %s false` != "false") &&
23
                         (`test -f $(pkg-config --silence-errors --variable=includedir libssl)/openssl/opensslv.h || printf %s false` != "false") &&
24
                         (`printf "#include <openssl/opensslv.h>\nLIBRESSL_VERSION_NUMBER" | ${CC:-cc} $(pkg-config --cflags --silence-errors libssl || true) -E -`.chomp.split('\n').last != "LIBRESSL_VERSION_NUMBER") %}
25
      {% ssl_version = `hash pkg-config 2> /dev/null && pkg-config --silence-errors --modversion libssl || printf %s 0.0.0`.split.last.gsub(/[^0-9.]/, "") %}
26
    {% end %}
27
28
    {% if from_libressl %}
29
      LIBRESSL_VERSION = {{ ssl_version }}
30
      OPENSSL_VERSION = "0.0.0"
31
    {% else %}
32
      LIBRESSL_VERSION = "0.0.0"
33
      OPENSSL_VERSION = {{ ssl_version }}
34
    {% end %}
35
  end
11
  end
36
{% end %}
12
{% end %}
37
13

Return to bug 262581