[97469] trunk/dports/databases/mysql5/Portfile

pixilla at macports.org pixilla at macports.org
Thu Sep 6 21:36:09 PDT 2012


Revision: 97469
          https://trac.macports.org/changeset/97469
Author:   pixilla at macports.org
Date:     2012-09-06 21:36:08 -0700 (Thu, 06 Sep 2012)
Log Message:
-----------
databases/mysql5:
- Unify mysql5-server.

Modified Paths:
--------------
    trunk/dports/databases/mysql5/Portfile

Modified: trunk/dports/databases/mysql5/Portfile
===================================================================
--- trunk/dports/databases/mysql5/Portfile	2012-09-07 04:21:16 UTC (rev 97468)
+++ trunk/dports/databases/mysql5/Portfile	2012-09-07 04:36:08 UTC (rev 97469)
@@ -8,7 +8,6 @@
 PortGroup               muniversal 1.0
 
 name                    mysql5
-conflicts               mysql5-devel mysql4
 version                 5.1.65
 set branch              [join [lrange [split ${version} .] 0 1] .]
 homepage                http://www.mysql.com/
@@ -38,13 +37,6 @@
 checksums           rmd160  f777be188656bf5ff4c486e2ecf8faf7f9969d99 \
                     sha256  393c2933b27aeb5d80d4da628e2371d85fee8d4d7fa3e08aa181edb7385a4db9
 
-depends_lib \
-    port:zlib \
-    port:openssl
-
-archcheck.files         lib/libz.dylib \
-                        lib/libssl.dylib
-
 set major_version       [strsed ${version} {s/\..*$//}]
 set mysql               mysql${major_version}
 set libdir              ${prefix}/lib/${mysql}
@@ -58,94 +50,146 @@
     set mysqluser       mysql
 }
 
-patch.pre_args      -p1
-patchfiles          patch-Makefile.in.diff \
-                    patch-scripts-mysql_secure_installation.sh.diff
+if {${name} == ${subport}} {
 
-post-patch {
-    reinplace s%@BINDIR@%${bindir}%g ${worksrcpath}/scripts/mysql_secure_installation.sh
-}
-
-configure.args \
-    --mandir=${prefix}/share/man \
-    --infodir=${prefix}/share/info \
-    --localstatedir=${dbdir} \
-    --libdir=${libdir} \
-    --bindir=${bindir} \
-    --includedir=${prefix}/include/${mysql} \
-    --datadir=${prefix}/share/${mysql} \
-    --sysconfdir=${sysconfdir} \
-    --with-zlib-dir=${prefix} \
-    --with-ssl=${prefix} \
-    --with-extra-charsets=complex \
-    --with-unix-socket-path=${prefix}/var/run/${mysql}/mysqld.sock \
-    --with-mysqld-user=${mysqluser} \
-    --without-docs \
-    --with-plugins=all \
-    --enable-thread-safe-client
-# the following is in store for future
-#    --program-suffix=5
-
-# Add readline support.
-# "--without-readline" has the peculiar meaning "do not use the bundled copy
-# of readline but use the system's (i.e. MacPorts') copy of readline"
-depends_lib-append      port:readline
-archcheck.files-append  lib/libreadline.dylib
-configure.args-append   --without-readline
-
-# Build libmysqld embedded server.
-configure.cflags-append -fPIC
-configure.cxxflags-append -fPIC
-configure.args-append --with-embedded-server --with-pic
-
-# BUILD FIX TODO: clang, build system
-# doesn't build with clang as of 2011.06.27
-# This looks like a bug in mysql's build system
-if {${configure.compiler} == "clang"} {
-    configure.compiler llvm-gcc-4.2
-}
-
-post-build {
-    if {[variant_isset universal]} {
-        set dirs {}
-        foreach arch ${universal_archs_to_use} {
-            lappend dirs ${worksrcpath}-${arch}
+    conflicts               mysql5-devel mysql4
+    depends_lib \
+        port:zlib \
+        port:openssl
+    
+    archcheck.files         lib/libz.dylib \
+                            lib/libssl.dylib
+    
+    patch.pre_args      -p1
+    patchfiles          patch-Makefile.in.diff \
+                        patch-scripts-mysql_secure_installation.sh.diff
+    
+    post-patch {
+        reinplace s%@BINDIR@%${bindir}%g ${worksrcpath}/scripts/mysql_secure_installation.sh
+    }
+    
+    configure.args \
+        --mandir=${prefix}/share/man \
+        --infodir=${prefix}/share/info \
+        --localstatedir=${dbdir} \
+        --libdir=${libdir} \
+        --bindir=${bindir} \
+        --includedir=${prefix}/include/${mysql} \
+        --datadir=${prefix}/share/${mysql} \
+        --sysconfdir=${sysconfdir} \
+        --with-zlib-dir=${prefix} \
+        --with-ssl=${prefix} \
+        --with-extra-charsets=complex \
+        --with-unix-socket-path=${prefix}/var/run/${mysql}/mysqld.sock \
+        --with-mysqld-user=${mysqluser} \
+        --without-docs \
+        --with-plugins=all \
+        --enable-thread-safe-client
+    # the following is in store for future
+    #    --program-suffix=5
+    
+    # Add readline support.
+    # "--without-readline" has the peculiar meaning "do not use the bundled copy
+    # of readline but use the system's (i.e. MacPorts') copy of readline"
+    depends_lib-append      port:readline
+    archcheck.files-append  lib/libreadline.dylib
+    configure.args-append   --without-readline
+    
+    # Build libmysqld embedded server.
+    configure.cflags-append -fPIC
+    configure.cxxflags-append -fPIC
+    configure.args-append --with-embedded-server --with-pic
+    
+    # BUILD FIX TODO: clang, build system
+    # doesn't build with clang as of 2011.06.27
+    # This looks like a bug in mysql's build system
+    if {${configure.compiler} == "clang"} {
+        configure.compiler llvm-gcc-4.2
+    }
+    
+    post-build {
+        if {[variant_isset universal]} {
+            set dirs {}
+            foreach arch ${universal_archs_to_use} {
+                lappend dirs ${worksrcpath}-${arch}
+            }
+        } else {
+            set dirs ${worksrcpath}
         }
-    } else {
-        set dirs ${worksrcpath}
+        foreach dir ${dirs} {
+            reinplace -E {s|-arch [a-z0-9_]+||g} \
+                ${dir}/scripts/mysql_config \
+                ${dir}/scripts/mysqlbug
+        }
     }
-    foreach dir ${dirs} {
-        reinplace -E {s|-arch [a-z0-9_]+||g} \
-            ${dir}/scripts/mysql_config \
-            ${dir}/scripts/mysqlbug
+    
+    pre-destroot {
+        xinstall -m 755 -d ${destroot}${sysconfdir}
+        destroot.keepdirs-append ${destroot}${sysconfdir}
     }
+    
+    post-destroot {
+        # Fix paths in manpages and sample configuration files
+        foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] {
+            reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage}
+        }
+        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] {
+            reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile}
+        }
+        
+        # Symlink mysql binaries into bin directory, with ${major_version} appended to the name
+        foreach f [glob -tails -directory ${destroot}${bindir} my*] {
+            ln -sf ${bindir}/${f} ${destroot}${prefix}/bin/${f}${major_version}
+        }
+    }
+    
+    post-install {
+        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${mysql}/org.macports.${mysql}.plist]} {
+            ui_msg "The MySQL client has been installed."
+            ui_msg "If you also want a MySQL server, install the mysql5-server port."
+        }
+    }
 }
 
-pre-destroot {
-    xinstall -m 755 -d ${destroot}${sysconfdir}
-    destroot.keepdirs-append ${destroot}${sysconfdir}
-}
+subport mysql5-server {
 
-post-destroot {
-    # Fix paths in manpages and sample configuration files
-    foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] {
-        reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage}
+    conflicts               mysql5-server-devel
+    supported_archs         noarch
+
+    depends_run \
+        port:mysql5
+    
+    distfiles
+
+    use_configure           no
+    
+    build {}
+    
+    destroot {
+        addgroup ${mysqluser}
+        set gid [existsgroup ${mysqluser}]
+        adduser ${mysqluser} gid=${gid} realname=MySQL\ Server
+        
+        xinstall -m 755 -o root -d ${destroot}${prefix}/var/run
+        
+        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
+            ${destroot}${dbdir} \
+            ${destroot}${prefix}/var/log/${mysql} \
+            ${destroot}${prefix}/var/run/${mysql}
+        destroot.keepdirs-append  \
+            ${destroot}${dbdir} \
+            ${destroot}${prefix}/var/log/${mysql} \
+            ${destroot}${prefix}/var/run/${mysql}
     }
-    foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] {
-        reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile}
-    }
     
-    # Symlink mysql binaries into bin directory, with ${major_version} appended to the name
-    foreach f [glob -tails -directory ${destroot}${bindir} my*] {
-        ln -sf ${bindir}/${f} ${destroot}${prefix}/bin/${f}${major_version}
-    }
-}
+    
+    startupitem.create      yes
+    startupitem.name        ${mysql}
+    startupitem.start       "${prefix}/share/${mysql}/mysql/mysql.server start"
+    startupitem.stop        "${prefix}/share/${mysql}/mysql/mysql.server stop"
 
-post-install {
-    if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${mysql}/org.macports.${mysql}.plist]} {
-        ui_msg "The MySQL client has been installed."
-        ui_msg "If you also want a MySQL server, install the mysql5-server port."
-    }
+    notes "If this is a new install, in order to setup the database you might want to run:" \
+        "sudo -u ${mysqluser} mysql_install_db5"
 }
 
 livecheck.type          regex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120906/8638eb07/attachment.html>


More information about the macports-changes mailing list