mkdir -p build
cd build

cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DINSTALL_SYSCONFDIR=/etc/mysql \
-DINSTALL_SYSCONF2DIR=/etc/my.cnf.d \
-DMYSQL_DATADIR=/var/lib/mysql \
-DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DENABLED_LOCAL_INFILE=ON \
-DINSTALL_MANDIR=share/man \
-DINSTALL_PLUGINDIR=/usr/lib/mysql/plugin \
-DINSTALL_SCRIPTDIR=bin \
-DINSTALL_INCLUDEDIR=include/mysql \
-DINSTALL_DOCREADMEDIR=share/mysql \
-DINSTALL_SUPPORTFILESDIR=share/mysql \
-DINSTALL_MYSQLSHAREDIR=share/mysql \
-DINSTALL_DOCDIR=share/doc \
-DINSTALL_SHAREDIR=share/mysql \
-DWITH_PCRE=bundled \
-DWITH_READLINE=ON \
-DWITH_ZLIB=system \
-DWITH_SSL=system \
-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_TOKUDB_STORAGE_ENGINE=1 \
-DCMAKE_C_FLAGS="-fPIC ${CFLAGS} -fno-strict-aliasing -fomit-frame-pointer" \
-DCMAKE_CXX_FLAGS="-fPIC ${CXXFLAGS} -fno-strict-aliasing -felide-constructors -fno-rtti" \
-DWITH_MYSQLD_LDFLAGS="${LDFLAGS}"

make ${MAKEJOBS}
