aboutsummaryrefslogtreecommitdiff
path: root/development/mariadb/mariadb.build
blob: b1945e86c3089a9aecfb32736a644bf7917e3c5f (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash
#
# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>

source /usr/src/ports/Build/build.sh

NAME=mariadb
VERSION=5.5.30
BUILD=1
OPTDEPENDS=('openssl >= 1.0.1e-1')

# Description

cat > ${PKG}/install/slack-desc <<EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

$(padd)|-----handy-ruler------------------------------------------------------|
${NAME}: mariadb (relational database server)
${NAME}:
${NAME}: A true multi-user, multi-threaded SQL database server which is
${NAME}: a backward compatible, drop-in replacement of the MySQL database
${NAME}: server. It includes all major open source storage engines, including
${NAME}: the Aria storage engine.
${NAME}:
${NAME}: Homepage: http://mariadb.org
${NAME}:
${NAME}:
${NAME}:
EOF

cat >> ${PKG}/install/doinst.sh <<EOF
#!/bin/sh

config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
    # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

# If the mariadb user and group do not exist, add them

if grep "^mariadb:x:" etc/passwd 1> /dev/null 2> /dev/null ; then
  true
else
  echo "mariadb:x:27:27:MariaDB:/var/lib/mariadb:/bin/bash" >> etc/passwd
fi
if grep "^mariadb:x:" etc/group 1> /dev/null 2> /dev/null ; then
  true
else
  echo "mariadb:x:27:" >> etc/group
fi
if grep "^mariadb:" etc/shadow 1> /dev/null 2> /dev/null ; then
  true
else
  echo "mariadb:*:9797:0:::::" >> etc/shadow
fi

# Fix directory permissions

(
  cd var/lib
  chown mariadb.mariadb mariadb
  chmod 750 mariadb
)

# Create mariadb's run directory if it's not already there

if [ ! -d run/mariadb ]; then
  install -m 0750 -o mariadb -g mariadb -d run/mariadb
fi

# Initialize the database if it isn't

if [ ! -d var/lib/mariadb/mysql ]; then
  usr/bin/mysql_install_db --user=mariadb --basedir=usr --datadir=var/lib/mariadb
  chown -R mariadb.mariadb var/lib/mariadb &>/dev/null
fi

# Keep same perms on rc.mariadb.new:

if [ -e etc/rc.d/rc.mariadb ]; then
  cp -a etc/rc.d/rc.mariadb etc/rc.d/rc.mariadb.new.incoming
  cat etc/rc.d/rc.mariadb.new > etc/rc.d/rc.mariadb.new.incoming
  mv etc/rc.d/rc.mariadb.new.incoming etc/rc.d/rc.mariadb.new
fi

config etc/rc.d/rc.mariadb.new
config etc/mariadb/mysqlaccess.conf.new
config etc/mariadb/my.cnf.new
config etc/mariadb/my.cnf.d/client.cnf.new
config etc/mariadb/my.cnf.d/mysql-clients.cnf.new
config etc/mariadb/my.cnf.d/server.cnf.new
config etc/logrotate.d/mariadb.new
EOF

# Sources

SRCNAME[0]=${NAME}
SRCVERS[0]=${VERSION}
SRCPACK[0]=http://downloads.askmonty.org/f/${SRCNAME[0]}-${SRCVERS[0]}/kvm-tarbake-jaunty-x86/${SRCNAME[0]}-${SRCVERS[0]}.tar.gz
SRCCOPY[0]="GPL2 LGPL21"
# normla nostrip ?

build0()
{
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DMANUFACTURER="Tightware" \
    -DCMAKE_C_FLAGS="-fPIC ${FLAGS} -DBIG_JOINS=1 -fno-strict-aliasing" \
    -DCMAKE_CXX_FLAGS="-fPIC ${FLAGS} -DBIG_JOINS=1 -fno-strict-aliasing -felide-constructors -fno-rtti" \
    -DWITH_MYSQLD_LDFLAGS="${LDFLAGS}" \
    -DCMAKE_INSTALL_PREFIX="${SYS_DIR[usr]}" \
    -DMYSQL_DATADIR="${SYS_DIR[var]}/lib/mariadb" \
    -DMYSQL_UNIX_ADDR="${SYS_DIR[run]}/mariadb/mariadb.sock" \
    -DINSTALL_SCRIPTDIR="${SYS_DIR[bin]}" \
    -DINSTALL_INCLUDEDIR="${SYS_DIR[include]}/mariadb" \
    -DINSTALL_SYSCONFDIR="${SYS_DIR[etc]}/mariadb" \
    -DINSTALL_MANDIR="${SYS_DIR[man]}" \
    -DINSTALL_PLUGINDIR="${SYS_DIR[lib]}/plugins/mariadb" \
    -DINSTALL_SHAREDIR="${SYS_DIR[share]}" \
    -DINSTALL_MYSQLSHAREDIR="share/application-data/mariadb" \
    -DINSTALL_SUPPORTFILESDIR="${SYS_DIR[doc]}/mariadb/sample" \
    -DINSTALL_DOCREADMEDIR="${SYS_DIR[doc]}/mariadb" \
    -DINSTALL_DOCDIR="${SYS_DIR[doc]}/mariadb" \
    -DINSTALL_SQLBENCHDIR="${SYS_DIR[usr]}/src" \
    -DINSTALL_MYSQLTESTDIR="${SYS_DIR[usr]}/src" \
    -DMYSQLD_USER="mariadb" \
    -DDEFAULT_CHARSET=utf8 \
    -DDEFAULT_COLLATION=utf8_general_ci \
    -DENABLED_LOCAL_INFILE=ON \
    -DUSE_ARIA_FOR_TMP_TABLES=ON \
    -DWITH_ZLIB=system \
    -DWITH_SSL=system \
    -DWITH_READLINE=ON \
    -DWITH_LIBWRAP=OFF \
    -DWITH_EXTRA_CHARSETS=complex \
    -DWITH_EMBEDDED_SERVER=ON \
    -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
    -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
    -DWITH_INNOBASE_STORAGE_ENGINE=1 \
    -DWITH_PARTITION_STORAGE_ENGINE=1 \
    -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
    -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 \
    -DWITHOUT_PBXT_STORAGE_ENGINE=1 \
CMakeLists.txt
make ${JOBS}
make install DESTDIR="${PKG}"
install.dir ${PKG}${SYS_DIR[var]}/lib/mariadb
install.dir ${PKG}${SYS_DIR[etc]}/{rc.d,tmpfiles.d}
install.dat rc.mariadb.new ${PKG}${SYS_DIR[etc]}/rc.d/rc.mariadb.new
install.dat mariadb.conf.tmpfiles ${PKG}${SYS_DIR[etc]}/tmpfiles.d/mariadb.conf
install.dir ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.dat mariadb.service ${PKG}${SYS_DIR[systemdsystemunitdir]}
install.bin mysqld-post.sh ${PKG}${SYS_DIR[bin]}/mysqld-post
install.dat support-files/{my-*.cnf,*.ini} ${PKG}${SYS_DIR[etc]}/mariadb
install.cfg scripts/mysqlaccess.conf ${PKG}${SYS_DIR[etc]}/mariadb
mv \
 ${PKG}${SYS_DIR[lib]}/plugins/mariadb/daemon_example.ini \
 ${PKG}${SYS_DIR[etc]}/mariadb
config ${PKG}${SYS_DIR[etc]}/logrotate.d/mariadb
config ${PKG}${SYS_DIR[etc]}/mariadb/mysqlaccess.conf
config ${PKG}${SYS_DIR[etc]}/mariadb/my.cnf
config ${PKG}${SYS_DIR[etc]}/mariadb/my.cnf.d/client.cnf
config ${PKG}${SYS_DIR[etc]}/mariadb/my.cnf.d/mysql-clients.cnf
config ${PKG}${SYS_DIR[etc]}/mariadb/my.cnf.d/server.cnf

#FIXME: compat

(
  cd ${PKG}${SYS_DIR[include]}
  ln -sf mariadb mysql
)

# Unneeded stuff

rm -rf \
 ${PKG}${SYS_DIR[lib]}/libmysql{d,client,client_r}.a \
 ${PKG}${SYS_DIR[bin]}/rcmysql \
 ${PKG}${SYS_DIR[etc]}/init.d \
 ${PKG}${SYS_DIR[man]}/man1/{mysqlman,mysql.server,mysql*test*.pl}.1 \
 ${PKG}${SYS_DIR[usr]}/src \
 ${PKG}${SYS_DIR[usr]}/data \
 ${PKG}${SYS_DIR[doc]}/mariadb

#FIXME: Make subpackages of mysql-test and sql-bench
}