diff mbox

[3/7,v2] galera: new package

Message ID 1436458921-4199-4-git-send-email-sylvain.raybaud@green-communications.fr
State Changes Requested
Headers show

Commit Message

Sylvain Raybaud July 9, 2015, 4:21 p.m. UTC
Add package galera: wsrep provider for MySQL and MariaDB galera cluster.

Signed-off-by: Sylvain Raybaud <sylvain.raybaud@green-communications.fr>
---
Changes v1 -> v2:
 - Remove duplicated block in package/galera/galera.mk

 package/Config.in                                  |  1 +
 package/galera/Config.in                           |  9 ++++
 ...lera-01-fix_sconstruct_for-crosscompiling.patch | 52 ++++++++++++++++++++++
 package/galera/galera.hash                         |  2 +
 package/galera/galera.mk                           | 49 ++++++++++++++++++++
 5 files changed, 113 insertions(+)
 create mode 100644 package/galera/Config.in
 create mode 100644 package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
 create mode 100644 package/galera/galera.hash
 create mode 100644 package/galera/galera.mk

Comments

Samuel Martin July 9, 2015, 9:29 p.m. UTC | #1
Hi Sylvain,

On Thu, Jul 9, 2015 at 6:21 PM, Sylvain Raybaud
<sylvain.raybaud@green-communications.fr> wrote:
> Add package galera: wsrep provider for MySQL and MariaDB galera cluster.
>
> Signed-off-by: Sylvain Raybaud <sylvain.raybaud@green-communications.fr>
> ---
> Changes v1 -> v2:
>  - Remove duplicated block in package/galera/galera.mk
>
>  package/Config.in                                  |  1 +
>  package/galera/Config.in                           |  9 ++++
>  ...lera-01-fix_sconstruct_for-crosscompiling.patch | 52 ++++++++++++++++++++++
>  package/galera/galera.hash                         |  2 +
>  package/galera/galera.mk                           | 49 ++++++++++++++++++++
>  5 files changed, 113 insertions(+)
>  create mode 100644 package/galera/Config.in
>  create mode 100644 package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
>  create mode 100644 package/galera/galera.hash
>  create mode 100644 package/galera/galera.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 72ec372..b15d026 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -740,6 +740,7 @@ menu "Database"
>         source "package/cppdb/Config.in"
>         source "package/gdbm/Config.in"
>         source "package/leveldb/Config.in"
> +       source "package/galera/Config.in"
>         source "package/mysql/Config.in"
>         source "package/postgresql/Config.in"
>         source "package/redis/Config.in"
> diff --git a/package/galera/Config.in b/package/galera/Config.in
> new file mode 100644
> index 0000000..4c50427
> --- /dev/null
> +++ b/package/galera/Config.in
> @@ -0,0 +1,9 @@
> +config BR2_PACKAGE_GALERA
> +       bool "galera"
> +       select BR2_PACKAGE_BOOST
> +       select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS
> +       select BR2_PACKAGE_OPENSSL
> +       select BR2_PACKAGE_CHECK
> +       help
> +         Galera WSREP provider
> +         http://galeracluster.com/
> diff --git a/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
> new file mode 100644
> index 0000000..25c9d59
> --- /dev/null
> +++ b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
> @@ -0,0 +1,52 @@
> +Fix cross compilation
> +
> +--- a/SConstruct       2015-05-28 12:23:41.027461788 +0200
> ++++ b/SConstruct       2015-07-02 11:27:55.763337287 +0200
> +@@ -15,18 +15,17 @@
> + ####################################################################
> +
> + import os
> +-import platform
> + import string
> +
> +-sysname = os.uname()[0].lower()
> +-machine = platform.machine()
> +-bits = platform.architecture()[0]
> ++sysname = "linux"
> ++machine = os.environ['BR2_ARCH']
> ++bits = os.environ['BR2_x86']
> + print 'Host: ' + sysname + ' ' + machine + ' ' + bits
> +
> + x86 = 0
> +-if bits == '32bit':
> ++if bits == '32':
> +     x86 = 32
> +-elif bits == '64bit':
> ++elif bits == '64':
> +     x86 = 64
> +
> +
> +@@ -240,6 +239,15 @@
> + #
> + env.Append(LINKFLAGS = link_arch)
> +
> ++# Cross-compilation
> ++
> ++if 'CROSS' in os.environ:
> ++        cross = os.environ['CROSS']
> ++        env.Append(CROSS = cross)
> ++        env.Replace(CC = cross + 'gcc')
> ++        env.Replace(CXX = cross + 'g++')
> ++        env.Replace(LD = cross + 'ld')
> ++
> + #
> + # Check required headers and libraries (autoconf functionality)
> + #
> +@@ -405,7 +413,7 @@
> +
> + # these will be used only with our softaware
> + if strict_build_flags == 1:
> +-    conf.env.Append(CPPFLAGS = ' -Werror')
> ++    conf.env.Append(CPPFLAGS = ' -Werror -Wno-error=uninitialized -Wno-error=pedantic')
Hum... -Werror is more a development flag than an integration one. It
should certainly be removed.

> +     conf.env.Append(CCFLAGS  = ' -pedantic')
> +     conf.env.Append(CXXFLAGS = ' -Weffc++ -Wold-style-cast')
> diff --git a/package/galera/galera.hash b/package/galera/galera.hash
> new file mode 100644
> index 0000000..d3872e1
> --- /dev/null
> +++ b/package/galera/galera.hash
> @@ -0,0 +1,2 @@
> +# From http://releases.galeracluster.com/source/galera-3-25.3.10.tar.gz
> +sha1   03f69fa87dc14fa4d793e7afab601e285c570809        galera-3-25.3.10.tar.gz
> diff --git a/package/galera/galera.mk b/package/galera/galera.mk
> new file mode 100644
> index 0000000..f9bf0d0
> --- /dev/null
> +++ b/package/galera/galera.mk
> @@ -0,0 +1,49 @@
> +################################################################################
> +#
> +# galera
> +#
> +################################################################################
> +
> +GALERA_VERSION = 3-25.3.10
> +GALERA_SOURCE = galera-$(GALERA_VERSION).tar.gz
> +GALERA_SITE = http://releases.galeracluster.com/source/
> +
> +GALERA_INSTALL_STAGING = NO
> +GALERA_INSTALL_TARGET = YES
> +
> +GALERA_DEPENDENCIES = boost openssl check host-scons
> +
> +GALERA_LIBNAME = libgalera_smm.so
> +
> +GALERA_SCONS_ENV = $(TARGET_CONFIGURE_OPTS) BR2_ARCH=$(BR2_ARCH)
> +ifeq ($(BR2_x86_64),y)
> +GALERA_SCONS_ENV += BR2_x86=64
BR2_ prefix is usually reserved for buildroot scope. Maybe this
variable could be rename GALERA_BITWISE instead of BR2_x86?

> +else ifeq ($(BR2_i386),y)
> +GALERA_SCONS_ENV += BR2_x86=32
> +else
> +GALERA_SCONS_ENV += BR2_x86=0
Hum... looks dubious!
Does this mean that galera is only available for x86 and x86_64 target?
Other architectures can also be available in 32bits and 64bits
(arm/aarch64, mips/mips64, etc).
Last thing, the variable BR2_ARCH_IS_64 is set when the bitwise is
64bit, whatever the CPU architecture, so prefer using it.

> +endif
> +
> +GALERA_SCONS_OPTS = \
> +       arch=$(BR2_ARCH) \
> +       prefix=/usr \
> +       extra_sysroot=$(STAGING_DIR) \
> +       tests=0
> +
> +define GALERA_BUILD_CMDS
> +        cd $(@D) && \
> +         $(GALERA_SCONS_ENV) \
> +         CROSS=$(TARGET_CROSS) \
CROSS=... can be appended to the GALERA_SCONS_ENV variable.

> +         $(SCONS) \
> +         $(GALERA_SCONS_OPTS)
> +endef
> +
> +define GALERA_INSTALL_TARGET_CMDS
> +       $(INSTALL) -m 644 $(@D)/$(GALERA_LIBNAME) $(TARGET_DIR)/usr/lib/$(GALERA_LIBNAME)
> +endef
> +
> +GALERA_LICENSE = GPLv2
> +GALERA_LICENSE_FILES = LICENSE COPYING
> +
> +$(eval $(generic-package))
> +$(eval $(host-generic-package))
Why a host-galera package?
Note that, as is, this host-galera package will build/install nothing
because of the generic infra used without any HOST_GALERA_*_CMDS
definition.

Regards,
Arnout Vandecappelle July 9, 2015, 9:53 p.m. UTC | #2
On 07/09/15 23:29, Samuel Martin wrote:
> Hi Sylvain,
> 
> On Thu, Jul 9, 2015 at 6:21 PM, Sylvain Raybaud
> <sylvain.raybaud@green-communications.fr> wrote:
>> Add package galera: wsrep provider for MySQL and MariaDB galera cluster.
>>
>> Signed-off-by: Sylvain Raybaud <sylvain.raybaud@green-communications.fr>
>> ---
>> Changes v1 -> v2:
>>  - Remove duplicated block in package/galera/galera.mk
>>
>>  package/Config.in                                  |  1 +
>>  package/galera/Config.in                           |  9 ++++
>>  ...lera-01-fix_sconstruct_for-crosscompiling.patch | 52 ++++++++++++++++++++++
>>  package/galera/galera.hash                         |  2 +
>>  package/galera/galera.mk                           | 49 ++++++++++++++++++++
>>  5 files changed, 113 insertions(+)
>>  create mode 100644 package/galera/Config.in
>>  create mode 100644 package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
>>  create mode 100644 package/galera/galera.hash
>>  create mode 100644 package/galera/galera.mk
>>
>> diff --git a/package/Config.in b/package/Config.in
>> index 72ec372..b15d026 100644
>> --- a/package/Config.in
>> +++ b/package/Config.in
>> @@ -740,6 +740,7 @@ menu "Database"
>>         source "package/cppdb/Config.in"
>>         source "package/gdbm/Config.in"
>>         source "package/leveldb/Config.in"
>> +       source "package/galera/Config.in"
>>         source "package/mysql/Config.in"
>>         source "package/postgresql/Config.in"
>>         source "package/redis/Config.in"
>> diff --git a/package/galera/Config.in b/package/galera/Config.in
>> new file mode 100644
>> index 0000000..4c50427
>> --- /dev/null
>> +++ b/package/galera/Config.in
>> @@ -0,0 +1,9 @@
>> +config BR2_PACKAGE_GALERA
>> +       bool "galera"
>> +       select BR2_PACKAGE_BOOST
>> +       select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS
>> +       select BR2_PACKAGE_OPENSSL
>> +       select BR2_PACKAGE_CHECK
>> +       help
>> +         Galera WSREP provider
>> +         http://galeracluster.com/
>> diff --git a/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
>> new file mode 100644
>> index 0000000..25c9d59
>> --- /dev/null
>> +++ b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
>> @@ -0,0 +1,52 @@
>> +Fix cross compilation
>> +
>> +--- a/SConstruct       2015-05-28 12:23:41.027461788 +0200
>> ++++ b/SConstruct       2015-07-02 11:27:55.763337287 +0200
>> +@@ -15,18 +15,17 @@
>> + ####################################################################
>> +
>> + import os
>> +-import platform
>> + import string
>> +
>> +-sysname = os.uname()[0].lower()
>> +-machine = platform.machine()
>> +-bits = platform.architecture()[0]
>> ++sysname = "linux"
>> ++machine = os.environ['BR2_ARCH']
>> ++bits = os.environ['BR2_x86']
>> + print 'Host: ' + sysname + ' ' + machine + ' ' + bits
>> +
>> + x86 = 0
>> +-if bits == '32bit':
>> ++if bits == '32':
>> +     x86 = 32
>> +-elif bits == '64bit':
>> ++elif bits == '64':
>> +     x86 = 64
>> +
>> +
>> +@@ -240,6 +239,15 @@
>> + #
>> + env.Append(LINKFLAGS = link_arch)
>> +
>> ++# Cross-compilation
>> ++
>> ++if 'CROSS' in os.environ:
>> ++        cross = os.environ['CROSS']
>> ++        env.Append(CROSS = cross)
>> ++        env.Replace(CC = cross + 'gcc')
>> ++        env.Replace(CXX = cross + 'g++')

 This means ccache will not be used. We prefer to pass CC and CXX in the
environment (through TARGET_CONFIGURE_OPTS). I think that would even work out of
the box without any patch, no?

>> ++        env.Replace(LD = cross + 'ld')
>> ++
>> + #
>> + # Check required headers and libraries (autoconf functionality)
>> + #
>> +@@ -405,7 +413,7 @@
>> +
>> + # these will be used only with our softaware
>> + if strict_build_flags == 1:
>> +-    conf.env.Append(CPPFLAGS = ' -Werror')
>> ++    conf.env.Append(CPPFLAGS = ' -Werror -Wno-error=uninitialized -Wno-error=pedantic')
> Hum... -Werror is more a development flag than an integration one. It
> should certainly be removed.

 Better yet, make sure the strict_build_flags is not set.


 Regards,
 Arnout

[snip]
Sylvain Raybaud Aug. 21, 2015, 1:20 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Arnout,

On 09/07/2015 23:53, Arnout Vandecappelle wrote:
> On 07/09/15 23:29, Samuel Martin wrote:

>>> diff --git
>>> a/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
>>> b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
>>>
>>> 
[..]
>>> ++# Cross-compilation ++ ++if 'CROSS' in os.environ: ++
>>> cross = os.environ['CROSS'] ++        env.Append(CROSS =
>>> cross) ++        env.Replace(CC = cross + 'gcc') ++
>>> env.Replace(CXX = cross + 'g++')
> 
> This means ccache will not be used. We prefer to pass CC and CXX in
> the environment (through TARGET_CONFIGURE_OPTS). I think that would
> even work out of the box without any patch, no?

I think TARGET_CONFIGURE_OPTS was already added to scons environment,
see the lines below in galera.mk (from my patch):

+GALERA_SCONS_ENV = $(TARGET_CONFIGURE_OPTS) BR2_ARCH=$(BR2_ARCH)

[..]

+define GALERA_BUILD_CMDS
+        cd $(@D) && \
+	  $(GALERA_SCONS_ENV) \
+	  CROSS=$(TARGET_CROSS) \
+	  $(SCONS) \
+	  $(GALERA_SCONS_OPTS)
+endef

I'll make the other requested changes and test again, maybe the
problem was somewhere else.


>>> + # these will be used only with our softaware + if
>>> strict_build_flags == 1: +-    conf.env.Append(CPPFLAGS = '
>>> -Werror') ++    conf.env.Append(CPPFLAGS = ' -Werror
>>> -Wno-error=uninitialized -Wno-error=pedantic')
>> Hum... -Werror is more a development flag than an integration
>> one. It should certainly be removed.
> 
> Better yet, make sure the strict_build_flags is not set.
> 

Perfectly right.  I failed to notice that sctrict_build_flags=0 could
be passed to scons. Thanks.

Cheers,

Sylvain

> 
> Regards, Arnout
> 
> [snip]
> 
> 

- -- 
Sylvain Raybaud
www.green-communications.fr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJV1yWKAAoJEEkkwl4JtJ9yCxkP/25RrYpGdZFJYehEuf3T/27R
ttvzToHlWrlOzhxG4qxNZ20YPoSejVkOFIfOzDBL0SdV7SclPxJC3rnQ/mHJGTB+
Ln0kJ0h/hgfpHi6575YmaQlGU5PQ64va9rrYa6fUbLvjZ7QHCiGm/d0+2s+R5zoX
Da459zUVZq1yjk6YYu5JDaDrp5NcINi+KWpyhpowg379B6BUr0mR7Q/eyA4G2bfL
7Z6Ivv6j9qHYRlOzBYMwHgLR4S+oRe4A3esVkXtfFsREUIHTcAunyS7OTi3uN2rT
oud6DKXNtPoTykQxOccGRVxToCZYVpDq3Jd6bEyyWk1EhfcpAt7DNLhCgZlbaqe+
K5FqBdaNjQQ1C4W4XN111rW7BYHXkN+sP+lgeGU+i1cgVGehzia1b36e3qZWAdHr
P45YuK5QDKNol7q4riOQ0Xldnp8XkaRew4L2H2w0E4RvoCzCCvpQ4yJo3SbGT1Kj
N4VmYR+TZx2bz0cTCrrwWo9ElAbqs9GM/QXM+moCDWlTCXIRPYCeUqK96wQM+nKJ
JzqHnY/iXnzhof9/66TJEBNXjaWtE+0cvLghjPLzt8i6IgJ55GvREbjAAyVcCWmb
xPRjDkcwGFA+N/iDrnKCmZbkv1vhn3jeMewNQn4V96zy7EIL6Gw7szvB5/daoUhq
ERLMQdGihjplRJLHrXHa
=f2vd
-----END PGP SIGNATURE-----
Sylvain Raybaud Aug. 21, 2015, 1:39 p.m. UTC | #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Samuel

Again, thanks for this review. Inlined, my comments about some points:

On 09/07/2015 23:29, Samuel Martin wrote:
>> + + # these will be used only with our softaware + if
>> strict_build_flags == 1: +-    conf.env.Append(CPPFLAGS = '
>> -Werror') ++    conf.env.Append(CPPFLAGS = ' -Werror
>> -Wno-error=uninitialized -Wno-error=pedantic')
> Hum... -Werror is more a development flag than an integration one.
> It should certainly be removed.

Yep, as Arnout suggested I made sure strict_build_flags wasn't set.
Thanks for pointing this out.


>> +GALERA_SCONS_ENV = $(TARGET_CONFIGURE_OPTS)
>> BR2_ARCH=$(BR2_ARCH) +ifeq ($(BR2_x86_64),y) +GALERA_SCONS_ENV +=
>> BR2_x86=64
> BR2_ prefix is usually reserved for buildroot scope. Maybe this 
> variable could be rename GALERA_BITWISE instead of BR2_x86?

Done.

> 
>> +else ifeq ($(BR2_i386),y) +GALERA_SCONS_ENV += BR2_x86=32 +else 
>> +GALERA_SCONS_ENV += BR2_x86=0
> Hum... looks dubious! Does this mean that galera is only available
> for x86 and x86_64 target? Other architectures can also be
> available in 32bits and 64bits (arm/aarch64, mips/mips64, etc). 
> Last thing, the variable BR2_ARCH_IS_64 is set when the bitwise is 
> 64bit, whatever the CPU architecture, so prefer using it.

You're right, the logic was poor. I'm not aware of such restriction. I
rewrote it using BR2_ARCH_IS_64, thus eliminating the cases in which
BR2_x86 was not set.

>> + +define GALERA_BUILD_CMDS +        cd $(@D) && \ +
>> $(GALERA_SCONS_ENV) \ +         CROSS=$(TARGET_CROSS) \
> CROSS=... can be appended to the GALERA_SCONS_ENV variable.

If I understand Arnout's remark correctly, it shouldn't even be needed
because all the necessary information is already present in
TARGET_CONFIGURE_OPTS which should be passed in the environment of
scons. However, I think it was already the case (see the definition
and use of GALERA_SCONS_ENV in my original patch). I'll test again and
let you know.

>> +$(eval $(generic-package)) +$(eval $(host-generic-package))
> Why a host-galera package? Note that, as is, this host-galera
> package will build/install nothing because of the generic infra
> used without any HOST_GALERA_*_CMDS definition.

Right. I added this line for the sake of completeness without
realising it wasn't doing anything. I don't need it, so I removed it.

Cheers,

Sylvain

> 
> Regards,
> 
> 

- -- 
Sylvain Raybaud
www.green-communications.fr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJV1yn5AAoJEEkkwl4JtJ9yA5UP/AoNuPuDByEKQ7SQ6TW5iujc
/980AigEbYtidC+HKc/eL7lWXEjD3L9gfi3G5jaVOEwDql4GftFmW6U7aoi/2bdf
GokEeY13EwFq2bK6kzEV2EX7m/R7rQVeFaWqZPqw+HxAYJ9mt/fyQYci0eTg1uEN
WpPV6Mci/wFQZUrTlnD/g6wmNbHu/d1/4uNJ+PJQ/lCM4owsgcAuNpamgxAJsQRh
zIsgqpAh3ZN2VteSf8v9bigLR9cUOdmcuQC+6C8FKUzlnHzJZO/KWOrIPk3DmF2N
erPG2zrjp77BtXK9Q38Tlxomwl2Udh7iNhMuiOlrCgcQCekFvRQmejjk8hD5fFec
HiS3eFDDVidsMvGMnu3lQ65H+gy4btFSgpxSD1iSlTD96/DNPR3IRBWBfnwP1D5U
3Hd8Q57/WTalm/0FoHvuAkDDmnOpWRcEtQRt4WNJoyEUfq5g8W7bhuIN75+ZO/Pv
VfpdJZDpalZj2l5Xv2S3onFEvaLUsm9J9jy40shtE9x3gk3OTzuHzxgZKzSlHAUv
xt9m734fhw6PrP4b63pGZvTP6E+RKP8a2V/v+9/3XjS8ZYGfIfr300XfS892naWE
XFbXNDT9T2sMJc/MSo670Xd7QH/s8n9r5COsfgSe3lJ5aDGpss8vgjPUC6GqohA+
M4towyyAL7e0qh1G0V5W
=ogdi
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 72ec372..b15d026 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -740,6 +740,7 @@  menu "Database"
 	source "package/cppdb/Config.in"
 	source "package/gdbm/Config.in"
 	source "package/leveldb/Config.in"
+	source "package/galera/Config.in"
 	source "package/mysql/Config.in"
 	source "package/postgresql/Config.in"
 	source "package/redis/Config.in"
diff --git a/package/galera/Config.in b/package/galera/Config.in
new file mode 100644
index 0000000..4c50427
--- /dev/null
+++ b/package/galera/Config.in
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_GALERA
+	bool "galera"
+	select BR2_PACKAGE_BOOST
+	select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_CHECK
+	help
+	  Galera WSREP provider
+	  http://galeracluster.com/
diff --git a/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
new file mode 100644
index 0000000..25c9d59
--- /dev/null
+++ b/package/galera/galera-01-fix_sconstruct_for-crosscompiling.patch
@@ -0,0 +1,52 @@ 
+Fix cross compilation
+
+--- a/SConstruct	2015-05-28 12:23:41.027461788 +0200
++++ b/SConstruct	2015-07-02 11:27:55.763337287 +0200
+@@ -15,18 +15,17 @@
+ ####################################################################
+ 
+ import os
+-import platform
+ import string
+ 
+-sysname = os.uname()[0].lower()
+-machine = platform.machine()
+-bits = platform.architecture()[0]
++sysname = "linux"
++machine = os.environ['BR2_ARCH']
++bits = os.environ['BR2_x86']
+ print 'Host: ' + sysname + ' ' + machine + ' ' + bits
+ 
+ x86 = 0
+-if bits == '32bit':
++if bits == '32':
+     x86 = 32
+-elif bits == '64bit':
++elif bits == '64':
+     x86 = 64
+ 
+ 
+@@ -240,6 +239,15 @@
+ #
+ env.Append(LINKFLAGS = link_arch)
+ 
++# Cross-compilation
++
++if 'CROSS' in os.environ:
++        cross = os.environ['CROSS']
++        env.Append(CROSS = cross)
++        env.Replace(CC = cross + 'gcc')
++        env.Replace(CXX = cross + 'g++')
++        env.Replace(LD = cross + 'ld')
++
+ #
+ # Check required headers and libraries (autoconf functionality)
+ #
+@@ -405,7 +413,7 @@
+
+ # these will be used only with our softaware
+ if strict_build_flags == 1:
+-    conf.env.Append(CPPFLAGS = ' -Werror')
++    conf.env.Append(CPPFLAGS = ' -Werror -Wno-error=uninitialized -Wno-error=pedantic')
+     conf.env.Append(CCFLAGS  = ' -pedantic')
+     conf.env.Append(CXXFLAGS = ' -Weffc++ -Wold-style-cast')
diff --git a/package/galera/galera.hash b/package/galera/galera.hash
new file mode 100644
index 0000000..d3872e1
--- /dev/null
+++ b/package/galera/galera.hash
@@ -0,0 +1,2 @@ 
+# From http://releases.galeracluster.com/source/galera-3-25.3.10.tar.gz
+sha1   03f69fa87dc14fa4d793e7afab601e285c570809	galera-3-25.3.10.tar.gz
diff --git a/package/galera/galera.mk b/package/galera/galera.mk
new file mode 100644
index 0000000..f9bf0d0
--- /dev/null
+++ b/package/galera/galera.mk
@@ -0,0 +1,49 @@ 
+################################################################################
+#
+# galera
+#
+################################################################################
+
+GALERA_VERSION = 3-25.3.10
+GALERA_SOURCE = galera-$(GALERA_VERSION).tar.gz
+GALERA_SITE = http://releases.galeracluster.com/source/
+
+GALERA_INSTALL_STAGING = NO
+GALERA_INSTALL_TARGET = YES
+
+GALERA_DEPENDENCIES = boost openssl check host-scons
+
+GALERA_LIBNAME = libgalera_smm.so
+
+GALERA_SCONS_ENV = $(TARGET_CONFIGURE_OPTS) BR2_ARCH=$(BR2_ARCH)
+ifeq ($(BR2_x86_64),y)
+GALERA_SCONS_ENV += BR2_x86=64
+else ifeq ($(BR2_i386),y)
+GALERA_SCONS_ENV += BR2_x86=32
+else
+GALERA_SCONS_ENV += BR2_x86=0
+endif
+
+GALERA_SCONS_OPTS = \
+	arch=$(BR2_ARCH) \
+	prefix=/usr \
+	extra_sysroot=$(STAGING_DIR) \
+	tests=0
+
+define GALERA_BUILD_CMDS
+        cd $(@D) && \
+	  $(GALERA_SCONS_ENV) \
+	  CROSS=$(TARGET_CROSS) \
+	  $(SCONS) \
+	  $(GALERA_SCONS_OPTS)
+endef
+
+define GALERA_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 644 $(@D)/$(GALERA_LIBNAME) $(TARGET_DIR)/usr/lib/$(GALERA_LIBNAME)
+endef
+
+GALERA_LICENSE = GPLv2
+GALERA_LICENSE_FILES = LICENSE COPYING
+
+$(eval $(generic-package))
+$(eval $(host-generic-package))