Changeset 97469 for trunk/dports


Ignore:
Timestamp:
Sep 7, 2012, 4:36:08 AM (8 years ago)
Author:
pixilla@…
Message:

databases/mysql5:

  • Unify mysql5-server.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/databases/mysql5/Portfile

    r97287 r97469  
    99
    1010name                    mysql5
    11 conflicts               mysql5-devel mysql4
    1211version                 5.1.65
    1312set branch              [join [lrange [split ${version} .] 0 1] .]
     
    3938                    sha256  393c2933b27aeb5d80d4da628e2371d85fee8d4d7fa3e08aa181edb7385a4db9
    4039
    41 depends_lib \
    42     port:zlib \
    43     port:openssl
    44 
    45 archcheck.files         lib/libz.dylib \
    46                         lib/libssl.dylib
    47 
    4840set major_version       [strsed ${version} {s/\..*$//}]
    4941set mysql               mysql${major_version}
     
    5951}
    6052
    61 patch.pre_args      -p1
    62 patchfiles          patch-Makefile.in.diff \
    63                     patch-scripts-mysql_secure_installation.sh.diff
     53if {${name} == ${subport}} {
    6454
    65 post-patch {
    66     reinplace s%@BINDIR@%${bindir}%g ${worksrcpath}/scripts/mysql_secure_installation.sh
    67 }
    68 
    69 configure.args \
    70     --mandir=${prefix}/share/man \
    71     --infodir=${prefix}/share/info \
    72     --localstatedir=${dbdir} \
    73     --libdir=${libdir} \
    74     --bindir=${bindir} \
    75     --includedir=${prefix}/include/${mysql} \
    76     --datadir=${prefix}/share/${mysql} \
    77     --sysconfdir=${sysconfdir} \
    78     --with-zlib-dir=${prefix} \
    79     --with-ssl=${prefix} \
    80     --with-extra-charsets=complex \
    81     --with-unix-socket-path=${prefix}/var/run/${mysql}/mysqld.sock \
    82     --with-mysqld-user=${mysqluser} \
    83     --without-docs \
    84     --with-plugins=all \
    85     --enable-thread-safe-client
    86 # the following is in store for future
    87 #    --program-suffix=5
    88 
    89 # Add readline support.
    90 # "--without-readline" has the peculiar meaning "do not use the bundled copy
    91 # of readline but use the system's (i.e. MacPorts') copy of readline"
    92 depends_lib-append      port:readline
    93 archcheck.files-append  lib/libreadline.dylib
    94 configure.args-append   --without-readline
    95 
    96 # Build libmysqld embedded server.
    97 configure.cflags-append -fPIC
    98 configure.cxxflags-append -fPIC
    99 configure.args-append --with-embedded-server --with-pic
    100 
    101 # BUILD FIX TODO: clang, build system
    102 # doesn't build with clang as of 2011.06.27
    103 # This looks like a bug in mysql's build system
    104 if {${configure.compiler} == "clang"} {
    105     configure.compiler llvm-gcc-4.2
    106 }
    107 
    108 post-build {
    109     if {[variant_isset universal]} {
    110         set dirs {}
    111         foreach arch ${universal_archs_to_use} {
    112             lappend dirs ${worksrcpath}-${arch}
     55    conflicts               mysql5-devel mysql4
     56    depends_lib \
     57        port:zlib \
     58        port:openssl
     59   
     60    archcheck.files         lib/libz.dylib \
     61                            lib/libssl.dylib
     62   
     63    patch.pre_args      -p1
     64    patchfiles          patch-Makefile.in.diff \
     65                        patch-scripts-mysql_secure_installation.sh.diff
     66   
     67    post-patch {
     68        reinplace s%@BINDIR@%${bindir}%g ${worksrcpath}/scripts/mysql_secure_installation.sh
     69    }
     70   
     71    configure.args \
     72        --mandir=${prefix}/share/man \
     73        --infodir=${prefix}/share/info \
     74        --localstatedir=${dbdir} \
     75        --libdir=${libdir} \
     76        --bindir=${bindir} \
     77        --includedir=${prefix}/include/${mysql} \
     78        --datadir=${prefix}/share/${mysql} \
     79        --sysconfdir=${sysconfdir} \
     80        --with-zlib-dir=${prefix} \
     81        --with-ssl=${prefix} \
     82        --with-extra-charsets=complex \
     83        --with-unix-socket-path=${prefix}/var/run/${mysql}/mysqld.sock \
     84        --with-mysqld-user=${mysqluser} \
     85        --without-docs \
     86        --with-plugins=all \
     87        --enable-thread-safe-client
     88    # the following is in store for future
     89    #    --program-suffix=5
     90   
     91    # Add readline support.
     92    # "--without-readline" has the peculiar meaning "do not use the bundled copy
     93    # of readline but use the system's (i.e. MacPorts') copy of readline"
     94    depends_lib-append      port:readline
     95    archcheck.files-append  lib/libreadline.dylib
     96    configure.args-append   --without-readline
     97   
     98    # Build libmysqld embedded server.
     99    configure.cflags-append -fPIC
     100    configure.cxxflags-append -fPIC
     101    configure.args-append --with-embedded-server --with-pic
     102   
     103    # BUILD FIX TODO: clang, build system
     104    # doesn't build with clang as of 2011.06.27
     105    # This looks like a bug in mysql's build system
     106    if {${configure.compiler} == "clang"} {
     107        configure.compiler llvm-gcc-4.2
     108    }
     109   
     110    post-build {
     111        if {[variant_isset universal]} {
     112            set dirs {}
     113            foreach arch ${universal_archs_to_use} {
     114                lappend dirs ${worksrcpath}-${arch}
     115            }
     116        } else {
     117            set dirs ${worksrcpath}
    113118        }
    114     } else {
    115         set dirs ${worksrcpath}
     119        foreach dir ${dirs} {
     120            reinplace -E {s|-arch [a-z0-9_]+||g} \
     121                ${dir}/scripts/mysql_config \
     122                ${dir}/scripts/mysqlbug
     123        }
    116124    }
    117     foreach dir ${dirs} {
    118         reinplace -E {s|-arch [a-z0-9_]+||g} \
    119             ${dir}/scripts/mysql_config \
    120             ${dir}/scripts/mysqlbug
     125   
     126    pre-destroot {
     127        xinstall -m 755 -d ${destroot}${sysconfdir}
     128        destroot.keepdirs-append ${destroot}${sysconfdir}
     129    }
     130   
     131    post-destroot {
     132        # Fix paths in manpages and sample configuration files
     133        foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] {
     134            reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage}
     135        }
     136        foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] {
     137            reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile}
     138        }
     139       
     140        # Symlink mysql binaries into bin directory, with ${major_version} appended to the name
     141        foreach f [glob -tails -directory ${destroot}${bindir} my*] {
     142            ln -sf ${bindir}/${f} ${destroot}${prefix}/bin/${f}${major_version}
     143        }
     144    }
     145   
     146    post-install {
     147        if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${mysql}/org.macports.${mysql}.plist]} {
     148            ui_msg "The MySQL client has been installed."
     149            ui_msg "If you also want a MySQL server, install the mysql5-server port."
     150        }
    121151    }
    122152}
    123153
    124 pre-destroot {
    125     xinstall -m 755 -d ${destroot}${sysconfdir}
    126     destroot.keepdirs-append ${destroot}${sysconfdir}
    127 }
     154subport mysql5-server {
    128155
    129 post-destroot {
    130     # Fix paths in manpages and sample configuration files
    131     foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] {
    132         reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage}
    133     }
    134     foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] {
    135         reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile}
     156    conflicts               mysql5-server-devel
     157    supported_archs         noarch
     158
     159    depends_run \
     160        port:mysql5
     161   
     162    distfiles
     163
     164    use_configure           no
     165   
     166    build {}
     167   
     168    destroot {
     169        addgroup ${mysqluser}
     170        set gid [existsgroup ${mysqluser}]
     171        adduser ${mysqluser} gid=${gid} realname=MySQL\ Server
     172       
     173        xinstall -m 755 -o root -d ${destroot}${prefix}/var/run
     174       
     175        xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
     176            ${destroot}${dbdir} \
     177            ${destroot}${prefix}/var/log/${mysql} \
     178            ${destroot}${prefix}/var/run/${mysql}
     179        destroot.keepdirs-append  \
     180            ${destroot}${dbdir} \
     181            ${destroot}${prefix}/var/log/${mysql} \
     182            ${destroot}${prefix}/var/run/${mysql}
    136183    }
    137184   
    138     # Symlink mysql binaries into bin directory, with ${major_version} appended to the name
    139     foreach f [glob -tails -directory ${destroot}${bindir} my*] {
    140         ln -sf ${bindir}/${f} ${destroot}${prefix}/bin/${f}${major_version}
    141     }
    142 }
     185   
     186    startupitem.create      yes
     187    startupitem.name        ${mysql}
     188    startupitem.start       "${prefix}/share/${mysql}/mysql/mysql.server start"
     189    startupitem.stop        "${prefix}/share/${mysql}/mysql/mysql.server stop"
    143190
    144 post-install {
    145     if {![file exists ${prefix}/etc/LaunchDaemons/org.macports.${mysql}/org.macports.${mysql}.plist]} {
    146         ui_msg "The MySQL client has been installed."
    147         ui_msg "If you also want a MySQL server, install the mysql5-server port."
    148     }
     191    notes "If this is a new install, in order to setup the database you might want to run:" \
     192        "sudo -u ${mysqluser} mysql_install_db5"
    149193}
    150194
Note: See TracChangeset for help on using the changeset viewer.