summaryrefslogtreecommitdiff
blob: 8d8462e547190cee17c8998f3ec6336fb1c9f083 (plain)
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
# Copyright 1999-2000 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Author Achim Gottinger <achim@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/mysql-3.23.38.ebuild,v 1.3 2001/06/09 19:46:14 achim Exp $

A=${P}.tar.gz
S=${WORKDIR}/${P}
DESCRIPTION="The MySQL Database"
SRC_URI="ftp://mysql.valueclick.com/mysql/Downloads/MySQL-3.23/${A}
	 http://www.mysql.com/Downloads/MySQL-3.23/${A}"

HOMEPAGE="http://www.mysql.com/"

DEPEND="virtual/glibc
        sys-devel/automake
        sys-devel/libtool
        sys-devel/autoconf
        sys-apps/procps
        tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
        berkdb? ( >=sys-libs/db-3.2.3h )
        readline? ( >=sys-libs/readline-4.1 )
        >=sys-libs/ncurses-5.1
        >=sys-libs/zlib-1.1.3"

RDEPEND="virtual/glibc
	berkdb? ( >=sys-libs/db-3.2.3h )
    readline? ( >=sys-libs/readline-4.1 )
    >=sys-libs/ncurses-5.1
    >=sys-libs/zlib-1.1.3"

src_unpack() {
	unpack ${A}
	cd ${S}
	echo ">>> Applying ${P}-db-3.2.3-gentoo.diff..."
	patch -p1 < ${FILESDIR}/${P}-db-3.2.3-gentoo.diff
	# Required for qmail-mysql
	echo ">>> Applying ${P}-nisam.h-gentoo.diff..."
	patch -p0 < ${FILESDIR}/${P}-nisam.h-gentoo.diff
	aclocal
	automake
	autoconf &>/dev/null
}

src_compile() {

    local myconf

    # MySQL doesn't like optimizations
    export CFLAGS="${CFLAGS/-O?/}"
    export CXXFLAGS="${CXXFLAGS/-O?/}"

    if [ "`use tcpd`" ]
    then
      myconf="--with-libwrap"
    fi

    if [ "`use readline`" ]
    then
      # Means use system readline
      myconf="$myconf --without-readline"
    fi

    if [ "`use berkdb`" ]
    then
      myconf="$myconf --with-berkeley-db --with-berkeley-db-includes=/usr/include/db3 --with-berkeley-db-libs=/usr/lib"
    else
      myconf="$myconf --without-berkdb"
    fi

    if [ "$DEBUG" == "true" ]
    then
      myconf="$myconf --with-debug"
    else
      myconf="$myconf --without-debug"
    fi
    
	try CXX=gcc ./configure --prefix=/usr --host=${CHOST} \
	--enable-shared \
	--enable-static \
	--enable-assembler \
	--enable-thread-safe-client \
	--with-raid \
	--with-low-memory \
	--libdir=/usr/lib \
	--libexecdir=/usr/sbin \
	--sysconfdir=/etc/mysql \
	--localstatedir=/var/mysql \
	--infodir=/usr/share/info \
	--mandir=/usr/share/man \
	--with-mysql-user=mysql \
    $myconf

	try make testdir=/usr/share/mysql/test benchdir=/usr/share/mysql/bench
}

src_install() {

	
	# Install MySQL

	try make install prefix=${D}/usr \
		libdir=${D}/usr/lib \
		libexecdir=${D}/usr/sbin \
		sysconfdir=${D}/etc/mysql \
		localstatedir=${D}/var/mysql \
		infodir=${D}/usr/share/info \
		mandir=${D}/usr/share/man \
	 	testdir=${D}/usr/share/mysql/test \
		benchdir=${D}/usr/share/mysql/bench


	# Move Client Libs
	mv ${D}/usr/lib/mysql/libmysqlclient*.so* ${D}/usr/lib
        dosym ../libmysqlclient.so /usr/lib/mysql/libmysqlclient.so
	insinto /usr/include/mysql
        doins include/my_config.h include/my_dir.h
	dodir /etc/mysql
	cp scripts/mysqlaccess.conf ${D}/etc/mysql
	cp ${FILESDIR}/my.cnf ${D}/etc/mysql

	dodir /etc/rc.d/init.d
	cp ${FILESDIR}/mysql ${D}/etc/rc.d/init.d/mysql
	
	# MySQL Docs
	

	dodoc README MIRRORS
	cd ${S}/Docs 
	docinto ps
	dodoc manual.ps 
	docinto txt
	dodoc manual.txt
	docinto html
	dodoc manual.html manual_toc.html
		
}

pkg_config () {

  echo "Setting up symlinks..."
  ${ROOT}/usr/sbin/rc-update add mysql

}