Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144017628
D31435.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D31435.diff
View Options
diff --git a/lang/crystal/Makefile b/lang/crystal/Makefile
--- a/lang/crystal/Makefile
+++ b/lang/crystal/Makefile
@@ -1,5 +1,6 @@
PORTNAME= crystal
DISTVERSION= 1.2.2
+PORTREVISION= 1
CATEGORIES= lang
MASTER_SITES= https://dl.unrelenting.technology/crystal/:bootstrap
DISTFILES= ${BOOTSTRAP_PATH}:bootstrap
@@ -22,7 +23,7 @@
git:devel/git
RUN_DEPENDS= pkg-config:devel/pkgconf
-USES= compiler gmake pkgconfig
+USES= compiler gmake pkgconfig ssl
USE_GITHUB= yes
GH_ACCOUNT= crystal-lang
@@ -52,6 +53,15 @@
IGNORE= not supported on anything but FreeBSD
.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:
${MKDIR} ${WRKSRC}/.build
${CP} ${DISTDIR}/${DIST_SUBDIR}/${BOOTSTRAP_PATH} ${WRKSRC}/.build/crystal
@@ -59,6 +69,15 @@
${LN} -s x86_64-freebsd ${WRKSRC}/src/lib_c/aarch64-portbld-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:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} docs \
CRYSTAL_CACHE_DIR="${WRKDIR}/cache"
diff --git a/lang/crystal/files/extra-patch-src_openssl_lib__crypto.cr b/lang/crystal/files/extra-patch-src_openssl_lib__crypto.cr
new file mode 100644
--- /dev/null
+++ b/lang/crystal/files/extra-patch-src_openssl_lib__crypto.cr
@@ -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
diff --git a/lang/crystal/files/extra-patch-src_openssl_lib__ssl.cr b/lang/crystal/files/extra-patch-src_openssl_lib__ssl.cr
new file mode 100644
--- /dev/null
+++ b/lang/crystal/files/extra-patch-src_openssl_lib__ssl.cr
@@ -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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 4, 10:45 AM (12 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28433937
Default Alt Text
D31435.diff (4 KB)
Attached To
Mode
D31435: lang/crystal: fix broken base SSL usage
Attached
Detach File
Event Timeline
Log In to Comment