-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Portfile
160 lines (147 loc) · 6.83 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# -*- 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 Perl5 Database Interface to the MySQL database
long_description {*}${description}
platforms darwin
###############################################################################
# Create an array of DBD:MYSQL versions
###############################################################################
# "DBD:MYSQL Major Verion" {
# version DBD:MYSQL version
# revision value
# rmd160 value
# sha256 value
# size. value
# }
###############################################################################
array set version_5 {
version 5.003
revision 1
rmd160 750b4a31d358a7c5ae5a3f9905df80357dbc1f3b
sha256 21554443d60e294cc0ac00adaef53ccb7de55d4fae66a38372a5adf0a0f1edda
size 154242
}
array set version_4 {
version 4.052
revision 1
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 {
mysql82 ""
mysql81 ""
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
}
}
# 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
perl5.setup DBD-mysql [lindex [array get version_5 version] 1] ../../authors/id/D/DV/DVEEDEN
revision [lindex [array get version_5 revision] 1]
checksums rmd160 [lindex [array get version_5 rmd160] 1] \
sha256 [lindex [array get version_5 sha256] 1] \
size [lindex [array get version_5 size] 1]
} else {
default_variants +mariadb10_6
perl5.setup DBD-mysql [lindex [array get version_4 version] 1] ../../authors/id/D/DV/DVEEDEN
checksums rmd160 [lindex [array get version_4 rmd160] 1] \
sha256 [lindex [array get version_4 sha256] 1] \
size [lindex [array get version_4 size] 1]
# base these on vversion_5 so port upgrade doesn't keep trying to upgrade the port
revision [lindex [array get version_5 revision] 1]
version [perl5_convert_version [lindex [array get version_5 version] 1]]
}
# if not, we want to set the correct version for download
} else {
foreach variant_name [array names db_variants] {
if {[variant_isset ${variant_name}]} {
switch -glob -- $variant_name {
"*mysql*" {
perl5.setup DBD-mysql [lindex [array get version_5 version] 1] ../../authors/id/D/DV/DVEEDEN
revision [lindex [array get version_5 revision] 1]
checksums rmd160 [lindex [array get version_5 rmd160] 1] \
sha256 [lindex [array get version_5 sha256] 1] \
size [lindex [array get version_5 size] 1]
}
default {
perl5.setup DBD-mysql [lindex [array get version_4 version] 1] ../../authors/id/D/DV/DVEEDEN
revision [lindex [array get version_4 revision] 1]
checksums rmd160 [lindex [array get version_4 rmd160] 1] \
sha256 [lindex [array get version_4 sha256] 1] \
size [lindex [array get version_4 size] 1]
version [perl5_convert_version [lindex [array get version_5 version] 1]]
}
}
break
}
}
}
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
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
}
}
}
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"
}
}