mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
lang/crystal: fix broken base SSL usage
crystal needs pkgconfig to determine precisely which SSL variant is present, and patch itself accordingly, but this is not present in FreeBSD base. Patch directly, what would have been provided by pkgconfig, for currently supported FreeBSD versions. PR: 257658 Approved by: greg@unrelenting.technology (maintainer) Differential Revision: https://reviews.freebsd.org/D31435
This commit is contained in:
parent
b78fab0d18
commit
30bb70e94e
3 changed files with 75 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
PORTNAME= crystal
|
PORTNAME= crystal
|
||||||
DISTVERSION= 1.2.2
|
DISTVERSION= 1.2.2
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= lang
|
CATEGORIES= lang
|
||||||
MASTER_SITES= https://dl.unrelenting.technology/crystal/:bootstrap
|
MASTER_SITES= https://dl.unrelenting.technology/crystal/:bootstrap
|
||||||
DISTFILES= ${BOOTSTRAP_PATH}:bootstrap
|
DISTFILES= ${BOOTSTRAP_PATH}:bootstrap
|
||||||
|
@ -22,7 +23,7 @@ BUILD_DEPENDS= ${LOCALBASE}/bin/llvm-config${LLVM_VERSION}:devel/llvm${BOOTSTRAP
|
||||||
git:devel/git
|
git:devel/git
|
||||||
RUN_DEPENDS= pkg-config:devel/pkgconf
|
RUN_DEPENDS= pkg-config:devel/pkgconf
|
||||||
|
|
||||||
USES= compiler gmake pkgconfig
|
USES= compiler gmake pkgconfig ssl
|
||||||
|
|
||||||
USE_GITHUB= yes
|
USE_GITHUB= yes
|
||||||
GH_ACCOUNT= crystal-lang
|
GH_ACCOUNT= crystal-lang
|
||||||
|
@ -52,6 +53,15 @@ OPTIONS_SUB= yes
|
||||||
IGNORE= not supported on anything but FreeBSD
|
IGNORE= not supported on anything but FreeBSD
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# crystal needs pkgconfig to determine SSL variants but these are not
|
||||||
|
# present in FreeBSD base. We splice in the correct info based on
|
||||||
|
# FreeBSD version and hope it doesn't change during minor releases.
|
||||||
|
# See post-patch for the substitutions of these patches.
|
||||||
|
.if ${SSL_DEFAULT} == "base"
|
||||||
|
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-src_openssl_lib__crypto.cr \
|
||||||
|
${PATCHDIR}/extra-patch-src_openssl_lib__ssl.cr
|
||||||
|
.endif
|
||||||
|
|
||||||
post-extract:
|
post-extract:
|
||||||
${MKDIR} ${WRKSRC}/.build
|
${MKDIR} ${WRKSRC}/.build
|
||||||
${CP} ${DISTDIR}/${DIST_SUBDIR}/${BOOTSTRAP_PATH} ${WRKSRC}/.build/crystal
|
${CP} ${DISTDIR}/${DIST_SUBDIR}/${BOOTSTRAP_PATH} ${WRKSRC}/.build/crystal
|
||||||
|
@ -59,6 +69,15 @@ post-extract:
|
||||||
${LN} -s x86_64-freebsd ${WRKSRC}/src/lib_c/aarch64-portbld-freebsd
|
${LN} -s x86_64-freebsd ${WRKSRC}/src/lib_c/aarch64-portbld-freebsd
|
||||||
${LN} -s x86_64-freebsd ${WRKSRC}/src/lib_c/aarch64-freebsd
|
${LN} -s x86_64-freebsd ${WRKSRC}/src/lib_c/aarch64-freebsd
|
||||||
|
|
||||||
|
post-patch:
|
||||||
|
.if ${SSL_DEFAULT} == "base" && ${OSREL:R} < 15
|
||||||
|
@${REINPLACE_CMD} \
|
||||||
|
-e 's|CRYSTAL_SSL_VERSION|1.1.1|g' \
|
||||||
|
-e 's|CRYSTAL_SSL_LDFLAGS|${OPENSSLLIB}|g' \
|
||||||
|
${WRKSRC}/src/openssl/lib_ssl.cr \
|
||||||
|
${WRKSRC}/src/openssl/lib_crypto.cr
|
||||||
|
.endif
|
||||||
|
|
||||||
do-build-DOCS-on:
|
do-build-DOCS-on:
|
||||||
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} docs \
|
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} docs \
|
||||||
CRYSTAL_CACHE_DIR="${WRKDIR}/cache"
|
CRYSTAL_CACHE_DIR="${WRKDIR}/cache"
|
||||||
|
|
27
lang/crystal/files/extra-patch-src_openssl_lib__crypto.cr
Normal file
27
lang/crystal/files/extra-patch-src_openssl_lib__crypto.cr
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
--- src/openssl/lib_crypto.cr.orig 2021-08-08 15:06:11 UTC
|
||||||
|
+++ src/openssl/lib_crypto.cr
|
||||||
|
@@ -1,21 +1,11 @@
|
||||||
|
{% begin %}
|
||||||
|
lib LibCrypto
|
||||||
|
- {% from_libressl = (`hash pkg-config 2> /dev/null || printf %s false` != "false") &&
|
||||||
|
- (`test -f $(pkg-config --silence-errors --variable=includedir libcrypto)/openssl/opensslv.h || printf %s false` != "false") &&
|
||||||
|
- (`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") %}
|
||||||
|
- {% ssl_version = `hash pkg-config 2> /dev/null && pkg-config --silence-errors --modversion libcrypto || printf %s 0.0.0`.split.last.gsub(/[^0-9.]/, "") %}
|
||||||
|
-
|
||||||
|
- {% if from_libressl %}
|
||||||
|
- LIBRESSL_VERSION = {{ ssl_version }}
|
||||||
|
- OPENSSL_VERSION = "0.0.0"
|
||||||
|
- {% else %}
|
||||||
|
- LIBRESSL_VERSION = "0.0.0"
|
||||||
|
- OPENSSL_VERSION = {{ ssl_version }}
|
||||||
|
- {% end %}
|
||||||
|
+ LIBRESSL_VERSION = "0.0.0"
|
||||||
|
+ OPENSSL_VERSION = "CRYSTAL_SSL_VERSION"
|
||||||
|
end
|
||||||
|
{% end %}
|
||||||
|
|
||||||
|
-@[Link(ldflags: "`command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'`")]
|
||||||
|
+@[Link(ldflags: "-LCRYSTAL_SSL_LDFLAGS -lcrypto")]
|
||||||
|
lib LibCrypto
|
||||||
|
alias Char = LibC::Char
|
||||||
|
alias Int = LibC::Int
|
28
lang/crystal/files/extra-patch-src_openssl_lib__ssl.cr
Normal file
28
lang/crystal/files/extra-patch-src_openssl_lib__ssl.cr
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
--- src/openssl/lib_ssl.cr.orig 2021-08-08 15:06:09 UTC
|
||||||
|
+++ src/openssl/lib_ssl.cr
|
||||||
|
@@ -6,22 +6,12 @@ require "./lib_crypto"
|
||||||
|
|
||||||
|
{% begin %}
|
||||||
|
lib LibSSL
|
||||||
|
- {% from_libressl = (`hash pkg-config 2> /dev/null || printf %s false` != "false") &&
|
||||||
|
- (`test -f $(pkg-config --silence-errors --variable=includedir libssl)/openssl/opensslv.h || printf %s false` != "false") &&
|
||||||
|
- (`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") %}
|
||||||
|
- {% ssl_version = `hash pkg-config 2> /dev/null && pkg-config --silence-errors --modversion libssl || printf %s 0.0.0`.split.last.gsub(/[^0-9.]/, "") %}
|
||||||
|
-
|
||||||
|
- {% if from_libressl %}
|
||||||
|
- LIBRESSL_VERSION = {{ ssl_version }}
|
||||||
|
- OPENSSL_VERSION = "0.0.0"
|
||||||
|
- {% else %}
|
||||||
|
- LIBRESSL_VERSION = "0.0.0"
|
||||||
|
- OPENSSL_VERSION = {{ ssl_version }}
|
||||||
|
- {% end %}
|
||||||
|
+ LIBRESSL_VERSION = "0.0.0"
|
||||||
|
+ OPENSSL_VERSION = "CRYSTAL_SSL_VERSION"
|
||||||
|
end
|
||||||
|
{% end %}
|
||||||
|
|
||||||
|
-@[Link(ldflags: "`command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'`")]
|
||||||
|
+@[Link(ldflags: "-LCRYSTAL_SSL_LDFLAGS -lssl")]
|
||||||
|
lib LibSSL
|
||||||
|
alias Int = LibC::Int
|
||||||
|
alias Char = LibC::Char
|
Loading…
Add table
Reference in a new issue