# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup perl5 1.0 PortGroup active_variants 1.1 perl5.branches 5.28 5.30 5.32 5.34 license {Artistic-1 GPL} maintainers nomaintainer description DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI) long_description {*}${description} ############################################################################### # Create an array of DBD:MYSQL versions ############################################################################### # "DBD:MYSQL Major Verion" { # version DBD:MYSQL version # rmd160 value # sha256 value # size. value # } ############################################################################### array set version_current { version 5.010 rmd160 dcfaa09467654d646f750b4fcb5aff096e116d9d sha256 2ca2ff39d93e89d4f7446e5f0faf03805e9167ee9b8a04ba7cb246e2cb46eee7 size 158599 } array set version_4 { version 4.052 rmd160 2e614009d863d4a67bb225a3a0ac329209b1910e sha256 a83f57af7817787de0ef56fb15fdfaf4f1c952c8f32ff907153b66d2da78ff5b size 162074 } ############################################################################### # Create an array of mysql variants. This is an attempt to make adding new # variant easier as they emerge. ############################################################################### # Variant list # { # sql variant name port name (if different) # } ############################################################################### array set db_variants { mysql8 "" mariadb10_11 mariadb-10.11 mariadb10_10 mariadb-10.10 mariadb10_6 mariadb-10.6 mariadb10_5 mariadb-10.5 mariadb10_4 mariadb-10.4 percona "" } # check to see if a variant was set by the user set any_sql no foreach variant_name [array names db_variants] { if {[variant_isset ${variant_name}]} { set any_sql yes switch -glob -- $variant_name { "*mysql*" { set install_version "version_current" } default { set install_version "version_4" } } break } } # set the default variant if no variant is set by the user # NOTE: if the user passes in a bad variant, these defaults will # be installed instead of throwing an error if { !${any_sql}} { if {${os.major} > 12} { default_variants +mysql8 set install_version "version_current" } else { default_variants +mariadb10_6 set install_version "version_4" } } # setup perl and checksums based the requested variant version perl5.setup DBD-mysql [lindex [array get $install_version version] 1] ../../authors/id/D/DV/DVEEDEN checksums rmd160 [lindex [array get $install_version rmd160] 1] \ sha256 [lindex [array get $install_version sha256] 1] \ size [lindex [array get $install_version size] 1] # version gets set to the "current version" values to prevenet constant upgraing by port upgrade version [perl5_convert_version [lindex [array get version_current version] 1]] revision 0 if {${perl5.major} != ""} { depends_build-append \ port:p${perl5.major}-devel-checklib \ port:p${perl5.major}-test-deep \ port:p${perl5.major}-time-hires depends_lib-append \ port:p${perl5.major}-dbi # loop over the array creating the specified variants # with the multiple versioning change, the conflicts lists no longer apepears # to be enforced, so this will be handled later in the pre-fetch stage with # active_vaiants. The conflicts list is left here so the user gets the approprate # warning when running port variant foreach variant_name [array names db_variants] { set idx [lsearch [array names db_variants] $variant_name] set conflict_list [lreplace [array names db_variants] $idx $idx] variant $variant_name conflicts $conflict_list description "build with $variant_name" {} if {[variant_isset $variant_name]} { set active_conflicts $conflict_list } } # add the build dependencies, this must be done outside the variant call to work foreach variant_name [array names db_variants] { set reqPort [lindex [array get db_variants $variant_name] 1] if {$reqPort eq ""} {set reqPort $variant_name} if { ([variant_exists $variant_name] && [variant_isset $variant_name])} { depends_lib-append port:$reqPort configure.args-append --mysql_config=${prefix}/lib/$reqPort/bin/mysql_config } } } # Use active_variants to enforce that only one variant can be installed at any given time pre-fetch { if {![catch {set result [active_variants p${perl5.major}-dbd-mysql $active_conflicts ""]}]} { ui_error " **** **** p${perl5.major}-dbd-mysql can only have one active variant installed **** If you need this vaiant, deactivate the previously installed one with **** port deactivate p${perl5.major}-dbd-mysql **** or uninstall is with **** sudo port uninstall p${perl5.major}-dbd-mysql ****" error "Error: p${perl5.major}-dbd-mysql variant already installed" } } # livecheck workaround due to MetaCPAN indexing failure livecheck.type regex livecheck.url https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN livecheck.regex "${perl5.module}-(\\d+(?:\\.\\d+)*)"