source: trunk/dports/databases/mysql55-lib_mysqludf_json/Portfile

Last change on this file was 98509, checked in by pixilla@…, 5 years ago

databases/mysql55-lib_mysqludf_json:

  • New port, user defined function json.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id: Portfile 98509 2012-10-07 18:48:41Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6set package.name    lib_mysqludf_json
7version             0.0.2
8set mysql.name      mysql55
9name                ${mysql.name}-${package.name}
10
11set mysql.ports     {mysql5 mysql51 mysql55 mariadb percona}
12foreach mysql.port ${mysql.ports} {
13
14    lappend mysql.extension.ports "${mysql.port}-${package.name}"
15}
16foreach mysql.extension.port ${mysql.extension.ports} {
17
18    set idx [lsearch ${mysql.extension.ports} ${mysql.extension.port}]
19    set mysql.port [lindex ${mysql.ports} $idx]
20    if {${mysql.extension.port} == ${name} == ${subport}} {
21
22        depends_lib-append  port:${mysql.port}
23    } else {
24
25        subport ${mysql.port}-${package.name} {
26   
27            set mysql.name      ${mysql.port}
28            depends_lib-append  port:${mysql.port}
29        }
30    }
31}
32
33categories          databases lang
34maintainers         pixilla
35platforms           darwin
36license             LGPL
37
38description         Map database data to the JSON.
39long_description    ${description}
40
41homepage            http://www.mysqludf.org/${package.name}/
42master_sites        ${homepage}
43
44dist_subdir         lib_mysqludf
45distname            ${package.name}_${version}
46
47checksums           rmd160  4c98739ed2753580195e11e602777188bc9a20ff \
48                    sha256  bed11c73d1e5d23669051b8a430f5c17b961e462ee82612b7dcdbceba47052b5
49
50extract.mkdir       yes
51
52use_configure       no
53
54configure.cflags-append \
55                    -I${prefix}/include/${mysql.name} \
56                    -I${prefix}/include/${mysql.name}/mysql \
57                    -bundle \
58                    -undefined dynamic_lookup
59
60post-extract {
61    move ${worksrcpath}/${package.name}.so \
62            ${worksrcpath}/${package.name}.so.orig
63}
64
65build {
66    set cmd "${configure.cpp} ${configure.ldflags} ${configure.cflags} ${configure.cppflags}"
67    if [variant_isset universal] {
68
69        set  "${cmd} ${configure.universal_cflags}"
70    }
71    system "cd ${worksrcpath} && ${cmd} ${package.name}.c -o ${package.name}.so"
72
73    xinstall -d ${worksrcpath}/macports
74    set fp [open ${worksrcpath}/macports/installdb.sql w]
75    puts $fp "USE mysql;"
76    puts $fp "DROP FUNCTION IF EXISTS lib_mysqludf_json_info;"
77    puts $fp "DROP FUNCTION IF EXISTS json_array;"
78    puts $fp "DROP FUNCTION IF EXISTS json_members;"
79    puts $fp "DROP FUNCTION IF EXISTS json_object;"
80    puts $fp "DROP FUNCTION IF EXISTS json_values;"
81    puts $fp "CREATE FUNCTION lib_mysqludf_json_info RETURNS STRING SONAME '${package.name}.so';"
82    puts $fp "CREATE FUNCTION json_array RETURNS REAL SONAME '${package.name}.so';"
83    puts $fp "CREATE FUNCTION json_members RETURNS REAL SONAME '${package.name}.so';"
84    puts $fp "CREATE FUNCTION json_object RETURNS REAL SONAME '${package.name}.so';"
85    puts $fp "CREATE FUNCTION json_values RETURNS REAL SONAME '${package.name}.so';"
86    close $fp
87
88    set fp [open ${worksrcpath}/macports/uninstalldb.sql w]
89    puts $fp "USE mysql;"
90    puts $fp "DROP FUNCTION IF EXISTS lib_mysqludf_json_info;"
91    puts $fp "DROP FUNCTION IF EXISTS json_array;"
92    puts $fp "DROP FUNCTION IF EXISTS json_members;"
93    puts $fp "DROP FUNCTION IF EXISTS json_object;"
94    puts $fp "DROP FUNCTION IF EXISTS json_values;"
95    close $fp
96}
97
98destroot {
99    xinstall -m 755 -d ${destroot}${prefix}/lib/${mysql.name}/plugin
100    xinstall -m 644 -W ${worksrcpath} \
101        ${package.name}.so \
102        ${destroot}${prefix}/lib/${mysql.name}/plugin
103    xinstall -m 755 -d ${destroot}${prefix}/share/${mysql.name}/${package.name}
104    xinstall -m 644 -W ${worksrcpath}/macports installdb.sql uninstalldb.sql \
105        ${destroot}${prefix}/share/${mysql.name}/${package.name}
106    xinstall -m 755 -d ${destroot}${prefix}/share/${mysql.name}/${package.name}/doc/html
107    xinstall -m 644 ${worksrcpath}/${package.name}.html \
108        ${destroot}${prefix}/share/${mysql.name}/${package.name}/doc/html/index.html
109}
110
111livecheck.url       [lindex ${master_sites} 0]
112livecheck.type      regex
113livecheck.regex     "href=.${package.name}_((?!\\${extract.suffix}).*)\\${extract.suffix}."
114
115notes "
116
117    This port installs two mysql scripts to simplify the install/uninstall of the ${package.name}
118    UDFs (user-defined-functions) along with html documentation describing the functions syntax.
119   
120    Install:
121    \$ ${prefix}/lib/${mysql.name}/bin/mysql -uroot -p < ${prefix}/share/${mysql.name}/${package.name}/installdb.sql
122
123    Uninstall:
124    \$ ${prefix}/lib/${mysql.name}/bin/mysql -uroot -p < ${prefix}/share/${mysql.name}/${package.name}/uninstalldb.sql
125   
126    HTML Documentation:
127    $ open ${prefix}/share/${mysql.name}/${package.name}/doc/html/index.html
128    "
Note: See TracBrowser for help on using the repository browser.