<pre style='margin:0'>
Chris Jones (cjones051073) pushed a commit to branch master
in repository macports-ports.

</pre>
<p><a href="https://github.com/macports/macports-ports/commit/3d111bcb4b4e6a84c4c51bf8372a028ad5cab494">https://github.com/macports/macports-ports/commit/3d111bcb4b4e6a84c4c51bf8372a028ad5cab494</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 3d111bcb4b4e6a84c4c51bf8372a028ad5cab494
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Tue Nov 9 16:10:25 2021 +0000

<span style='display:block; white-space:pre;color:#404040;'>    openssl PG: Add version check, means to disable support as required
</span>---
 _resources/port1.0/group/openssl-1.0.tcl | 144 ++++++++++++++++++-------------
 1 file changed, 82 insertions(+), 62 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/openssl-1.0.tcl b/_resources/port1.0/group/openssl-1.0.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index c9725141831..4b5a13e56ed 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/_resources/port1.0/group/openssl-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/_resources/port1.0/group/openssl-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -63,29 +63,46 @@ proc openssl::depends_portname {} {
</span>     return openssl[openssl::branch_nodot]
 }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc openssl::check_branch {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    set branch_ok [ expr { [option openssl.branch] in [list no_version 1.0 1.1 3] } ]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if { !${branch_ok} } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        ui_error "Invalid OpenSSL branch [option openssl.branch]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    return ${branch_ok}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc openssl::is_enabled {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    return [expr [openssl::check_branch] && {[option openssl.branch] != "no_version"} ]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> proc openssl::set_openssl_dependency {} {
     global openssl_cache_branch_nodot openssl_cache_depends
     
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    # Just in case, remove this dep
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    depends_lib-delete path:lib/libssl.dylib:openssl
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    # Set the requested opensslX dependency
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if { ${openssl_cache_branch_nodot} ne "" && ${openssl_cache_depends} ne "" } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        depends_${openssl_cache_depends}-delete port:openssl${openssl_cache_branch_nodot}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if { [openssl::is_enabled] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Just in case, remove this dep
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depends_lib-delete path:lib/libssl.dylib:openssl
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Set the requested opensslX dependency
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        if { ${openssl_cache_branch_nodot} ne "" && ${openssl_cache_depends} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            depends_${openssl_cache_depends}-delete port:openssl${openssl_cache_branch_nodot}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set openssl_cache_depends      [option openssl.depends_type]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set openssl_cache_branch_nodot [openssl::branch_nodot]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set openssl_cache_configure    ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depends_[option openssl.depends_type]-append port:openssl[openssl::branch_nodot]
</span>     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    set openssl_cache_depends      [option openssl.depends_type]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    set openssl_cache_branch_nodot [openssl::branch_nodot]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    set openssl_cache_configure    ""
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    depends_[option openssl.depends_type]-append port:openssl[openssl::branch_nodot]
</span> }
 port::register_callback openssl::set_openssl_dependency
 
 # Detect if cmake is being used
 proc openssl::check_for_cmake {} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    if { [string match *cmake* [option configure.cmd] ] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        if { ![string match *cmake* [option openssl.configure] ] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            ui_debug "Appending cmake to openssl configuration types"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            openssl.configure-append cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if { [openssl::is_enabled] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        if { [string match *cmake* [option configure.cmd] ] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { ![string match *cmake* [option openssl.configure] ] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                ui_debug "Appending cmake to openssl configuration types"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                openssl.configure-append cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span>         }
     }
 }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -94,68 +111,71 @@ port::register_callback openssl::check_for_cmake
</span> proc openssl::configure_build {} {
     global openssl_cache_branch_nodot openssl_cache_depends
     global openssl_cache_incdir openssl_cache_libdir openssl_cache_cmake_flags openssl_cache_configure
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    # Has configuration changed in any way ?
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-    if { ${openssl_cache_branch_nodot} ne [openssl::branch_nodot] ||
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-         ${openssl_cache_depends} ne [option openssl.depends_type] ||
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-         ${openssl_cache_configure} ne [option openssl.configure] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        ui_debug "Configure Types '[option openssl.configure]'"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # If no configure method(s) given do nothing
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        set openssl_cache_configure [option openssl.configure]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        if { [option openssl.configure] ne "" } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            foreach meth [option openssl.configure] {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                switch ${meth} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    pkgconfig {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        ui_debug " -> Setting openssl pkgconfig configuration"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        configure.pkg_config_path-prepend [openssl::pkgconfig_dir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        depends_build-delete port:pkgconfig
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        depends_build-append port:pkgconfig
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    build_flags {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        ui_debug " -> Setting openssl build flags configuration"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        if { ${openssl_cache_incdir} ne "" } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                            configure.cppflags-delete -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                            configure.cflags-delete   -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if { [openssl::is_enabled] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Has configuration changed in any way ?
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        if { ${openssl_cache_branch_nodot} ne [openssl::branch_nodot] ||
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+             ${openssl_cache_depends} ne [option openssl.depends_type] ||
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+             ${openssl_cache_configure} ne [option openssl.configure] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            ui_debug "Configure Types '[option openssl.configure]'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # If no configure method(s) given do nothing
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            set openssl_cache_configure [option openssl.configure]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            if { [option openssl.configure] ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                foreach meth [option openssl.configure] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    switch ${meth} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        pkgconfig {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            ui_debug " -> Setting openssl pkgconfig configuration"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            configure.pkg_config_path-prepend [openssl::pkgconfig_dir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            depends_build-delete port:pkgconfig
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            depends_build-append port:pkgconfig
</span>                         }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                        if { ${openssl_cache_libdir} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        build_flags {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            ui_debug " -> Setting openssl build flags configuration"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            if { ${openssl_cache_incdir} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                configure.cppflags-delete -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                configure.cflags-delete   -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            if { ${openssl_cache_libdir} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                configure.ldflags-prepend  -L${openssl_cache_libdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            set openssl_cache_incdir [openssl::include_dir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            set openssl_cache_libdir [openssl::lib_dir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            configure.cppflags-prepend -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            configure.cflags-prepend   -I${openssl_cache_incdir}
</span>                             configure.ldflags-prepend  -L${openssl_cache_libdir}
                         }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                        set openssl_cache_incdir [openssl::include_dir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        set openssl_cache_libdir [openssl::lib_dir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        configure.cppflags-prepend -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        configure.cflags-prepend   -I${openssl_cache_incdir}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        configure.ldflags-prepend  -L${openssl_cache_libdir}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    cmake {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        ui_debug " -> Setting openssl cmake configuration"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        if { ${openssl_cache_cmake_flags} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        cmake {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            ui_debug " -> Setting openssl cmake configuration"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            if { ${openssl_cache_cmake_flags} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                foreach flag ${openssl_cache_cmake_flags} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                    configure.args-delete ${flag}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            # Try and cover all bases here and set all possible variables ...
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            # See https://cmake.org/cmake/help/latest/module/FindOpenSSL.html
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            set openssl_cache_cmake_flags [list \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                                               -DOPENSSL_ROOT_DIR=[openssl::install_area] \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                                               -DOPENSSL_INCLUDE_DIR=[openssl::include_dir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                                          ]
</span>                             foreach flag ${openssl_cache_cmake_flags} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                                configure.args-delete ${flag}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                                configure.args-append ${flag}
</span>                             }
                         }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                        # Try and cover all bases here and set all possible variables ...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        # See https://cmake.org/cmake/help/latest/module/FindOpenSSL.html
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        set openssl_cache_cmake_flags [list \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                           -DOPENSSL_ROOT_DIR=[openssl::install_area] \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                           -DOPENSSL_INCLUDE_DIR=[openssl::include_dir]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                                                      ]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        foreach flag ${openssl_cache_cmake_flags} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                            configure.args-append ${flag}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                        default {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                            return -code error "invalid method \"${meth}\" for openssl.configure"
</span>                         }
                     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-                    default {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                        return -code error "invalid method \"${meth}\" for openssl.configure"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-                    }
</span>                 }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>             }
 
         }
 
     }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> }
 port::register_callback openssl::configure_build
 
</pre><pre style='margin:0'>

</pre>