From cd7450d95ca0fdacf54a13af7f0ec82c0a518895 Mon Sep 17 00:00:00 2001 From: Steve Prybylski Date: Wed, 9 Sep 2015 15:03:21 -0400 Subject: [PATCH] mariadb: fix musl; fix cross-compile --- srcpkgs/mariadb/patches/fix-cross.patch | 68 +++++++++++++++++++++++++ srcpkgs/mariadb/patches/fix-musl.patch | 36 +++++++++++++ srcpkgs/mariadb/patches/poll-h.patch | 35 +++++++++++++ srcpkgs/mariadb/template | 22 +++++--- 4 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 srcpkgs/mariadb/patches/fix-cross.patch create mode 100644 srcpkgs/mariadb/patches/fix-musl.patch create mode 100644 srcpkgs/mariadb/patches/poll-h.patch diff --git a/srcpkgs/mariadb/patches/fix-cross.patch b/srcpkgs/mariadb/patches/fix-cross.patch new file mode 100644 index 00000000000..cbd981b1320 --- /dev/null +++ b/srcpkgs/mariadb/patches/fix-cross.patch @@ -0,0 +1,68 @@ +--- ./CMakeLists.txt.orig 2015-09-17 15:47:59.794784111 -0400 ++++ ./CMakeLists.txt 2015-09-19 19:42:16.751348473 -0400 +@@ -362,10 +376,10 @@ + + CHECK_PCRE() + +-IF(CMAKE_CROSSCOMPILING) +- SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build") +- INCLUDE(${IMPORT_EXECUTABLES}) +-ENDIF() ++# IF(CMAKE_CROSSCOMPILING) ++# SET(IMPORT_EXECUTABLES "IMPORTFILE-NOTFOUND" CACHE FILEPATH "Path to import_executables.cmake from a native build") ++# INCLUDE(${IMPORT_EXECUTABLES}) ++# ENDIF() + + # + # Setup maintainer mode options. Platform checks are + +--- ./storage/xtradb/CMakeLists.txt.orig 2015-09-17 11:17:04.967280099 -0400 ++++ ./storage/xtradb/CMakeLists.txt 2015-09-17 11:18:58.011276650 -0400 +@@ -455,12 +455,13 @@ + SET(WITH_INNOBASE_STORAGE_ENGINE TRUE) + ENDIF() + +-IF(XTRADB_OK) +- MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE +- DEFAULT +- RECOMPILE_FOR_EMBEDDED +- LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT}) +-ELSE() +- MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform") ++IF(WITH_XTRADB) ++ IF(XTRADB_OK) ++ MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE ++ DEFAULT ++ RECOMPILE_FOR_EMBEDDED ++ LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT}) ++ ELSE() ++ MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform") ++ ENDIF() + ENDIF() +- + +--- ./storage/innobase/CMakeLists.txt.orig 2015-09-18 21:28:54.446428704 -0400 ++++ ./storage/innobase/CMakeLists.txt 2015-09-18 21:40:24.987436643 -0400 +@@ -15,6 +15,10 @@ + + # This is the CMakeLists for InnoDB + ++IF(NOT WITH_INNOBASE_STORAGE_ENGINE) ++ RETURN() ++ENDIF() ++ + INCLUDE(CheckFunctionExists) + INCLUDE(CheckCSourceCompiles) + INCLUDE(CheckCSourceRuns) + +--- ./storage/tokudb/ft-index/cmake_modules/TokuFeatureDetection.cmake.orig 2015-09-19 21:44:36.724432860 -0400 ++++ ./storage/tokudb/ft-index/cmake_modules/TokuFeatureDetection.cmake 2015-09-19 21:45:58.880433804 -0400 +@@ -92,7 +92,7 @@ + if (HAVE_BACKTRACE_WITH_EXECINFO) + list(APPEND EXTRA_SYSTEM_LIBS execinfo) + else () +- message(FATAL_ERROR "Cannot find backtrace(), even with -lexecinfo.") ++ message(WARNING "Cannot find backtrace(), even with -lexecinfo.") + endif () + endif () + diff --git a/srcpkgs/mariadb/patches/fix-musl.patch b/srcpkgs/mariadb/patches/fix-musl.patch new file mode 100644 index 00000000000..94cfea5da57 --- /dev/null +++ b/srcpkgs/mariadb/patches/fix-musl.patch @@ -0,0 +1,36 @@ +--- ./strings/my_vsnprintf.c.orig 2015-09-16 23:54:27.348529851 -0400 ++++ ./strings/my_vsnprintf.c 2015-09-16 23:57:11.968524828 -0400 +@@ -827,11 +827,7 @@ + */ + #if defined(__WIN__) + strerror_s(buf, len, nr); +-#elif ((defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE >= 200112L)) || \ +- (defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \ +- ! defined _GNU_SOURCE +- strerror_r(nr, buf, len); /* I can build with or without GNU */ +-#elif defined _GNU_SOURCE ++#elif defined(__GLIBC__) && defined (_GNU_SOURCE) + char *r= strerror_r(nr, buf, len); + if (r != buf) /* Want to help, GNU? */ + strmake(buf, r, len - 1); /* Then don't. */ + +--- ./storage/mroonga/vendor/groonga/lib/com.c.orig 2015-09-16 23:53:30.468531587 -0400 ++++ ./storage/mroonga/vendor/groonga/lib/com.c 2015-09-16 23:53:43.165531199 -0400 +@@ -351,7 +351,7 @@ + struct epoll_event e; + memset(&e, 0, sizeof(struct epoll_event)); + e.data.fd = (fd); +- e.events = (__uint32_t) events; ++ e.events = (uint32_t) events; + if (epoll_ctl(ev->epfd, EPOLL_CTL_ADD, (fd), &e) == -1) { + SERR("epoll_ctl"); + return ctx->rc; +@@ -399,7 +399,7 @@ + struct epoll_event e; + memset(&e, 0, sizeof(struct epoll_event)); + e.data.fd = (fd); +- e.events = (__uint32_t) events; ++ e.events = (uint32_t) events; + if (epoll_ctl(ev->epfd, EPOLL_CTL_MOD, (fd), &e) == -1) { + SERR("epoll_ctl"); + return ctx->rc; diff --git a/srcpkgs/mariadb/patches/poll-h.patch b/srcpkgs/mariadb/patches/poll-h.patch new file mode 100644 index 00000000000..358754ec39a --- /dev/null +++ b/srcpkgs/mariadb/patches/poll-h.patch @@ -0,0 +1,35 @@ +--- ./libmysql/libmysql.c.orig 2015-09-19 22:16:15.039454684 -0400 ++++ ./libmysql/libmysql.c 2015-09-19 22:16:44.841455027 -0400 +@@ -48,7 +48,7 @@ + #endif + #endif /* !defined(__WIN__) */ + #ifdef HAVE_POLL +-#include ++#include + #endif + #ifdef HAVE_SYS_UN_H + #include + +--- ./include/my_net.h.orig 2015-09-19 22:18:14.641456059 -0400 ++++ ./include/my_net.h 2015-09-19 22:18:29.871456234 -0400 +@@ -37,7 +37,7 @@ + #include + #endif + #ifdef HAVE_POLL +-#include ++#include + #endif + #ifdef HAVE_SYS_IOCTL_H + #include + +--- ./storage/mroonga/vendor/groonga/lib/grn_com.h.orig 2015-09-19 22:53:30.420480384 -0400 ++++ ./storage/mroonga/vendor/groonga/lib/grn_com.h 2015-09-19 22:54:29.412481062 -0400 +@@ -83,7 +83,7 @@ + # define GRN_COM_POLLIN EVFILT_READ + # define GRN_COM_POLLOUT EVFILT_WRITE + # else /* USE_KQUEUE */ +-# include ++# include + # define GRN_COM_POLLIN POLLIN + # define GRN_COM_POLLOUT POLLOUT + # endif /* USE_KQUEUE */ diff --git a/srcpkgs/mariadb/template b/srcpkgs/mariadb/template index 18e6d90b0b9..65bbed643c9 100644 --- a/srcpkgs/mariadb/template +++ b/srcpkgs/mariadb/template @@ -1,9 +1,9 @@ # Template file for 'mariadb' pkgname=mariadb version=10.0.21 -revision=1 +revision=2 build_style=cmake -configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql +configure_args="-DMYSQL_DATADIR=/var/lib/mysql -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON -DINSTALL_INFODIR=share/mysql/docs -DINSTALL_MANDIR=share/man @@ -12,12 +12,10 @@ configure_args="-DSYSCONFDIR=/etc/mysql -DMYSQL_DATADIR=/var/lib/mysql -DINSTALL_SUPPORTFILESDIR=share/mysql -DINSTALL_MYSQLSHAREDIR=share/mysql -DINSTALL_DOCDIR=share/mysql/docs -DINSTALL_SHAREDIR=share/mysql -DWITH_ZLIB=system -DWITH_PCRE=system -DWITH_READLINE=ON -DWITH_SSL=system - -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_TOKUDB=1 + -DWITH_EMBEDDED_SERVER=ON -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITHOUT_TOKUDB=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 - -DWITHOUT_PBXT_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=complex - -DWITH_LIBWRAP=OFF -DSTACK_DIRECTION=1" + -DWITH_EXTRA_CHARSETS=complex -DWITH_LIBWRAP=OFF -DSTACK_DIRECTION=1" lib32disabled=yes hostmakedepends="perl cmake bison ncurses-devel" makedepends="zlib-devel ncurses-devel libressl-devel readline-devel pcre-devel" @@ -33,17 +31,23 @@ homepage="http://mariadb.org/" license="GPL-2" distfiles="https://downloads.$pkgname.org/f/$pkgname-$version/source/$pkgname-$version.tar.gz" checksum=4b9a32e15ceadefdb1057a02eb3e0addf702b75aef631a3c9194b832ecfa3545 +CFLAGS="-w" + +if [ -z "$CROSS_BUILD" ]; then + configure_args+=" -DWITH_XTRADB=1 -DWITH_INNOBASE_STORAGE_ENGINE=1" +fi pre_configure() { # We need some host binaries before starting cross compilation. if [ "$CROSS_BUILD" ]; then # XXX still broken: jemalloc configure execs host bins. CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake . - make comp_err comp_sql gen_lex_hash + make comp_err comp_sql gen_lex_hash gen_lex_token mkdir bin.host cp extra/comp_err bin.host cp scripts/comp_sql bin.host cp sql/gen_lex_hash bin.host + cp sql/gen_lex_token bin.host make clean rm CMakeCache.txt fi @@ -54,10 +58,12 @@ pre_build() { cp bin.host/comp_err ${wrksrc}/extra cp bin.host/comp_sql ${wrksrc}/scripts cp bin.host/gen_lex_hash ${wrksrc}/sql + cp bin.host/gen_lex_token ${wrksrc}/sql export PATH=${PATH}:${wrksrc}/extra:${wrksrc}/scripts:${wrksrc}/sql fi export LD_LIBRARY_PATH=${wrksrc}/build/storage/tokudb/ft-index/portability } + post_install() { # Remove unneeded stuff. rm -rf ${DESTDIR}/usr/{sql-bench,mysql-test,data}