Commit bf2ef4ea authored by Michal Hrusecky's avatar Michal Hrusecky 🦎

mariadb: build fixes for old Turris

parent f2ab4eb7
......@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/uclibc++.mk
PKG_NAME:=mariadb
PKG_VERSION:=10.2.7
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=\
......@@ -26,8 +26,6 @@ PKG_BUILD_PARALLEL:=1
HOST_BUILD_DEPENDS:=ncurses/host openssl/host pkg-config
PKG_FIXUP:=libtool
PKG_CC_STACKPROTECTOR_REGULAR = 0
PKG_CC_STACKPROTECTOR_STRONG = 0
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
......@@ -35,15 +33,17 @@ include $(INCLUDE_DIR)/cmake.mk
ifneq ($(CONFIG_USE_UCLIBC),)
ICONV_PREFIX:=$(STAGING_DIR)/usr/lib/libiconv-stub
TARGET_CFLAGS:=-I$(ICONV_PREFIX)/include
TARGET_CFLAGS:=-I$(ICONV_PREFIX)/include -DHAVE_LIB_ATOMIC=1
TARGET_LDFLAGS:=-L$(ICONV_PREFIX)/lib -liconv-stub -latomic
endif
CMAKE_OPTIONS:= -DSTACK_DIRECTION=-1 \
-DHAVE_IB_GCC_ATOMIC_BUILTINS=1 \
-DHAVE_GCC_ATOMIC_BUILTINS=1 \
-DSECURITY_HARDENED=0 \
-DIMPORT_EXECUTABLES=$(STAGING_DIR_HOST)/mariadb-import_executables \
-DPLUGIN_HANDLERSOCKET=NO \
-DPLUGIN_AUTH_PAM=NO \
-DPLUGIN_XTRADB=DYNAMIC \
-DPLUGIN_TOKUDB=DYNAMIC \
-DWITH_UNIT_TESTS=OFF \
......
Index: mariadb-10.2.7/include/atomic/libatomic.h
===================================================================
--- /dev/null
+++ mariadb-10.2.7/include/atomic/libatomic.h
@@ -0,0 +1,41 @@
+#ifndef ATOMIC_LIBATOMIC_INCLUDED
+#define ATOMIC_LIBATOMIC_INCLUDED
+
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#define make_atomic_add_body(S) \
+ v= __atomic_add_fetch(a, v, __ATOMIC_RELAXED);
+#define make_atomic_fas_body(S) \
+ v= __atomic_exchange_n(a, v, __ATOMIC_RELAXED);
+#define make_atomic_cas_body(S) \
+ int ## S cmp_val= *cmp; \
+ __atomic_compare_exchange_n(a, &cmp_val, set, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);\
+ if (!(ret= (*cmp == cmp_val))) *cmp= cmp_val
+
+#ifdef MY_ATOMIC_MODE_DUMMY
+#define make_atomic_load_body(S) ret= *a
+#define make_atomic_store_body(S) *a= v
+#define MY_ATOMIC_MODE "libatomic-up"
+
+#else
+#define MY_ATOMIC_MODE "libatomic-smp"
+#define make_atomic_load_body(S) \
+ ret= __atomic_fetch_or(a, 0, __ATOMIC_RELAXED);
+#define make_atomic_store_body(S) \
+ (void) __atomic_exchange_n(a, v, __ATOMIC_RELAXED);
+#endif
+
+#endif /* ATOMIC_LIBATOMIC_INCLUDED */
Index: mariadb-10.2.7/include/my_atomic.h
===================================================================
--- mariadb-10.2.7.orig/include/my_atomic.h
+++ mariadb-10.2.7/include/my_atomic.h
@@ -126,6 +126,8 @@
#include "atomic/generic-msvc.h"
#elif defined(HAVE_SOLARIS_ATOMIC)
#include "atomic/solaris.h"
+#elif defined(HAVE_LIB_ATOMIC)
+#include "atomic/libatomic.h"
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
#include "atomic/gcc_builtins.h"
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment