1 | # -*- 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 |
---|
2 | # $Id: Portfile 87980 2011-12-15 01:47:29Z pixilla@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup archcheck 1.0 |
---|
6 | PortGroup cmake 1.0 |
---|
7 | |
---|
8 | name percona |
---|
9 | conflicts mysql4 mysql5 mysql5-devel mariadb |
---|
10 | set version_mysql 5.5.17 |
---|
11 | set major [join [lrange [split ${version_mysql} .] 0 0] .] |
---|
12 | set branch [join [lrange [split ${version_mysql} .] 0 1] .] |
---|
13 | set release 22.1 |
---|
14 | version ${version_mysql}-${release} |
---|
15 | revision 1 |
---|
16 | homepage http://www.percona.com/ |
---|
17 | categories databases |
---|
18 | platforms darwin |
---|
19 | maintainers mac.com:quest openmaintainer |
---|
20 | license GPL-2 |
---|
21 | distname Percona-Server-${version_mysql}-rel${release} |
---|
22 | dist_subdir mysql5 |
---|
23 | use_parallel_build yes |
---|
24 | |
---|
25 | description \ |
---|
26 | Multithreaded SQL database server |
---|
27 | |
---|
28 | long_description \ |
---|
29 | Percona is an open-source, multi-threaded SQL database \ |
---|
30 | with a command syntax very similar to mSQL. |
---|
31 | |
---|
32 | master_sites \ |
---|
33 | http://www.percona.com/redir/downloads/Percona-Server-${branch}/Percona-Server-${version}/source/ |
---|
34 | |
---|
35 | checksums md5 77e2ff68ff3ffa60a48a1ee045056f15 \ |
---|
36 | sha1 e945653232925f85a4dddaf02647ec80bb03fa07 \ |
---|
37 | rmd160 f29d6983bd1685ca4c76e42ab926aefbecc0e4bb |
---|
38 | |
---|
39 | depends_lib-append port:zlib \ |
---|
40 | port:openssl \ |
---|
41 | port:readline \ |
---|
42 | port:cmake |
---|
43 | |
---|
44 | archcheck.files lib/libz.dylib \ |
---|
45 | lib/libssl.dylib \ |
---|
46 | lib/libreadline.dylib |
---|
47 | |
---|
48 | set major_version [strsed ${version} {s/\..*$//}] |
---|
49 | set mysql mysql${major_version} |
---|
50 | set libdir ${prefix}/lib/${mysql} |
---|
51 | set bindir ${libdir}/bin |
---|
52 | set dbdir ${prefix}/var/db/${mysql} |
---|
53 | set sysconfdir ${prefix}/etc/${mysql} |
---|
54 | set sockfile ${prefix}/var/run/mysql5/mysqld.sock |
---|
55 | |
---|
56 | if {"darwin" == ${os.platform} && ${os.major} > 8} { |
---|
57 | set mysqluser _mysql |
---|
58 | } else { |
---|
59 | set mysqluser mysql |
---|
60 | } |
---|
61 | |
---|
62 | configure.args-append -DINSTALL_MANDIR:STRING=share/man \ |
---|
63 | -DINSTALL_INFODIR:STRING=share/info \ |
---|
64 | -DMYSQL_DATADIR:PATH=${dbdir} \ |
---|
65 | -DFEATURE_SET:STRING=community \ |
---|
66 | -DINSTALL_BINDIR:STRING=lib/${mysql}/bin \ |
---|
67 | -DINSTALL_SCRIPTDIR:STRING=lib/${mysql}/bin \ |
---|
68 | -DINSTALL_SBINDIR:STRING=lib/${mysql}/libexec \ |
---|
69 | -DINSTALL_INCLUDEDIR:STRING=include/${mysql}/mysql \ |
---|
70 | -DINSTALL_LIBDIR:STRING=lib/${mysql}/mysql \ |
---|
71 | -DINSTALL_PLUGINDIR:STRING=lib/${mysql}/mysql/plugin \ |
---|
72 | -DINSTALL_DOCDIR:STRING=share/doc/${mysql} \ |
---|
73 | -DINSTALL_DOCREADMEDIR:STRING=share/doc/${mysql} \ |
---|
74 | -DINSTALL_MYSQLDATADIR:STRING=share/${mysql} \ |
---|
75 | -DINSTALL_MYSQLSHAREDIR:STRING=share/${mysql}/mysql \ |
---|
76 | -DINSTALL_SHAREDIR:STRING=share/${mysql} \ |
---|
77 | -DINSTALL_SUPPORTFILESDIR:STRING=share/${mysql}/mysql \ |
---|
78 | -DDEFAULT_CHARSET:STRING=utf8 \ |
---|
79 | -DDEFAULT_COLLATION:STRING=utf8_general_ci \ |
---|
80 | -DMYSQL_UNIX_ADDR:PATH=${sockfile} \ |
---|
81 | -DSYSCONFDIR:PATH=${sysconfdir} \ |
---|
82 | -DWITH_EMBEDDED_SERVER:BOOL=OFF \ |
---|
83 | -DWITH_READLINE:BOOL=ON \ |
---|
84 | -DWITH_SSL:STRING=yes \ |
---|
85 | -DWITH_ZLIB:STRING=system \ |
---|
86 | -DWITH_UNIT_TESTS:BOOL=OFF \ |
---|
87 | -DENABLE_GCOV:BOOL=OFF \ |
---|
88 | -DENABLE_DTRACE:BOOL=OFF |
---|
89 | |
---|
90 | # Set compiler |
---|
91 | configure.compiler llvm-gcc-4.2 |
---|
92 | |
---|
93 | post-build { |
---|
94 | set dirs ${worksrcpath} |
---|
95 | foreach dir ${dirs} { |
---|
96 | reinplace -E {s|-arch [a-z0-9_]+||g} \ |
---|
97 | ${dir}/scripts/mysql_config \ |
---|
98 | ${dir}/scripts/mysqlbug |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | pre-destroot { |
---|
103 | xinstall -m 755 -d ${destroot}${sysconfdir} |
---|
104 | destroot.keepdirs-append ${destroot}${sysconfdir} |
---|
105 | } |
---|
106 | |
---|
107 | post-destroot { |
---|
108 | # Delete directories we don't want |
---|
109 | delete ${destroot}${prefix}/data ${destroot}${prefix}/mysql-test ${destroot}${prefix}/sql-bench |
---|
110 | # Fix link lib paths |
---|
111 | foreach libname [glob -type f -tails -directory ${destroot}${libdir}/mysql *.dylib] { |
---|
112 | if {[file type ${destroot}${libdir}/mysql/${libname}] == "file"} { |
---|
113 | system "install_name_tool -id ${libdir}/mysql/${libname} ${destroot}${libdir}/mysql/${libname}" |
---|
114 | } |
---|
115 | } |
---|
116 | # Fix paths in manpages and sample configuration files |
---|
117 | foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] { |
---|
118 | reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage} |
---|
119 | } |
---|
120 | foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] { |
---|
121 | reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile} |
---|
122 | } |
---|
123 | # Symlink mysql binaries into bin directory, with ${major_version} appended to the name |
---|
124 | foreach f [glob -tails -directory ${destroot}${bindir} my*] { |
---|
125 | ln -sf ${bindir}/${f} ${destroot}${prefix}/bin/${f}${major_version} |
---|
126 | } |
---|
127 | } |
---|
128 | |
---|
129 | post-install { |
---|
130 | if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${mysql}/org.macports.${mysql}.plist]} { |
---|
131 | ui_msg "The Percona client has been installed." |
---|
132 | ui_msg "If you also want a Percona server, install the percona-server-devel port." |
---|
133 | } |
---|
134 | } |
---|
135 | |
---|
136 | livecheck.type regex |
---|
137 | livecheck.url http://www.percona.com/downloads/Percona-Server-${branch}/ |
---|
138 | livecheck.version ${release} |
---|
139 | livecheck.regex "/Percona-Server-${version_mysql}-(\[^/\]+)/" |
---|