From 8d5dbd847cbc704a6a06405856e94b461011afe3 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 27 Mar 2021 06:06:27 +0000 Subject: gentoo resync : 27.03.2021 --- dev-db/Manifest.gz | Bin 17412 -> 17420 bytes dev-db/citus/Manifest | 6 +- dev-db/citus/citus-10.0.1.ebuild | 31 - dev-db/citus/citus-10.0.3.ebuild | 31 + dev-db/citus/citus-9.5.2.ebuild | 28 - dev-db/gqlplus/Manifest | 3 +- dev-db/gqlplus/gqlplus-1.16-r1.ebuild | 40 + dev-db/gqlplus/gqlplus-1.16.ebuild | 33 - dev-db/lmdb/Manifest | 4 +- dev-db/lmdb/lmdb-0.9.28.ebuild | 2 +- dev-db/lmdb/lmdb-0.9.29.ebuild | 75 ++ dev-db/mariadb/Manifest | 16 +- dev-db/mariadb/mariadb-10.2.37-r2.ebuild | 1287 ------------------- dev-db/mariadb/mariadb-10.2.37-r3.ebuild | 1287 +++++++++++++++++++ dev-db/mariadb/mariadb-10.3.28-r2.ebuild | 1279 ------------------- dev-db/mariadb/mariadb-10.3.28-r3.ebuild | 1279 +++++++++++++++++++ dev-db/mariadb/mariadb-10.4.18-r2.ebuild | 1298 -------------------- dev-db/mariadb/mariadb-10.4.18-r3.ebuild | 1298 ++++++++++++++++++++ dev-db/mariadb/mariadb-10.5.9-r3.ebuild | 1294 ------------------- dev-db/mariadb/mariadb-10.5.9-r4.ebuild | 1294 +++++++++++++++++++ dev-db/mysql-connector-c/Manifest | 2 +- .../mysql-connector-c-8.0.23-r1.ebuild | 2 +- dev-db/mysql-workbench/Manifest | 2 +- .../mysql-workbench/mysql-workbench-8.0.23.ebuild | 4 +- dev-db/percona-xtrabackup/Manifest | 4 + .../percona-xtrabackup-2.4.22.ebuild | 67 + .../percona-xtrabackup-8.0.23.16.ebuild | 86 ++ dev-db/pg_activity/Manifest | 2 - dev-db/pg_activity/pg_activity-1.6.2.ebuild | 24 - dev-db/postgresql/Manifest | 2 +- dev-db/postgresql/postgresql-9999.ebuild | 12 +- dev-db/redis/Manifest | 4 +- dev-db/redis/redis-5.0.12.ebuild | 2 +- dev-db/redis/redis-6.0.12.ebuild | 2 +- dev-db/sqlite/Manifest | 20 + dev-db/sqlite/files/sqlite-3.34.1-build_1.1.patch | 375 ++++++ dev-db/sqlite/files/sqlite-3.34.1-build_1.2.patch | 500 ++++++++ dev-db/sqlite/files/sqlite-3.34.1-build_2.1.patch | 291 +++++ dev-db/sqlite/files/sqlite-3.34.1-build_2.2.patch | 441 +++++++ dev-db/sqlite/files/sqlite-3.35.0-build_1.1.patch | 375 ++++++ dev-db/sqlite/files/sqlite-3.35.0-build_1.2.patch | 500 ++++++++ dev-db/sqlite/files/sqlite-3.35.0-build_2.1.patch | 292 +++++ dev-db/sqlite/files/sqlite-3.35.0-build_2.2.patch | 441 +++++++ dev-db/sqlite/sqlite-3.34.1.ebuild | 427 +++++++ dev-db/sqlite/sqlite-3.35.0.ebuild | 427 +++++++ dev-db/sqlite/sqlite-3.35.1.ebuild | 427 +++++++ dev-db/sqlite/sqlite-3.35.2.ebuild | 427 +++++++ 47 files changed, 10437 insertions(+), 5306 deletions(-) delete mode 100644 dev-db/citus/citus-10.0.1.ebuild create mode 100644 dev-db/citus/citus-10.0.3.ebuild delete mode 100644 dev-db/citus/citus-9.5.2.ebuild create mode 100644 dev-db/gqlplus/gqlplus-1.16-r1.ebuild delete mode 100644 dev-db/gqlplus/gqlplus-1.16.ebuild create mode 100644 dev-db/lmdb/lmdb-0.9.29.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.2.37-r2.ebuild create mode 100644 dev-db/mariadb/mariadb-10.2.37-r3.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.3.28-r2.ebuild create mode 100644 dev-db/mariadb/mariadb-10.3.28-r3.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.4.18-r2.ebuild create mode 100644 dev-db/mariadb/mariadb-10.4.18-r3.ebuild delete mode 100644 dev-db/mariadb/mariadb-10.5.9-r3.ebuild create mode 100644 dev-db/mariadb/mariadb-10.5.9-r4.ebuild create mode 100644 dev-db/percona-xtrabackup/percona-xtrabackup-2.4.22.ebuild create mode 100644 dev-db/percona-xtrabackup/percona-xtrabackup-8.0.23.16.ebuild delete mode 100644 dev-db/pg_activity/pg_activity-1.6.2.ebuild create mode 100644 dev-db/sqlite/files/sqlite-3.34.1-build_1.1.patch create mode 100644 dev-db/sqlite/files/sqlite-3.34.1-build_1.2.patch create mode 100644 dev-db/sqlite/files/sqlite-3.34.1-build_2.1.patch create mode 100644 dev-db/sqlite/files/sqlite-3.34.1-build_2.2.patch create mode 100644 dev-db/sqlite/files/sqlite-3.35.0-build_1.1.patch create mode 100644 dev-db/sqlite/files/sqlite-3.35.0-build_1.2.patch create mode 100644 dev-db/sqlite/files/sqlite-3.35.0-build_2.1.patch create mode 100644 dev-db/sqlite/files/sqlite-3.35.0-build_2.2.patch create mode 100644 dev-db/sqlite/sqlite-3.34.1.ebuild create mode 100644 dev-db/sqlite/sqlite-3.35.0.ebuild create mode 100644 dev-db/sqlite/sqlite-3.35.1.ebuild create mode 100644 dev-db/sqlite/sqlite-3.35.2.ebuild (limited to 'dev-db') diff --git a/dev-db/Manifest.gz b/dev-db/Manifest.gz index 86598e87a30c..e88a88142fad 100644 Binary files a/dev-db/Manifest.gz and b/dev-db/Manifest.gz differ diff --git a/dev-db/citus/Manifest b/dev-db/citus/Manifest index 2991d0dc4536..fc9cfeec4857 100644 --- a/dev-db/citus/Manifest +++ b/dev-db/citus/Manifest @@ -1,9 +1,7 @@ -DIST citus-10.0.1.tar.gz 5133492 BLAKE2B d0b95d00bb374613eb9514544e19071bfd28f5f30b02352b644bd4100a50f337dfc132a15d4193f4c8a369beec6ee783eafa2d032e7ac074667d3f0de6617d97 SHA512 31c979bd4baec987d709a5865e78296584104cb25671b986c5f5545cb3dda64cd2663c1274efc72c35c523ce9aefed598adf4df8aa96e790a8772ebb09233ae7 DIST citus-10.0.2.tar.gz 5154816 BLAKE2B ace68ec3dcce3e2e9d872b85a864a49f026ba2c0c8b0919bb057b60921094a922f6fed8bc6482b3c31dad396550348d51a514aff0d877d851b871bb5b97773f3 SHA512 3f831c1efd1a54b9dee587f64eae2466691f8d8316643e459d00219c8ca710ea9d12aeac4f0e2e01cadc3dee29f2d8e59f9757d794e9b0bedfbe6ae107815957 -DIST citus-9.5.2.tar.gz 4714211 BLAKE2B b8e9d862b5ea8cb77202632ddac1b20d521b82d512c424f093e41bca146630197fd57c6986660a7d3fd98b67fefac0255184bc83ac1c6ef4242b67bda28cbe69 SHA512 db114053419f9b268ad45a3bbebc58ba5aec0925737840c4389c5ebf23bef9a26ce8c132a4a88cf06fa54cab926172cc283a12acc2c09bd888b55a9a4c0472a3 +DIST citus-10.0.3.tar.gz 5165390 BLAKE2B ac9bca488cc5546d56f2b5dd2a14733a776fe8da6900650f0a41b0ee223af6b4ea56152e5351346c43de2c96d13b099cf8054692d038a2e8e73d7fc1ba423649 SHA512 1144642e460babca6919d1ddc1f00bfaaba5abc0b24869627fb230781d158f54d34e7c3039a65d79c46682a0e1732bebde3f16b25670a249753afdd7fb81de52 DIST citus-9.5.4.tar.gz 4718209 BLAKE2B 706726c8ca6ffb38321e3b91395924e9b778c106096393992080f511338a7ae559f94336bb015508900f85290bd17cda8ef9ce6dbdc2e254f3daf7a09e243bf6 SHA512 3d5e956354e094811675b646a5baf75c26a3ac593c56ac5b6c4c711671002f78fb98a1a4879c4cc967fc4381ae971311f5d73ddadc78a39b66c3108978d677b6 -EBUILD citus-10.0.1.ebuild 576 BLAKE2B abd2e1f362db53d55bbbfc8bef3e1d3d26fea6234685f353e72df5ea8584118015966f6a11f238ca8b0db91f1eb916e0a9f00a082358058bbf2fcbe338f8b99d SHA512 c2bf7eea0716ead448f7b9a3b8c3301492b6afcc59dd8f0101c9400423d9fea2de8aa4ec90452385486ce47ceb7955f7f93fb03cdb24a8094eb46110b374f1ea EBUILD citus-10.0.2.ebuild 576 BLAKE2B abd2e1f362db53d55bbbfc8bef3e1d3d26fea6234685f353e72df5ea8584118015966f6a11f238ca8b0db91f1eb916e0a9f00a082358058bbf2fcbe338f8b99d SHA512 c2bf7eea0716ead448f7b9a3b8c3301492b6afcc59dd8f0101c9400423d9fea2de8aa4ec90452385486ce47ceb7955f7f93fb03cdb24a8094eb46110b374f1ea -EBUILD citus-9.5.2.ebuild 545 BLAKE2B a55e994a95d3dc45985461843c8b69372835fa47cd1721cd580c9bcfda147ff5a5d69336b2e34cb487d92bebca583fe007255e0895cb6a253b0ab0c0c53d1df3 SHA512 4d38ab59fda3a078faabd49e22f36d1f9d449e730f82fd71e63ddce161c7af402edf7dc5a67d3aa08eebf0076d7f829ede2f2959a8b82bbbd1c0a91d7b1cc893 +EBUILD citus-10.0.3.ebuild 576 BLAKE2B abd2e1f362db53d55bbbfc8bef3e1d3d26fea6234685f353e72df5ea8584118015966f6a11f238ca8b0db91f1eb916e0a9f00a082358058bbf2fcbe338f8b99d SHA512 c2bf7eea0716ead448f7b9a3b8c3301492b6afcc59dd8f0101c9400423d9fea2de8aa4ec90452385486ce47ceb7955f7f93fb03cdb24a8094eb46110b374f1ea EBUILD citus-9.5.4.ebuild 576 BLAKE2B abd2e1f362db53d55bbbfc8bef3e1d3d26fea6234685f353e72df5ea8584118015966f6a11f238ca8b0db91f1eb916e0a9f00a082358058bbf2fcbe338f8b99d SHA512 c2bf7eea0716ead448f7b9a3b8c3301492b6afcc59dd8f0101c9400423d9fea2de8aa4ec90452385486ce47ceb7955f7f93fb03cdb24a8094eb46110b374f1ea MISC metadata.xml 280 BLAKE2B 75bfaba3095bd67dfa80654885579e51053fd130ae4e3ad61ac75192eebad9fe8d08cbdf63773dad3837ef2805e0594d0823655966fde8876ba5919e01f0e698 SHA512 efb5fb6652ac8cd75fff4eea8b2b044a2c9201cce2faf3bbe13a97565d150e64f9ba0dd8bb691a44a1b6726455306ea8b6c1b121678a721a82e7ea8b6589c94f diff --git a/dev-db/citus/citus-10.0.1.ebuild b/dev-db/citus/citus-10.0.1.ebuild deleted file mode 100644 index 4bb39ab5f008..000000000000 --- a/dev-db/citus/citus-10.0.1.ebuild +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -POSTGRES_COMPAT=( 11 12 13 ) - -inherit postgres-multi - -DESCRIPTION="Open-source postgresql extension for clustering/multi-node setups" -HOMEPAGE="https://www.citusdata.com/" -SRC_URI="https://github.com/citusdata/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -IUSE="" -LICENSE="POSTGRESQL AGPL-3" - -KEYWORDS="~amd64" - -SLOT=0 - -RESTRICT="test" - -DEPEND="${POSTGRES_DEP} - app-arch/lz4 - app-arch/zstd - " -RDEPEND="${DEPEND}" - -src_configure() { - postgres-multi_foreach econf -} diff --git a/dev-db/citus/citus-10.0.3.ebuild b/dev-db/citus/citus-10.0.3.ebuild new file mode 100644 index 000000000000..4bb39ab5f008 --- /dev/null +++ b/dev-db/citus/citus-10.0.3.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +POSTGRES_COMPAT=( 11 12 13 ) + +inherit postgres-multi + +DESCRIPTION="Open-source postgresql extension for clustering/multi-node setups" +HOMEPAGE="https://www.citusdata.com/" +SRC_URI="https://github.com/citusdata/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +IUSE="" +LICENSE="POSTGRESQL AGPL-3" + +KEYWORDS="~amd64" + +SLOT=0 + +RESTRICT="test" + +DEPEND="${POSTGRES_DEP} + app-arch/lz4 + app-arch/zstd + " +RDEPEND="${DEPEND}" + +src_configure() { + postgres-multi_foreach econf +} diff --git a/dev-db/citus/citus-9.5.2.ebuild b/dev-db/citus/citus-9.5.2.ebuild deleted file mode 100644 index 90d9c35006ca..000000000000 --- a/dev-db/citus/citus-9.5.2.ebuild +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -POSTGRES_COMPAT=( 11 12 13 ) - -inherit postgres-multi - -DESCRIPTION="Open-source postgresql extension for clustering/multi-node setups" -HOMEPAGE="https://www.citusdata.com/" -SRC_URI="https://github.com/citusdata/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -IUSE="" -LICENSE="POSTGRESQL AGPL-3" - -KEYWORDS="~amd64" - -SLOT=0 - -RESTRICT="test" - -DEPEND="${POSTGRES_DEP}" -RDEPEND="${DEPEND}" - -src_configure() { - postgres-multi_foreach econf -} diff --git a/dev-db/gqlplus/Manifest b/dev-db/gqlplus/Manifest index aa41c041cfb8..a9d628ef47a5 100644 --- a/dev-db/gqlplus/Manifest +++ b/dev-db/gqlplus/Manifest @@ -1,4 +1,5 @@ AUX gqlplus-1.16-ncurses-tinfo.patch 485 BLAKE2B c5a38640cd4a1b072fc0f966095041b9ae463e6a2c577a822e40bd899f061f11b42b4c0bb8eca4a2ff9064251a69bfef508c8b63b31953da45061e801b337f17 SHA512 4b9fe6e489d12e021384979bc659a75ad60f704ca485320893d42326aece16720c8d02268703b3bc8b45527197dbbe85cbac9d7ae9133ff350718b874abb4382 +DIST gqlplus-1.16-sqlplus-handling-fixes.patch 24618 BLAKE2B b0d4d784756bafc5a030e850a22749e4a981f3bd3da9f0951319c62d895de0c6795bcbc7cf47b4afd2f965dc139478d8fe8d4de904c8b378584de40ef862f556 SHA512 7d30941d6def9ab82c430e3c7089c510b3e96425c9b833f71d51940c3ed23529f27af11eeffece17eb9da82c5435c151f79bf4171a62ec0fb6cb82538da79e30 DIST gqlplus-1.16.tar.gz 2128428 BLAKE2B 5d2ad6cd58d7a5e0e6ce0d54301d70ad452d34a9636ce1f831d1b6d1de3bbc0ebce3d92ed15c2b8da60107d49c56c306543c768c0ef3534f34d2d545b80c43d7 SHA512 e9d7685e4db741db8232f7ba7a05df59042d0cafe198060adcd37aea2d3878e785eacb1f7b72fcb154558d1be8c619818dbeceffaefb75e372a18ed23e234512 -EBUILD gqlplus-1.16.ebuild 806 BLAKE2B 0e670ae099780beda48b434a2f6e13553c95316ac28c84faccdc3b36dfb2396f9713b25eca594672f03b8884fd324dc2f032b00d8df37424521a2ca1156b209d SHA512 7d5b310253539b0def3d8540115d1796467057968ea9ef175cb71885e54e539efb69fe613e37ace4e8be910b1e803c4f0212b71750c9d4b55c1cabca2b1af618 +EBUILD gqlplus-1.16-r1.ebuild 1060 BLAKE2B 8a968e7b2235fe5dafdc7e756ef9aea8d7b8988273d303883052b74834dc851a7bb805357c8e14bbe1283c63add18be28d57589ed4f6eff9fa7c5dbf67a10149 SHA512 4fcc2c3fe9f08fc7095a0e915469021c5fe7efd310a3293c2ed8873e0e033f343b872e61075807e3f030499b588555129104091c575ab3f9b99896c0882eed54 MISC metadata.xml 620 BLAKE2B 1bf8eef6669e88237044223573dd13252acfbd1ce2357a8c3a8b54c10b55aaf3acb2df040baea23b4cbaba487579263362c054131023e5e8da183f2257dd9ba5 SHA512 6d73381bce688df3aa4717c419131798673cf83c14cff9e32b6391d6c8d7df470285a7654c4f68370b2166b48b3abcf4a6d1715bf8d257a4a937e73e2a88ee57 diff --git a/dev-db/gqlplus/gqlplus-1.16-r1.ebuild b/dev-db/gqlplus/gqlplus-1.16-r1.ebuild new file mode 100644 index 000000000000..5ec9eb2c790f --- /dev/null +++ b/dev-db/gqlplus/gqlplus-1.16-r1.ebuild @@ -0,0 +1,40 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools + +DESCRIPTION="a front-end for Oracle program sqlplus with command-line editing" +HOMEPAGE="https://gitlab.com/jessp011/gqlplus" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz + https://dev.gentoo.org/~grobian/distfiles/gqlplus-1.16-sqlplus-handling-fixes.patch" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~amd64-linux ~x64-macos" +IUSE="" + +DEPEND="sys-libs/readline:*" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${P}-ncurses-tinfo.patch + "${DISTDIR}"/${P}-sqlplus-handling-fixes.patch +) + +src_prepare() { + default + + # don't use packaged readline and old version containing it + rm -Rf readline gqlplus-1.15 aclocal.m4 configure + + # maintainer can't seem to get versioning right + sed -i '/^#define VERSION/s/"[^"]\+"/"'"${PV}"'"/' gqlplus.c || die + sed -i '/^AC_INIT/s/\[[1-9.]\+\]/['"${PV}"']/' configure.ac || die + + # fix some ancientness, bug #777504 + sed -i 's/^INCLUDES=/gqlplus_CPPFLAGS=/' Makefile.am || die + + eautoreconf +} diff --git a/dev-db/gqlplus/gqlplus-1.16.ebuild b/dev-db/gqlplus/gqlplus-1.16.ebuild deleted file mode 100644 index b21f38c84694..000000000000 --- a/dev-db/gqlplus/gqlplus-1.16.ebuild +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit autotools - -DESCRIPTION="a front-end for Oracle program sqlplus with command-line editing" -HOMEPAGE="https://gitlab.com/jessp011/gqlplus" -SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~amd64 ~amd64-linux ~x64-macos" -IUSE="" - -DEPEND="sys-libs/readline:*" -RDEPEND="${DEPEND}" - -PATCHES=( "${FILESDIR}"/${P}-ncurses-tinfo.patch ) - -src_prepare() { - default - - # don't use packaged readline and old version containing it - rm -Rf readline gqlplus-1.15 - - # maintainer can't seem to get versioning right - sed -i '/^#define VERSION/s/"[^"]\+"/"'"${PV}"'"/' gqlplus.c || die - sed -i '/^AC_INIT/s/\[[1-9.]\+\]/['"${PV}"']/' configure.ac || die - - eautoreconf -} diff --git a/dev-db/lmdb/Manifest b/dev-db/lmdb/Manifest index 68f84dae2828..f2047005466a 100644 --- a/dev-db/lmdb/Manifest +++ b/dev-db/lmdb/Manifest @@ -5,9 +5,11 @@ DIST LMDB_0.9.24.tar.gz 143916 BLAKE2B f075ec5f4dfb77685188229e20f12c4febe8295c7 DIST openldap-LMDB_0.9.26.tar.gz 144029 BLAKE2B 07fe81cdaed7a402aaf485a2aa41d12c2c8cc8813d39d5304d8a1f5c8920f4695021eb586b4366a5f55010284227c7ac16487a8799c60f251ea97cd745b1261a SHA512 d7826f6d1a3144feb71eef65f843e8bcddf6cec384014bab3fc1d32a7f1b9316bcbb5b3a915b166cbdae2ffbd15f14b4eb783acd7eddbd2e321607f750efe94d DIST openldap-LMDB_0.9.27.tar.gz 144104 BLAKE2B 76b7b66ca455f61f71b7c010de0b5437d02a245a5129184cf45bf5684a745888c88012fb73a219076b6c47adfda0804e6c7f603e4631c98034c01efda99ad3a9 SHA512 a27c0d26c801b172f3c207666940f86ecaae9d223843b72823d064f0ea0629a855150d049cb143981783710d3ca791c7f0f65df9d91732b2709e6107af403854 DIST openldap-LMDB_0.9.28.tar.gz 144520 BLAKE2B 3466da1ffde7350056fb3b16fc0068d78139c578fdf79cd6456ca0d98e2d7b3d899849ae42a7224335a4680e52b5f0feb2c4233eaf00ee3d9ee648ae10c3114a SHA512 0cdf9a2ce35617a3135cde96491fbbb73be9362de2b94d23eda44b65ce48362ff9dbdfe921c3255ed486aceb385fcb62b81f560b1037476f4741291b29ba0dce +DIST openldap-LMDB_0.9.29.tar.gz 144545 BLAKE2B b7e55e4fa03e878a95b8f7c583684727a81d51a3acf2ec064d8fe26475bf9ffe4dddf16c2bccbda901b94b7c8d57f41fa63f7c09bcab46401bd000958a5b87b3 SHA512 b41ba5b139375d23617a79f4d322399df55745c5a4a63159ddbe0f1ded4707f0eb7f71acf3d1a4928f8fcab30a7b5db17e3e165441a61ec1dbd29f8d9efa65d1 EBUILD lmdb-0.9.23.ebuild 2243 BLAKE2B ea9b523973dde81ab257ba7a7b25ce41a3942f5cf457826ac43d37dcb34696efde6f5334426e3d067beeb337c42fda6e356365ecaaba6d6975237d4920611727 SHA512 a3fe3f76d49660589952124d1c6d409c455a454567446bda055a44c9c5934efe433cefbf70316a2c049b8d2e2e77b75dada4bc39e4866b3480b405ac6414fb2e EBUILD lmdb-0.9.24.ebuild 2263 BLAKE2B efc56dc416bc96dcf55e24fe2f757fe23e7194ee46036df50600a0794bdb44a1b9e892e6b00acceb467ef1a08a021eb22c66272193cf1d282dd733f9cd6e743e SHA512 05ac018fb64cc85ebb3f53c62c6094b46701239dd99fbe048e164bb0a180d15aff76e42a876e80a61484b864d98eff7da0469ae7ae40f6a9c9b3ab8f04bfb478 EBUILD lmdb-0.9.26.ebuild 2341 BLAKE2B 6a6edee5b90634bd0cb802b9b467ecffdf0bd0a3fc255ac2ccf601b1048d2d1cf45528341516c09f90d3ff4e1f3078f5665019f0783fdf71835176f076672c2a SHA512 1a21922d2a95b5de62962b6df10768079a608f7819fc3d00d34a260dbc251c88edc7f901dd8374f4dd31d8c87b631e9ec3fb1bb68474ca0806df0be4a236e8b2 EBUILD lmdb-0.9.27.ebuild 2341 BLAKE2B 6a6edee5b90634bd0cb802b9b467ecffdf0bd0a3fc255ac2ccf601b1048d2d1cf45528341516c09f90d3ff4e1f3078f5665019f0783fdf71835176f076672c2a SHA512 1a21922d2a95b5de62962b6df10768079a608f7819fc3d00d34a260dbc251c88edc7f901dd8374f4dd31d8c87b631e9ec3fb1bb68474ca0806df0be4a236e8b2 -EBUILD lmdb-0.9.28.ebuild 2425 BLAKE2B c2d3dede502a94b7c6800444c857fc5bb81618e2dc441f89f74ea110e335e2ed245707fb312d610a3679fd8a5d294dc085a1a37aadc4d20eb6e6c81e8f84d1de SHA512 c0bc7b2d2d30429917f420ef05c64a87fb015457ae005a31a6d4a1e2127f228f9076f26399486acd2f27fdea973bea825419cb1622d894e4272c043aeeec32bd +EBUILD lmdb-0.9.28.ebuild 2424 BLAKE2B 9cecd79ae5175de116b25967205e769de2fa82418743c88971ca522da8ee1fe0ec11f8980099e0a6437da0ffdc3ccb4ba0935628a1e886cdbd3608927361c7d7 SHA512 2a8968a90aeb26c1a3db147385dcfdc9f7044ad8b83039c96c3a101d2012565021f5e5ba35f6430076eb7fced19b560adb000801072c6b82c9b09446ba3ffa21 +EBUILD lmdb-0.9.29.ebuild 2373 BLAKE2B 109ba918bb68acf4e8d9ad246a9cf7c9f10ad1e233469a13a5833406b2daabceefb72c9456e6a0acf3ed6df9b5f3b2f0146e4b3182b9e7ce84d7356b7c04e433 SHA512 d9a44e95697108e05290cf31965b62349c793e0ada3100e881e08f8f6609f5b7ca51d483774ac3c7afb6b1094477af3dd4bdcc8261c308faf8ee724599776281 MISC metadata.xml 432 BLAKE2B 21af6c7ba636803d33bf8877d93282327ab14f0688657115cfc2d23bf40b0f1c556cdf7238460430347570590d8ff2441f8186b5f15fa48651f12e8fdef846e4 SHA512 5feed30bc7a5a51b41f330de6446ab4f92826d2e1c216f0eb994d3e6e55b596e0a57369d51f11fc0151acc67da5d6b0d169d2394de1bd4790f2eba0eac1a21cf diff --git a/dev-db/lmdb/lmdb-0.9.28.ebuild b/dev-db/lmdb/lmdb-0.9.28.ebuild index 270b26e5bf16..e07e694b68f2 100644 --- a/dev-db/lmdb/lmdb-0.9.28.ebuild +++ b/dev-db/lmdb/lmdb-0.9.28.ebuild @@ -12,7 +12,7 @@ SRC_URI="https://git.openldap.org/openldap/openldap/-/archive/${MY_P}/openldap-$ LICENSE="OPENLDAP" SLOT="0/${PV}" -KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" IUSE="static-libs" DEPEND="" diff --git a/dev-db/lmdb/lmdb-0.9.29.ebuild b/dev-db/lmdb/lmdb-0.9.29.ebuild new file mode 100644 index 000000000000..74b511a5c9d2 --- /dev/null +++ b/dev-db/lmdb/lmdb-0.9.29.ebuild @@ -0,0 +1,75 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit flag-o-matic multilib-minimal toolchain-funcs + +MY_P="${PN^^}_${PV}" + +DESCRIPTION="An ultra-fast, ultra-compact key-value embedded data store" +HOMEPAGE="https://symas.com/lmdb/technical/" +SRC_URI="https://git.openldap.org/openldap/openldap/-/archive/${MY_P}/openldap-${MY_P}.tar.gz" + +LICENSE="OPENLDAP" +SLOT="0/${PV}" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="static-libs" + +DEPEND="" +RDEPEND="" + +S="${WORKDIR}/openldap-${MY_P}/libraries/liblmdb" + +src_prepare() { + default + if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -lt 10 ]] ; then + # posix_memalign isn't available before 10.6, but on OSX + # malloc is always aligned for any addressable type + sed -i -e '/(__APPLE__)/a#define HAVE_MEMALIGN 1\n#define memalign(X,Y) malloc(X)' mdb.c || die + fi + multilib_copy_sources +} + +multilib_src_configure() { + local soname="-Wl,-soname,liblmdb$(get_libname 0)" + if [[ ${CHOST} == *-darwin* ]] ; then + soname="-dynamiclib -install_name ${EPREFIX}/usr/$(get_libdir)/liblmdb$(get_libname 0)" + replace-flags -O[123456789] -O1 + fi + sed -i -e "s!^CC.*!CC = $(tc-getCC)!" \ + -e "s!^CFLAGS.*!CFLAGS = ${CFLAGS}!" \ + -e "s!^AR.*!AR = $(tc-getAR)!" \ + -e "s!^SOEXT.*!SOEXT = $(get_libname)!" \ + -e "/^prefix/s!/usr/local!${EPREFIX}/usr!" \ + -e "/^libdir/s!lib\$!$(get_libdir)!" \ + -e "s!shared!shared ${soname}!" \ + "Makefile" || die + + if [[ ${CHOST} == *-solaris* ]] ; then + # fdatasync lives in -lrt on Solaris 10 + [[ ${CHOST#*-solaris2.} -le 10 ]] && append-ldflags -lrt + fi +} + +multilib_src_compile() { + emake LDLIBS+=" -pthread" +} + +multilib_src_install() { + emake DESTDIR="${D}" install + + mv "${ED}"/usr/$(get_libdir)/liblmdb$(get_libname) \ + "${ED}"/usr/$(get_libdir)/liblmdb$(get_libname 0) || die + dosym liblmdb$(get_libname 0) /usr/$(get_libdir)/liblmdb$(get_libname) + + insinto /usr/$(get_libdir)/pkgconfig + doins "${FILESDIR}/lmdb.pc" + sed -i -e "s!@PACKAGE_VERSION@!${PV}!" \ + -e "s!@prefix@!${EPREFIX}/usr!g" \ + -e "s!@libdir@!$(get_libdir)!" \ + "${ED}"/usr/$(get_libdir)/pkgconfig/lmdb.pc || die + + if ! use static-libs; then + rm "${ED}"/usr/$(get_libdir)/liblmdb.a || die + fi +} diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest index 5bc73606b712..bd3b15b0e570 100644 --- a/dev-db/mariadb/Manifest +++ b/dev-db/mariadb/Manifest @@ -12,7 +12,7 @@ DIST mariadb-10.2.35-patches-01.tar.xz 7232 BLAKE2B d70d348decbea7e823196a16e79c DIST mariadb-10.2.35.tar.gz 73889979 BLAKE2B c2b60c661fe253d60b74e84a1bf1e185fe7dc9e711d0d934312cc37301d18c506f71fcd8e62c20debff19c47a6c65a8fd7a3fb747d346fe6a6b59ac3ef1b4237 SHA512 5af4c1269bd07ed84b7b6a8ef4f5242d446f9c5e9e29702fb38ae3907ba93fe2e765259fe73448bcaf52728d5bbb96f7da2a8b0783782ae4a05f22992d8b8cf0 DIST mariadb-10.2.36-patches-01.tar.xz 6032 BLAKE2B d1ca7e8469e0f0b8a14d5f993894cacb1e081a6ea67cde18a6891597ef8590c27b12ff4ea15983089bc23134130e37154be5621cb4ea5884c698df19e29afdf3 SHA512 9b6382e3253a72df32b28f57fa276586eb7c09d79dce33db7b009fff4eb49ae46792e2f13428e53a7e8cb65dbb0d8e07d699ee7ce33b3103ab42243cd285dcd1 DIST mariadb-10.2.36.tar.gz 73892597 BLAKE2B 610fea30b944e46483f4a9630f8af22afcbcc8b461ce2b13e28b3376271dce8436df9bd771f048fb8af5e0ef9e5e3986be02af742937504e71413710e4f6462d SHA512 0f1ced570a79036fafd318ceaae06de71cfc748b0c99d31487a00f7fcebed993ef7e05614e866f48b1811660a7a4ad7c36d6bb0133bdb0228cc017199f182406 -DIST mariadb-10.2.37-patches-02.tar.xz 6280 BLAKE2B 34e056ab7b65dc862ec7b90e2fa85b8058b45de75fc4e2aa0c56df7f9df3a347b300a6a01f0e80467f652233ea3e597ccf5596ace160530be6767da70f61d7e7 SHA512 161ed8b6a8befcdaf11223286e48c2031052a105f13ceb547545f24a9576aa80328162a41165a3564bf2f5e57f6aa7a1706fcf1a01877a1b0674d3359b6327e0 +DIST mariadb-10.2.37-patches-03.tar.xz 6404 BLAKE2B c814ae967beac459810d1ecf4b5b21da99241e571c9c42fadeef0a27a1928459bb7d2a79461693fb6dd8821302891e459c3848f65738cda61f27bc8e174657e9 SHA512 b2b002ca1b390b251a0b6bce3dd996cc6aa0da4a9787d747c4ae276237e5c67ada7fc79a1acef9e3469232d5903ac8d1dcc30540e29974899c4128239a1569ba DIST mariadb-10.2.37.tar.gz 74041747 BLAKE2B 81ed5ada9f27c7dadf2daa88c52e1e40c834e8f243eb416a4a1e486d7e756d2bcb86f545b013fb1bb83987eef19239b2e8c3312a50be10eb13fee1a9c824095f SHA512 e4214d5f013917fff2606aa0b827373c228c06ba72ceaddee01459105ba08316f360ad930bd36e71bcc98d371162a0894560a7a36d2b242629cc970798660854 DIST mariadb-10.3.23-patches-03.tar.xz 5520 BLAKE2B 30bc247ed6d97aefaa1ed48f379fc9aab3df3409aa9a108728313c7c69ab0641b69ccb0289eda9539df367f85b2db494473d3836807dfbf60df1e0c832e57369 SHA512 64bff196d1651348d303571fd551a5666d9514c1ee17cd9296b9d420c4b3d7d9b339644a1cad029bae3c35a666b405d471a37846138f2551f3b1b88d99b80844 DIST mariadb-10.3.23.tar.gz 72582611 BLAKE2B 493605519f714cbe87b938f6ca3243d29189adbfcbb33c4e10a4a3f01b08d875f18b96b647dc92566b785c2cef9862ebacfd55954d13ab0a7a745606e40fb6e9 SHA512 535cd2ce80a95b6c0a1aa559cc3275dfcd559c3a4f958fab3382923190a16e6bc5b4ad79acaa518244512ff618568c239c0edef8a701d958362ede19a29c2986 @@ -22,7 +22,7 @@ DIST mariadb-10.3.26-patches-01.tar.xz 6720 BLAKE2B 5c7ae688e628bc5831bf4c1680bd DIST mariadb-10.3.26.tar.gz 72867143 BLAKE2B 5ab012e014e855bc5dab9bc5060bdf179fbe0fc67e564e25bb1059a0f19d5c90fa8fb6ccb9482eff6babe602eaf7b6c768eaa0ecb53bfed5ad6db9eb4e18e97c SHA512 28c593b26dcfd2208105ace87e85e86b37511821bc5f1fa65c7bfa5732d386e0b68af3b83a8259feb9af878e29d61f1da5c45b50c8e2f57a22e4001652c61140 DIST mariadb-10.3.27-patches-01.tar.xz 5516 BLAKE2B e78cc8514a3597b6ab38f00142a82c81e7482f1fd9afbcfd6f10ee92803a131f483f32361aebf288f9912e58140caeee1c536086e3f733c3a8dfe9c5afc5a590 SHA512 d1744bd83e099b67faa3c5385803c4eac58200c1a2ca30b5723e401c72e434d752be26c80da3b036431024c6a7d1ee889bde34a3143a43a9851984697d43e362 DIST mariadb-10.3.27.tar.gz 72870472 BLAKE2B 46d203ba018ba00ffee2e5e9bec7f0a9a4d27f0aa30b26651215c7b3fca803dae1080d075bb4938a403c1f78a46ec4fec4bd59736c0eb9a0b84763445efe097b SHA512 96507307cf95d319898e23cb46a5f46937907592e421eb4a4373f47ca54291623010d18414e58bdba88a78255b1996984b14b41fb8f32e3593a3b02ed852aac5 -DIST mariadb-10.3.28-patches-02.tar.xz 5768 BLAKE2B 2f8b55f52e8cf5b2575916639559f11b06d0ec5136fa8a451f045f0d745f3a4802904fdb57b6863e055237aa73e098c8730e9fbd612c015a98835da8934665a6 SHA512 5345d655c2ad863d49c8720eb8baf174a9ca746fa2b975a9533851179f3753c4549a400f422ebd9aa6b1a18b7543322fb9ce79dd16d1a7373b5ba353b5022fd7 +DIST mariadb-10.3.28-patches-03.tar.xz 5896 BLAKE2B bd9d7c3b32f17e0ce8c2149e5c2981dbb09647d56295eb9a2585a2c79f7e3aef46267e55a30a3440e57b1dbebe98a5a72d08aacb9a4b2fc3f30bb1f83d3b38c3 SHA512 0f8e8f9a50bbcb037bd22116ec826d01b15937f934d91fee11a37da0d4f91944762bfe3560c8edc4e5b9cdd9443fcce9b0e02373c4bfd97ed8570ff944d0b803 DIST mariadb-10.3.28.tar.gz 73040177 BLAKE2B 4fff746e7c04b239055c8528bcfd31e4911e6daae3427dc8a6e2e0e21c2888d2145b5383c6b0876b307949f122c2645d42fc7efaeec594bae1f02aff4037e676 SHA512 f6941bcc818f9b3640e4b5fdbdd3a32b45c62c04087e583f1f0e1c0258b09a21c7639abd1c902e183c057838308ad5eedc00ffee76d44a02043e8e349015fb20 DIST mariadb-10.4.13-patches-03.tar.xz 5520 BLAKE2B 949b7f6ee5a9a6077424264e53d2b7af8ceb56cb38b204800e1c3ec93fc929d57b201e075f8ed735364b5421a3b922ba45fc94ba006f1e6d94494efa17b521ef SHA512 042c3ca8a75ebbb1c2baa508603d4248a178f87b7126b439ef6894eaab979f01c47cd8fbea3c106cce2a951e9308c76e72b4e444dcbee09a991cb524f2b9fac8 DIST mariadb-10.4.13.tar.gz 80608459 BLAKE2B e9ada14da6ec7492311068549a5b6e5a66e1177312013b25472c084a21fbace543ec43b47f2e12190d45432648d508f311198521f42359561f8d75ea60f98205 SHA512 68919ceffb3d4afdd0d94daa77439a954c82ce4e08fbe06044fc397940eeb88a39ec75932cbd08ff26ef3cf7636fdb779947cda5b2764aa1fd888be19c44b566 @@ -32,7 +32,7 @@ DIST mariadb-10.4.16-patches-01.tar.xz 8284 BLAKE2B 4c8c8ad8ff672278207259298391 DIST mariadb-10.4.16.tar.gz 80985469 BLAKE2B 6960f64de8f3b561a869fb8632ec6f402883d4ae0a5ff307863732b5833f0bc01ef20151888e5ef21415e0b812afde434cdce0fee24c4548e5250d2b798ffe48 SHA512 4442e082f8ca61972336907cc4ca4d0a6ce48db2f78d038a51970789618a7ef0f456f158ec41b1ede2f7e32df1c411c7ebcfaa16aa9ee5dc77df6f453b1d2095 DIST mariadb-10.4.17-patches-01.tar.xz 5524 BLAKE2B a9424a8cd68a5106087e24f08a3ca2451dfa843d611b182cd676dc608a53e0cdae23106f984ceb0b9e56b24388c0793511cc06c09a525bfeff8177be5d0db06b SHA512 463eb00ccc152752084569c633212d98464004c4b285ce9d4caad860087cd5cec3fdc6639e7e03952f79fa9ada86598544d9b7add6a9c4194485325233ccfff6 DIST mariadb-10.4.17.tar.gz 80986181 BLAKE2B 68dc7e0a7a809d1d26c75351e2f934f07a7c2e73651a8253db658d8d93375545a97f50650f0ea92387b4f5e13aabe6de8567d22fb0434d40058a392a58ad9ee4 SHA512 51bbdbae9ba48e3e7b0b614a5e19a0549979b727797e2742a130c6bed23d06eea6d18da63759a3f5f3ba751bcaaef4cdbf6a3456f4d23ff9149b3b0ea07e7079 -DIST mariadb-10.4.18-patches-02.tar.xz 5768 BLAKE2B a6b84d4d2e451e840d5c0a31bbdfb15e42c970999ae88733e26676f4b582fec4f9ae4adca28a05bac7059d96456f7343341f8d8b9a40f84feb38c1154cc5a6c6 SHA512 24ca82162bf77470446bbd0501f934fe07e8e95f1536399eaf148ba30e9b47440fff50fabc89c1e92415ad2c41a0c7efe7a9469d39c9a7f5bf84e61d7321e536 +DIST mariadb-10.4.18-patches-03.tar.xz 5896 BLAKE2B e7d16fb0177a468b190ed0a3fd1c9e1bac369e0ddff034a999351af1a1020271013dd6dec52013aa7055c4b4177436ca3f5ebcca06d14355be88f55f0bd875f3 SHA512 2b6acff0ad88d4bca3dfa4703c651de6f7c94cf209f5c00d03d5cc4bac220490e7ec7ccd257bdc19617847074d372f24b2804aa6d37fd24f1c4acf40315890f9 DIST mariadb-10.4.18.tar.gz 81733656 BLAKE2B 6eb0a9bff586dab3efc4edb4e9d1a7e2f5ceb1341de08ffc4d63787a83b8eece18b96fcfae48e68262350e71dd28e2e4d328746fadcb006cd9d5e1bfb63187a3 SHA512 085c2468484d997facb021ea7cba4895729b6c5769d715e30cf1dfd62c3a291e5025774420ed278f9470de20be8d3537f03c7d1cc5482d957bc91eb072cd9c12 DIST mariadb-10.5.5-patches-02.tar.xz 6060 BLAKE2B 185a2016836721f76c19228ca39c1c7610c34210e23b42f254e4c4fde34c74d9c77bb0d1a441175c14938ecafea3e9575fa3b7349db826aef63e7d7e7a21901a SHA512 8a26bdbec19d45739ef7accd3cea999bde465714141532d999500df2ebd93bb98a00b8b86b1e855ea4f0cba6984b21ff09beee75372f840282a91f5dc95db432 DIST mariadb-10.5.6.tar.gz 86884252 BLAKE2B b0230acf43d54e976c4e757139dbaa2bb6ed992b0d056728142fc7fa41bd62539be22eae5aac614ea49acf220646ee57ecc67ff1373c6aa142434e6743a4d174 SHA512 c62bd6278d389baf179962bc6f617693cf3ba748382e96963b1ef5bbee8d1c9f0964025cf00fb7ff5de088a79362b65657ed30a8adbb61fe524bfd0d8d753421 @@ -40,7 +40,7 @@ DIST mariadb-10.5.7-patches-02.tar.xz 8992 BLAKE2B ec9acc1f09ac08319c5ad7e952e75 DIST mariadb-10.5.7.tar.gz 88214625 BLAKE2B 8ec53b4b98565d99a707899fd6adfdc5bffbf722528e0042ab16b5e186d32229a386881f2781a0ce435585f338b48dc66459bef9d8921fadc00a3d770b62bf5c SHA512 d964c61d6ba7cf21fea97b8e0b6a0bf1ee50fc7a7995753dafd710f4656001bd6e03c243896efb5802cce16dd6470849ed036d09b17415a538e008f64e974a9f DIST mariadb-10.5.8-patches-01.tar.xz 6212 BLAKE2B 7e4358d02d25edc51f5926a75646052ccf07fe2b5cab1901a133b27764793c94ca2a6c4d4b90b5d911b25a6d86f1cb7d2659edbcdab52c445fd6959ea080275d SHA512 f7a5d948c6d7d97896538b7df0de60c8e7969dd15b4ff406e8955a282e69fb7f19fe91424afc332029ac2a36c52781617bbf1c5f6d57dd3bfc21d3ea20ff4c5a DIST mariadb-10.5.8.tar.gz 88206163 BLAKE2B eaaddaf240102428a23602655920bdf543d25cf85e669b1b07bedba5119a5e0f4498e999db39031dcff168ac810ed0b28f5fa9ac995b3634b84b99b753b4636c SHA512 9801a68440a3502b49655e34dcbfd09734f4a4f1ba8621ed9b895e194cea461a8c69fb0ff66488d5defd3065b43f73e5083a60142e11cc7e4a442f86769b06e5 -DIST mariadb-10.5.9-patches-03.tar.xz 6440 BLAKE2B 3dd767e0a122357d00a1728e4ec0b5bde5c4d5abc2f996f40befb2fe0e4ef3f78095b1349bfe547eab420900f2f90fcd7e8ef16db4531eee126caba415e909b9 SHA512 21f78755335531591b497d97ff626e6e5f11e79eb8b389da4a187186e9cee17507778354545d9d5db524c8c9e322a8749c70ef7e7cb2d5a77a3b901e9e5cbfea +DIST mariadb-10.5.9-patches-04.tar.xz 6544 BLAKE2B 283e289fd4c8a701426db6a329bb6da06db82093cb40d103ddc878cdae15cebc66d3b99c5315d460f0db4bfa370ddb0e9e5cc017d01515085b7dc1a27f97bf48 SHA512 6de84664ddd4f1a022280336d7ee742dfadbbd2f3e5e23c3e68b1f9423cc45becf403dda9976cb366d7afafd412f112720c27b558147486dca781f1053010ede DIST mariadb-10.5.9.tar.gz 88639930 BLAKE2B 512c3fb0541bbeb19878979104f7858ce18ce67187507c8395798cfc9ffe92bd83e39bd47251419363600348a85716406286bd27b3c28662ea63e8ec761a4e01 SHA512 d23d5bf8510b3c36a6521fb3244cf323ef0f5d100ba379ed7b5bbc2acae1765a5b46c17bd929f0b27b28923eb1b5975314abdf7ffb96905cf7a93a5c8837294e DIST mysql-extras-20190305-2052Z.tar.bz2 331304 BLAKE2B 1d2c35a961159fa5ce9ee6699fce943f5a5b5cf60b11c9bb4bcccee4943f4508a9eb6d01050c642353ac592ce1a6b421abf2a1bebc706c44c4c8a36aa698ec43 SHA512 ae63403320e010acbb92f8aec6da8ed4f267cef0bad37147d594076fd94571de7f98bfc2afbe94af5d716f58d57696fd958b1e13e20e87052f252ed4a188cd3c EBUILD mariadb-10.2.22-r2.ebuild 32479 BLAKE2B cdb02077582e1f1e0f6c1739b43cfc28e8d03eb96c2c63d992fda2dd1a7da26baaaa8847cec4c6acd57ab0c54359d979015fec16a5faed2b3e4dc7c311eead68 SHA512 94d355a6789b3b44ef71137369d5e7dc0efa02efbfb656c989da0397332a69260031b53d17a93ccee97b3ce07201dcc7d009e500e04ff916619647e2ea14e964 @@ -48,19 +48,19 @@ EBUILD mariadb-10.2.32-r3.ebuild 33782 BLAKE2B 675dcec5874d2f025b4d9c38e36b9c9f9 EBUILD mariadb-10.2.34.ebuild 33912 BLAKE2B 0cf9492ea67e37883f4cbdd6060f0e44c5e045934500cd7482e8bd22b929879ab2b9e607ed724dbf28fc5fa61e82374ffe41adebfac1f54dba7266f0f2d9cfec SHA512 cdcdde796878493c0cc314688e5d24c44786e4a39654fae6ad0066385fd15643cb076cf6459844d92a3037b3fe1c2baa9e384e8a5525cf16575347027bc613a6 EBUILD mariadb-10.2.35.ebuild 33971 BLAKE2B 4c278c61d7497f3d8f9c69c90582411a2ec14f57d7865afc1932f2e07d897a2e9ee4388c53e16fffe4c001d09bfb12b16891f81b36c57556cea59f02b5159f06 SHA512 f42bdee8fe233b585f23a71b445b3ce2b4053e55833cd78957f77195b9fa407c575fcd0bcb035de9fd4018fbe7b6337a2a53c04099cb62b862cb8f5df6ec6add EBUILD mariadb-10.2.36.ebuild 33966 BLAKE2B e0bc3edc8eaf181d8e69e047353e46f9d1973d10108968c4b29f1e61d980a55492518f9fd27a93d8f9bdd63d2e64b3e828d19995ca5d322cfd19d5519a0bc5bd SHA512 d4b79a214f2823d5074288d359223468df2fa22caa69dc86d9f404267f21ff6b366dcaa4c23f35f7c5a76e381588c572cfcacfae16f8ce8c31940ded7e411afb -EBUILD mariadb-10.2.37-r2.ebuild 41669 BLAKE2B 05027a2154513221fe2b201fbc9acd32341af3d1cddcba49cdec02f2b25041a2793612fa45c8b6d75035d1a2b11f740ab97fb59a61f9b94282e560b9db5dd03e SHA512 db07c6bdaaaeaa1bd708382660846ae2dfda395804a0c9d128f074740a2729d7245022925526bf340d253ebc0cbdb1e5474cde5081d90787e1c51acab2811afe +EBUILD mariadb-10.2.37-r3.ebuild 41669 BLAKE2B f1696c334320731c4bd064f5cd8437a5f3571e50e7b9bbf0fff4bd6a900c0199ae178975f602f61cf13e9a273697ba6f138a606954108ca27a0b1b358d382de3 SHA512 533e279c550562dcac6d75866158b763fa704771baa992c928fb9dadaa7744cce4e4457ada36938fbec1574059bbcb212c8a220d1da25a226cf530f2d385a9d9 EBUILD mariadb-10.3.23-r3.ebuild 33535 BLAKE2B 90d0236994e8a13ab0b38e5e6dc052967b1fcb5442babfea78e032b46ce9051c2a01cc9383caae286d24a1ca80a5d74367574125b4500116804a432ea56bdcfa SHA512 f061844f10c320275febd82136bef72b1deb495b03f1cf5faa0550dfd6f7d677c46e0c296d505efb678d1e829b5f628b98af0e4bea64383167f553bb9c40a327 EBUILD mariadb-10.3.25.ebuild 33425 BLAKE2B c072e3713ca3dad00b1397d824fa8a04f68e38d875db46dd2527bddccc374dc8977e25e99d1ed7cd6504911a6e934b930667aa869ca394c7e01aa4b10b189c64 SHA512 673ed5a913c69bc86915c424bd221babc9639e17c704309e82feff8d0d509ce59b4345556bc5e8680662f8bd070d0cc84a7ad43d472ac680a19fe01683ce263f EBUILD mariadb-10.3.26.ebuild 33484 BLAKE2B 4b06603235ff2c01bae85db60240fe27e6c7ada074f0626033d6737e307674e99fb01ca2f49c32a4b370d364423f678f6a2c7af515f66bfb848d3d9c5e5e361d SHA512 64986ed9f33e393d75936f877c35a4e53d9e37718eb414a9cdd90322553f12e5ada3b1b0f99f49772728a601d81ac52cf628abc4d4b274b8fa636e5c365ad133 EBUILD mariadb-10.3.27.ebuild 33479 BLAKE2B c3ad220e76779a7ea17fdadee68cc0d8880ada6ee0df78bab327dee5d6fa762552174c38c69f9a639c50901f3de67be320e7c3a62116afbd3d6bd79ac2572b5e SHA512 d94cf965c4a2af570f899beb4ac98d65292459f9f0ea4db26731d20ef5d78d897b1740d82c6ad61e93997f8a25e43f1d2fa6f1bedfe16c4614a4f01ce188e49e -EBUILD mariadb-10.3.28-r2.ebuild 41201 BLAKE2B 24d79ad94b235d722530d6ff70c8aeb423b5d53e5cd8cd8d2bbbedf6f8f129b23d0caa47667b824ccb37d0061275faf465c797023705c7cc287b9d5671100b44 SHA512 4cb20665a2e01063da80b5b111aae195bd272eec48c475c29a45e806a431cdadb7678a74c81b1f20c1b378000c56741df734b64c414906e305f7fc7fbc655098 +EBUILD mariadb-10.3.28-r3.ebuild 41201 BLAKE2B 111b4ffea7492981982b84657c6913c68b0cdea67a647ca9af13f03191edc92acb6cff7a813fb1c1ff7fb53d9cd7bf2d8c5b48cf3af45735ac87f45b22999f3f SHA512 a63df40b531acf9d1a11976d06e2bd5d30433fab2da699e1131b0fc4ef77f8ea54fa3351110465d5d3717bb306ef1563d35501c6ca8be320a30a36afb8a4e3fc EBUILD mariadb-10.4.13-r3.ebuild 34099 BLAKE2B e8e055d85f8bdb2d278d5ecdcd78c7ec27b0e7760a4ae395624283ce75000cc6db26e29a784334ccfbf20dea63509df778da7b7b0f53c74169307dfe816f3e56 SHA512 c6fa64eb68089f606b5b225b762bdebad5cc9650ad3ca94fd2c2d35e8945dc36d0e354a5fecbcb00f33699f6ff74048389f28b7f8f103836fb2b49428007d127 EBUILD mariadb-10.4.15.ebuild 34130 BLAKE2B 23e17c379bcf4b8b388b8c0f44d332b9a8e4fc3dfe98f8f6c98d4135f509cf08f22022a140cbe47a3fe18b3ea772d8675c77ad5ed5cebe84b6c8bdfdabd081f8 SHA512 8b13080b4547f60bc9dfe092caf35d8ec44227919213edc2f80a4445446306f7e9ee7cbea7ebec054c697ceee2acb90e6af0a58bcc1b5279c679b8d74feaf3f4 EBUILD mariadb-10.4.16.ebuild 34263 BLAKE2B ca00223bd452d01f101cf60c1f91ee6c65cffa7f6873590d6f0807a6fc7ae3712ab14634a4b4115c79e437add7d25855569e7d2a5ea45e30087e1a2b7816d769 SHA512 40140335a8ffce7389fbab8ce4acc610466feaf2798cff1798ba1bb6c5ec9ce5244f01e53a2ea717002abecf6a602bcc244369e12920eca1adb9fc78fbc63a20 EBUILD mariadb-10.4.17.ebuild 34258 BLAKE2B 305bc236a9e044b34272681ebee9d2b4a199d905a05ff40812e3616908745c45820f4222240d3e07bddad8d8db5f0e2f20f082491ee7643865535854131c8628 SHA512 1aeabf3cf0f287a2780b5eabe7efc61c11374909d8797344cde0e0bd60b4027f2652c568f6e57099110ad2db3b91730edab90a12bd85c3a5c5ea6f30ab6736af -EBUILD mariadb-10.4.18-r2.ebuild 41758 BLAKE2B 68b854b434ec06bd043e4ed0d35c714292a6b2ecfaccaf20c0f22f3981156e7be00b5d69ff091dfc487fb0359ce2e22482dd981a3b67affdb0968b2bf4e4d8e8 SHA512 752de719abc3b8c3f9ede1c4652c2209c46b73afae16aaeaf05fee281111aeb229546d1ba818c1cd9615eee99806df76f57bb31b30a829223be1e9467eb5f138 +EBUILD mariadb-10.4.18-r3.ebuild 41758 BLAKE2B c9dbc9ac6afbfa4b17ce25c12e59de1293e24528169a65042c40e14adc0e1be7baf930c11d37b724a67b4776e2f8cedd2bcf81610fbff838a1d82c933f1f2656 SHA512 830ec17a255ebdd062046166a654ddc9b3068243789b2257df18d5de59846bd5a1943ccc02a1845ea74139358c96fc565ee95e8bd5571d8f9fab0851b3a30ef5 EBUILD mariadb-10.5.6.ebuild 33558 BLAKE2B 99623b62d5b0c6578f658bb7e1f5b713d59ff587eb95522d28834d1721538c38486f53c15335f42fc48c9814f965c9b028038cc796cc0893e3213b7f48fd11b4 SHA512 fb4013c674716962bb075c0c410b07e26d9d75baed841e237cf827a38994ce2c98b3fc07578071ead4c51cfe7b59564cc4e2a43a7d415983f56fa722d6311076 EBUILD mariadb-10.5.7.ebuild 33691 BLAKE2B 84108be4efeecf9544c727420e0bc1cdff72edd2c19d332fd9d5a31b1962780d74c75a93c8d230554e03c6c1b2bfdc89e7ef8d0cd936c04e1e8a61bbe62fda68 SHA512 eb19dae5ec6b535030f20a3b9ba2bdfb5e7d855188cf4c39a1a2f16d432c710c1883deb1f1252d1b176ca577129bc8d31c1f9f2a2f0e2d020d07fa0b5e8f9ce0 EBUILD mariadb-10.5.8.ebuild 33691 BLAKE2B c633321db0b12350ecac0efc53b9a06cf1d71ff43c3057e58afc299280d60d0118a5fd3cba9b6186ce5f753a36d6d11b27912cfdb4ac1891d35f79eef5e4c51d SHA512 b9bd51575a3703df33321c30e70143c94d8466e3f046fa0516e719df3cc7dccd1d60f0ce2c417ff0575de41afecab955d546b2b3fed1ae2cede2d8fc994448f8 -EBUILD mariadb-10.5.9-r3.ebuild 41256 BLAKE2B 6f79cff7460b11b531bba495748d669982e834c7560e50b7372cdf55841a076fadb1263b3bb97454362e61dbc73e6c19cca9f6917b0a5c0cac8a3caa29786478 SHA512 5f33c7bdb5e36232d1fb0f82a9977bf75bda76ff78cf9186e15d76ce78c2823008f820f90e68ae4967bde84d7b9bedbfe35c0499865c7bde4285547b2407647e +EBUILD mariadb-10.5.9-r4.ebuild 41256 BLAKE2B 142fee57576a64b50d62005ff3a3a1ea2e26fd8fa26977258fcff3884ce5fdcc4bed06e3857ed4fd1fc0ba6504f653ab09fa1689759ce17628484dcf13eb2aa4 SHA512 6689a01b2efd4cd4f92a28758dff08f417fbd8c67fa0229384ae37463cbf6f6f14dd967ee08e8e68bddb5777acfe5bd9c9e2b578dd6f54771f893d23c4e00f04 MISC metadata.xml 2735 BLAKE2B 961d1d49f7a6f5b90c731ce710c27e11bd2a1d996de9ae0adbabecd5823053e815397b5930797b66d94e1e767fbcba83fbb25fd002a1b2d346235cb24b6a2c3a SHA512 85a7ca20443ed2630f7ff8da19d74d9f415cd9d8dde25300eb1d6ed44b4d0c73bc34a149bf0471748933aa0200e14ced48c009b99d71a737e38283ed754b75c9 diff --git a/dev-db/mariadb/mariadb-10.2.37-r2.ebuild b/dev-db/mariadb/mariadb-10.2.37-r2.ebuild deleted file mode 100644 index 85198a6d6ccb..000000000000 --- a/dev-db/mariadb/mariadb-10.2.37-r2.ebuild +++ /dev/null @@ -1,1287 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -SUBSLOT="18" - -JAVA_PKG_OPT_USE="jdbc" - -inherit eutils systemd flag-o-matic prefix toolchain-funcs \ - multiprocessing java-pkg-opt-2 cmake - -# Patch version -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.2.37-patches-02.tar.xz" - -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz - ${PATCH_SET}" - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" -LICENSE="GPL-2 LGPL-2.1+" -SLOT="10.2/${SUBSLOT:-0}" -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx - sst-rsync sst-mariabackup sst-xtrabackup static systemd systemtap tcmalloc - test tokudb xml yassl" - -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) - server? ( tokudb? ( jemalloc !tcmalloc ) ) - ?? ( tcmalloc jemalloc ) - static? ( yassl !pam )" - -KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" - -# Shorten the path because the socket path length must be shorter than 107 chars -# and we will run a mysql server during test phase -S="${WORKDIR}/mysql" - -# Be warned, *DEPEND are version-dependant -# These are used for both runtime and compiletime -COMMON_DEPEND=" - kernel_linux? ( - sys-process/procps:0= - dev-libs/libaio:0= - ) - >=sys-apps/sed-4 - >=sys-apps/texinfo-4.7-r1 - jemalloc? ( dev-libs/jemalloc:0= ) - tcmalloc? ( dev-util/google-perftools:0= ) - systemtap? ( >=dev-util/systemtap-1.3:0= ) - >=sys-libs/zlib-1.2.3:0= - kerberos? ( virtual/krb5 ) - yassl? ( net-libs/gnutls:0= ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - sys-libs/ncurses:0= - !bindist? ( - sys-libs/binutils-libs:0= - >=sys-libs/readline-4.1:0= - ) - server? ( - backup? ( app-arch/libarchive:0= ) - cracklib? ( sys-libs/cracklib:0= ) - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - ) - innodb-lz4? ( app-arch/lz4 ) - innodb-lzo? ( dev-libs/lzo ) - innodb-snappy? ( app-arch/snappy ) - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) - numa? ( sys-process/numactl ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( sys-libs/pam:0= ) - systemd? ( sys-apps/systemd:= ) - tokudb? ( app-arch/snappy ) - ) - >=dev-libs/libpcre-8.41-r1:3= -" -BDEPEND="virtual/yacc - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) -" -DEPEND="static? ( sys-libs/ncurses[static-libs] ) - server? ( - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) - test? ( acct-group/mysql acct-user/mysql ) - ) - ${COMMON_DEPEND}" -RDEPEND="selinux? ( sec-policy/selinux-mysql ) - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster - !dev-db/mariadb:0 - !dev-db/mariadb:5.5 - !dev-db/mariadb:10.1 - !dev-db/mariadb:10.3 - !dev-db/mariadb:10.4 - !dev-db/mariadb:10.5 - !=virtual/jre-1.6 ) ) - ) -" -# For other stuff to bring us in -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL -# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) - server? ( - galera? ( - sst-xtrabackup? ( - || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) - ) - ) - )" - -mysql_init_vars() { - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="" - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//' \ - | tail -n1) - fi - fi - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="${MY_LOCALSTATEDIR}" - einfo "Using default MY_DATADIR" - fi - elog "MySQL MY_DATADIR is ${MY_DATADIR}" - - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then - if [[ -e "${MY_DATADIR}" ]] ; then - # If you get this and you're wondering about it, see bug #207636 - elog "MySQL datadir found in ${MY_DATADIR}" - elog "A new one will not be created." - PREVIOUS_DATADIR="yes" - else - PREVIOUS_DATADIR="no" - fi - export PREVIOUS_DATADIR - fi - else - if [[ ${EBUILD_PHASE} == "config" ]]; then - local new_MY_DATADIR - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then - ewarn "MySQL MY_DATADIR has changed" - ewarn "from ${MY_DATADIR}" - ewarn "to ${new_MY_DATADIR}" - MY_DATADIR="${new_MY_DATADIR}" - fi - fi - fi - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - local GCC_MAJOR_SET=$(gcc-major-version) - local GCC_MINOR_SET=$(gcc-minor-version) - - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on - # non x86{,_64} arches - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - if has test ${FEATURES} ; then - # Bug #213475 - MySQL _will_ object strenuously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if ! has userpriv ${FEATURES} ; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - fi - fi - - java-pkg-opt-2_pkg_setup -} - -src_unpack() { - unpack ${A} - - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die -} - -src_prepare() { - eapply "${WORKDIR}"/mariadb-patches - - eapply_user - - _disable_plugin() { - echo > "${S}/plugin/${1}/CMakeLists.txt" || die - } - _disable_engine() { - echo > "${S}/storage/${1}/CMakeLists.txt" || die - } - - if use jemalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" - elif use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - # Don't build bundled xz-utils for tokudb - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die - - local plugin - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info - locale_info qc_info server_audit sql_errlog auth_ed25519 ) - local test_plugins=( audit_null auth_examples daemon_example fulltext - debug_key_management example_key_management ) - if ! use server; then # These plugins are for the server - for plugin in "${server_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - fi - - if ! use test; then # These plugins are only used during testing - for plugin in "${test_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - _disable_engine test_sql_discovery - fi - - _disable_engine example - - if ! use oqgraph ; then # avoids extra library checks - _disable_engine oqgraph - fi - - if use mroonga ; then - # Remove the bundled groonga - # There is no CMake flag, it simply checks for existance - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" - else - _disable_engine mroonga - fi - - # Fix galera_recovery.sh script - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ - scripts/galera_recovery.sh || die - - cmake_src_prepare - java-pkg-opt-2_src_prepare -} - -src_configure() { - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - append-cxxflags -felide-constructors - - # bug #283926, with GCC4.4, this is required to get correct behavior. - append-flags -fno-strict-aliasing - - CMAKE_BUILD_TYPE="RelWithDebInfo" - - # debug hack wrt #497532 - mycmakeargs=( - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - -DINSTALL_BINDIR=bin - -DINSTALL_DOCDIR=share/doc/${PF} - -DINSTALL_DOCREADMEDIR=share/doc/${PF} - -DINSTALL_INCLUDEDIR=include/mysql - -DINSTALL_INFODIR=share/info - -DINSTALL_LIBDIR=$(get_libdir) - -DINSTALL_MANDIR=share/man - -DINSTALL_MYSQLSHAREDIR=share/mariadb - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin - -DINSTALL_SCRIPTDIR=bin - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" - -DWITH_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DWITH_DEFAULT_FEATURE_SET=0 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" - # The build forces this to be defined when cross-compiling. We pass it - # all the time for simplicity and to make sure it is actually correct. - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) - -DCONC_WITH_EXTERNAL_ZLIB=YES - -DWITH_EXTERNAL_ZLIB=YES - -DSUFFIX_INSTALL_DIR="" - -DWITH_UNITTEST=OFF - -DWITHOUT_CLIENTLIBS=YES - -DCLIENT_PLUGIN_DIALOG=OFF - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF - ) - if use test ; then - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) - else - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) - fi - - if ! use yassl ; then - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION - mycmakeargs+=( - -DWITH_READLINE=$(usex bindist 1 0) - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) - -DENABLE_DTRACE=$(usex systemtap) - ) - - if use server ; then - - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - mycmakeargs+=( - -DPLUGIN_FEDERATED=NO - -DPLUGIN_FEDERATEDX=NO ) - fi - - mycmakeargs+=( - -DWITH_JEMALLOC=$(usex jemalloc system) - -DWITH_PCRE=system - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) - -DPLUGIN_SPHINX=$(usex sphinx YES NO) - -DPLUGIN_TOKUDB=$(usex tokudb YES NO) - -DPLUGIN_AUTH_PAM=$(usex pam YES NO) - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) - -DPLUGIN_CASSANDRA=NO - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) - -DPLUGIN_SPIDER=$(usex extraengine YES NO) - -DPLUGIN_CONNECT=$(usex extraengine YES NO) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - # Build failure and autodep wrt bug 639144 - -DCONNECT_WITH_MONGO=OFF - -DWITH_WSREP=$(usex galera) - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DWITH_MARIABACKUP=$(usex backup ON OFF) - -DWITH_LIBARCHIVE=$(usex backup ON OFF) - -DINSTALL_SQLBENCHDIR=share/mariadb - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) - # systemd is only linked to for server notification - -DWITH_SYSTEMD=$(usex systemd yes no) - -DWITH_NUMA=$(usex numa ON OFF) - ) - - # Workaround for MDEV-14524 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) - - if use test ; then - # This is needed for the new client lib which tests a real, open server - mycmakeargs+=( -DSKIP_TESTS=ON ) - fi - - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi - mycmakeargs+=( - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DDISABLE_SHARED=$(usex static YES NO) - -DWITH_DEBUG=$(usex debug) - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_PROFILING=$(usex profiling) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use jemalloc || use tcmalloc ; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - ) - - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_EMBEDDED_SERVER=OFF - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SYSTEMD=no - ) - fi - - cmake_src_configure -} - -src_compile() { - cmake_src_compile -} - -# Official test instructions: -# USE='extraengine perl server' \ -# FEATURES='test userpriv' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - _disable_test() { - local rawtestname bug reason - rawtestname="${1}" ; shift - bug="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" - } - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if ! use server ; then - einfo "Skipping server tests due to minimal build." - return 0 - fi - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - - # Run CTest (test-units) - cmake_src_test - retstatus_unit=$? - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - - if [[ -z "${MTR_PARALLEL}" ]] ; then - local -x MTR_PARALLEL=$(makeopts_jobs) - - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then - # Running multiple tests in parallel usually require higher ulimit - # and fs.aio-max-nr setting. In addition, tests like main.multi_update - # are known to hit timeout when system is busy. - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of - # using "auto". - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" - einfo "${info_msg}" - unset info_msg - MTR_PARALLEL=4 - fi - else - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" - fi - - # Try to increase file limits to increase test coverage - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then - # Upper limit comes from parts.partition_* tests - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." - - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." - - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." - else - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 16500 (best test coverage)." - fi - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die - - local -a disabled_tests - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) - disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) - disabled_tests+=( "main.grant;0;Sporadically failing test" ) - disabled_tests+=( "main.join_cache;0;Sporadically failing test" ) - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) - disabled_tests+=( "mariabackup.*;0;Broken test suite" ) - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) - - if ! use latin1 ; then - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) - disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) - fi - - local test_infos_str test_infos_arr - for test_infos_str in "${disabled_tests[@]}" ; do - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" - - if [[ ${#test_infos_arr[@]} != 3 ]] ; then - die "Invalid test data set, not matching format: ${test_infos_str}" - fi - - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" - done - unset test_infos_str test_infos_arr - - # run mysql-test tests - pushd "${TESTDIR}" &>/dev/null || die - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" - retstatus_tests=$? - - popd &>/dev/null || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - local failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" -} - -src_install() { - cmake_src_install - - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then - rm "${ED}/usr/include/mysql/server/private/config.h" || die - fi - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "mysqlcheck" "/usr/bin/mysqlrepair" - dosym "mysqlcheck" "/usr/bin/mysqloptimize" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - if [[ -d "${ED}/usr/data" ]] ; then - rm -Rf "${ED}/usr/data" || die - fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" - fi - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - if use server ; then - mycnf_src="my.cnf.distro-server" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" || die - if use prefix ; then - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ - "${TMPDIR}/my.cnf.ok" || die - fi - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - einfo "Including support files and sample configurations" - docinto "support-files" - local script - for script in \ - "${S}"/support-files/magic - do - [[ -f "$script" ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" - done - # Manually install supporting files that conflict with other packages - # but are needed for galera and initial installation - exeinto /usr/libexec/mariadb - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" - fi - - # Remove bundled mytop in favor of dev-db/mytop - local mytop_file - for mytop_file in \ - "${ED}/usr/bin/mytop" \ - "${ED}/usr/share/man/man1/mytop.1" \ - ; do - if [[ -e "${mytop_file}" ]] ; then - rm -v "${mytop_file}" || die - fi - done - - # Fix a dangling symlink when galera is not built - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die - fi -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst - - # Here we need to see if the implementation switched client libraries - # We check if this is a new instance of the package and a client library already exists - local SHOW_ABI_MESSAGE libpath - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then - libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so") - elog "Due to ABI changes when switching between different client libraries," - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." - elog "Please run: revdep-rebuild --library ${libpath}" - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" - fi -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" - - if use server ; then - if use pam; then - einfo - elog "This install includes the PAM authentication plugin." - elog "To activate and configure the PAM plugin, please read:" - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" - einfo - fi - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog "\"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - elog - elog "If you are switching server implentations, you should run the" - elog "mysql_upgrade tool." - einfo - else - einfo - elog "If you are upgrading major versions, you should run the" - elog "mysql_upgrade tool." - einfo - fi - - if use galera ; then - einfo - elog "Be sure to edit the my.cnf file to activate your cluster settings." - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" - elog "The first time the cluster is activated, you should add" - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." - elog "This option should then be removed for subsequent starts." - einfo - if use sst-xtrabackup ; then - ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup" - ewarn "as an SST is broken by default beginning with 10.2.19 with the setting" - ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead." - ewarn "sst-xtrabackup is being removed in 10.3 and higher." - fi - fi - fi - - # Note about configuration change - einfo - elog "This version of mariadb reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/${PN}.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." - elog "You may have as many files as needed and they are read alphabetically." - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." - einfo -} - -pkg_config() { - _getoptval() { - local section="${1}" - local flag="--${2}=" - local extra_options="${3}" - local cmd=( - "${my_print_defaults_binary}" - "${extra_options}" - "${section}" - ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" - fi - } - - _mktemp_dry() { - # emktemp has no --dry-run option - local template="${1}" - - if [[ -z "${template}" ]] ; then - if [[ -z "${T}" ]] ; then - template="/tmp/XXXXXXX" - else - template="${T}/XXXXXXX" - fi - fi - - local template_wo_X=${template//X/} - local n_X - let n_X=${#template}-${#template_wo_X} - if [[ ${n_X} -lt 3 ]] ; then - echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 - return - fi - - local attempts=0 - local character tmpfile - while [[ true ]] ; do - let attempts=attempts+1 - - new_file= - while read -n1 character ; do - if [[ "${character}" == "X" ]] ; then - tmpfile+="${RANDOM:0:1}" - else - tmpfile+="${character}" - fi - done < <(echo -n "${template}") - - if [[ ! -f "${tmpfile}" ]] - then - echo "${tmpfile}" - return - fi - - if [[ ${attempts} -ge 100 ]] ; then - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 - return - fi - done - } - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" - if [[ ! -x "${mysql_install_db_binary}" ]] ; then - die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - # my_print_defaults needs to read stuff in $HOME/.my.cnf - local -x HOME="${EROOT}/root" - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Read currently set data directory - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ -z "${MY_DATADIR}" ]] ; then - die "Sorry, unable to find MY_DATADIR!" - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" - ewarn "Please rename or delete its content if you wish to initialize a new data directory." - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - fi - - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_TMPDIR=${MYSQL_TMPDIR%/} - # These are dir+prefix - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - - # Create missing directories. - # Always check if mysql user can write to directory even if we just - # created directory because a parent directory might be not - # accessible for that user. - PID_DIR="${EROOT}/run/mysqld" - if [[ ! -d "${PID_DIR}" ]] ; then - einfo "Creating ${PN} PID directory '${PID_DIR}' ..." - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ - || die "Failed to create PID directory '${PID_DIR}'!" - fi - - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_pid_dir_testfile}" ]] \ - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_pid_dir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" - else - rm "${_pid_dir_testfile}" || die - unset _pid_dir_testfile - fi - - if [[ ! -d "${MY_DATADIR}" ]] ; then - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" - fi - - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_datadir_testfile}" ]] \ - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_datadir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" - else - rm "${_my_datadir_testfile}" || die - unset _my_datadir_testfile - fi - - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" - fi - - if [[ -z "${MYSQL_TMPDIR}" ]] ; then - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" - [[ -z "${MYSQL_TMPDIR}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" - - mkdir "${MYSQL_TMPDIR}" || die - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die - fi - - # Now we need to test MYSQL_TMPDIR... - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" - fi - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_logbin_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_logbin_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" - else - rm "${_my_logbin_testfile}" || die - unset _my_logbin_testfile - fi - fi - - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_relaylog_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_relaylog_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" - else - rm "${_my_relaylog_testfile}" || die - unset _my_relaylog_testfile - fi - fi - - local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) - [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" - - # Limit access - chmod 0770 "${SETUP_TMPDIR}" || die - chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die - - local mysql_install_log="${SETUP_TMPDIR}/install_db.log" - local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" - - echo "" - einfo "Detected settings:" - einfo "==================" - einfo "MySQL User:\t\t\t\t${MYSQL_USER}" - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" - einfo "MySQL DATA directory:\t\t${MY_DATADIR}" - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" - fi - - einfo "PID DIR:\t\t\t\t${PID_DIR}" - einfo "Install db log:\t\t\t${mysql_install_log}" - einfo "Install server log:\t\t\t${mysqld_logfile}" - - echo - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local tmp_mysqld_password_source= - - for tmp_mysqld_password_source in mysql client ; do - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" - MYSQL_ROOT_PASSWORD= - continue - fi - - einfo "Found password in '${tmp_mysqld_password_source}' section!" - break - fi - done - - # Sometimes --show is required to display passwords in some implementations of my_print_defaults - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" - fi - - unset tmp_mysqld_password_source - fi - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local pwd1="a" - local pwd2="b" - - echo - einfo "No password for mysql 'root' user was specified via environment" - einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" - einfo "file like '${HOME}/.my.cnf'." - einfo "To continue please provide a password for the mysql 'root' user" - einfo "now on console:" - ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" - read -rsp " >" pwd1 ; echo - - einfo "Retype the password" - read -rsp " >" pwd2 ; echo - - if [[ "x${pwd1}" != "x${pwd2}" ]] ; then - die "Passwords are not the same!" - fi - - MYSQL_ROOT_PASSWORD="${pwd1}" - unset pwd1 pwd2 - - echo - fi - - local -a mysqld_options - - # Fix bug 446200. Don't reference host my.cnf, needs to come first, - # see http://bugs.mysql.com/bug.php?id=31312 - use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) - - # Figure out which options we need to disable to do the setup - local helpfile="${TMPDIR}/mysqld-help" - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null - - local opt optexp optfull - for opt in host-cache name-resolve networking slave-start \ - federated ssl log-bin relay-log slow-query-log external-locking \ - log-slave-updates \ - ; do - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" - egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) - done - - # Prepare timezones, see - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - local tz_sql="${SETUP_TMPDIR}/tz.sql" - - echo "USE mysql;" >"${tz_sql}" - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null - if [[ $? -ne 0 ]] ; then - die "mysql_tzinfo_to_sql failed!" - fi - - local cmd=( - "${mysql_install_db_binary}" - "${mysqld_options[@]}" - "--init-file='${tz_sql}'" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - "--log-error='${mysql_install_log}'" - "--rpm" - "--cross-bootstrap" - "--user=${MYSQL_USER}" - ) - - einfo "Initializing ${PN} data directory: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 - - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 - die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" - fi - - local x=${RANDOM} - local socket="${PID_DIR}/mysqld.${x}.sock" - [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" - local pidfile="${PID_DIR}/mysqld.${x}.pid" - [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" - unset x - - cmd=( - "${mysqld_binary}" - "${mysqld_options[@]}" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - --max_allowed_packet=8M - --net_buffer_length=16K - "--socket='${socket}'" - "--pid-file='${pidfile}'" - "--log-error='${mysqld_logfile}'" - "--user=${MYSQL_USER}" - ) - - einfo "Starting mysqld to finalize initialization: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & - - echo -n "Waiting for mysqld to accept connections " - local maxtry=15 - while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - if [[ -S "${socket}" ]] ; then - # Even with a socket we don't know if mysqld will abort - # start due to an error so just wait a little bit more... - maxtry=5 - while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - fi - - echo - - if [[ ! -S "${socket}" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 - die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" - fi - - local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" - touch "${mysql_logfile}" || die - - ebegin "Setting root password" - # Do this from memory, as we don't want clear text passwords in temp files - local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" - cmd=( - "${mysql_binary}" - --no-defaults - "--socket='${socket}'" - -hlocalhost - "-e \"${sql}\"" - ) - eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 - local rc=$? - eend ${rc} - - if [[ ${rc} -ne 0 ]] ; then - # Poor man's solution which tries to avoid having password - # in log. NOTE: sed can fail if user didn't follow advice - # and included character which will require escaping... - sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null - - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" - die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" - fi - - # Stop the server - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - echo -n "Stopping the server " - pkill -F "${pidfile}" &>/dev/null - - maxtry=10 - while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - echo - - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - # We somehow failed to stop server. - # However, not a fatal error. Just warn the user. - ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" - fi - fi - - rm -r "${SETUP_TMPDIR}" || die - - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" -} diff --git a/dev-db/mariadb/mariadb-10.2.37-r3.ebuild b/dev-db/mariadb/mariadb-10.2.37-r3.ebuild new file mode 100644 index 000000000000..a815c35193ed --- /dev/null +++ b/dev-db/mariadb/mariadb-10.2.37-r3.ebuild @@ -0,0 +1,1287 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +SUBSLOT="18" + +JAVA_PKG_OPT_USE="jdbc" + +inherit eutils systemd flag-o-matic prefix toolchain-funcs \ + multiprocessing java-pkg-opt-2 cmake + +# Patch version +PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.2.37-patches-03.tar.xz" + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz + ${PATCH_SET}" + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2 LGPL-2.1+" +SLOT="10.2/${SUBSLOT:-0}" +IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 + innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga + numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx + sst-rsync sst-mariabackup sst-xtrabackup static systemd systemtap tcmalloc + test tokudb xml yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" + +REQUIRED_USE="jdbc? ( extraengine server !static ) + server? ( tokudb? ( jemalloc !tcmalloc ) ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + jemalloc? ( dev-libs/jemalloc:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + >=sys-libs/zlib-1.2.3:0= + kerberos? ( virtual/krb5 ) + yassl? ( net-libs/gnutls:0= ) + !yassl? ( + !libressl? ( >=dev-libs/openssl-1.0.0:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + sys-libs/ncurses:0= + !bindist? ( + sys-libs/binutils-libs:0= + >=sys-libs/readline-4.1:0= + ) + server? ( + backup? ( app-arch/libarchive:0= ) + cracklib? ( sys-libs/cracklib:0= ) + extraengine? ( + odbc? ( dev-db/unixODBC:0= ) + xml? ( dev-libs/libxml2:2= ) + ) + innodb-lz4? ( app-arch/lz4 ) + innodb-lzo? ( dev-libs/lzo ) + innodb-snappy? ( app-arch/snappy ) + mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) + numa? ( sys-process/numactl ) + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( sys-libs/pam:0= ) + systemd? ( sys-apps/systemd:= ) + tokudb? ( app-arch/snappy ) + ) + >=dev-libs/libpcre-8.41-r1:3= +" +BDEPEND="virtual/yacc + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) +" +DEPEND="static? ( sys-libs/ncurses[static-libs] ) + server? ( + extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) + test? ( acct-group/mysql acct-user/mysql ) + ) + ${COMMON_DEPEND}" +RDEPEND="selinux? ( sec-policy/selinux-mysql ) + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + !dev-db/mariadb:0 + !dev-db/mariadb:5.5 + !dev-db/mariadb:10.1 + !dev-db/mariadb:10.3 + !dev-db/mariadb:10.4 + !dev-db/mariadb:10.5 + !=virtual/jre-1.6 ) ) + ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +# percona-xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 ) + server? ( + galera? ( + sst-xtrabackup? ( + || ( >=dev-db/percona-xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) + ) + ) + )" + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1) + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + if has test ${FEATURES} ; then + # Bug #213475 - MySQL _will_ object strenuously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if ! has userpriv ${FEATURES} ; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + fi + fi + + java-pkg-opt-2_pkg_setup +} + +src_unpack() { + unpack ${A} + + mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die +} + +src_prepare() { + eapply "${WORKDIR}"/mariadb-patches + + eapply_user + + _disable_plugin() { + echo > "${S}/plugin/${1}/CMakeLists.txt" || die + } + _disable_engine() { + echo > "${S}/storage/${1}/CMakeLists.txt" || die + } + + if use jemalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" + elif use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die + + local plugin + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info + locale_info qc_info server_audit sql_errlog auth_ed25519 ) + local test_plugins=( audit_null auth_examples daemon_example fulltext + debug_key_management example_key_management ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + _disable_engine test_sql_discovery + fi + + _disable_engine example + + if ! use oqgraph ; then # avoids extra library checks + _disable_engine oqgraph + fi + + if use mroonga ; then + # Remove the bundled groonga + # There is no CMake flag, it simply checks for existance + rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" + else + _disable_engine mroonga + fi + + # Fix galera_recovery.sh script + sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ + scripts/galera_recovery.sh || die + + cmake_src_prepare + java-pkg-opt-2_src_prepare +} + +src_configure() { + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" + -DSYSCONFDIR="${EPREFIX}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=bin + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" + -DWITH_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_LIBEDIT=0 + -DWITH_ZLIB=system + -DWITHOUT_LIBWRAP=1 + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DWITH_DEFAULT_COMPILER_OPTIONS=0 + -DWITH_DEFAULT_FEATURE_SET=0 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) + -DCONC_WITH_EXTERNAL_ZLIB=YES + -DWITH_EXTERNAL_ZLIB=YES + -DSUFFIX_INSTALL_DIR="" + -DWITH_UNITTEST=OFF + -DWITHOUT_CLIENTLIBS=YES + -DCLIENT_PLUGIN_DIALOG=OFF + -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF + -DCLIENT_PLUGIN_CLIENT_ED25519=OFF + -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC + -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF + ) + if use test ; then + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) + else + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) + fi + + if ! use yassl ; then + mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) + else + mycmakeargs+=( -DWITH_SSL=bundled ) + fi + + # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION + mycmakeargs+=( + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + ) + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO ) + fi + + mycmakeargs+=( + -DWITH_JEMALLOC=$(usex jemalloc system) + -DWITH_PCRE=system + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) + -DPLUGIN_SPHINX=$(usex sphinx YES NO) + -DPLUGIN_TOKUDB=$(usex tokudb YES NO) + -DPLUGIN_AUTH_PAM=$(usex pam YES NO) + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) + -DPLUGIN_SPIDER=$(usex extraengine YES NO) + -DPLUGIN_CONNECT=$(usex extraengine YES NO) + -DCONNECT_WITH_MYSQL=1 + -DCONNECT_WITH_LIBXML2=$(usex xml) + -DCONNECT_WITH_ODBC=$(usex odbc) + -DCONNECT_WITH_JDBC=$(usex jdbc) + # Build failure and autodep wrt bug 639144 + -DCONNECT_WITH_MONGO=OFF + -DWITH_WSREP=$(usex galera) + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DWITH_MARIABACKUP=$(usex backup ON OFF) + -DWITH_LIBARCHIVE=$(usex backup ON OFF) + -DINSTALL_SQLBENCHDIR=share/mariadb + -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) + # systemd is only linked to for server notification + -DWITH_SYSTEMD=$(usex systemd yes no) + -DWITH_NUMA=$(usex numa ON OFF) + ) + + # Workaround for MDEV-14524 + use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) + + if use test ; then + # This is needed for the new client lib which tests a real, open server + mycmakeargs+=( -DSKIP_TESTS=ON ) + fi + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DMYSQL_USER=mysql + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_DEBUG=$(usex debug) + -DWITH_EMBEDDED_SERVER=OFF + -DWITH_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DWITH_EMBEDDED_SERVER=OFF + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + -DWITH_SYSTEMD=no + ) + fi + + cmake_src_configure +} + +src_compile() { + cmake_src_compile +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + _disable_test() { + local rawtestname bug reason + rawtestname="${1}" ; shift + bug="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" + echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) + cmake_src_test + retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + + if [[ -z "${MTR_PARALLEL}" ]] ; then + local -x MTR_PARALLEL=$(makeopts_jobs) + + if [[ ${MTR_PARALLEL} -gt 4 ]] ; then + # Running multiple tests in parallel usually require higher ulimit + # and fs.aio-max-nr setting. In addition, tests like main.multi_update + # are known to hit timeout when system is busy. + # To avoid test failure we will limit MTR_PARALLEL to 4 instead of + # using "auto". + local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" + info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" + einfo "${info_msg}" + unset info_msg + MTR_PARALLEL=4 + fi + else + einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" + fi + + # Try to increase file limits to increase test coverage + if ! ulimit -n 16500 1>/dev/null 2>&1 ; then + # Upper limit comes from parts.partition_* tests + ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." + + if ! ulimit -n 4162 1>/dev/null 2>&1 ; then + # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' + ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." + + if ! ulimit -n 3000 1>/dev/null 2>&1 ; then + ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." + else + einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 16500 (best test coverage)." + fi + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die + + local -a disabled_tests + disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) + disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) + disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) + disabled_tests+=( "main.grant;0;Sporadically failing test" ) + disabled_tests+=( "main.join_cache;0;Sporadically failing test" ) + disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) + disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) + disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) + disabled_tests+=( "mariabackup.*;0;Broken test suite" ) + disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) + disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) + disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) + disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) + + if ! use latin1 ; then + disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) + disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) + disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) + disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) + fi + + local test_infos_str test_infos_arr + for test_infos_str in "${disabled_tests[@]}" ; do + IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" + + if [[ ${#test_infos_arr[@]} != 3 ]] ; then + die "Invalid test data set, not matching format: ${test_infos_str}" + fi + + _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" + done + unset test_infos_str test_infos_arr + + # run mysql-test tests + pushd "${TESTDIR}" &>/dev/null || die + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd &>/dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +src_install() { + cmake_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED}/usr/data" ]] ; then + rm -Rf "${ED}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" + cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + doins "${TMPDIR}/50-distro-client.cnf" + + if use server ; then + mycnf_src="my.cnf.distro-server" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/${mycnf_src}" \ + > "${TMPDIR}/my.cnf.ok" || die + if use prefix ; then + sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ + "${TMPDIR}/my.cnf.ok" || die + fi + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + fi + + # Remove bundled mytop in favor of dev-db/mytop + local mytop_file + for mytop_file in \ + "${ED}/usr/bin/mytop" \ + "${ED}/usr/share/man/man1/mytop.1" \ + ; do + if [[ -e "${mytop_file}" ]] ; then + rm -v "${mytop_file}" || die + fi + done + + # Fix a dangling symlink when galera is not built + if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then + rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die + fi +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst + + # Here we need to see if the implementation switched client libraries + # We check if this is a new instance of the package and a client library already exists + local SHOW_ABI_MESSAGE libpath + if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then + libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so") + elog "Due to ABI changes when switching between different client libraries," + elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." + elog "Please run: revdep-rebuild --library ${libpath}" + ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" + fi +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + if use galera ; then + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + if use sst-xtrabackup ; then + ewarn "As per https://mariadb.com/kb/en/meta/xtrabackup_warning/, XtraBackup" + ewarn "as an SST is broken by default beginning with 10.2.19 with the setting" + ewarn "innodb_safe_truncate=ON. Please migrate to sst-mariabackup instead." + ewarn "sst-xtrabackup is being removed in 10.3 and higher." + fi + fi + fi + + # Note about configuration change + einfo + elog "This version of mariadb reorganizes the configuration from a single my.cnf" + elog "to several files in /etc/mysql/${PN}.d." + elog "Please backup any changes you made to /etc/mysql/my.cnf" + elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." + elog "You may have as many files as needed and they are read alphabetically." + elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." + einfo +} + +pkg_config() { + _getoptval() { + local section="${1}" + local flag="--${2}=" + local extra_options="${3}" + local cmd=( + "${my_print_defaults_binary}" + "${extra_options}" + "${section}" + ) + local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) + + if [[ ${#results[@]} -gt 0 ]] ; then + # When option is set multiple times only return last value + echo "${results[-1]}" + fi + } + + _mktemp_dry() { + # emktemp has no --dry-run option + local template="${1}" + + if [[ -z "${template}" ]] ; then + if [[ -z "${T}" ]] ; then + template="/tmp/XXXXXXX" + else + template="${T}/XXXXXXX" + fi + fi + + local template_wo_X=${template//X/} + local n_X + let n_X=${#template}-${#template_wo_X} + if [[ ${n_X} -lt 3 ]] ; then + echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 + return + fi + + local attempts=0 + local character tmpfile + while [[ true ]] ; do + let attempts=attempts+1 + + new_file= + while read -n1 character ; do + if [[ "${character}" == "X" ]] ; then + tmpfile+="${RANDOM:0:1}" + else + tmpfile+="${character}" + fi + done < <(echo -n "${template}") + + if [[ ! -f "${tmpfile}" ]] + then + echo "${tmpfile}" + return + fi + + if [[ ${attempts} -ge 100 ]] ; then + echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 + return + fi + done + } + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" + if [[ ! -x "${mysql_install_db_binary}" ]] ; then + die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + + # my_print_defaults needs to read stuff in $HOME/.my.cnf + local -x HOME="${EROOT}/root" + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Read currently set data directory + MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ -z "${MY_DATADIR}" ]] ; then + die "Sorry, unable to find MY_DATADIR!" + elif [[ -d "${MY_DATADIR}/mysql" ]] ; then + ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" + ewarn "Please rename or delete its content if you wish to initialize a new data directory." + die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" + fi + + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_TMPDIR=${MYSQL_TMPDIR%/} + # These are dir+prefix + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + + # Create missing directories. + # Always check if mysql user can write to directory even if we just + # created directory because a parent directory might be not + # accessible for that user. + PID_DIR="${EROOT}/run/mysqld" + if [[ ! -d "${PID_DIR}" ]] ; then + einfo "Creating ${PN} PID directory '${PID_DIR}' ..." + install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ + || die "Failed to create PID directory '${PID_DIR}'!" + fi + + local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_pid_dir_testfile}" ]] \ + && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_pid_dir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" + else + rm "${_pid_dir_testfile}" || die + unset _pid_dir_testfile + fi + + if [[ ! -d "${MY_DATADIR}" ]] ; then + einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ + || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" + fi + + local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_datadir_testfile}" ]] \ + && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_datadir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" + else + rm "${_my_datadir_testfile}" || die + unset _my_datadir_testfile + fi + + if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then + einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ + || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" + fi + + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" + [[ -z "${MYSQL_TMPDIR}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" + + mkdir "${MYSQL_TMPDIR}" || die + chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die + fi + + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then + einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ + || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" + fi + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_logbin_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_logbin_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" + else + rm "${_my_logbin_testfile}" || die + unset _my_logbin_testfile + fi + fi + + if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then + einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ + || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_relaylog_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_relaylog_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" + else + rm "${_my_relaylog_testfile}" || die + unset _my_relaylog_testfile + fi + fi + + local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) + [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" + + # Limit access + chmod 0770 "${SETUP_TMPDIR}" || die + chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die + + local mysql_install_log="${SETUP_TMPDIR}/install_db.log" + local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + + echo + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client ; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local pwd1="a" + local pwd2="b" + + echo + einfo "No password for mysql 'root' user was specified via environment" + einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" + einfo "file like '${HOME}/.my.cnf'." + einfo "To continue please provide a password for the mysql 'root' user" + einfo "now on console:" + ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x${pwd1}" != "x${pwd2}" ]] ; then + die "Passwords are not the same!" + fi + + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + + echo + fi + + local -a mysqld_options + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see http://bugs.mysql.com/bug.php?id=31312 + use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + + local opt optexp optfull + for opt in host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) + done + + # Prepare timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + local tz_sql="${SETUP_TMPDIR}/tz.sql" + + echo "USE mysql;" >"${tz_sql}" + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null + if [[ $? -ne 0 ]] ; then + die "mysql_tzinfo_to_sql failed!" + fi + + local cmd=( + "${mysql_install_db_binary}" + "${mysqld_options[@]}" + "--init-file='${tz_sql}'" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + "--log-error='${mysql_install_log}'" + "--rpm" + "--cross-bootstrap" + "--user=${MYSQL_USER}" + ) + + einfo "Initializing ${PN} data directory: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 + + if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 + die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" + fi + + local x=${RANDOM} + local socket="${PID_DIR}/mysqld.${x}.sock" + [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" + local pidfile="${PID_DIR}/mysqld.${x}.pid" + [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" + unset x + + cmd=( + "${mysqld_binary}" + "${mysqld_options[@]}" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + --max_allowed_packet=8M + --net_buffer_length=16K + "--socket='${socket}'" + "--pid-file='${pidfile}'" + "--log-error='${mysqld_logfile}'" + "--user=${MYSQL_USER}" + ) + + einfo "Starting mysqld to finalize initialization: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & + + echo -n "Waiting for mysqld to accept connections " + local maxtry=15 + while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + if [[ -S "${socket}" ]] ; then + # Even with a socket we don't know if mysqld will abort + # start due to an error so just wait a little bit more... + maxtry=5 + while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + fi + + echo + + if [[ ! -S "${socket}" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 + die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" + fi + + local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" + touch "${mysql_logfile}" || die + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" + cmd=( + "${mysql_binary}" + --no-defaults + "--socket='${socket}'" + -hlocalhost + "-e \"${sql}\"" + ) + eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 + local rc=$? + eend ${rc} + + if [[ ${rc} -ne 0 ]] ; then + # Poor man's solution which tries to avoid having password + # in log. NOTE: sed can fail if user didn't follow advice + # and included character which will require escaping... + sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null + + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" + die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" + fi + + # Stop the server + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + echo -n "Stopping the server " + pkill -F "${pidfile}" &>/dev/null + + maxtry=10 + while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + echo + + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + # We somehow failed to stop server. + # However, not a fatal error. Just warn the user. + ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" + fi + fi + + rm -r "${SETUP_TMPDIR}" || die + + einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" +} diff --git a/dev-db/mariadb/mariadb-10.3.28-r2.ebuild b/dev-db/mariadb/mariadb-10.3.28-r2.ebuild deleted file mode 100644 index b127dfd2fcd0..000000000000 --- a/dev-db/mariadb/mariadb-10.3.28-r2.ebuild +++ /dev/null @@ -1,1279 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -SUBSLOT="18" - -JAVA_PKG_OPT_USE="jdbc" - -inherit eutils systemd flag-o-matic prefix toolchain-funcs \ - multiprocessing java-pkg-opt-2 cmake - -# Patch version -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.3.28-patches-02.tar.xz" - -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz - ${PATCH_SET}" - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" -LICENSE="GPL-2 LGPL-2.1+" -SLOT="10.3/${SUBSLOT:-0}" -IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx - sst-rsync sst-mariabackup static systemd systemtap tcmalloc - test tokudb xml yassl" - -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) - server? ( tokudb? ( jemalloc !tcmalloc ) ) - ?? ( tcmalloc jemalloc ) - static? ( yassl !pam )" - -KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" - -# Shorten the path because the socket path length must be shorter than 107 chars -# and we will run a mysql server during test phase -S="${WORKDIR}/mysql" - -# Be warned, *DEPEND are version-dependant -# These are used for both runtime and compiletime -COMMON_DEPEND=" - kernel_linux? ( - sys-process/procps:0= - dev-libs/libaio:0= - ) - >=sys-apps/sed-4 - >=sys-apps/texinfo-4.7-r1 - jemalloc? ( dev-libs/jemalloc:0= ) - tcmalloc? ( dev-util/google-perftools:0= ) - systemtap? ( >=dev-util/systemtap-1.3:0= ) - >=sys-libs/zlib-1.2.3:0= - kerberos? ( virtual/krb5 ) - yassl? ( net-libs/gnutls:0= ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - sys-libs/ncurses:0= - !bindist? ( - sys-libs/binutils-libs:0= - >=sys-libs/readline-4.1:0= - ) - server? ( - backup? ( app-arch/libarchive:0= ) - cracklib? ( sys-libs/cracklib:0= ) - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - ) - innodb-lz4? ( app-arch/lz4 ) - innodb-lzo? ( dev-libs/lzo ) - innodb-snappy? ( app-arch/snappy ) - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) - numa? ( sys-process/numactl ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( sys-libs/pam:0= ) - systemd? ( sys-apps/systemd:= ) - tokudb? ( app-arch/snappy ) - ) - >=dev-libs/libpcre-8.41-r1:3= -" -BDEPEND="virtual/yacc - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) -" -DEPEND="static? ( sys-libs/ncurses[static-libs] ) - server? ( - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) - test? ( acct-group/mysql acct-user/mysql ) - ) - ${COMMON_DEPEND}" -RDEPEND="selinux? ( sec-policy/selinux-mysql ) - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster - !dev-db/mariadb:0 - !dev-db/mariadb:5.5 - !dev-db/mariadb:10.1 - !dev-db/mariadb:10.2 - !dev-db/mariadb:10.4 - !dev-db/mariadb:10.5 - !=virtual/jre-1.6 ) ) - ) -" -# For other stuff to bring us in -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" - -mysql_init_vars() { - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="" - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//' \ - | tail -n1) - fi - fi - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="${MY_LOCALSTATEDIR}" - einfo "Using default MY_DATADIR" - fi - elog "MySQL MY_DATADIR is ${MY_DATADIR}" - - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then - if [[ -e "${MY_DATADIR}" ]] ; then - # If you get this and you're wondering about it, see bug #207636 - elog "MySQL datadir found in ${MY_DATADIR}" - elog "A new one will not be created." - PREVIOUS_DATADIR="yes" - else - PREVIOUS_DATADIR="no" - fi - export PREVIOUS_DATADIR - fi - else - if [[ ${EBUILD_PHASE} == "config" ]]; then - local new_MY_DATADIR - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then - ewarn "MySQL MY_DATADIR has changed" - ewarn "from ${MY_DATADIR}" - ewarn "to ${new_MY_DATADIR}" - MY_DATADIR="${new_MY_DATADIR}" - fi - fi - fi - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - local GCC_MAJOR_SET=$(gcc-major-version) - local GCC_MINOR_SET=$(gcc-minor-version) - - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on - # non x86{,_64} arches - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - if has test ${FEATURES} ; then - # Bug #213475 - MySQL _will_ object strenuously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if ! has userpriv ${FEATURES} ; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - fi - fi - - java-pkg-opt-2_pkg_setup -} - -src_unpack() { - unpack ${A} - - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die -} - -src_prepare() { - eapply "${WORKDIR}"/mariadb-patches - - eapply_user - - _disable_plugin() { - echo > "${S}/plugin/${1}/CMakeLists.txt" || die - } - _disable_engine() { - echo > "${S}/storage/${1}/CMakeLists.txt" || die - } - - if use jemalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" - elif use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - # Don't build bundled xz-utils for tokudb - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die - - local plugin - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info - locale_info qc_info server_audit sql_errlog auth_ed25519 ) - local test_plugins=( audit_null auth_examples daemon_example fulltext - debug_key_management example_key_management versioning ) - if ! use server; then # These plugins are for the server - for plugin in "${server_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - fi - - if ! use test; then # These plugins are only used during testing - for plugin in "${test_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - _disable_engine test_sql_discovery - fi - - _disable_engine example - - if ! use oqgraph ; then # avoids extra library checks - _disable_engine oqgraph - fi - - if use mroonga ; then - # Remove the bundled groonga - # There is no CMake flag, it simply checks for existance - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" - else - _disable_engine mroonga - fi - - # Fix galera_recovery.sh script - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ - scripts/galera_recovery.sh || die - - cmake_src_prepare - java-pkg-opt-2_src_prepare -} - -src_configure() { - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - append-cxxflags -felide-constructors - - # bug #283926, with GCC4.4, this is required to get correct behavior. - append-flags -fno-strict-aliasing - - CMAKE_BUILD_TYPE="RelWithDebInfo" - - # debug hack wrt #497532 - mycmakeargs=( - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - -DINSTALL_BINDIR=bin - -DINSTALL_DOCDIR=share/doc/${PF} - -DINSTALL_DOCREADMEDIR=share/doc/${PF} - -DINSTALL_INCLUDEDIR=include/mysql - -DINSTALL_INFODIR=share/info - -DINSTALL_LIBDIR=$(get_libdir) - -DINSTALL_MANDIR=share/man - -DINSTALL_MYSQLSHAREDIR=share/mariadb - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin - -DINSTALL_SCRIPTDIR=bin - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" - -DWITH_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DWITH_DEFAULT_FEATURE_SET=0 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" - # The build forces this to be defined when cross-compiling. We pass it - # all the time for simplicity and to make sure it is actually correct. - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) - -DCONC_WITH_EXTERNAL_ZLIB=YES - -DWITH_EXTERNAL_ZLIB=YES - -DSUFFIX_INSTALL_DIR="" - -DWITH_UNITTEST=OFF - -DWITHOUT_CLIENTLIBS=YES - -DCLIENT_PLUGIN_DIALOG=OFF - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF - ) - if use test ; then - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) - else - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) - fi - - if ! use yassl ; then - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION - mycmakeargs+=( - -DWITH_READLINE=$(usex bindist 1 0) - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) - -DENABLE_DTRACE=$(usex systemtap) - ) - - if use server ; then - - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - mycmakeargs+=( - -DPLUGIN_FEDERATED=NO - -DPLUGIN_FEDERATEDX=NO ) - fi - - mycmakeargs+=( - -DWITH_PCRE=system - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) - -DPLUGIN_SPHINX=$(usex sphinx YES NO) - -DPLUGIN_TOKUDB=$(usex tokudb YES NO) - -DPLUGIN_AUTH_PAM=$(usex pam YES NO) - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) - -DPLUGIN_CASSANDRA=NO - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) - -DPLUGIN_SPIDER=$(usex extraengine YES NO) - -DPLUGIN_CONNECT=$(usex extraengine YES NO) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - # Build failure and autodep wrt bug 639144 - -DCONNECT_WITH_MONGO=OFF - -DWITH_WSREP=$(usex galera) - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DWITH_MARIABACKUP=$(usex backup ON OFF) - -DWITH_LIBARCHIVE=$(usex backup ON OFF) - -DINSTALL_SQLBENCHDIR="" - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) - # systemd is only linked to for server notification - -DWITH_SYSTEMD=$(usex systemd yes no) - -DWITH_NUMA=$(usex numa ON OFF) - ) - - # Workaround for MDEV-14524 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) - - if use test ; then - # This is needed for the new client lib which tests a real, open server - mycmakeargs+=( -DSKIP_TESTS=ON ) - fi - - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi - mycmakeargs+=( - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DDISABLE_SHARED=$(usex static YES NO) - -DWITH_DEBUG=$(usex debug) - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_PROFILING=$(usex profiling) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use jemalloc || use tcmalloc ; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - ) - - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_EMBEDDED_SERVER=OFF - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SYSTEMD=no - ) - fi - - cmake_src_configure -} - -src_compile() { - cmake_src_compile -} - -# Official test instructions: -# USE='extraengine perl server' \ -# FEATURES='test userpriv' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - _disable_test() { - local rawtestname bug reason - rawtestname="${1}" ; shift - bug="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" - } - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if ! use server ; then - einfo "Skipping server tests due to minimal build." - return 0 - fi - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - - # Run CTest (test-units) - cmake_src_test - retstatus_unit=$? - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - - if [[ -z "${MTR_PARALLEL}" ]] ; then - local -x MTR_PARALLEL=$(makeopts_jobs) - - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then - # Running multiple tests in parallel usually require higher ulimit - # and fs.aio-max-nr setting. In addition, tests like main.multi_update - # are known to hit timeout when system is busy. - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of - # using "auto". - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" - einfo "${info_msg}" - unset info_msg - MTR_PARALLEL=4 - fi - else - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" - fi - - # Try to increase file limits to increase test coverage - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then - # Upper limit comes from parts.partition_* tests - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." - - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." - - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." - else - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 16500 (best test coverage)." - fi - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die - - local -a disabled_tests - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) - disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) - disabled_tests+=( "main.grant;0;Sporadically failing test" ) - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) - disabled_tests+=( "mariabackup.*;0;Broken test suite" ) - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) - - if ! use latin1 ; then - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) - disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) - fi - - local test_infos_str test_infos_arr - for test_infos_str in "${disabled_tests[@]}" ; do - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" - - if [[ ${#test_infos_arr[@]} != 3 ]] ; then - die "Invalid test data set, not matching format: ${test_infos_str}" - fi - - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" - done - unset test_infos_str test_infos_arr - - # run mysql-test tests - pushd "${TESTDIR}" &>/dev/null || die - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" - retstatus_tests=$? - - popd &>/dev/null || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - local failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" -} - -src_install() { - cmake_src_install - - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then - rm "${ED}/usr/include/mysql/server/private/config.h" || die - fi - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "mysqlcheck" "/usr/bin/mysqlrepair" - dosym "mysqlcheck" "/usr/bin/mysqloptimize" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - if [[ -d "${ED}/usr/data" ]] ; then - rm -Rf "${ED}/usr/data" || die - fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" - fi - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - if use server ; then - mycnf_src="my.cnf.distro-server" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" || die - if use prefix ; then - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ - "${TMPDIR}/my.cnf.ok" || die - fi - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - einfo "Including support files and sample configurations" - docinto "support-files" - local script - for script in \ - "${S}"/support-files/magic - do - [[ -f "$script" ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" - done - # Manually install supporting files that conflict with other packages - # but are needed for galera and initial installation - exeinto /usr/libexec/mariadb - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" - fi - - # Remove bundled mytop in favor of dev-db/mytop - local mytop_file - for mytop_file in \ - "${ED}/usr/bin/mytop" \ - "${ED}/usr/share/man/man1/mytop.1" \ - ; do - if [[ -e "${mytop_file}" ]] ; then - rm -v "${mytop_file}" || die - fi - done - - # Fix a dangling symlink when galera is not built - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die - fi - - # Remove broken SST scripts that are incompatible - local scriptremove - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then - rm "${ED}/usr/bin/${scriptremove}" || die - fi - done -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst - - # Here we need to see if the implementation switched client libraries - # We check if this is a new instance of the package and a client library already exists - local SHOW_ABI_MESSAGE libpath - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then - libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so") - elog "Due to ABI changes when switching between different client libraries," - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." - elog "Please run: revdep-rebuild --library ${libpath}" - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" - fi -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" - - if use server ; then - if use pam; then - einfo - elog "This install includes the PAM authentication plugin." - elog "To activate and configure the PAM plugin, please read:" - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" - einfo - fi - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog "\"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - elog - elog "If you are switching server implentations, you should run the" - elog "mysql_upgrade tool." - einfo - else - einfo - elog "If you are upgrading major versions, you should run the" - elog "mysql_upgrade tool." - einfo - fi - - if use galera ; then - einfo - elog "Be sure to edit the my.cnf file to activate your cluster settings." - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" - elog "The first time the cluster is activated, you should add" - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." - elog "This option should then be removed for subsequent starts." - einfo - fi - fi - - # Note about configuration change - einfo - elog "This version of mariadb reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/${PN}.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." - elog "You may have as many files as needed and they are read alphabetically." - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." - einfo -} - -pkg_config() { - _getoptval() { - local section="${1}" - local flag="--${2}=" - local extra_options="${3}" - local cmd=( - "${my_print_defaults_binary}" - "${extra_options}" - "${section}" - ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" - fi - } - - _mktemp_dry() { - # emktemp has no --dry-run option - local template="${1}" - - if [[ -z "${template}" ]] ; then - if [[ -z "${T}" ]] ; then - template="/tmp/XXXXXXX" - else - template="${T}/XXXXXXX" - fi - fi - - local template_wo_X=${template//X/} - local n_X - let n_X=${#template}-${#template_wo_X} - if [[ ${n_X} -lt 3 ]] ; then - echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 - return - fi - - local attempts=0 - local character tmpfile - while [[ true ]] ; do - let attempts=attempts+1 - - new_file= - while read -n1 character ; do - if [[ "${character}" == "X" ]] ; then - tmpfile+="${RANDOM:0:1}" - else - tmpfile+="${character}" - fi - done < <(echo -n "${template}") - - if [[ ! -f "${tmpfile}" ]] - then - echo "${tmpfile}" - return - fi - - if [[ ${attempts} -ge 100 ]] ; then - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 - return - fi - done - } - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" - if [[ ! -x "${mysql_install_db_binary}" ]] ; then - die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - # my_print_defaults needs to read stuff in $HOME/.my.cnf - local -x HOME="${EROOT}/root" - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Read currently set data directory - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ -z "${MY_DATADIR}" ]] ; then - die "Sorry, unable to find MY_DATADIR!" - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" - ewarn "Please rename or delete its content if you wish to initialize a new data directory." - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - fi - - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_TMPDIR=${MYSQL_TMPDIR%/} - # These are dir+prefix - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - - # Create missing directories. - # Always check if mysql user can write to directory even if we just - # created directory because a parent directory might be not - # accessible for that user. - PID_DIR="${EROOT}/run/mysqld" - if [[ ! -d "${PID_DIR}" ]] ; then - einfo "Creating ${PN} PID directory '${PID_DIR}' ..." - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ - || die "Failed to create PID directory '${PID_DIR}'!" - fi - - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_pid_dir_testfile}" ]] \ - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_pid_dir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" - else - rm "${_pid_dir_testfile}" || die - unset _pid_dir_testfile - fi - - if [[ ! -d "${MY_DATADIR}" ]] ; then - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" - fi - - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_datadir_testfile}" ]] \ - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_datadir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" - else - rm "${_my_datadir_testfile}" || die - unset _my_datadir_testfile - fi - - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" - fi - - if [[ -z "${MYSQL_TMPDIR}" ]] ; then - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" - [[ -z "${MYSQL_TMPDIR}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" - - mkdir "${MYSQL_TMPDIR}" || die - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die - fi - - # Now we need to test MYSQL_TMPDIR... - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" - fi - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_logbin_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_logbin_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" - else - rm "${_my_logbin_testfile}" || die - unset _my_logbin_testfile - fi - fi - - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_relaylog_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_relaylog_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" - else - rm "${_my_relaylog_testfile}" || die - unset _my_relaylog_testfile - fi - fi - - local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) - [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" - - # Limit access - chmod 0770 "${SETUP_TMPDIR}" || die - chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die - - local mysql_install_log="${SETUP_TMPDIR}/install_db.log" - local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" - - echo "" - einfo "Detected settings:" - einfo "==================" - einfo "MySQL User:\t\t\t\t${MYSQL_USER}" - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" - einfo "MySQL DATA directory:\t\t${MY_DATADIR}" - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" - fi - - einfo "PID DIR:\t\t\t\t${PID_DIR}" - einfo "Install db log:\t\t\t${mysql_install_log}" - einfo "Install server log:\t\t\t${mysqld_logfile}" - - echo - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local tmp_mysqld_password_source= - - for tmp_mysqld_password_source in mysql client ; do - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" - MYSQL_ROOT_PASSWORD= - continue - fi - - einfo "Found password in '${tmp_mysqld_password_source}' section!" - break - fi - done - - # Sometimes --show is required to display passwords in some implementations of my_print_defaults - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" - fi - - unset tmp_mysqld_password_source - fi - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local pwd1="a" - local pwd2="b" - - echo - einfo "No password for mysql 'root' user was specified via environment" - einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" - einfo "file like '${HOME}/.my.cnf'." - einfo "To continue please provide a password for the mysql 'root' user" - einfo "now on console:" - ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" - read -rsp " >" pwd1 ; echo - - einfo "Retype the password" - read -rsp " >" pwd2 ; echo - - if [[ "x${pwd1}" != "x${pwd2}" ]] ; then - die "Passwords are not the same!" - fi - - MYSQL_ROOT_PASSWORD="${pwd1}" - unset pwd1 pwd2 - - echo - fi - - local -a mysqld_options - - # Fix bug 446200. Don't reference host my.cnf, needs to come first, - # see http://bugs.mysql.com/bug.php?id=31312 - use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) - - # Figure out which options we need to disable to do the setup - local helpfile="${TMPDIR}/mysqld-help" - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null - - local opt optexp optfull - for opt in host-cache name-resolve networking slave-start \ - federated ssl log-bin relay-log slow-query-log external-locking \ - log-slave-updates \ - ; do - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" - egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) - done - - # Prepare timezones, see - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - local tz_sql="${SETUP_TMPDIR}/tz.sql" - - echo "USE mysql;" >"${tz_sql}" - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null - if [[ $? -ne 0 ]] ; then - die "mysql_tzinfo_to_sql failed!" - fi - - local cmd=( - "${mysql_install_db_binary}" - "${mysqld_options[@]}" - "--init-file='${tz_sql}'" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - "--log-error='${mysql_install_log}'" - "--rpm" - "--cross-bootstrap" - "--skip-test-db" - "--user=${MYSQL_USER}" - ) - - einfo "Initializing ${PN} data directory: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 - - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 - die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" - fi - - local x=${RANDOM} - local socket="${PID_DIR}/mysqld.${x}.sock" - [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" - local pidfile="${PID_DIR}/mysqld.${x}.pid" - [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" - unset x - - cmd=( - "${mysqld_binary}" - "${mysqld_options[@]}" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - --max_allowed_packet=8M - --net_buffer_length=16K - "--socket='${socket}'" - "--pid-file='${pidfile}'" - "--log-error='${mysqld_logfile}'" - "--user=${MYSQL_USER}" - ) - - einfo "Starting mysqld to finalize initialization: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & - - echo -n "Waiting for mysqld to accept connections " - local maxtry=15 - while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - if [[ -S "${socket}" ]] ; then - # Even with a socket we don't know if mysqld will abort - # start due to an error so just wait a little bit more... - maxtry=5 - while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - fi - - echo - - if [[ ! -S "${socket}" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 - die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" - fi - - local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" - touch "${mysql_logfile}" || die - - ebegin "Setting root password" - # Do this from memory, as we don't want clear text passwords in temp files - local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" - cmd=( - "${mysql_binary}" - --no-defaults - "--socket='${socket}'" - -hlocalhost - "-e \"${sql}\"" - ) - eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 - local rc=$? - eend ${rc} - - if [[ ${rc} -ne 0 ]] ; then - # Poor man's solution which tries to avoid having password - # in log. NOTE: sed can fail if user didn't follow advice - # and included character which will require escaping... - sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null - - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" - die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" - fi - - # Stop the server - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - echo -n "Stopping the server " - pkill -F "${pidfile}" &>/dev/null - - maxtry=10 - while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - echo - - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - # We somehow failed to stop server. - # However, not a fatal error. Just warn the user. - ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" - fi - fi - - rm -r "${SETUP_TMPDIR}" || die - - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" -} diff --git a/dev-db/mariadb/mariadb-10.3.28-r3.ebuild b/dev-db/mariadb/mariadb-10.3.28-r3.ebuild new file mode 100644 index 000000000000..b9722ab6f774 --- /dev/null +++ b/dev-db/mariadb/mariadb-10.3.28-r3.ebuild @@ -0,0 +1,1279 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +SUBSLOT="18" + +JAVA_PKG_OPT_USE="jdbc" + +inherit eutils systemd flag-o-matic prefix toolchain-funcs \ + multiprocessing java-pkg-opt-2 cmake + +# Patch version +PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.3.28-patches-03.tar.xz" + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz + ${PATCH_SET}" + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2 LGPL-2.1+" +SLOT="10.3/${SUBSLOT:-0}" +IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4 + innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga + numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx + sst-rsync sst-mariabackup static systemd systemtap tcmalloc + test tokudb xml yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" + +REQUIRED_USE="jdbc? ( extraengine server !static ) + server? ( tokudb? ( jemalloc !tcmalloc ) ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + jemalloc? ( dev-libs/jemalloc:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + >=sys-libs/zlib-1.2.3:0= + kerberos? ( virtual/krb5 ) + yassl? ( net-libs/gnutls:0= ) + !yassl? ( + !libressl? ( >=dev-libs/openssl-1.0.0:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + sys-libs/ncurses:0= + !bindist? ( + sys-libs/binutils-libs:0= + >=sys-libs/readline-4.1:0= + ) + server? ( + backup? ( app-arch/libarchive:0= ) + cracklib? ( sys-libs/cracklib:0= ) + extraengine? ( + odbc? ( dev-db/unixODBC:0= ) + xml? ( dev-libs/libxml2:2= ) + ) + innodb-lz4? ( app-arch/lz4 ) + innodb-lzo? ( dev-libs/lzo ) + innodb-snappy? ( app-arch/snappy ) + mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) + numa? ( sys-process/numactl ) + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( sys-libs/pam:0= ) + systemd? ( sys-apps/systemd:= ) + tokudb? ( app-arch/snappy ) + ) + >=dev-libs/libpcre-8.41-r1:3= +" +BDEPEND="virtual/yacc + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) +" +DEPEND="static? ( sys-libs/ncurses[static-libs] ) + server? ( + extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) + test? ( acct-group/mysql acct-user/mysql ) + ) + ${COMMON_DEPEND}" +RDEPEND="selinux? ( sec-policy/selinux-mysql ) + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + !dev-db/mariadb:0 + !dev-db/mariadb:5.5 + !dev-db/mariadb:10.1 + !dev-db/mariadb:10.2 + !dev-db/mariadb:10.4 + !dev-db/mariadb:10.5 + !=virtual/jre-1.6 ) ) + ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1) + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + if has test ${FEATURES} ; then + # Bug #213475 - MySQL _will_ object strenuously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if ! has userpriv ${FEATURES} ; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + fi + fi + + java-pkg-opt-2_pkg_setup +} + +src_unpack() { + unpack ${A} + + mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die +} + +src_prepare() { + eapply "${WORKDIR}"/mariadb-patches + + eapply_user + + _disable_plugin() { + echo > "${S}/plugin/${1}/CMakeLists.txt" || die + } + _disable_engine() { + echo > "${S}/storage/${1}/CMakeLists.txt" || die + } + + if use jemalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" + elif use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die + + local plugin + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info + locale_info qc_info server_audit sql_errlog auth_ed25519 ) + local test_plugins=( audit_null auth_examples daemon_example fulltext + debug_key_management example_key_management versioning ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + _disable_engine test_sql_discovery + fi + + _disable_engine example + + if ! use oqgraph ; then # avoids extra library checks + _disable_engine oqgraph + fi + + if use mroonga ; then + # Remove the bundled groonga + # There is no CMake flag, it simply checks for existance + rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" + else + _disable_engine mroonga + fi + + # Fix galera_recovery.sh script + sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ + scripts/galera_recovery.sh || die + + cmake_src_prepare + java-pkg-opt-2_src_prepare +} + +src_configure() { + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" + -DSYSCONFDIR="${EPREFIX}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=bin + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" + -DWITH_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_LIBEDIT=0 + -DWITH_ZLIB=system + -DWITHOUT_LIBWRAP=1 + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DWITH_DEFAULT_COMPILER_OPTIONS=0 + -DWITH_DEFAULT_FEATURE_SET=0 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) + -DCONC_WITH_EXTERNAL_ZLIB=YES + -DWITH_EXTERNAL_ZLIB=YES + -DSUFFIX_INSTALL_DIR="" + -DWITH_UNITTEST=OFF + -DWITHOUT_CLIENTLIBS=YES + -DCLIENT_PLUGIN_DIALOG=OFF + -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF + -DCLIENT_PLUGIN_CLIENT_ED25519=OFF + -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC + -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF + ) + if use test ; then + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) + else + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) + fi + + if ! use yassl ; then + mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) + else + mycmakeargs+=( -DWITH_SSL=bundled ) + fi + + # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION + mycmakeargs+=( + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + ) + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO ) + fi + + mycmakeargs+=( + -DWITH_PCRE=system + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) + -DPLUGIN_SPHINX=$(usex sphinx YES NO) + -DPLUGIN_TOKUDB=$(usex tokudb YES NO) + -DPLUGIN_AUTH_PAM=$(usex pam YES NO) + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) + -DPLUGIN_SPIDER=$(usex extraengine YES NO) + -DPLUGIN_CONNECT=$(usex extraengine YES NO) + -DCONNECT_WITH_MYSQL=1 + -DCONNECT_WITH_LIBXML2=$(usex xml) + -DCONNECT_WITH_ODBC=$(usex odbc) + -DCONNECT_WITH_JDBC=$(usex jdbc) + # Build failure and autodep wrt bug 639144 + -DCONNECT_WITH_MONGO=OFF + -DWITH_WSREP=$(usex galera) + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DWITH_MARIABACKUP=$(usex backup ON OFF) + -DWITH_LIBARCHIVE=$(usex backup ON OFF) + -DINSTALL_SQLBENCHDIR="" + -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) + # systemd is only linked to for server notification + -DWITH_SYSTEMD=$(usex systemd yes no) + -DWITH_NUMA=$(usex numa ON OFF) + ) + + # Workaround for MDEV-14524 + use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) + + if use test ; then + # This is needed for the new client lib which tests a real, open server + mycmakeargs+=( -DSKIP_TESTS=ON ) + fi + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DMYSQL_USER=mysql + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_DEBUG=$(usex debug) + -DWITH_EMBEDDED_SERVER=OFF + -DWITH_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DWITH_EMBEDDED_SERVER=OFF + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + -DWITH_SYSTEMD=no + ) + fi + + cmake_src_configure +} + +src_compile() { + cmake_src_compile +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + _disable_test() { + local rawtestname bug reason + rawtestname="${1}" ; shift + bug="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" + echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) + cmake_src_test + retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + + if [[ -z "${MTR_PARALLEL}" ]] ; then + local -x MTR_PARALLEL=$(makeopts_jobs) + + if [[ ${MTR_PARALLEL} -gt 4 ]] ; then + # Running multiple tests in parallel usually require higher ulimit + # and fs.aio-max-nr setting. In addition, tests like main.multi_update + # are known to hit timeout when system is busy. + # To avoid test failure we will limit MTR_PARALLEL to 4 instead of + # using "auto". + local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" + info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" + einfo "${info_msg}" + unset info_msg + MTR_PARALLEL=4 + fi + else + einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" + fi + + # Try to increase file limits to increase test coverage + if ! ulimit -n 16500 1>/dev/null 2>&1 ; then + # Upper limit comes from parts.partition_* tests + ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." + + if ! ulimit -n 4162 1>/dev/null 2>&1 ; then + # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' + ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." + + if ! ulimit -n 3000 1>/dev/null 2>&1 ; then + ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." + else + einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 16500 (best test coverage)." + fi + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die + + local -a disabled_tests + disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) + disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) + disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) + disabled_tests+=( "main.grant;0;Sporadically failing test" ) + disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) + disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) + disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) + disabled_tests+=( "mariabackup.*;0;Broken test suite" ) + disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) + disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) + disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) + disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) + + if ! use latin1 ; then + disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) + disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) + disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) + disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) + fi + + local test_infos_str test_infos_arr + for test_infos_str in "${disabled_tests[@]}" ; do + IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" + + if [[ ${#test_infos_arr[@]} != 3 ]] ; then + die "Invalid test data set, not matching format: ${test_infos_str}" + fi + + _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" + done + unset test_infos_str test_infos_arr + + # run mysql-test tests + pushd "${TESTDIR}" &>/dev/null || die + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd &>/dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +src_install() { + cmake_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED}/usr/data" ]] ; then + rm -Rf "${ED}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" + cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + doins "${TMPDIR}/50-distro-client.cnf" + + if use server ; then + mycnf_src="my.cnf.distro-server" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/${mycnf_src}" \ + > "${TMPDIR}/my.cnf.ok" || die + if use prefix ; then + sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ + "${TMPDIR}/my.cnf.ok" || die + fi + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + fi + + # Remove bundled mytop in favor of dev-db/mytop + local mytop_file + for mytop_file in \ + "${ED}/usr/bin/mytop" \ + "${ED}/usr/share/man/man1/mytop.1" \ + ; do + if [[ -e "${mytop_file}" ]] ; then + rm -v "${mytop_file}" || die + fi + done + + # Fix a dangling symlink when galera is not built + if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then + rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die + fi + + # Remove broken SST scripts that are incompatible + local scriptremove + for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do + if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then + rm "${ED}/usr/bin/${scriptremove}" || die + fi + done +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst + + # Here we need to see if the implementation switched client libraries + # We check if this is a new instance of the package and a client library already exists + local SHOW_ABI_MESSAGE libpath + if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}/usr/$(get_libdir)/libmysqlclient.so" ]] ; then + libpath=$(readlink "${EROOT}/usr/$(get_libdir)/libmysqlclient.so") + elog "Due to ABI changes when switching between different client libraries," + elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient." + elog "Please run: revdep-rebuild --library ${libpath}" + ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries" + fi +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + if use galera ; then + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + fi + fi + + # Note about configuration change + einfo + elog "This version of mariadb reorganizes the configuration from a single my.cnf" + elog "to several files in /etc/mysql/${PN}.d." + elog "Please backup any changes you made to /etc/mysql/my.cnf" + elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." + elog "You may have as many files as needed and they are read alphabetically." + elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." + einfo +} + +pkg_config() { + _getoptval() { + local section="${1}" + local flag="--${2}=" + local extra_options="${3}" + local cmd=( + "${my_print_defaults_binary}" + "${extra_options}" + "${section}" + ) + local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) + + if [[ ${#results[@]} -gt 0 ]] ; then + # When option is set multiple times only return last value + echo "${results[-1]}" + fi + } + + _mktemp_dry() { + # emktemp has no --dry-run option + local template="${1}" + + if [[ -z "${template}" ]] ; then + if [[ -z "${T}" ]] ; then + template="/tmp/XXXXXXX" + else + template="${T}/XXXXXXX" + fi + fi + + local template_wo_X=${template//X/} + local n_X + let n_X=${#template}-${#template_wo_X} + if [[ ${n_X} -lt 3 ]] ; then + echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 + return + fi + + local attempts=0 + local character tmpfile + while [[ true ]] ; do + let attempts=attempts+1 + + new_file= + while read -n1 character ; do + if [[ "${character}" == "X" ]] ; then + tmpfile+="${RANDOM:0:1}" + else + tmpfile+="${character}" + fi + done < <(echo -n "${template}") + + if [[ ! -f "${tmpfile}" ]] + then + echo "${tmpfile}" + return + fi + + if [[ ${attempts} -ge 100 ]] ; then + echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 + return + fi + done + } + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" + if [[ ! -x "${mysql_install_db_binary}" ]] ; then + die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + + # my_print_defaults needs to read stuff in $HOME/.my.cnf + local -x HOME="${EROOT}/root" + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Read currently set data directory + MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ -z "${MY_DATADIR}" ]] ; then + die "Sorry, unable to find MY_DATADIR!" + elif [[ -d "${MY_DATADIR}/mysql" ]] ; then + ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" + ewarn "Please rename or delete its content if you wish to initialize a new data directory." + die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" + fi + + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_TMPDIR=${MYSQL_TMPDIR%/} + # These are dir+prefix + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + + # Create missing directories. + # Always check if mysql user can write to directory even if we just + # created directory because a parent directory might be not + # accessible for that user. + PID_DIR="${EROOT}/run/mysqld" + if [[ ! -d "${PID_DIR}" ]] ; then + einfo "Creating ${PN} PID directory '${PID_DIR}' ..." + install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ + || die "Failed to create PID directory '${PID_DIR}'!" + fi + + local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_pid_dir_testfile}" ]] \ + && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_pid_dir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" + else + rm "${_pid_dir_testfile}" || die + unset _pid_dir_testfile + fi + + if [[ ! -d "${MY_DATADIR}" ]] ; then + einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ + || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" + fi + + local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_datadir_testfile}" ]] \ + && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_datadir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" + else + rm "${_my_datadir_testfile}" || die + unset _my_datadir_testfile + fi + + if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then + einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ + || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" + fi + + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" + [[ -z "${MYSQL_TMPDIR}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" + + mkdir "${MYSQL_TMPDIR}" || die + chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die + fi + + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then + einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ + || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" + fi + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_logbin_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_logbin_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" + else + rm "${_my_logbin_testfile}" || die + unset _my_logbin_testfile + fi + fi + + if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then + einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ + || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_relaylog_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_relaylog_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" + else + rm "${_my_relaylog_testfile}" || die + unset _my_relaylog_testfile + fi + fi + + local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) + [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" + + # Limit access + chmod 0770 "${SETUP_TMPDIR}" || die + chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die + + local mysql_install_log="${SETUP_TMPDIR}/install_db.log" + local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + + echo + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client ; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local pwd1="a" + local pwd2="b" + + echo + einfo "No password for mysql 'root' user was specified via environment" + einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" + einfo "file like '${HOME}/.my.cnf'." + einfo "To continue please provide a password for the mysql 'root' user" + einfo "now on console:" + ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x${pwd1}" != "x${pwd2}" ]] ; then + die "Passwords are not the same!" + fi + + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + + echo + fi + + local -a mysqld_options + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see http://bugs.mysql.com/bug.php?id=31312 + use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + + local opt optexp optfull + for opt in host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) + done + + # Prepare timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + local tz_sql="${SETUP_TMPDIR}/tz.sql" + + echo "USE mysql;" >"${tz_sql}" + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null + if [[ $? -ne 0 ]] ; then + die "mysql_tzinfo_to_sql failed!" + fi + + local cmd=( + "${mysql_install_db_binary}" + "${mysqld_options[@]}" + "--init-file='${tz_sql}'" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + "--log-error='${mysql_install_log}'" + "--rpm" + "--cross-bootstrap" + "--skip-test-db" + "--user=${MYSQL_USER}" + ) + + einfo "Initializing ${PN} data directory: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 + + if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 + die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" + fi + + local x=${RANDOM} + local socket="${PID_DIR}/mysqld.${x}.sock" + [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" + local pidfile="${PID_DIR}/mysqld.${x}.pid" + [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" + unset x + + cmd=( + "${mysqld_binary}" + "${mysqld_options[@]}" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + --max_allowed_packet=8M + --net_buffer_length=16K + "--socket='${socket}'" + "--pid-file='${pidfile}'" + "--log-error='${mysqld_logfile}'" + "--user=${MYSQL_USER}" + ) + + einfo "Starting mysqld to finalize initialization: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & + + echo -n "Waiting for mysqld to accept connections " + local maxtry=15 + while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + if [[ -S "${socket}" ]] ; then + # Even with a socket we don't know if mysqld will abort + # start due to an error so just wait a little bit more... + maxtry=5 + while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + fi + + echo + + if [[ ! -S "${socket}" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 + die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" + fi + + local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" + touch "${mysql_logfile}" || die + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" + cmd=( + "${mysql_binary}" + --no-defaults + "--socket='${socket}'" + -hlocalhost + "-e \"${sql}\"" + ) + eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 + local rc=$? + eend ${rc} + + if [[ ${rc} -ne 0 ]] ; then + # Poor man's solution which tries to avoid having password + # in log. NOTE: sed can fail if user didn't follow advice + # and included character which will require escaping... + sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null + + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" + die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" + fi + + # Stop the server + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + echo -n "Stopping the server " + pkill -F "${pidfile}" &>/dev/null + + maxtry=10 + while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + echo + + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + # We somehow failed to stop server. + # However, not a fatal error. Just warn the user. + ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" + fi + fi + + rm -r "${SETUP_TMPDIR}" || die + + einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" +} diff --git a/dev-db/mariadb/mariadb-10.4.18-r2.ebuild b/dev-db/mariadb/mariadb-10.4.18-r2.ebuild deleted file mode 100644 index a372d07959ca..000000000000 --- a/dev-db/mariadb/mariadb-10.4.18-r2.ebuild +++ /dev/null @@ -1,1298 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -SUBSLOT="18" - -JAVA_PKG_OPT_USE="jdbc" - -inherit eutils systemd flag-o-matic prefix toolchain-funcs \ - multiprocessing java-pkg-opt-2 cmake - -# Patch version -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.18-patches-02.tar.xz" - -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz - ${PATCH_SET}" - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" -LICENSE="GPL-2 LGPL-2.1+" -SLOT="10.4/${SUBSLOT:-0}" -IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx - sst-rsync sst-mariabackup static systemd systemtap tcmalloc - test tokudb xml yassl" - -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) - server? ( tokudb? ( jemalloc !tcmalloc ) ) - ?? ( tcmalloc jemalloc ) - static? ( yassl !pam )" - -KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" - -# Shorten the path because the socket path length must be shorter than 107 chars -# and we will run a mysql server during test phase -S="${WORKDIR}/mysql" - -# Be warned, *DEPEND are version-dependant -# These are used for both runtime and compiletime -COMMON_DEPEND=" - kernel_linux? ( - sys-process/procps:0= - dev-libs/libaio:0= - ) - >=sys-apps/sed-4 - >=sys-apps/texinfo-4.7-r1 - jemalloc? ( dev-libs/jemalloc:0= ) - tcmalloc? ( dev-util/google-perftools:0= ) - systemtap? ( >=dev-util/systemtap-1.3:0= ) - >=sys-libs/zlib-1.2.3:0= - kerberos? ( virtual/krb5 ) - yassl? ( net-libs/gnutls:0= ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - sys-libs/ncurses:0= - !bindist? ( - sys-libs/binutils-libs:0= - >=sys-libs/readline-4.1:0= - ) - server? ( - backup? ( app-arch/libarchive:0= ) - cracklib? ( sys-libs/cracklib:0= ) - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - ) - innodb-lz4? ( app-arch/lz4 ) - innodb-lzo? ( dev-libs/lzo ) - innodb-snappy? ( app-arch/snappy ) - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) - numa? ( sys-process/numactl ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( sys-libs/pam:0= ) - systemd? ( sys-apps/systemd:= ) - tokudb? ( app-arch/snappy ) - ) - >=dev-libs/libpcre-8.41-r1:3= -" -BDEPEND="virtual/yacc - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) -" -DEPEND="static? ( sys-libs/ncurses[static-libs] ) - server? ( - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) - test? ( acct-group/mysql acct-user/mysql ) - ) - ${COMMON_DEPEND}" -RDEPEND="selinux? ( sec-policy/selinux-mysql ) - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster - !dev-db/mariadb:0 - !dev-db/mariadb:5.5 - !dev-db/mariadb:10.1 - !dev-db/mariadb:10.2 - !dev-db/mariadb:10.3 - !dev-db/mariadb:10.5 - !=virtual/jre-1.6 ) ) - ) -" -# For other stuff to bring us in -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" - -mysql_init_vars() { - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="" - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//' \ - | tail -n1) - fi - fi - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="${MY_LOCALSTATEDIR}" - einfo "Using default MY_DATADIR" - fi - elog "MySQL MY_DATADIR is ${MY_DATADIR}" - - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then - if [[ -e "${MY_DATADIR}" ]] ; then - # If you get this and you're wondering about it, see bug #207636 - elog "MySQL datadir found in ${MY_DATADIR}" - elog "A new one will not be created." - PREVIOUS_DATADIR="yes" - else - PREVIOUS_DATADIR="no" - fi - export PREVIOUS_DATADIR - fi - else - if [[ ${EBUILD_PHASE} == "config" ]]; then - local new_MY_DATADIR - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then - ewarn "MySQL MY_DATADIR has changed" - ewarn "from ${MY_DATADIR}" - ewarn "to ${new_MY_DATADIR}" - MY_DATADIR="${new_MY_DATADIR}" - fi - fi - fi - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - local GCC_MAJOR_SET=$(gcc-major-version) - local GCC_MINOR_SET=$(gcc-minor-version) - - if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on - # non x86{,_64} arches - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - if has test ${FEATURES} ; then - # Bug #213475 - MySQL _will_ object strenuously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if ! has userpriv ${FEATURES} ; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - fi - fi - - java-pkg-opt-2_pkg_setup -} - -src_unpack() { - unpack ${A} - - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die -} - -src_prepare() { - eapply "${WORKDIR}"/mariadb-patches - - eapply_user - - _disable_plugin() { - echo > "${S}/plugin/${1}/CMakeLists.txt" || die - } - _disable_engine() { - echo > "${S}/storage/${1}/CMakeLists.txt" || die - } - - if use jemalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" - elif use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - # Don't build bundled xz-utils for tokudb - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die - - local plugin - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info - locale_info qc_info server_audit sql_errlog auth_ed25519 ) - local test_plugins=( audit_null auth_examples daemon_example fulltext - debug_key_management example_key_management versioning ) - if ! use server; then # These plugins are for the server - for plugin in "${server_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - fi - - if ! use test; then # These plugins are only used during testing - for plugin in "${test_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - _disable_engine test_sql_discovery - echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die - fi - - _disable_engine example - - if ! use oqgraph ; then # avoids extra library checks - _disable_engine oqgraph - fi - - if use mroonga ; then - # Remove the bundled groonga - # There is no CMake flag, it simply checks for existance - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" - else - _disable_engine mroonga - fi - - # Fix static bindings in galera replication - sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \ - "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die - sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \ - "${S}"/wsrep-lib/src/CMakeLists.txt || die - - # Fix galera_recovery.sh script - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ - scripts/galera_recovery.sh || die - - sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \ - "${S}"/scripts/mysql_install_db.sh || die - - cmake_src_prepare - java-pkg-opt-2_src_prepare -} - -src_configure() { - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - # It fails on alpha without this - use alpha && append-ldflags "-Wl,--no-relax" - - append-cxxflags -felide-constructors - - # bug #283926, with GCC4.4, this is required to get correct behavior. - append-flags -fno-strict-aliasing - - CMAKE_BUILD_TYPE="RelWithDebInfo" - - # debug hack wrt #497532 - mycmakeargs=( - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - -DINSTALL_BINDIR=bin - -DINSTALL_DOCDIR=share/doc/${PF} - -DINSTALL_DOCREADMEDIR=share/doc/${PF} - -DINSTALL_INCLUDEDIR=include/mysql - -DINSTALL_INFODIR=share/info - -DINSTALL_LIBDIR=$(get_libdir) - -DINSTALL_MANDIR=share/man - -DINSTALL_MYSQLSHAREDIR=share/mariadb - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin - -DINSTALL_SCRIPTDIR=bin - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" - -DWITH_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DWITH_DEFAULT_FEATURE_SET=0 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" - # The build forces this to be defined when cross-compiling. We pass it - # all the time for simplicity and to make sure it is actually correct. - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) - -DCONC_WITH_EXTERNAL_ZLIB=YES - -DWITH_EXTERNAL_ZLIB=YES - -DSUFFIX_INSTALL_DIR="" - -DWITH_UNITTEST=OFF - -DWITHOUT_CLIENTLIBS=YES - -DCLIENT_PLUGIN_DIALOG=OFF - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF - ) - if use test ; then - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) - else - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) - fi - - if ! use yassl ; then - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION - mycmakeargs+=( - -DWITH_READLINE=$(usex bindist 1 0) - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) - -DENABLE_DTRACE=$(usex systemtap) - ) - - if use server ; then - - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - mycmakeargs+=( - -DPLUGIN_FEDERATED=NO - -DPLUGIN_FEDERATEDX=NO ) - fi - - mycmakeargs+=( - -DWITH_PCRE=system - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) - -DPLUGIN_SPHINX=$(usex sphinx YES NO) - -DPLUGIN_TOKUDB=$(usex tokudb YES NO) - -DPLUGIN_AUTH_PAM=$(usex pam YES NO) - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) - -DPLUGIN_CASSANDRA=NO - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) - -DPLUGIN_SPIDER=$(usex extraengine YES NO) - -DPLUGIN_CONNECT=$(usex extraengine YES NO) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - # Build failure and autodep wrt bug 639144 - -DCONNECT_WITH_MONGO=OFF - -DWITH_WSREP=$(usex galera) - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DWITH_MARIABACKUP=$(usex backup ON OFF) - -DWITH_LIBARCHIVE=$(usex backup ON OFF) - -DINSTALL_SQLBENCHDIR="" - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) - # systemd is only linked to for server notification - -DWITH_SYSTEMD=$(usex systemd yes no) - -DWITH_NUMA=$(usex numa ON OFF) - ) - - # Workaround for MDEV-14524 - use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) - - if use test ; then - # This is needed for the new client lib which tests a real, open server - mycmakeargs+=( -DSKIP_TESTS=ON ) - fi - - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi - mycmakeargs+=( - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DDISABLE_SHARED=$(usex static YES NO) - -DWITH_DEBUG=$(usex debug) - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_PROFILING=$(usex profiling) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use jemalloc || use tcmalloc ; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - ) - - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_EMBEDDED_SERVER=OFF - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SYSTEMD=no - ) - fi - - cmake_src_configure -} - -src_compile() { - cmake_src_compile -} - -# Official test instructions: -# USE='extraengine perl server' \ -# FEATURES='test userpriv' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - _disable_test() { - local rawtestname bug reason - rawtestname="${1}" ; shift - bug="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" - } - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if ! use server ; then - einfo "Skipping server tests due to minimal build." - return 0 - fi - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - - # Run CTest (test-units) - cmake_src_test - retstatus_unit=$? - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - - if [[ -z "${MTR_PARALLEL}" ]] ; then - local -x MTR_PARALLEL=$(makeopts_jobs) - - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then - # Running multiple tests in parallel usually require higher ulimit - # and fs.aio-max-nr setting. In addition, tests like main.multi_update - # are known to hit timeout when system is busy. - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of - # using "auto". - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" - einfo "${info_msg}" - unset info_msg - MTR_PARALLEL=4 - fi - else - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" - fi - - # Try to increase file limits to increase test coverage - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then - # Upper limit comes from parts.partition_* tests - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." - - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." - - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." - else - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 16500 (best test coverage)." - fi - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die - - local -a disabled_tests - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) - disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) - disabled_tests+=( "mariabackup.*;0;Broken test suite" ) - disabled_tests+=( "perfschema.nesting;23458;Known to be broken" ) - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) - - if ! use latin1 ; then - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) - disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) - disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" ) - fi - - local test_infos_str test_infos_arr - for test_infos_str in "${disabled_tests[@]}" ; do - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" - - if [[ ${#test_infos_arr[@]} != 3 ]] ; then - die "Invalid test data set, not matching format: ${test_infos_str}" - fi - - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" - done - unset test_infos_str test_infos_arr - - # run mysql-test tests - pushd "${TESTDIR}" &>/dev/null || die - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" - retstatus_tests=$? - - popd &>/dev/null || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - local failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" -} - -src_install() { - cmake_src_install - - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then - rm "${ED}/usr/include/mysql/server/private/config.h" || die - fi - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "mysqlcheck" "/usr/bin/mysqlrepair" - dosym "mysqlcheck" "/usr/bin/mysqloptimize" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - if [[ -d "${ED}/usr/data" ]] ; then - rm -Rf "${ED}/usr/data" || die - fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" - fi - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - if use server ; then - mycnf_src="my.cnf.distro-server" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" || die - if use prefix ; then - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ - "${TMPDIR}/my.cnf.ok" || die - fi - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - einfo "Including support files and sample configurations" - docinto "support-files" - local script - for script in \ - "${S}"/support-files/magic - do - [[ -f "$script" ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" - done - # Manually install supporting files that conflict with other packages - # but are needed for galera and initial installation - exeinto /usr/libexec/mariadb - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" - - if use pam ; then - keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir - fi - fi - - # Remove bundled mytop in favor of dev-db/mytop - local mytop_file - for mytop_file in \ - "${ED}/usr/bin/mytop" \ - "${ED}/usr/share/man/man1/mytop.1" \ - ; do - if [[ -e "${mytop_file}" ]] ; then - rm -v "${mytop_file}" || die - fi - done - - # Fix a dangling symlink when galera is not built - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die - fi - - # Remove broken SST scripts that are incompatible - local scriptremove - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then - rm "${ED}/usr/bin/${scriptremove}" || die - fi - done -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" - - if use server ; then - if use pam; then - einfo - elog "This install includes the PAM authentication plugin." - elog "To activate and configure the PAM plugin, please read:" - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" - einfo - chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die - fi - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog "\"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - elog - elog "If you are switching server implentations, you should run the" - elog "mysql_upgrade tool." - einfo - else - einfo - elog "If you are upgrading major versions, you should run the" - elog "mysql_upgrade tool." - einfo - fi - - if use galera ; then - einfo - elog "Be sure to edit the my.cnf file to activate your cluster settings." - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" - elog "The first time the cluster is activated, you should add" - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." - elog "This option should then be removed for subsequent starts." - einfo - if [[ -n "${REPLACING_VERSIONS}" ]] ; then - local rver - for rver in ${REPLACING_VERSIONS} ; do - if ver_test "${rver}" -lt "10.4.0" ; then - ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster." - ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4" - ewarn "for more information" - fi - done - fi - fi - fi - - # Note about configuration change - einfo - elog "This version of mariadb reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/${PN}.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." - elog "You may have as many files as needed and they are read alphabetically." - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." - einfo -} - -pkg_config() { - _getoptval() { - local section="${1}" - local flag="--${2}=" - local extra_options="${3}" - local cmd=( - "${my_print_defaults_binary}" - "${extra_options}" - "${section}" - ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" - fi - } - - _mktemp_dry() { - # emktemp has no --dry-run option - local template="${1}" - - if [[ -z "${template}" ]] ; then - if [[ -z "${T}" ]] ; then - template="/tmp/XXXXXXX" - else - template="${T}/XXXXXXX" - fi - fi - - local template_wo_X=${template//X/} - local n_X - let n_X=${#template}-${#template_wo_X} - if [[ ${n_X} -lt 3 ]] ; then - echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 - return - fi - - local attempts=0 - local character tmpfile - while [[ true ]] ; do - let attempts=attempts+1 - - new_file= - while read -n1 character ; do - if [[ "${character}" == "X" ]] ; then - tmpfile+="${RANDOM:0:1}" - else - tmpfile+="${character}" - fi - done < <(echo -n "${template}") - - if [[ ! -f "${tmpfile}" ]] - then - echo "${tmpfile}" - return - fi - - if [[ ${attempts} -ge 100 ]] ; then - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 - return - fi - done - } - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" - if [[ ! -x "${mysql_install_db_binary}" ]] ; then - die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - # my_print_defaults needs to read stuff in $HOME/.my.cnf - local -x HOME="${EROOT}/root" - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Read currently set data directory - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ -z "${MY_DATADIR}" ]] ; then - die "Sorry, unable to find MY_DATADIR!" - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" - ewarn "Please rename or delete its content if you wish to initialize a new data directory." - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - fi - - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_TMPDIR=${MYSQL_TMPDIR%/} - # These are dir+prefix - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - - # Create missing directories. - # Always check if mysql user can write to directory even if we just - # created directory because a parent directory might be not - # accessible for that user. - PID_DIR="${EROOT}/run/mysqld" - if [[ ! -d "${PID_DIR}" ]] ; then - einfo "Creating ${PN} PID directory '${PID_DIR}' ..." - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ - || die "Failed to create PID directory '${PID_DIR}'!" - fi - - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_pid_dir_testfile}" ]] \ - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_pid_dir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" - else - rm "${_pid_dir_testfile}" || die - unset _pid_dir_testfile - fi - - if [[ ! -d "${MY_DATADIR}" ]] ; then - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" - fi - - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_datadir_testfile}" ]] \ - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_datadir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" - else - rm "${_my_datadir_testfile}" || die - unset _my_datadir_testfile - fi - - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" - fi - - if [[ -z "${MYSQL_TMPDIR}" ]] ; then - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" - [[ -z "${MYSQL_TMPDIR}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" - - mkdir "${MYSQL_TMPDIR}" || die - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die - fi - - # Now we need to test MYSQL_TMPDIR... - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" - fi - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_logbin_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_logbin_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" - else - rm "${_my_logbin_testfile}" || die - unset _my_logbin_testfile - fi - fi - - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_relaylog_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_relaylog_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" - else - rm "${_my_relaylog_testfile}" || die - unset _my_relaylog_testfile - fi - fi - - local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) - [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" - - # Limit access - chmod 0770 "${SETUP_TMPDIR}" || die - chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die - - local mysql_install_log="${SETUP_TMPDIR}/install_db.log" - local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" - - echo "" - einfo "Detected settings:" - einfo "==================" - einfo "MySQL User:\t\t\t\t${MYSQL_USER}" - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" - einfo "MySQL DATA directory:\t\t${MY_DATADIR}" - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" - fi - - einfo "PID DIR:\t\t\t\t${PID_DIR}" - einfo "Install db log:\t\t\t${mysql_install_log}" - einfo "Install server log:\t\t\t${mysqld_logfile}" - - echo - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local tmp_mysqld_password_source= - - for tmp_mysqld_password_source in mysql client ; do - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" - MYSQL_ROOT_PASSWORD= - continue - fi - - einfo "Found password in '${tmp_mysqld_password_source}' section!" - break - fi - done - - # Sometimes --show is required to display passwords in some implementations of my_print_defaults - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" - fi - - unset tmp_mysqld_password_source - fi - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local pwd1="a" - local pwd2="b" - - echo - einfo "No password for mysql 'root' user was specified via environment" - einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" - einfo "file like '${HOME}/.my.cnf'." - einfo "To continue please provide a password for the mysql 'root' user" - einfo "now on console:" - ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" - read -rsp " >" pwd1 ; echo - - einfo "Retype the password" - read -rsp " >" pwd2 ; echo - - if [[ "x${pwd1}" != "x${pwd2}" ]] ; then - die "Passwords are not the same!" - fi - - MYSQL_ROOT_PASSWORD="${pwd1}" - unset pwd1 pwd2 - - echo - fi - - local -a mysqld_options - - # Fix bug 446200. Don't reference host my.cnf, needs to come first, - # see http://bugs.mysql.com/bug.php?id=31312 - use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) - - # Figure out which options we need to disable to do the setup - local helpfile="${TMPDIR}/mysqld-help" - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null - - local opt optexp optfull - for opt in host-cache name-resolve networking slave-start \ - federated ssl log-bin relay-log slow-query-log external-locking \ - log-slave-updates \ - ; do - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" - egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) - done - - # Prepare timezones, see - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - local tz_sql="${SETUP_TMPDIR}/tz.sql" - - echo "USE mysql;" >"${tz_sql}" - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null - if [[ $? -ne 0 ]] ; then - die "mysql_tzinfo_to_sql failed!" - fi - - local cmd=( - "${mysql_install_db_binary}" - "${mysqld_options[@]}" - "--init-file='${tz_sql}'" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - "--log-error='${mysql_install_log}'" - "--rpm" - "--cross-bootstrap" - "--skip-test-db" - "--user=${MYSQL_USER}" - ) - - einfo "Initializing ${PN} data directory: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 - - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 - die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" - fi - - local x=${RANDOM} - local socket="${PID_DIR}/mysqld.${x}.sock" - [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" - local pidfile="${PID_DIR}/mysqld.${x}.pid" - [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" - unset x - - cmd=( - "${mysqld_binary}" - "${mysqld_options[@]}" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - --max_allowed_packet=8M - --net_buffer_length=16K - "--socket='${socket}'" - "--pid-file='${pidfile}'" - "--log-error='${mysqld_logfile}'" - "--user=${MYSQL_USER}" - ) - - einfo "Starting mysqld to finalize initialization: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & - - echo -n "Waiting for mysqld to accept connections " - local maxtry=15 - while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - if [[ -S "${socket}" ]] ; then - # Even with a socket we don't know if mysqld will abort - # start due to an error so just wait a little bit more... - maxtry=5 - while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - fi - - echo - - if [[ ! -S "${socket}" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 - die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" - fi - - local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" - touch "${mysql_logfile}" || die - - ebegin "Setting root password" - # Do this from memory, as we don't want clear text passwords in temp files - local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" - cmd=( - "${mysql_binary}" - --no-defaults - "--socket='${socket}'" - -hlocalhost - "-e \"${sql}\"" - ) - eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 - local rc=$? - eend ${rc} - - if [[ ${rc} -ne 0 ]] ; then - # Poor man's solution which tries to avoid having password - # in log. NOTE: sed can fail if user didn't follow advice - # and included character which will require escaping... - sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null - - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" - die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" - fi - - # Stop the server - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - echo -n "Stopping the server " - pkill -F "${pidfile}" &>/dev/null - - maxtry=10 - while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - echo - - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - # We somehow failed to stop server. - # However, not a fatal error. Just warn the user. - ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" - fi - fi - - rm -r "${SETUP_TMPDIR}" || die - - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" -} diff --git a/dev-db/mariadb/mariadb-10.4.18-r3.ebuild b/dev-db/mariadb/mariadb-10.4.18-r3.ebuild new file mode 100644 index 000000000000..5fad8a38238e --- /dev/null +++ b/dev-db/mariadb/mariadb-10.4.18-r3.ebuild @@ -0,0 +1,1298 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +SUBSLOT="18" + +JAVA_PKG_OPT_USE="jdbc" + +inherit eutils systemd flag-o-matic prefix toolchain-funcs \ + multiprocessing java-pkg-opt-2 cmake + +# Patch version +PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.4.18-patches-03.tar.xz" + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz + ${PATCH_SET}" + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2 LGPL-2.1+" +SLOT="10.4/${SUBSLOT:-0}" +IUSE="+backup bindist cracklib debug extraengine galera innodb-lz4 + innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga + numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx + sst-rsync sst-mariabackup static systemd systemtap tcmalloc + test tokudb xml yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" + +REQUIRED_USE="jdbc? ( extraengine server !static ) + server? ( tokudb? ( jemalloc !tcmalloc ) ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + jemalloc? ( dev-libs/jemalloc:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + >=sys-libs/zlib-1.2.3:0= + kerberos? ( virtual/krb5 ) + yassl? ( net-libs/gnutls:0= ) + !yassl? ( + !libressl? ( >=dev-libs/openssl-1.0.0:0= ) + libressl? ( dev-libs/libressl:0= ) + ) + sys-libs/ncurses:0= + !bindist? ( + sys-libs/binutils-libs:0= + >=sys-libs/readline-4.1:0= + ) + server? ( + backup? ( app-arch/libarchive:0= ) + cracklib? ( sys-libs/cracklib:0= ) + extraengine? ( + odbc? ( dev-db/unixODBC:0= ) + xml? ( dev-libs/libxml2:2= ) + ) + innodb-lz4? ( app-arch/lz4 ) + innodb-lzo? ( dev-libs/lzo ) + innodb-snappy? ( app-arch/snappy ) + mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) + numa? ( sys-process/numactl ) + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( sys-libs/pam:0= ) + systemd? ( sys-apps/systemd:= ) + tokudb? ( app-arch/snappy ) + ) + >=dev-libs/libpcre-8.41-r1:3= +" +BDEPEND="virtual/yacc + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) +" +DEPEND="static? ( sys-libs/ncurses[static-libs] ) + server? ( + extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) + test? ( acct-group/mysql acct-user/mysql ) + ) + ${COMMON_DEPEND}" +RDEPEND="selinux? ( sec-policy/selinux-mysql ) + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + !dev-db/mariadb:0 + !dev-db/mariadb:5.5 + !dev-db/mariadb:10.1 + !dev-db/mariadb:10.2 + !dev-db/mariadb:10.3 + !dev-db/mariadb:10.5 + !=virtual/jre-1.6 ) ) + ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1) + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + if has test ${FEATURES} ; then + # Bug #213475 - MySQL _will_ object strenuously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if ! has userpriv ${FEATURES} ; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + fi + fi + + java-pkg-opt-2_pkg_setup +} + +src_unpack() { + unpack ${A} + + mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die +} + +src_prepare() { + eapply "${WORKDIR}"/mariadb-patches + + eapply_user + + _disable_plugin() { + echo > "${S}/plugin/${1}/CMakeLists.txt" || die + } + _disable_engine() { + echo > "${S}/storage/${1}/CMakeLists.txt" || die + } + + if use jemalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" + elif use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" + fi + + # Don't build bundled xz-utils for tokudb + echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die + + local plugin + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info + locale_info qc_info server_audit sql_errlog auth_ed25519 ) + local test_plugins=( audit_null auth_examples daemon_example fulltext + debug_key_management example_key_management versioning ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + _disable_engine test_sql_discovery + echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die + fi + + _disable_engine example + + if ! use oqgraph ; then # avoids extra library checks + _disable_engine oqgraph + fi + + if use mroonga ; then + # Remove the bundled groonga + # There is no CMake flag, it simply checks for existance + rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" + else + _disable_engine mroonga + fi + + # Fix static bindings in galera replication + sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \ + "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die + sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \ + "${S}"/wsrep-lib/src/CMakeLists.txt || die + + # Fix galera_recovery.sh script + sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ + scripts/galera_recovery.sh || die + + sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \ + "${S}"/scripts/mysql_install_db.sh || die + + cmake_src_prepare + java-pkg-opt-2_src_prepare +} + +src_configure() { + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + # It fails on alpha without this + use alpha && append-ldflags "-Wl,--no-relax" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" + -DSYSCONFDIR="${EPREFIX}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=bin + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" + -DWITH_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_LIBEDIT=0 + -DWITH_ZLIB=system + -DWITHOUT_LIBWRAP=1 + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DWITH_DEFAULT_COMPILER_OPTIONS=0 + -DWITH_DEFAULT_FEATURE_SET=0 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) + -DCONC_WITH_EXTERNAL_ZLIB=YES + -DWITH_EXTERNAL_ZLIB=YES + -DSUFFIX_INSTALL_DIR="" + -DWITH_UNITTEST=OFF + -DWITHOUT_CLIENTLIBS=YES + -DCLIENT_PLUGIN_DIALOG=OFF + -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF + -DCLIENT_PLUGIN_CLIENT_ED25519=OFF + -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC + -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF + ) + if use test ; then + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) + else + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) + fi + + if ! use yassl ; then + mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) + else + mycmakeargs+=( -DWITH_SSL=bundled ) + fi + + # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION + mycmakeargs+=( + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + ) + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO ) + fi + + mycmakeargs+=( + -DWITH_PCRE=system + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) + -DPLUGIN_SPHINX=$(usex sphinx YES NO) + -DPLUGIN_TOKUDB=$(usex tokudb YES NO) + -DPLUGIN_AUTH_PAM=$(usex pam YES NO) + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) + -DPLUGIN_SPIDER=$(usex extraengine YES NO) + -DPLUGIN_CONNECT=$(usex extraengine YES NO) + -DCONNECT_WITH_MYSQL=1 + -DCONNECT_WITH_LIBXML2=$(usex xml) + -DCONNECT_WITH_ODBC=$(usex odbc) + -DCONNECT_WITH_JDBC=$(usex jdbc) + # Build failure and autodep wrt bug 639144 + -DCONNECT_WITH_MONGO=OFF + -DWITH_WSREP=$(usex galera) + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DWITH_MARIABACKUP=$(usex backup ON OFF) + -DWITH_LIBARCHIVE=$(usex backup ON OFF) + -DINSTALL_SQLBENCHDIR="" + -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) + # systemd is only linked to for server notification + -DWITH_SYSTEMD=$(usex systemd yes no) + -DWITH_NUMA=$(usex numa ON OFF) + ) + + # Workaround for MDEV-14524 + use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 ) + + if use test ; then + # This is needed for the new client lib which tests a real, open server + mycmakeargs+=( -DSKIP_TESTS=ON ) + fi + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DMYSQL_USER=mysql + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_DEBUG=$(usex debug) + -DWITH_EMBEDDED_SERVER=OFF + -DWITH_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DWITH_EMBEDDED_SERVER=OFF + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + -DWITH_SYSTEMD=no + ) + fi + + cmake_src_configure +} + +src_compile() { + cmake_src_compile +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + _disable_test() { + local rawtestname bug reason + rawtestname="${1}" ; shift + bug="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" + echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) + cmake_src_test + retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + + if [[ -z "${MTR_PARALLEL}" ]] ; then + local -x MTR_PARALLEL=$(makeopts_jobs) + + if [[ ${MTR_PARALLEL} -gt 4 ]] ; then + # Running multiple tests in parallel usually require higher ulimit + # and fs.aio-max-nr setting. In addition, tests like main.multi_update + # are known to hit timeout when system is busy. + # To avoid test failure we will limit MTR_PARALLEL to 4 instead of + # using "auto". + local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" + info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" + einfo "${info_msg}" + unset info_msg + MTR_PARALLEL=4 + fi + else + einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" + fi + + # Try to increase file limits to increase test coverage + if ! ulimit -n 16500 1>/dev/null 2>&1 ; then + # Upper limit comes from parts.partition_* tests + ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." + + if ! ulimit -n 4162 1>/dev/null 2>&1 ; then + # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' + ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." + + if ! ulimit -n 3000 1>/dev/null 2>&1 ; then + ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." + else + einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 16500 (best test coverage)." + fi + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die + + local -a disabled_tests + disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) + disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) + disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) + disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) + disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) + disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) + disabled_tests+=( "mariabackup.*;0;Broken test suite" ) + disabled_tests+=( "perfschema.nesting;23458;Known to be broken" ) + disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) + disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) + disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) + disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) + + if ! use latin1 ; then + disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) + disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) + disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) + disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) + disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" ) + fi + + local test_infos_str test_infos_arr + for test_infos_str in "${disabled_tests[@]}" ; do + IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" + + if [[ ${#test_infos_arr[@]} != 3 ]] ; then + die "Invalid test data set, not matching format: ${test_infos_str}" + fi + + _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" + done + unset test_infos_str test_infos_arr + + # run mysql-test tests + pushd "${TESTDIR}" &>/dev/null || die + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd &>/dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +src_install() { + cmake_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED}/usr/data" ]] ; then + rm -Rf "${ED}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" + cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + doins "${TMPDIR}/50-distro-client.cnf" + + if use server ; then + mycnf_src="my.cnf.distro-server" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/${mycnf_src}" \ + > "${TMPDIR}/my.cnf.ok" || die + if use prefix ; then + sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ + "${TMPDIR}/my.cnf.ok" || die + fi + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + + if use pam ; then + keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir + fi + fi + + # Remove bundled mytop in favor of dev-db/mytop + local mytop_file + for mytop_file in \ + "${ED}/usr/bin/mytop" \ + "${ED}/usr/share/man/man1/mytop.1" \ + ; do + if [[ -e "${mytop_file}" ]] ; then + rm -v "${mytop_file}" || die + fi + done + + # Fix a dangling symlink when galera is not built + if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then + rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die + fi + + # Remove broken SST scripts that are incompatible + local scriptremove + for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do + if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then + rm "${ED}/usr/bin/${scriptremove}" || die + fi + done +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + if use galera ; then + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + if [[ -n "${REPLACING_VERSIONS}" ]] ; then + local rver + for rver in ${REPLACING_VERSIONS} ; do + if ver_test "${rver}" -lt "10.4.0" ; then + ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster." + ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4" + ewarn "for more information" + fi + done + fi + fi + fi + + # Note about configuration change + einfo + elog "This version of mariadb reorganizes the configuration from a single my.cnf" + elog "to several files in /etc/mysql/${PN}.d." + elog "Please backup any changes you made to /etc/mysql/my.cnf" + elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." + elog "You may have as many files as needed and they are read alphabetically." + elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." + einfo +} + +pkg_config() { + _getoptval() { + local section="${1}" + local flag="--${2}=" + local extra_options="${3}" + local cmd=( + "${my_print_defaults_binary}" + "${extra_options}" + "${section}" + ) + local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) + + if [[ ${#results[@]} -gt 0 ]] ; then + # When option is set multiple times only return last value + echo "${results[-1]}" + fi + } + + _mktemp_dry() { + # emktemp has no --dry-run option + local template="${1}" + + if [[ -z "${template}" ]] ; then + if [[ -z "${T}" ]] ; then + template="/tmp/XXXXXXX" + else + template="${T}/XXXXXXX" + fi + fi + + local template_wo_X=${template//X/} + local n_X + let n_X=${#template}-${#template_wo_X} + if [[ ${n_X} -lt 3 ]] ; then + echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 + return + fi + + local attempts=0 + local character tmpfile + while [[ true ]] ; do + let attempts=attempts+1 + + new_file= + while read -n1 character ; do + if [[ "${character}" == "X" ]] ; then + tmpfile+="${RANDOM:0:1}" + else + tmpfile+="${character}" + fi + done < <(echo -n "${template}") + + if [[ ! -f "${tmpfile}" ]] + then + echo "${tmpfile}" + return + fi + + if [[ ${attempts} -ge 100 ]] ; then + echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 + return + fi + done + } + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" + if [[ ! -x "${mysql_install_db_binary}" ]] ; then + die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + + # my_print_defaults needs to read stuff in $HOME/.my.cnf + local -x HOME="${EROOT}/root" + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Read currently set data directory + MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ -z "${MY_DATADIR}" ]] ; then + die "Sorry, unable to find MY_DATADIR!" + elif [[ -d "${MY_DATADIR}/mysql" ]] ; then + ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" + ewarn "Please rename or delete its content if you wish to initialize a new data directory." + die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" + fi + + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_TMPDIR=${MYSQL_TMPDIR%/} + # These are dir+prefix + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + + # Create missing directories. + # Always check if mysql user can write to directory even if we just + # created directory because a parent directory might be not + # accessible for that user. + PID_DIR="${EROOT}/run/mysqld" + if [[ ! -d "${PID_DIR}" ]] ; then + einfo "Creating ${PN} PID directory '${PID_DIR}' ..." + install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ + || die "Failed to create PID directory '${PID_DIR}'!" + fi + + local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_pid_dir_testfile}" ]] \ + && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_pid_dir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" + else + rm "${_pid_dir_testfile}" || die + unset _pid_dir_testfile + fi + + if [[ ! -d "${MY_DATADIR}" ]] ; then + einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ + || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" + fi + + local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_datadir_testfile}" ]] \ + && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_datadir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" + else + rm "${_my_datadir_testfile}" || die + unset _my_datadir_testfile + fi + + if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then + einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ + || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" + fi + + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" + [[ -z "${MYSQL_TMPDIR}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" + + mkdir "${MYSQL_TMPDIR}" || die + chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die + fi + + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then + einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ + || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" + fi + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_logbin_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_logbin_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" + else + rm "${_my_logbin_testfile}" || die + unset _my_logbin_testfile + fi + fi + + if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then + einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ + || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_relaylog_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_relaylog_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" + else + rm "${_my_relaylog_testfile}" || die + unset _my_relaylog_testfile + fi + fi + + local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) + [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" + + # Limit access + chmod 0770 "${SETUP_TMPDIR}" || die + chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die + + local mysql_install_log="${SETUP_TMPDIR}/install_db.log" + local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + + echo + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client ; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local pwd1="a" + local pwd2="b" + + echo + einfo "No password for mysql 'root' user was specified via environment" + einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" + einfo "file like '${HOME}/.my.cnf'." + einfo "To continue please provide a password for the mysql 'root' user" + einfo "now on console:" + ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x${pwd1}" != "x${pwd2}" ]] ; then + die "Passwords are not the same!" + fi + + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + + echo + fi + + local -a mysqld_options + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see http://bugs.mysql.com/bug.php?id=31312 + use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + + local opt optexp optfull + for opt in host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) + done + + # Prepare timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + local tz_sql="${SETUP_TMPDIR}/tz.sql" + + echo "USE mysql;" >"${tz_sql}" + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null + if [[ $? -ne 0 ]] ; then + die "mysql_tzinfo_to_sql failed!" + fi + + local cmd=( + "${mysql_install_db_binary}" + "${mysqld_options[@]}" + "--init-file='${tz_sql}'" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + "--log-error='${mysql_install_log}'" + "--rpm" + "--cross-bootstrap" + "--skip-test-db" + "--user=${MYSQL_USER}" + ) + + einfo "Initializing ${PN} data directory: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 + + if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 + die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" + fi + + local x=${RANDOM} + local socket="${PID_DIR}/mysqld.${x}.sock" + [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" + local pidfile="${PID_DIR}/mysqld.${x}.pid" + [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" + unset x + + cmd=( + "${mysqld_binary}" + "${mysqld_options[@]}" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + --max_allowed_packet=8M + --net_buffer_length=16K + "--socket='${socket}'" + "--pid-file='${pidfile}'" + "--log-error='${mysqld_logfile}'" + "--user=${MYSQL_USER}" + ) + + einfo "Starting mysqld to finalize initialization: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & + + echo -n "Waiting for mysqld to accept connections " + local maxtry=15 + while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + if [[ -S "${socket}" ]] ; then + # Even with a socket we don't know if mysqld will abort + # start due to an error so just wait a little bit more... + maxtry=5 + while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + fi + + echo + + if [[ ! -S "${socket}" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 + die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" + fi + + local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" + touch "${mysql_logfile}" || die + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" + cmd=( + "${mysql_binary}" + --no-defaults + "--socket='${socket}'" + -hlocalhost + "-e \"${sql}\"" + ) + eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 + local rc=$? + eend ${rc} + + if [[ ${rc} -ne 0 ]] ; then + # Poor man's solution which tries to avoid having password + # in log. NOTE: sed can fail if user didn't follow advice + # and included character which will require escaping... + sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null + + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" + die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" + fi + + # Stop the server + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + echo -n "Stopping the server " + pkill -F "${pidfile}" &>/dev/null + + maxtry=10 + while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + echo + + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + # We somehow failed to stop server. + # However, not a fatal error. Just warn the user. + ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" + fi + fi + + rm -r "${SETUP_TMPDIR}" || die + + einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" +} diff --git a/dev-db/mariadb/mariadb-10.5.9-r3.ebuild b/dev-db/mariadb/mariadb-10.5.9-r3.ebuild deleted file mode 100644 index 8a8a34578935..000000000000 --- a/dev-db/mariadb/mariadb-10.5.9-r3.ebuild +++ /dev/null @@ -1,1294 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -SUBSLOT="18" - -JAVA_PKG_OPT_USE="jdbc" - -inherit eutils systemd flag-o-matic prefix toolchain-funcs \ - multiprocessing java-pkg-opt-2 cmake - -# Patch version -PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.5.9-patches-03.tar.xz" - -SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz - ${PATCH_SET}" - -HOMEPAGE="https://mariadb.org/" -DESCRIPTION="An enhanced, drop-in replacement for MySQL" -LICENSE="GPL-2 LGPL-2.1+" -SLOT="10.5/${SUBSLOT:-0}" -IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4 - innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga - numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx - sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc - test xml yassl" - -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests -RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" - -REQUIRED_USE="jdbc? ( extraengine server !static ) - ?? ( tcmalloc jemalloc ) - static? ( yassl !pam )" - -KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" - -# Shorten the path because the socket path length must be shorter than 107 chars -# and we will run a mysql server during test phase -S="${WORKDIR}/mysql" - -# Be warned, *DEPEND are version-dependant -# These are used for both runtime and compiletime -COMMON_DEPEND=" - >=dev-libs/libpcre2-10.34:= - >=sys-apps/sed-4 - >=sys-apps/texinfo-4.7-r1 - sys-libs/ncurses:0= - >=sys-libs/zlib-1.2.3:0= - !bindist? ( - sys-libs/binutils-libs:0= - >=sys-libs/readline-4.1:0= - ) - jemalloc? ( dev-libs/jemalloc:0= ) - kerberos? ( virtual/krb5 ) - kernel_linux? ( - sys-process/procps:0= - dev-libs/libaio:0= - ) - server? ( - app-arch/bzip2 - app-arch/xz-utils - backup? ( app-arch/libarchive:0= ) - columnstore? ( - app-arch/snappy - dev-libs/boost:0= - dev-libs/libxml2:2= - ) - cracklib? ( sys-libs/cracklib:0= ) - extraengine? ( - odbc? ( dev-db/unixODBC:0= ) - xml? ( dev-libs/libxml2:2= ) - ) - innodb-lz4? ( app-arch/lz4 ) - innodb-lzo? ( dev-libs/lzo ) - innodb-snappy? ( app-arch/snappy ) - mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) - numa? ( sys-process/numactl ) - oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) - pam? ( sys-libs/pam:0= ) - s3? ( net-misc/curl ) - systemd? ( sys-apps/systemd:= ) - ) - systemtap? ( >=dev-util/systemtap-1.3:0= ) - tcmalloc? ( dev-util/google-perftools:0= ) - yassl? ( net-libs/gnutls:0= ) - !yassl? ( - !libressl? ( >=dev-libs/openssl-1.0.0:0= ) - libressl? ( dev-libs/libressl:0= ) - ) -" -BDEPEND="virtual/yacc - || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) -" -DEPEND="${COMMON_DEPEND} - server? ( - extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) - test? ( acct-group/mysql acct-user/mysql ) - ) - static? ( sys-libs/ncurses[static-libs] ) -" -RDEPEND="${COMMON_DEPEND} - !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster - !dev-db/mariadb:0 - !dev-db/mariadb:5.5 - !dev-db/mariadb:10.1 - !dev-db/mariadb:10.2 - !dev-db/mariadb:10.3 - !dev-db/mariadb:10.4 - !=virtual/jre-1.6 ) ) - galera? ( - sys-apps/iproute2 - =sys-cluster/galera-26* - sst-rsync? ( sys-process/lsof ) - sst-mariabackup? ( net-misc/socat[ssl] ) - ) - !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql ) - ) -" -# For other stuff to bring us in -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" - -mysql_init_vars() { - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} - - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="" - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then - MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//' \ - | tail -n1) - fi - fi - if [[ -z "${MY_DATADIR}" ]] ; then - MY_DATADIR="${MY_LOCALSTATEDIR}" - einfo "Using default MY_DATADIR" - fi - elog "MySQL MY_DATADIR is ${MY_DATADIR}" - - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then - if [[ -e "${MY_DATADIR}" ]] ; then - # If you get this and you're wondering about it, see bug #207636 - elog "MySQL datadir found in ${MY_DATADIR}" - elog "A new one will not be created." - PREVIOUS_DATADIR="yes" - else - PREVIOUS_DATADIR="no" - fi - export PREVIOUS_DATADIR - fi - else - if [[ ${EBUILD_PHASE} == "config" ]]; then - local new_MY_DATADIR - new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ - | sed -ne '/datadir/s|^--datadir=||p' \ - | tail -n1) - - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then - ewarn "MySQL MY_DATADIR has changed" - ewarn "from ${MY_DATADIR}" - ewarn "to ${new_MY_DATADIR}" - MY_DATADIR="${new_MY_DATADIR}" - fi - fi - fi - - export MY_SHAREDSTATEDIR MY_SYSCONFDIR - export MY_LOCALSTATEDIR MY_LOGDIR - export MY_DATADIR -} - -pkg_setup() { - if [[ ${MERGE_TYPE} != binary ]] ; then - local GCC_MAJOR_SET=$(gcc-major-version) - local GCC_MINOR_SET=$(gcc-minor-version) - - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on - # non x86{,_64} arches - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then - eerror "${PN} needs to be built with gcc-4.7 or later." - eerror "Please use gcc-config to switch to gcc-4.7 or later version." - die - fi - - if has test ${FEATURES} ; then - # Bug #213475 - MySQL _will_ object strenuously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if ! has userpriv ${FEATURES} ; then - die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." - fi - fi - fi - - java-pkg-opt-2_pkg_setup -} - -src_unpack() { - unpack ${A} - - mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die -} - -src_prepare() { - eapply "${WORKDIR}"/mariadb-patches - - eapply_user - - _disable_plugin() { - echo > "${S}/plugin/${1}/CMakeLists.txt" || die - } - _disable_engine() { - echo > "${S}/storage/${1}/CMakeLists.txt" || die - } - - if use jemalloc; then - echo "TARGET_LINK_LIBRARIES(mariadbd jemalloc)" >> "${S}/sql/CMakeLists.txt" - elif use tcmalloc; then - echo "TARGET_LINK_LIBRARIES(mariadbd tcmalloc)" >> "${S}/sql/CMakeLists.txt" - fi - - local plugin - local server_plugins=( handler_socket auth_socket feedback metadata_lock_info - locale_info qc_info server_audit sql_errlog auth_ed25519 ) - local test_plugins=( audit_null auth_examples daemon_example fulltext - debug_key_management example_key_management versioning ) - if ! use server; then # These plugins are for the server - for plugin in "${server_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - fi - - if ! use test; then # These plugins are only used during testing - for plugin in "${test_plugins[@]}" ; do - _disable_plugin "${plugin}" - done - _disable_engine test_sql_discovery - echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die - fi - - _disable_engine example - - if ! use oqgraph ; then # avoids extra library checks - _disable_engine oqgraph - fi - - if use mroonga ; then - # Remove the bundled groonga - # There is no CMake flag, it simply checks for existance - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" - else - _disable_engine mroonga - fi - - # Fix static bindings in galera replication - sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \ - "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die - sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \ - "${S}"/wsrep-lib/src/CMakeLists.txt || die - - # Fix galera_recovery.sh script - sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ - scripts/galera_recovery.sh || die - - sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \ - "${S}"/scripts/mysql_install_db.sh || die - - cmake_src_prepare - java-pkg-opt-2_src_prepare -} - -src_configure() { - # bug 508724 mariadb cannot use ld.gold - tc-ld-disable-gold - # Bug #114895, bug #110149 - filter-flags "-O" "-O[01]" - - # It fails on alpha without this - use alpha && append-ldflags "-Wl,--no-relax" - - append-cxxflags -felide-constructors - - # bug #283926, with GCC4.4, this is required to get correct behavior. - append-flags -fno-strict-aliasing - - CMAKE_BUILD_TYPE="RelWithDebInfo" - - # debug hack wrt #497532 - mycmakeargs=( - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" - -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" - -DSYSCONFDIR="${EPREFIX}/etc/mysql" - -DINSTALL_BINDIR=bin - -DINSTALL_DOCDIR=share/doc/${PF} - -DINSTALL_DOCREADMEDIR=share/doc/${PF} - -DINSTALL_INCLUDEDIR=include/mysql - -DINSTALL_INFODIR=share/info - -DINSTALL_LIBDIR=$(get_libdir) - -DINSTALL_MANDIR=share/man - -DINSTALL_MYSQLSHAREDIR=share/mariadb - -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin - -DINSTALL_SCRIPTDIR=bin - -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" - -DINSTALL_SBINDIR=sbin - -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" - -DWITH_COMMENT="Gentoo Linux ${PF}" - -DWITH_UNIT_TESTS=$(usex test ON OFF) - -DWITH_LIBEDIT=0 - -DWITH_ZLIB=system - -DWITHOUT_LIBWRAP=1 - -DENABLED_LOCAL_INFILE=1 - -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" - -DWITH_DEFAULT_COMPILER_OPTIONS=0 - -DWITH_DEFAULT_FEATURE_SET=0 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" - # The build forces this to be defined when cross-compiling. We pass it - # all the time for simplicity and to make sure it is actually correct. - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) - -DCONC_WITH_EXTERNAL_ZLIB=YES - -DWITH_EXTERNAL_ZLIB=YES - -DSUFFIX_INSTALL_DIR="" - -DWITH_UNITTEST=OFF - -DWITHOUT_CLIENTLIBS=YES - -DCLIENT_PLUGIN_DIALOG=OFF - -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF - -DCLIENT_PLUGIN_CLIENT_ED25519=OFF - -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC - -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF - ) - if use test ; then - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) - else - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) - fi - - if ! use yassl ; then - mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) - else - mycmakeargs+=( -DWITH_SSL=bundled ) - fi - - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION - mycmakeargs+=( - -DWITH_READLINE=$(usex bindist 1 0) - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) - -DENABLE_DTRACE=$(usex systemtap) - ) - - if use server ; then - - # Federated{,X} must be treated special otherwise they will not be built as plugins - if ! use extraengine ; then - mycmakeargs+=( - -DPLUGIN_FEDERATED=NO - -DPLUGIN_FEDERATEDX=NO - ) - fi - - mycmakeargs+=( - -DWITH_PCRE=system - -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) - -DPLUGIN_SPHINX=$(usex sphinx YES NO) - -DPLUGIN_AUTH_PAM=$(usex pam YES NO) - -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) - -DPLUGIN_CASSANDRA=NO - -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) - -DPLUGIN_SPIDER=$(usex extraengine YES NO) - -DPLUGIN_S3=$(usex s3 YES NO) - -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO) - -DPLUGIN_CONNECT=$(usex extraengine YES NO) - -DCONNECT_WITH_MYSQL=1 - -DCONNECT_WITH_LIBXML2=$(usex xml) - -DCONNECT_WITH_ODBC=$(usex odbc) - -DCONNECT_WITH_JDBC=$(usex jdbc) - # Build failure and autodep wrt bug 639144 - -DCONNECT_WITH_MONGO=OFF - -DWITH_WSREP=$(usex galera) - -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) - -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) - -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) - -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) - -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) - -DWITH_MARIABACKUP=$(usex backup ON OFF) - -DWITH_LIBARCHIVE=$(usex backup ON OFF) - -DINSTALL_SQLBENCHDIR="" - -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) - # systemd is only linked to for server notification - -DWITH_SYSTEMD=$(usex systemd yes no) - -DWITH_NUMA=$(usex numa ON OFF) - ) - - if use test ; then - # This is needed for the new client lib which tests a real, open server - mycmakeargs+=( -DSKIP_TESTS=ON ) - fi - - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." - ewarn "You MUST file bugs without these variables set." - - mycmakeargs+=( - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} - ) - - elif ! use latin1 ; then - mycmakeargs+=( - -DDEFAULT_CHARSET=utf8 - -DDEFAULT_COLLATION=utf8_general_ci - ) - else - mycmakeargs+=( - -DDEFAULT_CHARSET=latin1 - -DDEFAULT_COLLATION=latin1_swedish_ci - ) - fi - mycmakeargs+=( - -DEXTRA_CHARSETS=all - -DMYSQL_USER=mysql - -DDISABLE_SHARED=$(usex static YES NO) - -DWITH_DEBUG=$(usex debug) - -DWITH_EMBEDDED_SERVER=OFF - -DWITH_PROFILING=$(usex profiling) - ) - - if use static; then - mycmakeargs+=( -DWITH_PIC=1 ) - fi - - if use jemalloc || use tcmalloc ; then - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) - fi - - # Storage engines - mycmakeargs+=( - -DWITH_ARCHIVE_STORAGE_ENGINE=1 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1 - -DWITH_CSV_STORAGE_ENGINE=1 - -DWITH_HEAP_STORAGE_ENGINE=1 - -DWITH_INNOBASE_STORAGE_ENGINE=1 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1 - -DWITH_MYISAM_STORAGE_ENGINE=1 - -DWITH_PARTITION_STORAGE_ENGINE=1 - ) - - else - mycmakeargs+=( - -DWITHOUT_SERVER=1 - -DWITH_EMBEDDED_SERVER=OFF - -DEXTRA_CHARSETS=none - -DINSTALL_SQLBENCHDIR= - -DWITH_SYSTEMD=no - ) - fi - - cmake_src_configure -} - -src_compile() { - cmake_src_compile -} - -# Official test instructions: -# USE='extraengine perl server' \ -# FEATURES='test userpriv' \ -# ebuild mariadb-X.X.XX.ebuild \ -# digest clean package -src_test() { - _disable_test() { - local rawtestname bug reason - rawtestname="${1}" ; shift - bug="${1}" ; shift - reason="${@}" - ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" - echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" - } - - local TESTDIR="${BUILD_DIR}/mysql-test" - local retstatus_unit - local retstatus_tests - - if ! use server ; then - einfo "Skipping server tests due to minimal build." - return 0 - fi - - einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" - - # Run CTest (test-units) - cmake_src_test - retstatus_unit=$? - - # Ensure that parallel runs don't die - export MTR_BUILD_THREAD="$((${RANDOM} % 100))" - - if [[ -z "${MTR_PARALLEL}" ]] ; then - local -x MTR_PARALLEL=$(makeopts_jobs) - - if [[ ${MTR_PARALLEL} -gt 4 ]] ; then - # Running multiple tests in parallel usually require higher ulimit - # and fs.aio-max-nr setting. In addition, tests like main.multi_update - # are known to hit timeout when system is busy. - # To avoid test failure we will limit MTR_PARALLEL to 4 instead of - # using "auto". - local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" - info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" - einfo "${info_msg}" - unset info_msg - MTR_PARALLEL=4 - fi - else - einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" - fi - - # Try to increase file limits to increase test coverage - if ! ulimit -n 16500 1>/dev/null 2>&1 ; then - # Upper limit comes from parts.partition_* tests - ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." - - if ! ulimit -n 4162 1>/dev/null 2>&1 ; then - # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' - ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." - - if ! ulimit -n 3000 1>/dev/null 2>&1 ; then - ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." - else - einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." - fi - else - einfo "Will run test suite with open file limit set to 16500 (best test coverage)." - fi - - # create directories because mysqladmin might run out of order - mkdir -p "${T}"/var-tests{,/log} || die - - cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die - - local -a disabled_tests - disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) - disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) - disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) - disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) - disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) - disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) - disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" ) - disabled_tests+=( "mariabackup.*;0;Broken test suite" ) - disabled_tests+=( "perfschema.nesting;23458;Known to be broken" ) - disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) - disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) - disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) - disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) - - if ! use latin1 ; then - disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) - disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) - disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) - disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) - disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" ) - fi - - local test_infos_str test_infos_arr - for test_infos_str in "${disabled_tests[@]}" ; do - IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" - - if [[ ${#test_infos_arr[@]} != 3 ]] ; then - die "Invalid test data set, not matching format: ${test_infos_str}" - fi - - _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" - done - unset test_infos_str test_infos_arr - - # run mysql-test tests - pushd "${TESTDIR}" &>/dev/null || die - perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def" - retstatus_tests=$? - - popd &>/dev/null || die - - # Cleanup is important for these testcases. - pkill -9 -f "${S}/ndb" 2>/dev/null - pkill -9 -f "${S}/sql" 2>/dev/null - - local failures="" - [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" - [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" - - [[ -z "$failures" ]] || die "Test failures: $failures" - einfo "Tests successfully completed" -} - -src_install() { - cmake_src_install - - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used - if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then - rm "${ED}/usr/include/mysql/server/private/config.h" || die - fi - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Convenience links - einfo "Making Convenience links for mysqlcheck multi-call binary" - dosym "mysqlcheck" "/usr/bin/mysqlanalyze" - dosym "mysqlcheck" "/usr/bin/mysqlrepair" - dosym "mysqlcheck" "/usr/bin/mysqloptimize" - - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir - if [[ -d "${ED}/usr/data" ]] ; then - rm -Rf "${ED}/usr/data" || die - fi - - # Unless they explicitly specific USE=test, then do not install the - # testsuite. It DOES have a use to be installed, esp. when you want to do a - # validation of your database configuration after tuning it. - if ! use test ; then - rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" - fi - - # Configuration stuff - einfo "Building default configuration ..." - insinto "${MY_SYSCONFDIR#${EPREFIX}}" - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf - cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die - eprefixify "${TMPDIR}/my.cnf" - doins "${TMPDIR}/my.cnf" - insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" - cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die - eprefixify "${TMPDIR}/50-distro-client.cnf" - doins "${TMPDIR}/50-distro-client.cnf" - - if use server ; then - mycnf_src="my.cnf.distro-server" - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ - "${FILESDIR}/${mycnf_src}" \ - > "${TMPDIR}/my.cnf.ok" || die - if use prefix ; then - sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ - "${TMPDIR}/my.cnf.ok" || die - fi - if use latin1 ; then - sed -i \ - -e "/character-set/s|utf8|latin1|g" \ - "${TMPDIR}/my.cnf.ok" || die - fi - eprefixify "${TMPDIR}/my.cnf.ok" - newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf - - einfo "Including support files and sample configurations" - docinto "support-files" - local script - for script in \ - "${S}"/support-files/magic - do - [[ -f "$script" ]] && dodoc "${script}" - done - - docinto "scripts" - for script in "${S}"/scripts/mysql* ; do - [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" - done - # Manually install supporting files that conflict with other packages - # but are needed for galera and initial installation - exeinto /usr/libexec/mariadb - doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" - - if use pam ; then - keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir - fi - fi - - # Remove bundled mytop in favor of dev-db/mytop - local mytop_file - for mytop_file in \ - "${ED}/usr/bin/mytop" \ - "${ED}/usr/share/man/man1/mytop.1" \ - ; do - if [[ -e "${mytop_file}" ]] ; then - rm -v "${mytop_file}" || die - fi - done - - # Fix a dangling symlink when galera is not built - if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then - rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die - fi - - # Remove broken SST scripts that are incompatible - local scriptremove - for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do - if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then - rm "${ED}/usr/bin/${scriptremove}" || die - fi - done -} - -pkg_preinst() { - java-pkg-opt-2_pkg_preinst -} - -pkg_postinst() { - # Make sure the vars are correctly initialized - mysql_init_vars - - # Create log directory securely if it does not exist - [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" - - if use server ; then - if use pam; then - einfo - elog "This install includes the PAM authentication plugin." - elog "To activate and configure the PAM plugin, please read:" - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" - einfo - chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die - fi - - if [[ -z "${REPLACING_VERSIONS}" ]] ; then - einfo - elog "You might want to run:" - elog "\"emerge --config =${CATEGORY}/${PF}\"" - elog "if this is a new install." - elog - elog "If you are switching server implentations, you should run the" - elog "mysql_upgrade tool." - einfo - else - einfo - elog "If you are upgrading major versions, you should run the" - elog "mysql_upgrade tool." - einfo - fi - - if use galera ; then - einfo - elog "Be sure to edit the my.cnf file to activate your cluster settings." - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" - elog "The first time the cluster is activated, you should add" - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." - elog "This option should then be removed for subsequent starts." - einfo - if [[ -n "${REPLACING_VERSIONS}" ]] ; then - local rver - for rver in ${REPLACING_VERSIONS} ; do - if ver_test "${rver}" -lt "10.4.0" ; then - ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster." - ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4" - ewarn "for more information" - fi - done - fi - fi - fi - - # Note about configuration change - einfo - elog "This version of mariadb reorganizes the configuration from a single my.cnf" - elog "to several files in /etc/mysql/${PN}.d." - elog "Please backup any changes you made to /etc/mysql/my.cnf" - elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." - elog "You may have as many files as needed and they are read alphabetically." - elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." - einfo -} - -pkg_config() { - _getoptval() { - local section="${1}" - local flag="--${2}=" - local extra_options="${3}" - local cmd=( - "${my_print_defaults_binary}" - "${extra_options}" - "${section}" - ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" - fi - } - - _mktemp_dry() { - # emktemp has no --dry-run option - local template="${1}" - - if [[ -z "${template}" ]] ; then - if [[ -z "${T}" ]] ; then - template="/tmp/XXXXXXX" - else - template="${T}/XXXXXXX" - fi - fi - - local template_wo_X=${template//X/} - local n_X - let n_X=${#template}-${#template_wo_X} - if [[ ${n_X} -lt 3 ]] ; then - echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 - return - fi - - local attempts=0 - local character tmpfile - while [[ true ]] ; do - let attempts=attempts+1 - - new_file= - while read -n1 character ; do - if [[ "${character}" == "X" ]] ; then - tmpfile+="${RANDOM:0:1}" - else - tmpfile+="${character}" - fi - done < <(echo -n "${template}") - - if [[ ! -f "${tmpfile}" ]] - then - echo "${tmpfile}" - return - fi - - if [[ ${attempts} -ge 100 ]] ; then - echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 - return - fi - done - } - - local mysql_binary="${EROOT}/usr/bin/mysql" - if [[ ! -x "${mysql_binary}" ]] ; then - die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysqld_binary="${EROOT}/usr/sbin/mysqld" - if [[ ! -x "${mysqld_binary}" ]] ; then - die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" - if [[ ! -x "${mysql_install_db_binary}" ]] ; then - die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" - fi - - local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" - if [[ ! -x "${my_print_defaults_binary}" ]] ; then - die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" - fi - - if [[ -z "${MYSQL_USER}" ]] ; then - MYSQL_USER=mysql - if use prefix ; then - MYSQL_USER=$(id -u -n 2>/dev/null) - if [[ -z "${MYSQL_USER}" ]] ; then - die "Failed to determine current username!" - fi - fi - fi - - if [[ -z "${MYSQL_GROUP}" ]] ; then - MYSQL_GROUP=mysql - if use prefix ; then - MYSQL_GROUP=$(id -g -n 2>/dev/null) - if [[ -z "${MYSQL_GROUP}" ]] ; then - die "Failed to determine current user groupname!" - fi - fi - fi - - # my_print_defaults needs to read stuff in $HOME/.my.cnf - local -x HOME="${EROOT}/root" - - # Make sure the vars are correctly initialized - mysql_init_vars - - # Read currently set data directory - MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - - # Bug #213475 - MySQL _will_ object strenously if your machine is named - # localhost. Also causes weird failures. - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" - - if [[ -z "${MY_DATADIR}" ]] ; then - die "Sorry, unable to find MY_DATADIR!" - elif [[ -d "${MY_DATADIR}/mysql" ]] ; then - ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" - ewarn "Please rename or delete its content if you wish to initialize a new data directory." - die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" - fi - - MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_TMPDIR=${MYSQL_TMPDIR%/} - # These are dir+prefix - MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} - MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} - - # Create missing directories. - # Always check if mysql user can write to directory even if we just - # created directory because a parent directory might be not - # accessible for that user. - PID_DIR="${EROOT}/run/mysqld" - if [[ ! -d "${PID_DIR}" ]] ; then - einfo "Creating ${PN} PID directory '${PID_DIR}' ..." - install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ - || die "Failed to create PID directory '${PID_DIR}'!" - fi - - local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_pid_dir_testfile}" ]] \ - && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_pid_dir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" - else - rm "${_pid_dir_testfile}" || die - unset _pid_dir_testfile - fi - - if [[ ! -d "${MY_DATADIR}" ]] ; then - einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ - || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" - fi - - local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_datadir_testfile}" ]] \ - && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_datadir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" - else - rm "${_my_datadir_testfile}" || die - unset _my_datadir_testfile - fi - - if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then - einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ - || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" - fi - - if [[ -z "${MYSQL_TMPDIR}" ]] ; then - MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" - [[ -z "${MYSQL_TMPDIR}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" - - mkdir "${MYSQL_TMPDIR}" || die - chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die - fi - - # Now we need to test MYSQL_TMPDIR... - local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_tmpdir_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_tmpdir_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" - else - rm "${_my_tmpdir_testfile}" || die - unset _my_tmpdir_testfile - fi - - if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then - einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ - || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" - fi - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_logbin_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_logbin_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" - else - rm "${_my_logbin_testfile}" || die - unset _my_logbin_testfile - fi - fi - - if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then - einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." - install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ - || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" - [[ -z "${_my_relaylog_testfile}" ]] \ - && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" - - if use prefix ; then - touch "${_my_relaylog_testfile}" &>/dev/null - else - su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null - fi - - if [[ $? -ne 0 ]] ; then - die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" - else - rm "${_my_relaylog_testfile}" || die - unset _my_relaylog_testfile - fi - fi - - local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) - [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" - - # Limit access - chmod 0770 "${SETUP_TMPDIR}" || die - chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die - - local mysql_install_log="${SETUP_TMPDIR}/install_db.log" - local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" - - echo "" - einfo "Detected settings:" - einfo "==================" - einfo "MySQL User:\t\t\t\t${MYSQL_USER}" - einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" - einfo "MySQL DATA directory:\t\t${MY_DATADIR}" - einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" - - if [[ -n "${MYSQL_LOG_BIN}" ]] ; then - einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" - fi - - if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then - einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" - fi - - einfo "PID DIR:\t\t\t\t${PID_DIR}" - einfo "Install db log:\t\t\t${mysql_install_log}" - einfo "Install server log:\t\t\t${mysqld_logfile}" - - echo - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local tmp_mysqld_password_source= - - for tmp_mysqld_password_source in mysql client ; do - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" - MYSQL_ROOT_PASSWORD= - continue - fi - - einfo "Found password in '${tmp_mysqld_password_source}' section!" - break - fi - done - - # Sometimes --show is required to display passwords in some implementations of my_print_defaults - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then - MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" - fi - - unset tmp_mysqld_password_source - fi - - if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then - local pwd1="a" - local pwd2="b" - - echo - einfo "No password for mysql 'root' user was specified via environment" - einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" - einfo "file like '${HOME}/.my.cnf'." - einfo "To continue please provide a password for the mysql 'root' user" - einfo "now on console:" - ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" - read -rsp " >" pwd1 ; echo - - einfo "Retype the password" - read -rsp " >" pwd2 ; echo - - if [[ "x${pwd1}" != "x${pwd2}" ]] ; then - die "Passwords are not the same!" - fi - - MYSQL_ROOT_PASSWORD="${pwd1}" - unset pwd1 pwd2 - - echo - fi - - local -a mysqld_options - - # Fix bug 446200. Don't reference host my.cnf, needs to come first, - # see http://bugs.mysql.com/bug.php?id=31312 - use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) - - # Figure out which options we need to disable to do the setup - local helpfile="${TMPDIR}/mysqld-help" - "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null - - local opt optexp optfull - for opt in host-cache name-resolve networking slave-start \ - federated ssl log-bin relay-log slow-query-log external-locking \ - log-slave-updates \ - ; do - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" - egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) - done - - # Prepare timezones, see - # https://dev.mysql.com/doc/mysql/en/time-zone-support.html - local tz_sql="${SETUP_TMPDIR}/tz.sql" - - echo "USE mysql;" >"${tz_sql}" - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null - if [[ $? -ne 0 ]] ; then - die "mysql_tzinfo_to_sql failed!" - fi - - local cmd=( - "${mysql_install_db_binary}" - "${mysqld_options[@]}" - "--init-file='${tz_sql}'" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - "--log-error='${mysql_install_log}'" - "--rpm" - "--cross-bootstrap" - "--skip-test-db" - "--user=${MYSQL_USER}" - ) - - einfo "Initializing ${PN} data directory: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 - - if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 - die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" - fi - - local x=${RANDOM} - local socket="${PID_DIR}/mysqld.${x}.sock" - [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" - local pidfile="${PID_DIR}/mysqld.${x}.pid" - [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" - unset x - - cmd=( - "${mysqld_binary}" - "${mysqld_options[@]}" - "--basedir='${EROOT}/usr'" - "--datadir='${MY_DATADIR}'" - "--tmpdir='${MYSQL_TMPDIR}'" - --max_allowed_packet=8M - --net_buffer_length=16K - "--socket='${socket}'" - "--pid-file='${pidfile}'" - "--log-error='${mysqld_logfile}'" - "--user=${MYSQL_USER}" - ) - - einfo "Starting mysqld to finalize initialization: ${cmd[@]}" - eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & - - echo -n "Waiting for mysqld to accept connections " - local maxtry=15 - while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - if [[ -S "${socket}" ]] ; then - # Even with a socket we don't know if mysqld will abort - # start due to an error so just wait a little bit more... - maxtry=5 - while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - fi - - echo - - if [[ ! -S "${socket}" ]] ; then - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 - die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" - fi - - local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" - touch "${mysql_logfile}" || die - - ebegin "Setting root password" - # Do this from memory, as we don't want clear text passwords in temp files - local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" - cmd=( - "${mysql_binary}" - --no-defaults - "--socket='${socket}'" - -hlocalhost - "-e \"${sql}\"" - ) - eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 - local rc=$? - eend ${rc} - - if [[ ${rc} -ne 0 ]] ; then - # Poor man's solution which tries to avoid having password - # in log. NOTE: sed can fail if user didn't follow advice - # and included character which will require escaping... - sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null - - grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" - die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" - fi - - # Stop the server - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - echo -n "Stopping the server " - pkill -F "${pidfile}" &>/dev/null - - maxtry=10 - while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do - maxtry=$((${maxtry}-1)) - echo -n "." - sleep 1 - done - - echo - - if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then - # We somehow failed to stop server. - # However, not a fatal error. Just warn the user. - ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" - fi - fi - - rm -r "${SETUP_TMPDIR}" || die - - einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" -} diff --git a/dev-db/mariadb/mariadb-10.5.9-r4.ebuild b/dev-db/mariadb/mariadb-10.5.9-r4.ebuild new file mode 100644 index 000000000000..a5ae5e62b16f --- /dev/null +++ b/dev-db/mariadb/mariadb-10.5.9-r4.ebuild @@ -0,0 +1,1294 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +SUBSLOT="18" + +JAVA_PKG_OPT_USE="jdbc" + +inherit eutils systemd flag-o-matic prefix toolchain-funcs \ + multiprocessing java-pkg-opt-2 cmake + +# Patch version +PATCH_SET="https://dev.gentoo.org/~whissi/dist/${PN}/${PN}-10.5.9-patches-04.tar.xz" + +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz + ${PATCH_SET}" + +HOMEPAGE="https://mariadb.org/" +DESCRIPTION="An enhanced, drop-in replacement for MySQL" +LICENSE="GPL-2 LGPL-2.1+" +SLOT="10.5/${SUBSLOT:-0}" +IUSE="+backup bindist columnstore cracklib debug extraengine galera innodb-lz4 + innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga + numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx + sst-rsync sst-mariabackup static systemd systemtap s3 tcmalloc + test xml yassl" + +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests +RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )" + +REQUIRED_USE="jdbc? ( extraengine server !static ) + ?? ( tcmalloc jemalloc ) + static? ( yassl !pam )" + +KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris ~x86-solaris" + +# Shorten the path because the socket path length must be shorter than 107 chars +# and we will run a mysql server during test phase +S="${WORKDIR}/mysql" + +# Be warned, *DEPEND are version-dependant +# These are used for both runtime and compiletime +COMMON_DEPEND=" + >=dev-libs/libpcre2-10.34:= + >=sys-apps/sed-4 + >=sys-apps/texinfo-4.7-r1 + sys-libs/ncurses:0= + >=sys-libs/zlib-1.2.3:0= + !bindist? ( + sys-libs/binutils-libs:0= + >=sys-libs/readline-4.1:0= + ) + jemalloc? ( dev-libs/jemalloc:0= ) + kerberos? ( virtual/krb5 ) + kernel_linux? ( + sys-process/procps:0= + dev-libs/libaio:0= + ) + server? ( + app-arch/bzip2 + app-arch/xz-utils + backup? ( app-arch/libarchive:0= ) + columnstore? ( + app-arch/snappy + dev-libs/boost:0= + dev-libs/libxml2:2= + ) + cracklib? ( sys-libs/cracklib:0= ) + extraengine? ( + odbc? ( dev-db/unixODBC:0= ) + xml? ( dev-libs/libxml2:2= ) + ) + innodb-lz4? ( app-arch/lz4 ) + innodb-lzo? ( dev-libs/lzo ) + innodb-snappy? ( app-arch/snappy ) + mroonga? ( app-text/groonga-normalizer-mysql >=app-text/groonga-7.0.4 ) + numa? ( sys-process/numactl ) + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= ) + pam? ( sys-libs/pam:0= ) + s3? ( net-misc/curl ) + systemd? ( sys-apps/systemd:= ) + ) + systemtap? ( >=dev-util/systemtap-1.3:0= ) + tcmalloc? ( dev-util/google-perftools:0= ) + yassl? ( net-libs/gnutls:0= ) + !yassl? ( + !libressl? ( >=dev-libs/openssl-1.0.0:0= ) + libressl? ( dev-libs/libressl:0= ) + ) +" +BDEPEND="virtual/yacc + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 ) +" +DEPEND="${COMMON_DEPEND} + server? ( + extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) + test? ( acct-group/mysql acct-user/mysql ) + ) + static? ( sys-libs/ncurses[static-libs] ) +" +RDEPEND="${COMMON_DEPEND} + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster + !dev-db/mariadb:0 + !dev-db/mariadb:5.5 + !dev-db/mariadb:10.1 + !dev-db/mariadb:10.2 + !dev-db/mariadb:10.3 + !dev-db/mariadb:10.4 + !=virtual/jre-1.6 ) ) + galera? ( + sys-apps/iproute2 + =sys-cluster/galera-26* + sst-rsync? ( sys-process/lsof ) + sst-mariabackup? ( net-misc/socat[ssl] ) + ) + !prefix? ( dev-db/mysql-init-scripts acct-group/mysql acct-user/mysql ) + ) +" +# For other stuff to bring us in +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )" + +mysql_init_vars() { + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"} + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"} + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"} + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"} + + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="" + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then + MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR=$(grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ + | sed -e 's/.*=\s*//' \ + | tail -n1) + fi + fi + if [[ -z "${MY_DATADIR}" ]] ; then + MY_DATADIR="${MY_LOCALSTATEDIR}" + einfo "Using default MY_DATADIR" + fi + elog "MySQL MY_DATADIR is ${MY_DATADIR}" + + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then + if [[ -e "${MY_DATADIR}" ]] ; then + # If you get this and you're wondering about it, see bug #207636 + elog "MySQL datadir found in ${MY_DATADIR}" + elog "A new one will not be created." + PREVIOUS_DATADIR="yes" + else + PREVIOUS_DATADIR="no" + fi + export PREVIOUS_DATADIR + fi + else + if [[ ${EBUILD_PHASE} == "config" ]]; then + local new_MY_DATADIR + new_MY_DATADIR=$(my_print_defaults mysqld 2>/dev/null \ + | sed -ne '/datadir/s|^--datadir=||p' \ + | tail -n1) + + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then + ewarn "MySQL MY_DATADIR has changed" + ewarn "from ${MY_DATADIR}" + ewarn "to ${new_MY_DATADIR}" + MY_DATADIR="${new_MY_DATADIR}" + fi + fi + fi + + export MY_SHAREDSTATEDIR MY_SYSCONFDIR + export MY_LOCALSTATEDIR MY_LOGDIR + export MY_DATADIR +} + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]] ; then + local GCC_MAJOR_SET=$(gcc-major-version) + local GCC_MINOR_SET=$(gcc-minor-version) + + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on + # non x86{,_64} arches + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \ + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi + + if has test ${FEATURES} ; then + # Bug #213475 - MySQL _will_ object strenuously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if ! has userpriv ${FEATURES} ; then + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." + fi + fi + fi + + java-pkg-opt-2_pkg_setup +} + +src_unpack() { + unpack ${A} + + mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die +} + +src_prepare() { + eapply "${WORKDIR}"/mariadb-patches + + eapply_user + + _disable_plugin() { + echo > "${S}/plugin/${1}/CMakeLists.txt" || die + } + _disable_engine() { + echo > "${S}/storage/${1}/CMakeLists.txt" || die + } + + if use jemalloc; then + echo "TARGET_LINK_LIBRARIES(mariadbd jemalloc)" >> "${S}/sql/CMakeLists.txt" + elif use tcmalloc; then + echo "TARGET_LINK_LIBRARIES(mariadbd tcmalloc)" >> "${S}/sql/CMakeLists.txt" + fi + + local plugin + local server_plugins=( handler_socket auth_socket feedback metadata_lock_info + locale_info qc_info server_audit sql_errlog auth_ed25519 ) + local test_plugins=( audit_null auth_examples daemon_example fulltext + debug_key_management example_key_management versioning ) + if ! use server; then # These plugins are for the server + for plugin in "${server_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + fi + + if ! use test; then # These plugins are only used during testing + for plugin in "${test_plugins[@]}" ; do + _disable_plugin "${plugin}" + done + _disable_engine test_sql_discovery + echo > "${S}/plugin/auth_pam/testing/CMakeLists.txt" || die + fi + + _disable_engine example + + if ! use oqgraph ; then # avoids extra library checks + _disable_engine oqgraph + fi + + if use mroonga ; then + # Remove the bundled groonga + # There is no CMake flag, it simply checks for existance + rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga" + else + _disable_engine mroonga + fi + + # Fix static bindings in galera replication + sed -i -e 's~add_library(wsrep_api_v26$~add_library(wsrep_api_v26 STATIC~' \ + "${S}"/wsrep-lib/wsrep-API/CMakeLists.txt || die + sed -i -e 's~add_library(wsrep-lib$~add_library(wsrep-lib STATIC~' \ + "${S}"/wsrep-lib/src/CMakeLists.txt || die + + # Fix galera_recovery.sh script + sed -i -e "s~@bindir@/my_print_defaults~${EPREFIX}/usr/libexec/mariadb/my_print_defaults~" \ + scripts/galera_recovery.sh || die + + sed -i -e 's~ \$basedir/lib/\*/mariadb19/plugin~~' \ + "${S}"/scripts/mysql_install_db.sh || die + + cmake_src_prepare + java-pkg-opt-2_src_prepare +} + +src_configure() { + # bug 508724 mariadb cannot use ld.gold + tc-ld-disable-gold + # Bug #114895, bug #110149 + filter-flags "-O" "-O[01]" + + # It fails on alpha without this + use alpha && append-ldflags "-Wl,--no-relax" + + append-cxxflags -felide-constructors + + # bug #283926, with GCC4.4, this is required to get correct behavior. + append-flags -fno-strict-aliasing + + CMAKE_BUILD_TYPE="RelWithDebInfo" + + # debug hack wrt #497532 + mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')" + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql" + -DSYSCONFDIR="${EPREFIX}/etc/mysql" + -DINSTALL_BINDIR=bin + -DINSTALL_DOCDIR=share/doc/${PF} + -DINSTALL_DOCREADMEDIR=share/doc/${PF} + -DINSTALL_INCLUDEDIR=include/mysql + -DINSTALL_INFODIR=share/info + -DINSTALL_LIBDIR=$(get_libdir) + -DINSTALL_MANDIR=share/man + -DINSTALL_MYSQLSHAREDIR=share/mariadb + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin + -DINSTALL_SCRIPTDIR=bin + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql" + -DINSTALL_SBINDIR=sbin + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb" + -DWITH_COMMENT="Gentoo Linux ${PF}" + -DWITH_UNIT_TESTS=$(usex test ON OFF) + -DWITH_LIBEDIT=0 + -DWITH_ZLIB=system + -DWITHOUT_LIBWRAP=1 + -DENABLED_LOCAL_INFILE=1 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock" + -DWITH_DEFAULT_COMPILER_OPTIONS=0 + -DWITH_DEFAULT_FEATURE_SET=0 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)" + # The build forces this to be defined when cross-compiling. We pass it + # all the time for simplicity and to make sure it is actually correct. + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) + -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)" + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF) + -DCONC_WITH_EXTERNAL_ZLIB=YES + -DWITH_EXTERNAL_ZLIB=YES + -DSUFFIX_INSTALL_DIR="" + -DWITH_UNITTEST=OFF + -DWITHOUT_CLIENTLIBS=YES + -DCLIENT_PLUGIN_DIALOG=OFF + -DCLIENT_PLUGIN_AUTH_GSSAPI_CLIENT=OFF + -DCLIENT_PLUGIN_CLIENT_ED25519=OFF + -DCLIENT_PLUGIN_MYSQL_CLEAR_PASSWORD=STATIC + -DCLIENT_PLUGIN_CACHING_SHA2_PASSWORD=OFF + ) + if use test ; then + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test ) + else + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' ) + fi + + if ! use yassl ; then + mycmakeargs+=( -DWITH_SSL=system -DCLIENT_PLUGIN_SHA256_PASSWORD=STATIC ) + else + mycmakeargs+=( -DWITH_SSL=bundled ) + fi + + # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION + mycmakeargs+=( + -DWITH_READLINE=$(usex bindist 1 0) + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1) + -DENABLE_DTRACE=$(usex systemtap) + ) + + if use server ; then + + # Federated{,X} must be treated special otherwise they will not be built as plugins + if ! use extraengine ; then + mycmakeargs+=( + -DPLUGIN_FEDERATED=NO + -DPLUGIN_FEDERATEDX=NO + ) + fi + + mycmakeargs+=( + -DWITH_PCRE=system + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO) + -DPLUGIN_SPHINX=$(usex sphinx YES NO) + -DPLUGIN_AUTH_PAM=$(usex pam YES NO) + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO) + -DPLUGIN_CASSANDRA=NO + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO) + -DPLUGIN_SPIDER=$(usex extraengine YES NO) + -DPLUGIN_S3=$(usex s3 YES NO) + -DPLUGIN_COLUMNSTORE=$(usex columnstore YES NO) + -DPLUGIN_CONNECT=$(usex extraengine YES NO) + -DCONNECT_WITH_MYSQL=1 + -DCONNECT_WITH_LIBXML2=$(usex xml) + -DCONNECT_WITH_ODBC=$(usex odbc) + -DCONNECT_WITH_JDBC=$(usex jdbc) + # Build failure and autodep wrt bug 639144 + -DCONNECT_WITH_MONGO=OFF + -DWITH_WSREP=$(usex galera) + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF) + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF) + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF) + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO) + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO) + -DWITH_MARIABACKUP=$(usex backup ON OFF) + -DWITH_LIBARCHIVE=$(usex backup ON OFF) + -DINSTALL_SQLBENCHDIR="" + -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO) + # systemd is only linked to for server notification + -DWITH_SYSTEMD=$(usex systemd yes no) + -DWITH_NUMA=$(usex numa ON OFF) + ) + + if use test ; then + # This is needed for the new client lib which tests a real, open server + mycmakeargs+=( -DSKIP_TESTS=ON ) + fi + + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." + ewarn "You MUST file bugs without these variables set." + + mycmakeargs+=( + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} + ) + + elif ! use latin1 ; then + mycmakeargs+=( + -DDEFAULT_CHARSET=utf8 + -DDEFAULT_COLLATION=utf8_general_ci + ) + else + mycmakeargs+=( + -DDEFAULT_CHARSET=latin1 + -DDEFAULT_COLLATION=latin1_swedish_ci + ) + fi + mycmakeargs+=( + -DEXTRA_CHARSETS=all + -DMYSQL_USER=mysql + -DDISABLE_SHARED=$(usex static YES NO) + -DWITH_DEBUG=$(usex debug) + -DWITH_EMBEDDED_SERVER=OFF + -DWITH_PROFILING=$(usex profiling) + ) + + if use static; then + mycmakeargs+=( -DWITH_PIC=1 ) + fi + + if use jemalloc || use tcmalloc ; then + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF ) + fi + + # Storage engines + mycmakeargs+=( + -DWITH_ARCHIVE_STORAGE_ENGINE=1 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1 + -DWITH_CSV_STORAGE_ENGINE=1 + -DWITH_HEAP_STORAGE_ENGINE=1 + -DWITH_INNOBASE_STORAGE_ENGINE=1 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1 + -DWITH_MYISAM_STORAGE_ENGINE=1 + -DWITH_PARTITION_STORAGE_ENGINE=1 + ) + + else + mycmakeargs+=( + -DWITHOUT_SERVER=1 + -DWITH_EMBEDDED_SERVER=OFF + -DEXTRA_CHARSETS=none + -DINSTALL_SQLBENCHDIR= + -DWITH_SYSTEMD=no + ) + fi + + cmake_src_configure +} + +src_compile() { + cmake_src_compile +} + +# Official test instructions: +# USE='extraengine perl server' \ +# FEATURES='test userpriv' \ +# ebuild mariadb-X.X.XX.ebuild \ +# digest clean package +src_test() { + _disable_test() { + local rawtestname bug reason + rawtestname="${1}" ; shift + bug="${1}" ; shift + reason="${@}" + ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})" + echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def" + } + + local TESTDIR="${BUILD_DIR}/mysql-test" + local retstatus_unit + local retstatus_tests + + if ! use server ; then + einfo "Skipping server tests due to minimal build." + return 0 + fi + + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}" + + # Run CTest (test-units) + cmake_src_test + retstatus_unit=$? + + # Ensure that parallel runs don't die + export MTR_BUILD_THREAD="$((${RANDOM} % 100))" + + if [[ -z "${MTR_PARALLEL}" ]] ; then + local -x MTR_PARALLEL=$(makeopts_jobs) + + if [[ ${MTR_PARALLEL} -gt 4 ]] ; then + # Running multiple tests in parallel usually require higher ulimit + # and fs.aio-max-nr setting. In addition, tests like main.multi_update + # are known to hit timeout when system is busy. + # To avoid test failure we will limit MTR_PARALLEL to 4 instead of + # using "auto". + local info_msg="Parallel MySQL test suite jobs limited to 4 (MAKEOPTS=${MTR_PARALLEL})" + info_msg+=" to avoid test failures. Set MTR_PARALLEL if you know what you are doing!" + einfo "${info_msg}" + unset info_msg + MTR_PARALLEL=4 + fi + else + einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'" + fi + + # Try to increase file limits to increase test coverage + if ! ulimit -n 16500 1>/dev/null 2>&1 ; then + # Upper limit comes from parts.partition_* tests + ewarn "For maximum test coverage please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager." + + if ! ulimit -n 4162 1>/dev/null 2>&1 ; then + # Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)' + ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager." + + if ! ulimit -n 3000 1>/dev/null 2>&1 ; then + ewarn "For minimum test coverage please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager." + else + einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 4162 (medium test coverage)." + fi + else + einfo "Will run test suite with open file limit set to 16500 (best test coverage)." + fi + + # create directories because mysqladmin might run out of order + mkdir -p "${T}"/var-tests{,/log} || die + + cp "${S}"/mysql-test/unstable-tests "${T}/disabled.def" || die + + local -a disabled_tests + disabled_tests+=( "compat/oracle.plugin;0;Needs example plugin which Gentoo disables" ) + disabled_tests+=( "main.explain_non_select;0;Sporadically failing test" ) + disabled_tests+=( "main.func_time;0;Dependent on time test was written" ) + disabled_tests+=( "main.plugin_auth;0;Needs client libraries built" ) + disabled_tests+=( "main.stat_tables;0;Sporadically failing test" ) + disabled_tests+=( "main.stat_tables_innodb;0;Sporadically failing test" ) + disabled_tests+=( "main.upgrade_MDEV-19650;25096;Known to be broken" ) + disabled_tests+=( "mariabackup.*;0;Broken test suite" ) + disabled_tests+=( "perfschema.nesting;23458;Known to be broken" ) + disabled_tests+=( "plugins.auth_ed25519;0;Needs client libraries built" ) + disabled_tests+=( "plugins.cracklib_password_check;0;False positive due to varying policies" ) + disabled_tests+=( "plugins.two_password_validations;0;False positive due to varying policies" ) + disabled_tests+=( "roles.acl_statistics;0;False positive due to a user count mismatch caused by previous test" ) + + if ! use latin1 ; then + disabled_tests+=( "funcs_1.is_columns_mysql;0;Requires USE=latin1" ) + disabled_tests+=( "main.information_schema;0;Requires USE=latin1" ) + disabled_tests+=( "main.sp2;24177;Requires USE=latin1" ) + disabled_tests+=( "main.system_mysql_db;0;Requires USE=latin1" ) + disabled_tests+=( "main.upgrade_MDEV-19650;24178;Requires USE=latin1" ) + fi + + local test_infos_str test_infos_arr + for test_infos_str in "${disabled_tests[@]}" ; do + IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}" + + if [[ ${#test_infos_arr[@]} != 3 ]] ; then + die "Invalid test data set, not matching format: ${test_infos_str}" + fi + + _disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}" + done + unset test_infos_str test_infos_arr + + # run mysql-test tests + pushd "${TESTDIR}" &>/dev/null || die + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test-list="${T}/disabled.def" + retstatus_tests=$? + + popd &>/dev/null || die + + # Cleanup is important for these testcases. + pkill -9 -f "${S}/ndb" 2>/dev/null + pkill -9 -f "${S}/sql" 2>/dev/null + + local failures="" + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit" + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests" + + [[ -z "$failures" ]] || die "Test failures: $failures" + einfo "Tests successfully completed" +} + +src_install() { + cmake_src_install + + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used + if [[ -f "${ED}/usr/include/mysql/server/private/config.h" ]] ; then + rm "${ED}/usr/include/mysql/server/private/config.h" || die + fi + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Convenience links + einfo "Making Convenience links for mysqlcheck multi-call binary" + dosym "mysqlcheck" "/usr/bin/mysqlanalyze" + dosym "mysqlcheck" "/usr/bin/mysqlrepair" + dosym "mysqlcheck" "/usr/bin/mysqloptimize" + + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir + if [[ -d "${ED}/usr/data" ]] ; then + rm -Rf "${ED}/usr/data" || die + fi + + # Unless they explicitly specific USE=test, then do not install the + # testsuite. It DOES have a use to be installed, esp. when you want to do a + # validation of your database configuration after tuning it. + if ! use test ; then + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test" + fi + + # Configuration stuff + einfo "Building default configuration ..." + insinto "${MY_SYSCONFDIR#${EPREFIX}}" + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf + cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die + eprefixify "${TMPDIR}/my.cnf" + doins "${TMPDIR}/my.cnf" + insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d" + cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die + eprefixify "${TMPDIR}/50-distro-client.cnf" + doins "${TMPDIR}/50-distro-client.cnf" + + if use server ; then + mycnf_src="my.cnf.distro-server" + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ + "${FILESDIR}/${mycnf_src}" \ + > "${TMPDIR}/my.cnf.ok" || die + if use prefix ; then + sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \ + "${TMPDIR}/my.cnf.ok" || die + fi + if use latin1 ; then + sed -i \ + -e "/character-set/s|utf8|latin1|g" \ + "${TMPDIR}/my.cnf.ok" || die + fi + eprefixify "${TMPDIR}/my.cnf.ok" + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf + + einfo "Including support files and sample configurations" + docinto "support-files" + local script + for script in \ + "${S}"/support-files/magic + do + [[ -f "$script" ]] && dodoc "${script}" + done + + docinto "scripts" + for script in "${S}"/scripts/mysql* ; do + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}" + done + # Manually install supporting files that conflict with other packages + # but are needed for galera and initial installation + exeinto /usr/libexec/mariadb + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror" + + if use pam ; then + keepdir /usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir + fi + fi + + # Remove bundled mytop in favor of dev-db/mytop + local mytop_file + for mytop_file in \ + "${ED}/usr/bin/mytop" \ + "${ED}/usr/share/man/man1/mytop.1" \ + ; do + if [[ -e "${mytop_file}" ]] ; then + rm -v "${mytop_file}" || die + fi + done + + # Fix a dangling symlink when galera is not built + if [[ -L "${ED}/usr/bin/wsrep_sst_rsync_wan" ]] && ! use galera ; then + rm "${ED}/usr/bin/wsrep_sst_rsync_wan" || die + fi + + # Remove broken SST scripts that are incompatible + local scriptremove + for scriptremove in wsrep_sst_xtrabackup wsrep_sst_xtrabackup-v2 ; do + if [[ -e "${ED}/usr/bin/${scriptremove}" ]] ; then + rm "${ED}/usr/bin/${scriptremove}" || die + fi + done +} + +pkg_preinst() { + java-pkg-opt-2_pkg_preinst +} + +pkg_postinst() { + # Make sure the vars are correctly initialized + mysql_init_vars + + # Create log directory securely if it does not exist + [[ -d "${ROOT}/${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}/${MY_LOGDIR}" + + if use server ; then + if use pam; then + einfo + elog "This install includes the PAM authentication plugin." + elog "To activate and configure the PAM plugin, please read:" + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/" + einfo + chown mysql:mysql "${EROOT}/usr/$(get_libdir)/mariadb/plugin/auth_pam_tool_dir" || die + fi + + if [[ -z "${REPLACING_VERSIONS}" ]] ; then + einfo + elog "You might want to run:" + elog "\"emerge --config =${CATEGORY}/${PF}\"" + elog "if this is a new install." + elog + elog "If you are switching server implentations, you should run the" + elog "mysql_upgrade tool." + einfo + else + einfo + elog "If you are upgrading major versions, you should run the" + elog "mysql_upgrade tool." + einfo + fi + + if use galera ; then + einfo + elog "Be sure to edit the my.cnf file to activate your cluster settings." + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\"" + elog "The first time the cluster is activated, you should add" + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node." + elog "This option should then be removed for subsequent starts." + einfo + if [[ -n "${REPLACING_VERSIONS}" ]] ; then + local rver + for rver in ${REPLACING_VERSIONS} ; do + if ver_test "${rver}" -lt "10.4.0" ; then + ewarn "Upgrading galera from a previous version requires admin restart of the entire cluster." + ewarn "Please refer to https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-104/#galera-4" + ewarn "for more information" + fi + done + fi + fi + fi + + # Note about configuration change + einfo + elog "This version of mariadb reorganizes the configuration from a single my.cnf" + elog "to several files in /etc/mysql/${PN}.d." + elog "Please backup any changes you made to /etc/mysql/my.cnf" + elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension." + elog "You may have as many files as needed and they are read alphabetically." + elog "Be sure the options have the appropriate section headers, i.e. [mysqld]." + einfo +} + +pkg_config() { + _getoptval() { + local section="${1}" + local flag="--${2}=" + local extra_options="${3}" + local cmd=( + "${my_print_defaults_binary}" + "${extra_options}" + "${section}" + ) + local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) + + if [[ ${#results[@]} -gt 0 ]] ; then + # When option is set multiple times only return last value + echo "${results[-1]}" + fi + } + + _mktemp_dry() { + # emktemp has no --dry-run option + local template="${1}" + + if [[ -z "${template}" ]] ; then + if [[ -z "${T}" ]] ; then + template="/tmp/XXXXXXX" + else + template="${T}/XXXXXXX" + fi + fi + + local template_wo_X=${template//X/} + local n_X + let n_X=${#template}-${#template_wo_X} + if [[ ${n_X} -lt 3 ]] ; then + echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2 + return + fi + + local attempts=0 + local character tmpfile + while [[ true ]] ; do + let attempts=attempts+1 + + new_file= + while read -n1 character ; do + if [[ "${character}" == "X" ]] ; then + tmpfile+="${RANDOM:0:1}" + else + tmpfile+="${character}" + fi + done < <(echo -n "${template}") + + if [[ ! -f "${tmpfile}" ]] + then + echo "${tmpfile}" + return + fi + + if [[ ${attempts} -ge 100 ]] ; then + echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2 + return + fi + done + } + + local mysql_binary="${EROOT}/usr/bin/mysql" + if [[ ! -x "${mysql_binary}" ]] ; then + die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysqld_binary="${EROOT}/usr/sbin/mysqld" + if [[ ! -x "${mysqld_binary}" ]] ; then + die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local mysql_install_db_binary="${EROOT}/usr/bin/mysql_install_db" + if [[ ! -x "${mysql_install_db_binary}" ]] ; then + die "'${mysql_install_db_binary}' not found! Please re-install ${CATEGORY}/${PN}!" + fi + + local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults" + if [[ ! -x "${my_print_defaults_binary}" ]] ; then + die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!" + fi + + if [[ -z "${MYSQL_USER}" ]] ; then + MYSQL_USER=mysql + if use prefix ; then + MYSQL_USER=$(id -u -n 2>/dev/null) + if [[ -z "${MYSQL_USER}" ]] ; then + die "Failed to determine current username!" + fi + fi + fi + + if [[ -z "${MYSQL_GROUP}" ]] ; then + MYSQL_GROUP=mysql + if use prefix ; then + MYSQL_GROUP=$(id -g -n 2>/dev/null) + if [[ -z "${MYSQL_GROUP}" ]] ; then + die "Failed to determine current user groupname!" + fi + fi + fi + + # my_print_defaults needs to read stuff in $HOME/.my.cnf + local -x HOME="${EROOT}/root" + + # Make sure the vars are correctly initialized + mysql_init_vars + + # Read currently set data directory + MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + + # Bug #213475 - MySQL _will_ object strenously if your machine is named + # localhost. Also causes weird failures. + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost" + + if [[ -z "${MY_DATADIR}" ]] ; then + die "Sorry, unable to find MY_DATADIR!" + elif [[ -d "${MY_DATADIR}/mysql" ]] ; then + ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!" + ewarn "Please rename or delete its content if you wish to initialize a new data directory." + die "${PN} data directory at '${MY_DATADIR}' looks already initialized!" + fi + + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_TMPDIR=${MYSQL_TMPDIR%/} + # These are dir+prefix + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*} + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")" + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*} + + # Create missing directories. + # Always check if mysql user can write to directory even if we just + # created directory because a parent directory might be not + # accessible for that user. + PID_DIR="${EROOT}/run/mysqld" + if [[ ! -d "${PID_DIR}" ]] ; then + einfo "Creating ${PN} PID directory '${PID_DIR}' ..." + install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \ + || die "Failed to create PID directory '${PID_DIR}'!" + fi + + local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_pid_dir_testfile}" ]] \ + && die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_pid_dir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!" + else + rm "${_pid_dir_testfile}" || die + unset _pid_dir_testfile + fi + + if [[ ! -d "${MY_DATADIR}" ]] ; then + einfo "Creating ${PN} data directory '${MY_DATADIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \ + || die "Failed to create ${PN} data directory '${MY_DATADIR}'!" + fi + + local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_datadir_testfile}" ]] \ + && die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_datadir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!" + else + rm "${_my_datadir_testfile}" || die + unset _my_datadir_testfile + fi + + if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then + einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \ + || die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!" + fi + + if [[ -z "${MYSQL_TMPDIR}" ]] ; then + MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")" + [[ -z "${MYSQL_TMPDIR}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!" + + mkdir "${MYSQL_TMPDIR}" || die + chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die + fi + + # Now we need to test MYSQL_TMPDIR... + local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_tmpdir_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_tmpdir_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!" + else + rm "${_my_tmpdir_testfile}" || die + unset _my_tmpdir_testfile + fi + + if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then + einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \ + || die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'" + fi + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_logbin_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_logbin_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!" + else + rm "${_my_logbin_testfile}" || die + unset _my_logbin_testfile + fi + fi + + if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then + einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..." + install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \ + || die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")" + [[ -z "${_my_relaylog_testfile}" ]] \ + && die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!" + + if use prefix ; then + touch "${_my_relaylog_testfile}" &>/dev/null + else + su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null + fi + + if [[ $? -ne 0 ]] ; then + die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!" + else + rm "${_my_relaylog_testfile}" || die + unset _my_relaylog_testfile + fi + fi + + local SETUP_TMPDIR=$(mktemp -d "/tmp/${PN}-config.XXXXXXXXX" 2>/dev/null) + [[ -z "${SETUP_TMPDIR}" ]] && die "Failed to create setup tmpdir" + + # Limit access + chmod 0770 "${SETUP_TMPDIR}" || die + chown ${MYSQL_USER} "${SETUP_TMPDIR}" || die + + local mysql_install_log="${SETUP_TMPDIR}/install_db.log" + local mysqld_logfile="${SETUP_TMPDIR}/mysqld.log" + + echo "" + einfo "Detected settings:" + einfo "==================" + einfo "MySQL User:\t\t\t\t${MYSQL_USER}" + einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}" + einfo "MySQL DATA directory:\t\t${MY_DATADIR}" + einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}" + + if [[ -n "${MYSQL_LOG_BIN}" ]] ; then + einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}" + fi + + if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then + einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}" + fi + + einfo "PID DIR:\t\t\t\t${PID_DIR}" + einfo "Install db log:\t\t\t${mysql_install_log}" + einfo "Install server log:\t\t\t${mysqld_logfile}" + + echo + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local tmp_mysqld_password_source= + + for tmp_mysqld_password_source in mysql client ; do + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..." + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)" + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!" + MYSQL_ROOT_PASSWORD= + continue + fi + + einfo "Found password in '${tmp_mysqld_password_source}' section!" + break + fi + done + + # Sometimes --show is required to display passwords in some implementations of my_print_defaults + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)" + fi + + unset tmp_mysqld_password_source + fi + + if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then + local pwd1="a" + local pwd2="b" + + echo + einfo "No password for mysql 'root' user was specified via environment" + einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config" + einfo "file like '${HOME}/.my.cnf'." + einfo "To continue please provide a password for the mysql 'root' user" + einfo "now on console:" + ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!" + read -rsp " >" pwd1 ; echo + + einfo "Retype the password" + read -rsp " >" pwd2 ; echo + + if [[ "x${pwd1}" != "x${pwd2}" ]] ; then + die "Passwords are not the same!" + fi + + MYSQL_ROOT_PASSWORD="${pwd1}" + unset pwd1 pwd2 + + echo + fi + + local -a mysqld_options + + # Fix bug 446200. Don't reference host my.cnf, needs to come first, + # see http://bugs.mysql.com/bug.php?id=31312 + use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" ) + + # Figure out which options we need to disable to do the setup + local helpfile="${TMPDIR}/mysqld-help" + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null + + local opt optexp optfull + for opt in host-cache name-resolve networking slave-start \ + federated ssl log-bin relay-log slow-query-log external-locking \ + log-slave-updates \ + ; do + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" + egrep -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" ) + done + + # Prepare timezones, see + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html + local tz_sql="${SETUP_TMPDIR}/tz.sql" + + echo "USE mysql;" >"${tz_sql}" + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null + if [[ $? -ne 0 ]] ; then + die "mysql_tzinfo_to_sql failed!" + fi + + local cmd=( + "${mysql_install_db_binary}" + "${mysqld_options[@]}" + "--init-file='${tz_sql}'" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + "--log-error='${mysql_install_log}'" + "--rpm" + "--cross-bootstrap" + "--skip-test-db" + "--user=${MYSQL_USER}" + ) + + einfo "Initializing ${PN} data directory: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1 + + if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql/user.frm" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2 + die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!" + fi + + local x=${RANDOM} + local socket="${PID_DIR}/mysqld.${x}.sock" + [[ -f "${socket}" ]] && die "Randomness failed; Socket ${socket} already exists!" + local pidfile="${PID_DIR}/mysqld.${x}.pid" + [[ -f "${pidfile}" ]] && die "Randomness failed; Pidfile ${pidfile} already exists!" + unset x + + cmd=( + "${mysqld_binary}" + "${mysqld_options[@]}" + "--basedir='${EROOT}/usr'" + "--datadir='${MY_DATADIR}'" + "--tmpdir='${MYSQL_TMPDIR}'" + --max_allowed_packet=8M + --net_buffer_length=16K + "--socket='${socket}'" + "--pid-file='${pidfile}'" + "--log-error='${mysqld_logfile}'" + "--user=${MYSQL_USER}" + ) + + einfo "Starting mysqld to finalize initialization: ${cmd[@]}" + eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 & + + echo -n "Waiting for mysqld to accept connections " + local maxtry=15 + while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + if [[ -S "${socket}" ]] ; then + # Even with a socket we don't know if mysqld will abort + # start due to an error so just wait a little bit more... + maxtry=5 + while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + fi + + echo + + if [[ ! -S "${socket}" ]] ; then + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2 + die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!" + fi + + local mysql_logfile="${SETUP_TMPDIR}/set_root_pw.log" + touch "${mysql_logfile}" || die + + ebegin "Setting root password" + # Do this from memory, as we don't want clear text passwords in temp files + local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'" + cmd=( + "${mysql_binary}" + --no-defaults + "--socket='${socket}'" + -hlocalhost + "-e \"${sql}\"" + ) + eval "${cmd[@]}" >"${mysql_logfile}" 2>&1 + local rc=$? + eend ${rc} + + if [[ ${rc} -ne 0 ]] ; then + # Poor man's solution which tries to avoid having password + # in log. NOTE: sed can fail if user didn't follow advice + # and included character which will require escaping... + sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null + + grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}" + die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!" + fi + + # Stop the server + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + echo -n "Stopping the server " + pkill -F "${pidfile}" &>/dev/null + + maxtry=10 + while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do + maxtry=$((${maxtry}-1)) + echo -n "." + sleep 1 + done + + echo + + if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then + # We somehow failed to stop server. + # However, not a fatal error. Just warn the user. + ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!" + fi + fi + + rm -r "${SETUP_TMPDIR}" || die + + einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!" +} diff --git a/dev-db/mysql-connector-c/Manifest b/dev-db/mysql-connector-c/Manifest index 3b9e9b68561f..8b663637ac18 100644 --- a/dev-db/mysql-connector-c/Manifest +++ b/dev-db/mysql-connector-c/Manifest @@ -5,5 +5,5 @@ AUX mysql-connector-c-8.0.23-libressl.patch 13374 BLAKE2B 991f1e921c3f06937c682e DIST mysql-boost-8.0.22.tar.gz 285934450 BLAKE2B 1ba0c9bb9a0cb74af4842d3b746f8b690c122cfbf2c6d5201ce95e59a257427a8683dd8d5c2be31dfe9ece4761366c1287fa7b841c45db222725bf76b0639bc6 SHA512 792f2ada93ec67a4679228478c6b798e81d9e9f6d13c7f4977cb7682738a4aae3cb483294edc6b2fde16c3960e51af8786216c063ab500840afd39a609e4b612 DIST mysql-boost-8.0.23.tar.gz 291039175 BLAKE2B 3a7d3e05c774085d6078d0d3effd58d2df47521615356a2aa5efc2ea2ef8457e19ad57a054926ccff0a4752ca71d0464daa7fe9a3ac6c1b1d3bd86a9a82dfc58 SHA512 b8c2e2ac772b7b730f8b3bac7a5afb205da173b3639500606e7d1fac74832a0134027951855a2dc81af015e6158c924927ad63b9e1f2e7c823d45d4c4961c3f8 EBUILD mysql-connector-c-8.0.22.ebuild 2904 BLAKE2B b46f1757bd0d1f4ba6db5f9c029425e57f5f43b379ce121fcffffd0d6562f747b81f980bbf22cec610fdb416192b05368cd9cb45362e296d6e851de6d5ed6780 SHA512 e8de286e91c74a9cd65396d713372fa13d793a719bd702e9116370659194b001a221881051f0bc9c46f3474336e7d134177b1bd35883c09e0e0c3f3c5e0902e5 -EBUILD mysql-connector-c-8.0.23-r1.ebuild 3109 BLAKE2B 061ffdc701798e2e6b743b3fb22827a82bdf79bf69abdf458a4774f08a5afe5b861db5aee923c49ea134f652994583f0195878dba0fbd8468d65b262b09cea75 SHA512 f4890724a0a9e488f2a3d1751b331d57dfa617fb6e72f2669df7fe3f391b00313bb555203491f5a587e1eba8cba52a21e301a8e4a73b4a7f268beb9f0b56b4bf +EBUILD mysql-connector-c-8.0.23-r1.ebuild 3108 BLAKE2B 76464a96141b5a7af40f5caaa022515d2e6d3e7c66c6ed6a69bfab598f83441fa2688fd9709c7c020dbbacc676c0c030e361f865291a66eb97f8d29de42e5d74 SHA512 158deb31fa322a479ca19e331b5a04db3340a705ad777fd106f3dba0b3fef5e303e83e017fd341bcc81d5b981786e4f909e6dc2ef35d8e055563375e20bbf983 MISC metadata.xml 239 BLAKE2B c4d6706d083b72927d239f41a644a4009c054c1c1a388af7733d3a2daf47d354009eb472573304a6be272601f05535297bcd9ceaea811a741cd905577ffe53d1 SHA512 e6e2fafe2f503db1d12e3d2368a99631ee8d014b7ea802d9879e7e3e2c0f9378675fffccd78ed09b914ae781ac3902567b1a53a721906e3ea63ceb51d0a1654b diff --git a/dev-db/mysql-connector-c/mysql-connector-c-8.0.23-r1.ebuild b/dev-db/mysql-connector-c/mysql-connector-c-8.0.23-r1.ebuild index 4923fe57f0c3..9c2d649a5211 100644 --- a/dev-db/mysql-connector-c/mysql-connector-c-8.0.23-r1.ebuild +++ b/dev-db/mysql-connector-c/mysql-connector-c-8.0.23-r1.ebuild @@ -18,7 +18,7 @@ if [[ ${PV} == "9999" ]]; then inherit git-r3 else SRC_URI="https://dev.mysql.com/get/Downloads/MySQL-$(ver_cut 1-2)/mysql-boost-${PV}.tar.gz" - KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 sparc x86" + KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 s390 sparc x86" S="${WORKDIR}/mysql-${PV}" fi diff --git a/dev-db/mysql-workbench/Manifest b/dev-db/mysql-workbench/Manifest index 4dd1385bb6f2..a13ddc429761 100644 --- a/dev-db/mysql-workbench/Manifest +++ b/dev-db/mysql-workbench/Manifest @@ -3,5 +3,5 @@ AUX mysql-workbench-8.0.19-mysql-connector-8.patch 624 BLAKE2B 0cb899a8b01276644 AUX mysql-workbench-8.0.23-findlibssh.patch 633 BLAKE2B 12deef5c346773931fb0f6d37a24cc67d4d0d6079b05cacbcaefc7a8c453f2811a4ea018a5e71390739500d2801cc12889ac2b61346830eff9d348925fdbb88d SHA512 d1d2d7091fad56fb62f29a323df00ae29a7ce5e921a49eb9199363e1113da207872f8f636cba479bc15697b574e54b4cf312aa354f6c050bd1934a523175b79d DIST antlr-4.7.1-complete.jar 2240116 BLAKE2B 3acf99b3701b2092cad2fb6e91f27791cbedd82f26888d7329e481be29fce4ec644eb57f663e515b92dea46c24222d4fb090aae5cae30c57c412a38932ea72ed SHA512 de1c230d7294e05ac7b451cbc639bab9d416a674b281e21092fb4a9329ca8b6d4b92b9ad78a9771cff475a1610f1d0419819c4619bdff36c683019da67ef13b1 DIST mysql-workbench-community-8.0.23-src.tar.gz 20719770 BLAKE2B 4e1e44428a9e8a00c23f8f9f6e1519f8d13c205fac110168da67fb462d2a13204d41f1d0e109a3dde8ad2dbd3de31fee09ae4ccea97f9de04d0bc4fb2fad180e SHA512 f50d71bd196d5e5446cd14a228e52c4e74506cc2dd95d1601cc5e99b00db0d82dbcb28fd2ed404ee77ca63c6854d47c46773938e09ab601c10009c0ca99e4d54 -EBUILD mysql-workbench-8.0.23.ebuild 2784 BLAKE2B 6469603c3deda475b362530141abc3012e440c5b80a557d8f969f86737e6406822c9d8d310ec10f95b1aeccf46c1d0c45a94a4e3dbf408f300cfc07618367cef SHA512 6468bcccdbd8073474225cc3a53ca81457da7ad3930290106f792f9ce2ce83a5431b09f04e89004f2f11e79d1772ad9bd8e254c508523995a756ab203e476aaa +EBUILD mysql-workbench-8.0.23.ebuild 2787 BLAKE2B fbc8bafa406b87b30467b11e61cebf5caf381f90ae2acf1c3afaf4e15c97d51698ca85be0fa8c370c37731026b7732587e255f3fcfa51b9e9949bee6efe5268a SHA512 2fe267d734478e7aad69d0f4f26c03779d806fb88772a6f330358db285196e1b8ea1063f1d8d6fd68981bc9cb8de8a50e7794813e37d181aae609eae2e4da3e7 MISC metadata.xml 310 BLAKE2B b0d985e39bb17865a05907e5449723c2bf862d9f3ae7f8570173c9cff443171feef6694db26a51880f8c1a4b1e3834ca7ab9bc7c2057fd6f8930b9d1c1c02cdd SHA512 f284063d72f2218f8ed60a74b43f252d608865682b8c0447f52016a02a7cbf6d45a226787d893328dd31946ade1cca78ff7556896183b4422c4142a8935a2193 diff --git a/dev-db/mysql-workbench/mysql-workbench-8.0.23.ebuild b/dev-db/mysql-workbench/mysql-workbench-8.0.23.ebuild index 864c6587d674..b5fcf9ee2576 100644 --- a/dev-db/mysql-workbench/mysql-workbench-8.0.23.ebuild +++ b/dev-db/mysql-workbench/mysql-workbench-8.0.23.ebuild @@ -20,7 +20,7 @@ SRC_URI="https://cdn.mysql.com/Downloads/MySQLGUITools/${MY_P}.tar.gz LICENSE="GPL-2" SLOT="0" -KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +KEYWORDS="amd64 ~x86 ~amd64-linux ~x86-linux" IUSE="debug doc" REQUIRED_USE="${PYTHON_REQUIRED_USE}" @@ -30,7 +30,7 @@ CDEPEND="${PYTHON_DEPS} dev-libs/glib:2 dev-cpp/antlr-cpp:4 dev-cpp/atkmm:* - dev-cpp/pangomm + dev-cpp/pangomm:1.4 >=dev-cpp/glibmm-2.14:2 dev-cpp/gtkmm:3.0 dev-libs/atk diff --git a/dev-db/percona-xtrabackup/Manifest b/dev-db/percona-xtrabackup/Manifest index 15364776e6d1..0ac960d66ec8 100644 --- a/dev-db/percona-xtrabackup/Manifest +++ b/dev-db/percona-xtrabackup/Manifest @@ -10,11 +10,15 @@ DIST boost_1_73_0.tar.bz2 109247910 BLAKE2B 5995ff6ca21f45988b187b94bf743795cca9 DIST percona-xtrabackup-2.4.15.tar.gz 57357749 BLAKE2B fcc64736230636a3a5584a300229e0507f00bcd64a3d0b8e00f834b15ec757347a55a85521dd0aea939761c3a26b1ef99466ff7e633133b8088cd290bd835444 SHA512 789b6870d3ad06861126f67190717ffb31224628d1b9631ec5f39d0a41b3c66aaf2127e3ec4b38d3e8f7858a1438a74f0e89b07b9f4248b637b2ed39143ab599 DIST percona-xtrabackup-2.4.20.tar.gz 59782001 BLAKE2B 25deaa3044d89d6f884734bbaee20004d792f4b0bf86bd0d456177cd2b149c29af13900b32e29f92c04cf810b34584ec2d9a74b443be27b8c7dca54b330ced99 SHA512 bac5d276bb78209eacc34ea9950dc128a636c549795b6b071597ac3c8a43fefe9db085a42827b8176647affc2fcfc6caa51462dbc0ae7a1a716ba6fdc9092478 DIST percona-xtrabackup-2.4.21.tar.gz 61901220 BLAKE2B 77245818015d4e9c22d05cfeb254ff570ab490c43f9d2fd0e1c499e1e3fefb143b4659fb929740a563e2344b3cd7dfb408931c6d24b277f6df06886dfa83126e SHA512 8b14ef4620fdf836a090d07e5aeb78141eacf081a2cf1069d91af1ba5206e36e3e195f8acb06609f334661d6ad27937b31e997b0f1aabb9cef612d35fabd0284 +DIST percona-xtrabackup-2.4.22.tar.gz 61911038 BLAKE2B 4e0eb211b253ac3bbe82af7b4303ae13ca557926fdad100e9101522f0b1af2fab5258f4a2c98dd9e71cbf3f28586bd527f552a40f1a7a9cb93f5649260a8325b SHA512 2ad0533e5f4750dbb2713b8538d62c23613ac94066fcaee154ab90b1a9ac19ed3c5c7a024e2dbbdf298192665ad6f3c0d42a1435400b003425a8d7630503eb2d DIST percona-xtrabackup-8.0.13.tar.gz 272887474 BLAKE2B d0ac4c602c7c3197ca0a7c361f9658bd2da00bdac5c6dc0a4d56b92e04e4e6c86f22b70e7cf2b375f121983ea7f134edae93116c91945b2c3314a51565033ae5 SHA512 b1fdb0dea1c8b6e39b5451153f01c8ce0dcf411fd88fe8f9f686e562e0950ff9270a39574230ada928b734cc8bb4517da0f01310e75d5c9beba0e35cfeaa11ff DIST percona-xtrabackup-8.0.22-15.tar.gz 294237178 BLAKE2B 819d7594bc41e0adc1e6f2632e6ad50de7a2416c7577f48ea83948bed1b14c0c552c4c44597c84c86fa292bcbbaace185978956acdc39070f81ede6701f4af52 SHA512 f5295e2f1e3ee71931295f89dbd708eed936c4912ab3b6c122eb63795ee2e5154011ddf95cfad005a89c7f086f087f7fb19068d098b49202c697a95b58ee7672 +DIST percona-xtrabackup-8.0.23-16.tar.gz 288261551 BLAKE2B ca82bfcac881cd1d9d3a1d0ea4647d809030b617cc8605f26f1378fba74f106b522447fc67be3968fe72bd8c6bd9fa64ba1943d8379c11f241178aa232680f06 SHA512 11927649ab2a25dbfc5268ab2196dbdd2b102229728a41dc61995aec92a133718c0bf79d3fe15ea91e0917cd4201bba806647d259a6aa0fc7b59ff8bd533e810 EBUILD percona-xtrabackup-2.4.15.ebuild 1778 BLAKE2B 74e30f27b5dc192c2fe8050cb881b1c5450a0f0d39c630580bf93b8bb95312602b30fa827a06df1794410b2d655f8adc2be9fef596ea26bdf00d071800f99f72 SHA512 fa47544c2b83c281d04a3b9f2e435a36a47d94bce872b3b0fce45071cdffc196c0bd03ca41837a2d2132a09880c1a443216f9b7d98ffe856a3323f8de9067bed EBUILD percona-xtrabackup-2.4.20.ebuild 1535 BLAKE2B 41170fcaab472910dde609fb7b12aa6918a708018a7fde9cc182276b8383fd041c322141aea8dcf599752a88e2ed5872f4087ac11cc27387495f7574af1be594 SHA512 592dacff26ec640eec56853e8a9bbe63ba8ecae859463e55aac9478c393d05409e3b0bd9a7aefbd4795f37ef213e183c9e24f9929ea05f470c33a6034e5a1fd3 EBUILD percona-xtrabackup-2.4.21.ebuild 1499 BLAKE2B 00e2dcb73eee4fcc85847e8524c67195d50e53675dfd9e65d2c4e2ad286cdf18416809f185be81256c59fb5908cf5b44893d365c3f0fb535c8025334350c573c SHA512 b436b90f4aa3bd37471c30f3cf23d35327f6d06d67ba4def513e49528fcc6569c22afee356392c877b951c49d60f2235e408ac18e11d61606105bb5ff00aa7a7 +EBUILD percona-xtrabackup-2.4.22.ebuild 1499 BLAKE2B 00e2dcb73eee4fcc85847e8524c67195d50e53675dfd9e65d2c4e2ad286cdf18416809f185be81256c59fb5908cf5b44893d365c3f0fb535c8025334350c573c SHA512 b436b90f4aa3bd37471c30f3cf23d35327f6d06d67ba4def513e49528fcc6569c22afee356392c877b951c49d60f2235e408ac18e11d61606105bb5ff00aa7a7 EBUILD percona-xtrabackup-8.0.13.ebuild 1545 BLAKE2B 42ea67173b4c4f462e0acbe4a5ebdf2cae8ea7764df7d5353c73f65dd5d9023a2833e8e8c7baf9b4f8316d5179ea5aa3a7ca1b55eebd88d43fb89cbea333928d SHA512 5967bb6a3e95187d13c4b6995cfd8b151aa1d1fa9c4dadfa1bf0791ff8748a73705a750214115c62c92c41c483d48872e38c7915e82fbc4ef90d79f594a135c2 EBUILD percona-xtrabackup-8.0.22.15.ebuild 1867 BLAKE2B 626bc0a244a6335f0b8f65ea586e1d26bd2215b239338160f6dcf5a0cb832a810d1a128de7c0599c74fa6c61a8389b002ab9a800d4fd9dfd7ef924d3f32ff0c5 SHA512 d5387d3a5ddf1232786b4d477b404f856484f4d2c9ef4a1b3edc7b4d9f0fb001e18137f0ac597da9ea7c6feed96fe74503126e17d0ff2f890bf12f33ff9c06d9 +EBUILD percona-xtrabackup-8.0.23.16.ebuild 2163 BLAKE2B 0ab36f111f6df3855f9641c35bb5440d532ee54ddf3b257ef7dff03cb1f8c9880753ce20b39d1fecb43f113e1433381432d8ad832b251ef0e9c6034dd16136b4 SHA512 4e95c7c94d2d8743560638a665225e846da34331e6a8e999810c066528aa202d22ccf78cd1f41cdd1547657a002e1a5d48036d6448d34281c4a45471caafd53a MISC metadata.xml 334 BLAKE2B dcc722d923e0f35bd57d67664edf99e7bc159816aa88b4ea210b72a643326c64ed26082088e0468c2b51670b1bd913e66e5f8a99adcb847b42e7f61e7a354223 SHA512 035813d50369063ec1da627ed05ad625045a52e252441bbd4ada2035913525fb18dbf443a57af587aa0f1f18a4e87168e4b683cd33b701e1f115d7e852a81add diff --git a/dev-db/percona-xtrabackup/percona-xtrabackup-2.4.22.ebuild b/dev-db/percona-xtrabackup/percona-xtrabackup-2.4.22.ebuild new file mode 100644 index 000000000000..967e9fa2e0e1 --- /dev/null +++ b/dev-db/percona-xtrabackup/percona-xtrabackup-2.4.22.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +CMAKE_MAKEFILE_GENERATOR="emake" + +inherit cmake flag-o-matic + +DESCRIPTION="Hot backup utility for MySQL based servers" +HOMEPAGE="https://www.percona.com/software/mysql-database/percona-xtrabackup" +SRC_URI="https://www.percona.com/downloads/Percona-XtraBackup-2.4/Percona-XtraBackup-${PV}/source/tarball/${P}.tar.gz + mirror://sourceforge/boost/boost_1_59_0.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND=" + app-arch/lz4:0= + app-editors/vim-core + dev-libs/libaio + dev-libs/libedit + dev-libs/libev + dev-libs/libevent:0= + dev-libs/libgcrypt:0= + dev-libs/libgpg-error + dev-python/sphinx + net-misc/curl + sys-libs/zlib:=" + +RDEPEND=" + ${DEPEND} + !dev-db/percona-xtrabackup-bin + dev-perl/DBD-mysql" + +PATCHES=( + "${FILESDIR}"/${PN}-2.4.6-remove-boost-version-check.patch + "${FILESDIR}"/${PN}-2.4.20-fix-gcc10.patch +) + +src_configure() { + local mycmakeargs=( + -DBUILD_CONFIG=xtrabackup_release + -DBUILD_SHARED_LIBS=OFF + -DWITH_BOOST="${WORKDIR}/boost_1_59_0" + -DWITH_EDITLINE=system + -DWITH_LIBEVENT=system + -DWITH_LZ4=system + -DWITH_SSL=system + -DWITH_ZLIB=system + -DWITH_PIC=ON + ) + + local CMAKE_BUILD_TYPE="Release" + cmake_src_configure +} + +src_install() { + local p="${BUILD_DIR}/storage/innobase/xtrabackup" + + dobin "${p}"/src/{xbcloud/xbcloud,xbcrypt,xbstream,xtrabackup} + dosym xtrabackup /usr/bin/innobackupex + + einstalldocs + doman "${p}"/doc/source/build/man/* +} diff --git a/dev-db/percona-xtrabackup/percona-xtrabackup-8.0.23.16.ebuild b/dev-db/percona-xtrabackup/percona-xtrabackup-8.0.23.16.ebuild new file mode 100644 index 000000000000..cb198ddf576a --- /dev/null +++ b/dev-db/percona-xtrabackup/percona-xtrabackup-8.0.23.16.ebuild @@ -0,0 +1,86 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +CMAKE_MAKEFILE_GENERATOR="emake" + +inherit cmake flag-o-matic + +MY_BOOST_VERSION="1.73.0" +MY_PV=$(ver_rs 3 '-') +MY_PV="${MY_PV//_pre*}" +MY_PN="Percona-XtraBackup" +MY_P="${PN}-${MY_PV}" +MY_MAJOR_PV=$(ver_cut 1-2) + +DESCRIPTION="Hot backup utility for MySQL based servers" +HOMEPAGE="https://www.percona.com/software/mysql-database/percona-xtrabackup" +SRC_URI="https://www.percona.com/downloads/${MY_PN}-${MY_MAJOR_PV}/${MY_PN}-${MY_PV}/source/tarball/${PN}-${MY_PV}.tar.gz + https://dl.bintray.com/boostorg/release/${MY_BOOST_VERSION}/source/boost_$(ver_rs 1- _ ${MY_BOOST_VERSION}).tar.bz2 +" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND=" + app-arch/lz4:0= + app-editors/vim-core + dev-libs/icu:= + dev-libs/libaio + dev-libs/libedit + dev-libs/libev + dev-libs/libevent:0= + dev-libs/libgcrypt:0= + dev-libs/libgpg-error + dev-libs/openssl:0= + dev-libs/protobuf:= + dev-libs/rapidjson + dev-libs/re2:= + dev-python/sphinx + net-misc/curl + sys-libs/zlib:=" + +RDEPEND=" + ${DEPEND} + !dev-db/percona-xtrabackup-bin + dev-perl/DBD-mysql" + +PATCHES=( + "${FILESDIR}"/${PN}-8.0.22-remove-rpm.patch + "${FILESDIR}"/${PN}-8.0.22-fix-building-against-ICU-68.patch +) + +S="${WORKDIR}/percona-xtrabackup-${MY_PV}" + +src_configure() { + CMAKE_BUILD_TYPE="RelWithDebInfo" + + local mycmakeargs=( + -DCMAKE_C_FLAGS_RELWITHDEBINFO=-DNDEBUG + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-DNDEBUG + -DBUILD_SHARED_LIBS=OFF + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}" + -DINSTALL_PLUGINDIR=$(get_libdir)/${PN}/plugin + -DWITH_BOOST="${WORKDIR}/boost_$(ver_rs 1- _ ${MY_BOOST_VERSION})" + -DWITH_MAN_PAGES=ON + -DWITH_SYSTEM_LIBS=ON + ) + + cmake_src_configure +} + +src_install() { + local p="${BUILD_DIR}/storage/innobase/xtrabackup" + + dobin "${p}"/xbcloud_osenv + dobin "${BUILD_DIR}"/runtime_output_directory/{xbcloud,xbcrypt,xbstream,xtrabackup} + + # cannot use dolib.so because helper would append libdir to target dir + insinto /usr/$(get_libdir)/${PN}/plugin + insopts -m 0755 + doins "${BUILD_DIR}"/plugin_output_directory/{keyring_file.so,keyring_vault.so} + + doman "${p}"/doc/source/build/man/* +} diff --git a/dev-db/pg_activity/Manifest b/dev-db/pg_activity/Manifest index c95a7a7c161e..e0e1a5fc7602 100644 --- a/dev-db/pg_activity/Manifest +++ b/dev-db/pg_activity/Manifest @@ -1,5 +1,3 @@ -DIST pg_activity-1.6.2.tar.gz 127561 BLAKE2B 5ddebd3068ddc33196903892c01b947ffc50ecff7ec790e196626e87ee8933ff79242e3ba61c207ea1020535c5d85dbbc4ac9e4825a19ab98004bb27ea0b6a6c SHA512 fd743f369201c6ec3762373c39969b2b7632d79a8fb9c8ebd12a88b66b91915c30e445e93162844b4a176cf7e13009c9c8136e973180b00e7cc708ecd66b4853 DIST pg_activity-2.1.3.tar.gz 277297 BLAKE2B 9677ebad581e2e66e266e5433454e054274693a8e2e5a959c5f807ec1641f3b02a4c202eac7bddb7abe7e51e131d32d25a513a439e97aca996e79be6e1e9c0be SHA512 e28c75d1b88f6b530820d82327d6428d2388341bd09ba4efec5e80e753aee17e995b4e6d5ee8b35b3b972f20aa1228d525fe0c4bdcb8e365795d568a4a25c076 -EBUILD pg_activity-1.6.2.ebuild 624 BLAKE2B 023b6368bd071c1fc01eddac90d205293bf0d6edde9a315e8549fe5c20ca8e4fa7048213a9e5e1ecc83c0d8241868ad3593de6fcd572ddead29198a62c9e8704 SHA512 121f3dc7c5d348d27bfd999e5d4dce387466d4a593dfa0aab4f20f1a1d6af80db03c617d340e3976e59b5c3e6fdc63ce73d8201241c540e53c3c1deb1e501151 EBUILD pg_activity-2.1.3.ebuild 988 BLAKE2B 69eeb374337b00713cb593f0ba2eee64bf644aec89183105678797205b871ed0e1c67cdb0754eadad4694dbe951d41a4ff544c63bf14d3906cff4a4fd09c694b SHA512 4a03d3b88b369f1be169ca542a0e567d4f4099bb729929d1a428473bf9de9174c254d60d0cfc9ed8b9ae95d0214a50da3f6ca5f508a66900a21cd286d6b318d5 MISC metadata.xml 339 BLAKE2B 216c15e347a9dd6061fa95a90fe2a6b5b14f9dcfe7dce8a36376f28dc1c30bad6ae505247d1a5133bf9d8c1d0d61aa07b0f827f1547d563a5046a40e300896ef SHA512 e4b44855c8acd726e3e43cf79e4706077edb2cbccb955ed70c3fe44ee91ed604a057d8b612e4f3950387ee8c96b3fc77fd8e5696e63b896280a243506c7c8853 diff --git a/dev-db/pg_activity/pg_activity-1.6.2.ebuild b/dev-db/pg_activity/pg_activity-1.6.2.ebuild deleted file mode 100644 index 262e50ab2923..000000000000 --- a/dev-db/pg_activity/pg_activity-1.6.2.ebuild +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -PYTHON_COMPAT=( python3_7 python3_8 ) - -inherit distutils-r1 - -DESCRIPTION="Realtime PostgreSQL database server monitoring tool" -HOMEPAGE="https://github.com/dalibo/pg_activity" -SRC_URI="https://github.com/dalibo/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" -KEYWORDS="~amd64" -SLOT="0" -LICENSE="POSTGRESQL" - -DEPEND="" -RDEPEND="dev-python/psutil[${PYTHON_USEDEP}] - dev-python/setuptools[${PYTHON_USEDEP}] - dev-python/psycopg:2[${PYTHON_USEDEP}]" - -src_install() { - distutils-r1_src_install - doman docs/man/${PN}.1 -} diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest index 192baef60a10..f9ee63b9d63d 100644 --- a/dev-db/postgresql/Manifest +++ b/dev-db/postgresql/Manifest @@ -24,5 +24,5 @@ EBUILD postgresql-12.6.ebuild 13623 BLAKE2B fd4a8afad1a5dbf1cdceb5b59185220fb5a2 EBUILD postgresql-13.2.ebuild 13869 BLAKE2B 1644abb185392b63183e1e949fe9735fa86733e4191716073d12de2fa96538fdf46fc648fdacb6bf06a7b0b4542586ffdcd6b93d7d26fe6a9d22d6377def8d2b SHA512 57dec06a04df5b2cd8847e2dcff6f4a6e643494dd93041a3b75661cf675b15081b2fa9a81bfc3aa89b1769dc474ce0c622a6cb3b4dc4b957242e4419999d327b EBUILD postgresql-9.5.25.ebuild 14352 BLAKE2B 384d20f025a4c6a5109e6c56b13fc5f3fe1017f4a3e1574ee4902e5a4fba5ca03b06f32407c6a536810a4faec1327ac857004d581102abe88ed54d14d728fe89 SHA512 fe008861fb16e8c4ba9754c89b7beca9d1173e46dec634cf6bd18f0ea95ab36aa600930fef3168d0e6de38a420c8e1af95a1d99b5eda6d9a9eac74f53099470a EBUILD postgresql-9.6.21.ebuild 14574 BLAKE2B ec064e090ccee5ed827f05469a665014937039fe8c9f12c39ab843037bd772de0fdf25fd931ab5aeb3015fbdcde96bccc6c0cd3afc6b8d969712b76052f1f392 SHA512 991a15e030dd85642f16b05cb724c07fd663630b982e7a982d53b35034d56aa067abf2c6f8b1cf5766549a59adfdbf5bbf074b83a983392c170f1e2d39ccb496 -EBUILD postgresql-9999.ebuild 14050 BLAKE2B 2ab90ab4e72ae00105b995f99b7bfbc249e604ad68f0b1301c1d0bf4a07b192360ac595f66f049e19caade63449ee3b501d842fdf3e58ef7a93bd477a6ccf309 SHA512 1a3fd6fdbe2b5e3a841a4341fccfd4e480c85336668b68994087be439b010f939a412f3b08764546f0ec4e647bf9b7d2ac202ab0075e385c9f98498194a83e41 +EBUILD postgresql-9999.ebuild 14092 BLAKE2B 125143665bda11dd9f9b090fed94d9ad6fc10e96bd7713b6cddaa8ef9a63395a68b7801e108e2b358752fe2a10ca4b6748981b2a2db8d4eb9786d025bf9d1f61 SHA512 3a5bd27396252f6a5d812530ead9a2f0792ecb6db3cb8e96b389ceed16c085321be52275e0104b935da6f29d6808a1119ddd3d676a61c55e71b9c50bef405bf4 MISC metadata.xml 715 BLAKE2B 71b868113676bdbb1996ecc8e3727b0cc16a559c5906e6459a41c330bcb5a5f4b3f4b5c4473a81905713c2f0735f185cd14612c69108b6bb602a7d8a92d6f3ce SHA512 4148c9c11ffaea5d30cd18befb06af914147d41eec4a8f905127f0abc5317ca370a745e0fd51b03c4583efde927fe9c1b3333853e80c2aa3e7677de65cd5d1ba diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild index c9a4ce82776c..c1b8aefe265b 100644 --- a/dev-db/postgresql/postgresql-9999.ebuild +++ b/dev-db/postgresql/postgresql-9999.ebuild @@ -18,9 +18,9 @@ LICENSE="POSTGRESQL GPL-2" DESCRIPTION="PostgreSQL RDBMS" HOMEPAGE="https://www.postgresql.org/" -IUSE="debug icu kerberos kernel_linux ldap libressl llvm nls pam perl - python +readline selinux server systemd ssl static-libs tcl - threads uuid xml zlib" +IUSE="debug icu kerberos kernel_linux ldap libressl llvm lz4 + nls pam perl python +readline selinux server systemd + ssl static-libs tcl threads uuid xml zlib" REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" @@ -37,6 +37,7 @@ llvm? ( sys-devel/llvm:= sys-devel/clang:= ) +lz4? ( app-arch/lz4 ) pam? ( sys-libs/pam ) perl? ( >=dev-lang/perl-5.8:= ) python? ( ${PYTHON_DEPS} ) @@ -78,8 +79,8 @@ uuid? ( DEPEND="${CDEPEND} >=dev-lang/perl-5.8 app-text/docbook-dsssl-stylesheets -app-text/docbook-sgml-dtd:4.2 -app-text/docbook-xml-dtd:4.2 +app-text/docbook-sgml-dtd:4.5 +app-text/docbook-xml-dtd:4.5 app-text/docbook-xsl-stylesheets app-text/openjade dev-libs/libxml2 @@ -168,6 +169,7 @@ src_configure() { $(use_with kerberos gssapi) \ $(use_with ldap) \ $(use_with llvm) \ + $(use_with lz4) \ $(use_with pam) \ $(use_with perl) \ $(use_with python) \ diff --git a/dev-db/redis/Manifest b/dev-db/redis/Manifest index ccc7c4fe4a4d..212b03ef31e9 100644 --- a/dev-db/redis/Manifest +++ b/dev-db/redis/Manifest @@ -26,9 +26,9 @@ DIST redis-5.0.9.tar.gz 1986574 BLAKE2B 7802d0556d11c9be8577b9bb3f4dbad8c2419b38 DIST redis-6.0.12.tar.gz 2276349 BLAKE2B ab49b0278420c65fc995a90e850130971ccaf3df34a08a5cc10a8c211239eba8449b87fe67684189c71816cf259a70a23a77935ec61e8baa787daa61cb994201 SHA512 9dd8e3bed51e1356470e1bf08892f771744c0c9418ff874c16ea932ad1f471a908ffd8479efe1f32531d7f63cd7af5224273ce50f2fe7aa26c47716e0e78330b DIST redis-6.0.9.tar.gz 2261418 BLAKE2B 93e64e2c682320d11e468021fd13a2888dd6b15430c15eaaa9468242d9b4d8b60e29dfe656e677774dc88ed751471284d1adf94c723521085019b375785abe7a SHA512 ebae2b09637fdbdc71dd22b72ccea24e2c21beb81c6ff5c4bae8b341886a7d847ce868f52dc917079bab8aa250ff61c83efe8acbb8a1cbc5e285c7842b0aefa3 DIST redis-6.2.1.tar.gz 2438367 BLAKE2B 8717630771eafaf8a15dd371d46475f81f15bbcdc9a4fabd8f270ab6e09fbfb3ee2a1cddddb6c7778922d3552bcf5ee475eec7ba0623147ec36a5c5422cb0de0 SHA512 7c339cc360fc3125bb67c5748bb4fe940977faa937e3a86294829bde472479a811df8ea0ce4961d8128ec8d4ffba5d5a943c2957589c8da0cfc3f109f82e4af6 -EBUILD redis-5.0.12.ebuild 4729 BLAKE2B 1c5329e5d7e296f97fe5561b64b39ed85e83cc22cb5508016a2e966359140e9e946b72c4865435a6fee6dc5f350eb6a981afeda5aaef5b30318046280e1ccfa3 SHA512 a61756d60c828959e9986af99a169f19f6b3f607868836e15b79218527a9eef5601825bb176b1f87bf4cafab3150937213c6ca881e6dc4cd5a7caaf346b4f786 +EBUILD redis-5.0.12.ebuild 4728 BLAKE2B c3861fcaaedaa070407435c58644efc9ff511cef8e1433c006566e5078b13f9b5b7d8323b95348a5c9c79704021464ecd167a613e960f4ab0e73b02ce6e27bb0 SHA512 3555106201068131822af9cd12375e5c28e7a77cdb8dc7d3a169700d246fef9391a15dd2a3821d6b9f751c004019f371e4597df79c40345a79bef648cd9b0864 EBUILD redis-5.0.9-r1.ebuild 4727 BLAKE2B 296ae8313437d189b96ee93f5b63cefe11abb576d4925e150de6db510183a948bae6a4ae76db1a393e8c1f3c0c17dfad8c52e07b8d1cf36cd88d11df4d2ac17d SHA512 af8a96dcccbc12d8dfb0c77d1c857b245c47d77b3084f11021e9cf02ce1a8258c3c09a855c209356c49ba9aa8a5ad37e732751d908e01e2314d7c2d5ceddf320 -EBUILD redis-6.0.12.ebuild 5017 BLAKE2B eb087b9eec1e14361140200dbfe6cb9388b32d06170434c50e40c17b237b91d7986b226f97cb4a823858a9f39913a4a8905cb729fe5cd27f84d594d85c545c63 SHA512 fcd2acef853696d40900cee136ed29b86614befd89555560f5bbe985dcdba5179b7ba9424c782ee81cfe22414bec600be53ba3d2f6f5b89234c4d923f5bd2b9d +EBUILD redis-6.0.12.ebuild 5015 BLAKE2B a9d9b3c82ab6ea5567c4f1b3650cba4fc26c7f64573bd348daaed1a46869a668e1d84793c9e94530d8e547c54c98d747ce55af5591102b64b8f5d4d9f083ba3d SHA512 3bbe7b495f93d89b7c304cd0765e98e4962e7522013745e21a0c1d20f76391eb6ecbb9df1bca1a34d3d06e7ef5261374ba724ebb9ee3e186d2bf22fcc5ad8978 EBUILD redis-6.0.9-r100.ebuild 4569 BLAKE2B 255dc421757021cabf391366934eaac4eb3220df64e60742ccc7746e5923fe60bc90e7abb7180002c831017525ac3bf0dcc39d0bb8a4014a38894e68fb3bad18 SHA512 b3ce8c2c71d11f73a66b012adfef1aed5505e441814cb14cdc820a24d50cfc6f7dd57695d3bb5fa2f18037ca92113932daa22f97979c967a6f5fdf91bf630785 EBUILD redis-6.2.1.ebuild 5020 BLAKE2B 9d64fc2efeb3b7a22ecbaf9440639b327f2555a21152f0cedb81cccbed351f1037e6158dbff9afa10e33c7ea59b575fce0f9c59e06576b1284e749f07a1472bd SHA512 c61f65441d30d13a939275bdebc0d27b7906eb6aa9de5dc675ba53662a5404d06f5bee04c4412a85daff711b5d31a739142e7e365e2fd19bd32aaaf66ebbbed5 MISC metadata.xml 356 BLAKE2B 19e27b12be84927b990fc2f481d8dd1f88f05b5e029fdd91c7ce9517e7fd378d6e1df1eb55052a04fefe781da09b371da1c28fd269c72f4222aa896897222bf7 SHA512 ab06f694c5b20072f40e85b3a8e05d2c333f3b29fc145733fde1e3f42ea78ac7c51550afc29e671ef9b4a163597ac9f44bc182344c18db52036595e5d65f7e22 diff --git a/dev-db/redis/redis-5.0.12.ebuild b/dev-db/redis/redis-5.0.12.ebuild index db7046eaf85a..fdab1f212d55 100644 --- a/dev-db/redis/redis-5.0.12.ebuild +++ b/dev-db/redis/redis-5.0.12.ebuild @@ -10,7 +10,7 @@ HOMEPAGE="https://redis.io" SRC_URI="http://download.redis.io/releases/${P}.tar.gz" LICENSE="BSD" -KEYWORDS="amd64 ~arm ~arm64 ~hppa ppc ppc64 x86 ~amd64-linux ~x86-linux ~x86-solaris" +KEYWORDS="amd64 ~arm arm64 ~hppa ppc ppc64 x86 ~amd64-linux ~x86-linux ~x86-solaris" IUSE="+jemalloc tcmalloc luajit test" RESTRICT="!test? ( test )" SLOT="0" diff --git a/dev-db/redis/redis-6.0.12.ebuild b/dev-db/redis/redis-6.0.12.ebuild index ba48c5558daf..18d3272e4a85 100644 --- a/dev-db/redis/redis-6.0.12.ebuild +++ b/dev-db/redis/redis-6.0.12.ebuild @@ -18,7 +18,7 @@ HOMEPAGE="https://redis.io" SRC_URI="https://download.redis.io/releases/${P}.tar.gz" LICENSE="BSD" -KEYWORDS="amd64 ~arm ~arm64 ~hppa ppc ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~x86-solaris" +KEYWORDS="amd64 ~arm arm64 ~hppa ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~x86-solaris" IUSE="+jemalloc ssl tcmalloc test" RESTRICT="!test? ( test )" SLOT="0" diff --git a/dev-db/sqlite/Manifest b/dev-db/sqlite/Manifest index 6b3cb8a75d95..cb736b565eb9 100644 --- a/dev-db/sqlite/Manifest +++ b/dev-db/sqlite/Manifest @@ -6,10 +6,30 @@ AUX sqlite-3.34.0-build_1.1.patch 9731 BLAKE2B 18e1fdfc8f0ae531340f8173b77bf63dd AUX sqlite-3.34.0-build_1.2.patch 14103 BLAKE2B 0d52e5b11e71fe6a47104bccbc0ef949baccd70b8378ff8a0248cd0d06f03320ce07bdd9c61b6185384113a0888d27cc357fdb43f264a5bdd248c14d86011bb9 SHA512 cbc89164540c57d427814195c39269496e45bc2bf400a49e59edf17e81545ae73ee6639100ff356683a8ab1776f332c368b4b1653f07ef2a530fd7143af6dba5 AUX sqlite-3.34.0-build_2.1.patch 11070 BLAKE2B 6368c4fad56ed33c4778795124a14477b502c8b832b5c0d9a78b945e051c53d89b584393222680d9366c101928c2a7062f7475dd886188fa1ca15ad16a655758 SHA512 57f5cd5edc5fa42c04a4d5eefb995bd221f236a835fd06e54dbcfd5f89c902712a259d1cb3faf2ed6364c82e2642af7f69ae8f3b6f71a8e6016900879cd374cb AUX sqlite-3.34.0-build_2.2.patch 12207 BLAKE2B 5c0ca0ed89c37fdb80430df1f8f1bc6649131535d80581885780382f617607950e35ae97c949904d9a45995241d98ec2885db42a1886b466ede6ab20373e29cc SHA512 66ac76f25606c8cbd64beff2abe4ef000b3a3320dc5949d8c88e29d3bede0cd5e0cd96d7fe41ba51c8920fbbc66d3e6e82df6896b323c4960617a29e5c9857e4 +AUX sqlite-3.34.1-build_1.1.patch 9731 BLAKE2B 8ed8e3f591525e70e06c3d4891b63ed3e71da6a244246b2dedca925c3d349b59015d9f5f7c6a7b877c57555b35d19aaf5e2137944c057b1d6bbae61bedf8c313 SHA512 b57ea96bf7cb2fef22e09b12f0dc2273d81e00c296f57f9ba9926aef6ca8aabc7f45b770a570630d4465c87f571da0af710b3f6b4c68eb939982f0bc9db5254d +AUX sqlite-3.34.1-build_1.2.patch 14036 BLAKE2B 84a2f2ac4b7a48a64a510b6dc37ed7cc66b3a645e9349081612aa77f7bfdbc88cf125d1a4ab5c2b2a61561c89611308a3a6ab1c839d6a950cf7f337593c57553 SHA512 648d5a9e8c1feb155d6abb7c078bc39cdd61c1dec3f1d22b343d765f7d567317820ba96470767eb24de2b0984a581d8cae5d3a74071e9f15af9c23aa4cc65460 +AUX sqlite-3.34.1-build_2.1.patch 11070 BLAKE2B 2c7239f0b509a16679ff96cdf42fdc73827e8fc72268be79bdb11aaf96b028a599d57c3f814f2fb3f655dd639964a721ab19a2ca57c2c5b08a350a95211ffdfe SHA512 1c08e48808c3b333734c5e31049b0adacff12914a7394eb75d3d09032f1bd2671fa8c4ea6a7d88e97a6fdf7a03bf6877775095c773d71f8ec4f36619125cdfd1 +AUX sqlite-3.34.1-build_2.2.patch 12207 BLAKE2B 4a2af921464c55256a29a440f4c248f969b775bda9335a8218784cd1904fe4a8f28c30cff3f5f15388c2e2c9460ce0de415f87e00c09f2eaad964aadeac4f562 SHA512 d9e3f1bc9ffd927e758bbbaa76832f82c569309e67b1c41b6cff56d3c18499287495cfeb174663032a9e2a911621806f6e6c6746767a97d9fb9cc3ccf83791cf +AUX sqlite-3.35.0-build_1.1.patch 9731 BLAKE2B e0d0e53847f272ddde038115d27d3b0595ec3aafaee0f7aef4bd0d1e3a0287f5e27c02957b7bb882462d3a2f00d683c7f0250a9d22aaea86212c836d52e9f5e9 SHA512 9aeecc2fd77440403e74d31367aca53885811e9b74f909a27105475ab4263a30e85f85ab1d471ac73c83774e570021556c3b747be0ac8bce9a9dc422dbd8a8b0 +AUX sqlite-3.35.0-build_1.2.patch 14036 BLAKE2B 42b1aa12f1aa0be10f565a5da09c5c1d4f78692f2a89918cb0714ebae536d60e9f5aea09fc325032cd56655fc5dd9abb566b6e962128c65f4296e5d299e1bde7 SHA512 d81dd506d06a54c6120f98a22922409e8f9b285d7b2f33630a71ef89d455a87356289363d9a7c4390422288c42855a0655e1d72b3aa51af8f37b7eb46e94e269 +AUX sqlite-3.35.0-build_2.1.patch 11089 BLAKE2B 54192c90a19f08ef05a9276b54a66b782aa23aaf6580bac5d94e48c72e96903e5328968bbce8145e5953e0e9f7a22d6bcf9fc9268817f4dab2466dc27a928db0 SHA512 11c8463c8282e92c3276578433f5ac0073ca935162dbc717ad0a22750f22af3c4ce87037da42c604c98b77ec88ef1f4f5e1073f8c257aaa3c2106c7dfa6992a8 +AUX sqlite-3.35.0-build_2.2.patch 12207 BLAKE2B cb8295b8ca8f1f38ebf130f5e32dd2b07dbb57bad7679ecda263bfe8e4e586864a69b9035a69c2579b1e9080322a26f3a4ce01c8bf066da16c7550938400e8d2 SHA512 094b1e5442743ec6020f1621bb1c3ca9f52434f8c83f1c237e345cafc7ec530c66244f4f0e1aa80416fcd85582fcb50a15ce8c93ab8967f6dfcd9fb9aa4012bd DIST sqlite-doc-3330000.zip 9834159 BLAKE2B f67155a8ce8e46c2fbc0a4e35722d1fcad86e905a15230adc70732cee267b6b2002c7499883b938129aaa908b99634e4214360e9d1dbdae333b09060de24530e SHA512 14a3cccb4ff6af57738990eeadd37a1b827f89c9c1b16201c62ca5bb9301d39223d48677b9c269ce332210e5c9ae3f42aa0f9de7d79b38acb9809c732d038368 DIST sqlite-doc-3340000.zip 10069888 BLAKE2B 343df62bc8b75d57dffe69c779cceb856d9e94a5b2a77c3a972761eedd8b4b0f5f8849102ec271652c3aa4039df75d7f2e503fd04b0547be03e024fdfbd894ac SHA512 1bdf20030e656ec4ce38a264c8ef7a95c9f2731cd7d756a44b35b6c68827e8aba92018007139ee09d1c27b34bcd72bff1a201dc3f30aa13e96120af5d58e835e +DIST sqlite-doc-3340100.zip 10074559 BLAKE2B 66aa999d87b7f3c994c289eda320d6a4e371b0a6a2ab8bcebde540aa955f3bdf4f00b739ca32aa913685cd35a88ee83bebd7fa43a0c148614e9086a1d3f5652a SHA512 20cbb9f05cd329bf7aa2877431781e46192544806042f4104e4eb0e87d84cd2dfc02c7ff226d4bef9bb2c6a69cc612201844d116abe99b0cfed9602adf243a60 +DIST sqlite-doc-3350000.zip 10165959 BLAKE2B e24ae04764617d07fafc82f4c27d96b853df77de2a945109c2ff28abd3b61f8bdd318756d14b8d20e22a0dff05fcca26c9a8c9972f600af0a996cd8e13478c9d SHA512 f6b92cf1a087a97071c55605e85676c4d76b9435a1a433e4663ff3d7937557d72e4fb99931a14abda9ab3dece654da09d10f7ca2560ca3e0972e4b7690997132 +DIST sqlite-doc-3350100.zip 10175402 BLAKE2B c8ac8814837dc88320ae0f6973b5ec0b815a4fbfefae26ea2b5365485decb33e9e4add9097865819a5facb2568198535166dd8c492cb621ec845d8bfc2056721 SHA512 4843d8186f4cc98fc9ad5459a1b987d4512e72ceeeb985372c22d44f35856e33ee41ab0fa4372c273cfa4730f9461dc3f359ba50f26e53a0c7abd87e70cdfe86 +DIST sqlite-doc-3350200.zip 10182547 BLAKE2B f50b04495aa79eca1ce935c8a96fe83d0a415f15ec55fda0cd982d02b4473ba8f5175c97d9816de2b79526787bc958b3be5e1234994e5f00d8ee1b432627391e SHA512 7ef973b804d059cf00c759a0ae001b7714df0472398e7cd55e34f59222df816a36511cefd15fa99abf67dec4291ee6babbc12bd87855194608ff556a5c1182ae DIST sqlite-src-3330000.zip 12591089 BLAKE2B 14888bca229683e97c4666f8efb535be5bd3e322de0089f0175ba15e038016be3a3cc00b5bfa8c111538116914cf6d8439839ca5d1e20339b184e547ddf260a4 SHA512 3260e3e03ee2f6a4ff2bc4ea4bada5a1497afeca33878c155a8005824970c6c1eb8a2db58eb3023cab084af475fadb81d1c3c9892ae92c07f884881e6602e173 DIST sqlite-src-3340000.zip 12623425 BLAKE2B 548293cf0166407727cd068804eb5e1ce62f654533c88a87b71a6ff62da37eb2af21b89b8d63ee677777ca917e0d685ddcf9b8d5c3c8b2a2b787d71da8e5a161 SHA512 520fbca59da02452e2861a140bde891aedfc8254eafaa6894e8d845369d60d6a921595a411efb2611c0f7b0cadd69a713dcdaaeaad1e4254e9fd9a6efde07f91 +DIST sqlite-src-3340100.zip 12623711 BLAKE2B 08c98d0c56d46fe909f449f322002ae4d69fd952930d2f04514988a939b31744a13aea85935d84bc05db52faca1aad6a70d7c31e7da0e396bb649685a49699bb SHA512 5ed02fe609b3d08c3297cc43b21e6ee3f56fb51a6616ac391a0e50cd1677dbad03c6bf9bf9c8409cf94b83b16fe6b6e4a112640b18c7d4fd95328066da3c3943 +DIST sqlite-src-3350000.zip 12814378 BLAKE2B f77880bfb335da078623841f9d9d9fc690085630757d8d8e3d40d42646902f809febf8dcc5048d38be0e2d74c0114c35f09789bc261e51d49f9685201f6d1297 SHA512 4b77d963092a6aed61b50e59450edf2af187f16b185b05ca54d81c3eecf71b1cb9bc2883a8aadeb971fcebe343fa430ea788aedb77e3712c8b39d4892c93a797 +DIST sqlite-src-3350100.zip 12814875 BLAKE2B bc4f6913ce93c32e1c6fbd39f45666a14476096b09f7534047aee56cbb18e949bf5225c080c813281a0abae9198a35165161393db39df0c2af2a92138b4604d9 SHA512 004bcca9c2ae883b05d8f15c8bf28a12fd2fdf9527d1560d137f8e2570c153d14ea5405c500d0e79966a3881a516df4d9ed07be751712f1584df411e86c60977 +DIST sqlite-src-3350200.zip 12815298 BLAKE2B a65034fc59c32e950b5337ef4fe1b2476190fe6f1272494b12f9e1d048aac759ac31e7c0f252774c850b0f313bf44b34a97fc563c049e30d2a896f262b199dce SHA512 d5382bf31d812bc51533d28a583c78d3f389b1ecbe1f9f30cc755059f2867f832c0529e9f97b090be5c5bc855c45611b220b8c29b5648c451490566a70cc5122 EBUILD sqlite-3.33.0.ebuild 11438 BLAKE2B f0cc7f4987d1642d4b294e2c2d373e7da1cfa8db202fdef9ea66eb0347cf809eef5f09590114f6a75f8d1e3461ed689dfa8b6d574095c6113aee37c6c6500d77 SHA512 5ee535586943330b0cfc8e4108207c46964766fd59ae6a86bbc8afc6d4e5dcd820d60a75cbfe6715ed9908677f6f927adf185f9950953fa7eb242c3a611ba93b EBUILD sqlite-3.34.0.ebuild 13013 BLAKE2B fbd505c4299e99f26d7d81b5915b31b8297e1b33098df9bc247320d99b1ac974b8c9b265fe7631d264910ae924bc4864c87784e694673ed62a5859349885b22f SHA512 b69523d15df43fe906ddf53ebc0fababf0a57af3a8e4ad1aaf4d14d850168a25bd90cc493e4e2a38fcb911ea9b80d1e71fbc9adf1abe15f45950d820f64321ee +EBUILD sqlite-3.34.1.ebuild 13008 BLAKE2B db0ce7c73a26827e7e52e95a4414cba13ebab2c1910a67ed828c56d815c2a230cf4786cf63fef56d74163a33fa8c98b9c10fd813f131403e32fcb0ff4bc12cc2 SHA512 be29ea17d73209d7e519157468e30cd21f7673f56ec7305e8ec5416e035898b70f78487a4c45e2163da9cf10fe83c9b65821090e1dfdc571ba252f3bf07c0e68 +EBUILD sqlite-3.35.0.ebuild 13013 BLAKE2B d5404a030cd47e4bad4fe811e9387ee7438549a1e9db281650dc00d068dea20b93224c65656ca3833a8532219c413db1552a614b8240f44a51319080acdb816b SHA512 335321cc9e4d79be78a6ebfe5176805fb69c259bac163d0ac68954cd575b3056336a48f59ccba61a6e9790188f4bf14940a63a0b345914873c9ca80f12edc0e6 +EBUILD sqlite-3.35.1.ebuild 13013 BLAKE2B d5404a030cd47e4bad4fe811e9387ee7438549a1e9db281650dc00d068dea20b93224c65656ca3833a8532219c413db1552a614b8240f44a51319080acdb816b SHA512 335321cc9e4d79be78a6ebfe5176805fb69c259bac163d0ac68954cd575b3056336a48f59ccba61a6e9790188f4bf14940a63a0b345914873c9ca80f12edc0e6 +EBUILD sqlite-3.35.2.ebuild 13013 BLAKE2B d5404a030cd47e4bad4fe811e9387ee7438549a1e9db281650dc00d068dea20b93224c65656ca3833a8532219c413db1552a614b8240f44a51319080acdb816b SHA512 335321cc9e4d79be78a6ebfe5176805fb69c259bac163d0ac68954cd575b3056336a48f59ccba61a6e9790188f4bf14940a63a0b345914873c9ca80f12edc0e6 MISC metadata.xml 743 BLAKE2B 4e2cdd6391c851ad8a705895fc9a5b5f8d77df3ae9cdd96310b1a72d5f4963d19427b8c97f5690f49262e91e9f321f6aafcdd5fee222eede0505810a803265cc SHA512 06315ac56dd1d0e738e3d1161b611c4db053de49e1a35e536b06b9ad7c0f9276b50c390ea6572802b58d49b84c7f1a3c8e63496d04d0f4b0d603bba804fb1757 diff --git a/dev-db/sqlite/files/sqlite-3.34.1-build_1.1.patch b/dev-db/sqlite/files/sqlite-3.34.1-build_1.1.patch new file mode 100644 index 000000000000..d7f759af35d8 --- /dev/null +++ b/dev-db/sqlite/files/sqlite-3.34.1-build_1.1.patch @@ -0,0 +1,375 @@ +Add initialization functions for internal usage in libsqlite3.so. + +SQLite revision: 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f + +--- /ext/misc/amatch.c ++++ /ext/misc/amatch.c +@@ -1480,9 +1480,18 @@ + + #endif /* SQLITE_OMIT_VIRTUALTABLE */ + ++int sqlite3AmatchInit(sqlite3 *db){ ++ int rc = SQLITE_OK; ++#ifndef SQLITE_OMIT_VIRTUALTABLE ++ rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0); ++#endif /* SQLITE_OMIT_VIRTUALTABLE */ ++ return rc; ++} ++ + /* + ** Register the amatch virtual table + */ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -1491,11 +1500,8 @@ + char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ +- int rc = SQLITE_OK; + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Not used */ +-#ifndef SQLITE_OMIT_VIRTUALTABLE +- rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0); +-#endif /* SQLITE_OMIT_VIRTUALTABLE */ +- return rc; ++ return sqlite3AmatchInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/carray.c ++++ /ext/misc/carray.c +@@ -498,16 +498,8 @@ + + #endif /* SQLITE_OMIT_VIRTUALTABLE */ + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_carray_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3CarrayInit(sqlite3 *db){ + int rc = SQLITE_OK; +- SQLITE_EXTENSION_INIT2(pApi); + #ifndef SQLITE_OMIT_VIRTUALTABLE + rc = sqlite3_create_module(db, "carray", &carrayModule, 0); + #ifdef SQLITE_TEST +@@ -519,3 +511,18 @@ + #endif /* SQLITE_OMIT_VIRTUALTABLE */ + return rc; + } ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) ++#ifdef _WIN32 ++__declspec(dllexport) ++#endif ++int sqlite3_carray_init( ++ sqlite3 *db, ++ char **pzErrMsg, ++ const sqlite3_api_routines *pApi ++){ ++ SQLITE_EXTENSION_INIT2(pApi); ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3CarrayInit(db); ++} ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/completion.c ++++ /ext/misc/completion.c +@@ -483,12 +483,13 @@ + return rc; + } + ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif + int sqlite3_completion_init( +- sqlite3 *db, +- char **pzErrMsg, ++ sqlite3 *db, ++ char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ + int rc = SQLITE_OK; +@@ -499,3 +500,4 @@ + #endif + return rc; + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/csv.c ++++ /ext/misc/csv.c +@@ -928,6 +928,22 @@ + #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ + + ++int sqlite3CsvInit(sqlite3 *db){ ++#ifndef SQLITE_OMIT_VIRTUALTABLE ++ int rc; ++ rc = sqlite3_create_module(db, "csv", &CsvModule, 0); ++#ifdef SQLITE_TEST ++ if( rc==SQLITE_OK ){ ++ rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0); ++ } ++#endif ++ return rc; ++#else ++ return SQLITE_OK; ++#endif ++} ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -941,17 +957,8 @@ + char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ +-#ifndef SQLITE_OMIT_VIRTUALTABLE +- int rc; + SQLITE_EXTENSION_INIT2(pApi); +- rc = sqlite3_create_module(db, "csv", &CsvModule, 0); +-#ifdef SQLITE_TEST +- if( rc==SQLITE_OK ){ +- rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0); +- } +-#endif +- return rc; +-#else +- return SQLITE_OK; +-#endif ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3CsvInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/dbdata.c ++++ /ext/misc/dbdata.c +@@ -803,7 +803,7 @@ + /* + ** Invoke this routine to register the "sqlite_dbdata" virtual table module + */ +-static int sqlite3DbdataRegister(sqlite3 *db){ ++int sqlite3DbdataRegister(sqlite3 *db){ + static sqlite3_module dbdata_module = { + 0, /* iVersion */ + 0, /* xCreate */ +@@ -838,6 +838,7 @@ + return rc; + } + ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -849,3 +850,4 @@ + SQLITE_EXTENSION_INIT2(pApi); + return sqlite3DbdataRegister(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/decimal.c ++++ /ext/misc/decimal.c +@@ -590,14 +590,7 @@ + decimal_free(pB); + } + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_decimal_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3DecimalInit(sqlite3 *db){ + int rc = SQLITE_OK; + static const struct { + const char *zFuncName; +@@ -611,10 +604,6 @@ + { "decimal_mul", 2, decimalMulFunc }, + }; + unsigned int i; +- (void)pzErrMsg; /* Unused parameter */ +- +- SQLITE_EXTENSION_INIT2(pApi); +- + for(i=0; i +@@ -101,6 +103,20 @@ + } + + ++int sqlite3SqlarInit(sqlite3 *db){ ++ int rc = SQLITE_OK; ++ rc = sqlite3_create_function(db, "sqlar_compress", 1, ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0, ++ sqlarCompressFunc, 0, 0); ++ if( rc==SQLITE_OK ){ ++ rc = sqlite3_create_function(db, "sqlar_uncompress", 2, ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0, ++ sqlarUncompressFunc, 0, 0); ++ } ++ return rc; ++} ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -109,16 +125,10 @@ + char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ +- int rc = SQLITE_OK; + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ +- rc = sqlite3_create_function(db, "sqlar_compress", 1, +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0, +- sqlarCompressFunc, 0, 0); +- if( rc==SQLITE_OK ){ +- rc = sqlite3_create_function(db, "sqlar_uncompress", 2, +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0, +- sqlarUncompressFunc, 0, 0); +- } +- return rc; ++ return sqlite3SqlarInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ ++ ++#endif /* SQLITE_HAVE_ZLIB */ +--- /ext/misc/totype.c ++++ /ext/misc/totype.c +@@ -491,17 +491,8 @@ + #pragma warning(default: 4748) + #endif + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_totype_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3TotypeInit(sqlite3 *db){ + int rc = SQLITE_OK; +- SQLITE_EXTENSION_INIT2(pApi); +- (void)pzErrMsg; /* Unused parameter */ + rc = sqlite3_create_function(db, "tointeger", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0, + tointegerFunc, 0, 0); +@@ -512,3 +503,18 @@ + } + return rc; + } ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) ++#ifdef _WIN32 ++__declspec(dllexport) ++#endif ++int sqlite3_totype_init( ++ sqlite3 *db, ++ char **pzErrMsg, ++ const sqlite3_api_routines *pApi ++){ ++ SQLITE_EXTENSION_INIT2(pApi); ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3TotypeInit(db); ++} ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/uint.c ++++ /ext/misc/uint.c +@@ -78,6 +78,11 @@ + return (nKey1 - i) - (nKey2 - j); + } + ++int sqlite3UintInit(sqlite3 *db){ ++ return sqlite3_create_collation(db, "UINT", SQLITE_UTF8, 0, uintCollFunc); ++} ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -88,5 +93,6 @@ + ){ + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ +- return sqlite3_create_collation(db, "uint", SQLITE_UTF8, 0, uintCollFunc); ++ return sqlite3UintInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/uuid.c ++++ /ext/misc/uuid.c +@@ -206,21 +206,12 @@ + sqlite3_result_blob(context, pBlob, 16, SQLITE_TRANSIENT); + } + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_uuid_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3UuidInit(sqlite3 *db){ + int rc = SQLITE_OK; +- SQLITE_EXTENSION_INIT2(pApi); +- (void)pzErrMsg; /* Unused parameter */ + rc = sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8|SQLITE_INNOCUOUS, 0, + sqlite3UuidFunc, 0, 0); + if( rc==SQLITE_OK ){ +- rc = sqlite3_create_function(db, "uuid_str", 1, ++ rc = sqlite3_create_function(db, "uuid_str", 1, + SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC, + 0, sqlite3UuidStrFunc, 0, 0); + } +@@ -231,3 +222,18 @@ + } + return rc; + } ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) ++#ifdef _WIN32 ++__declspec(dllexport) ++#endif ++int sqlite3_uuid_init( ++ sqlite3 *db, ++ char **pzErrMsg, ++ const sqlite3_api_routines *pApi ++){ ++ SQLITE_EXTENSION_INIT2(pApi); ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3UuidInit(db); ++} ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/zipfile.c ++++ /ext/misc/zipfile.c +@@ -24,6 +24,8 @@ + ** * No support for zip64 extensions + ** * Only the "inflate/deflate" (zlib) compression method is supported + */ ++#ifdef SQLITE_HAVE_ZLIB ++ + #include "sqlite3ext.h" + SQLITE_EXTENSION_INIT1 + #include +@@ -2139,7 +2141,7 @@ + /* + ** Register the "zipfile" virtual table. + */ +-static int zipfileRegister(sqlite3 *db){ ++int sqlite3ZipfileInit(sqlite3 *db){ + static sqlite3_module zipfileModule = { + 1, /* iVersion */ + zipfileConnect, /* xCreate */ +@@ -2173,9 +2175,10 @@ + return rc; + } + #else /* SQLITE_OMIT_VIRTUALTABLE */ +-# define zipfileRegister(x) SQLITE_OK ++# define sqlite3ZipfileInit(x) SQLITE_OK + #endif + ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -2186,5 +2189,8 @@ + ){ + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ +- return zipfileRegister(db); ++ return sqlite3ZipfileInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ ++ ++#endif /* SQLITE_HAVE_ZLIB */ diff --git a/dev-db/sqlite/files/sqlite-3.34.1-build_2.1.patch b/dev-db/sqlite/files/sqlite-3.34.1-build_2.1.patch new file mode 100644 index 000000000000..fe5fb7e78057 --- /dev/null +++ b/dev-db/sqlite/files/sqlite-3.34.1-build_2.1.patch @@ -0,0 +1,291 @@ +Move some code to libsqlite3.so to avoid duplication. +Link executables against libsqlite3.so. +Increase timeout for fuzzcheck. +Update list of optionally available functions. +Fix building with dlopen() not available. + +SQLite revision: 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f + +--- /Makefile.in ++++ /Makefile.in +@@ -313,6 +313,9 @@ + # Source code for extensions + # + SRC += \ ++ $(TOP)/ext/expert/sqlite3expert.c \ ++ $(TOP)/ext/expert/sqlite3expert.h ++SRC += \ + $(TOP)/ext/fts1/fts1.c \ + $(TOP)/ext/fts1/fts1.h \ + $(TOP)/ext/fts1/fts1_hash.c \ +@@ -365,8 +368,29 @@ + $(TOP)/ext/rbu/sqlite3rbu.h \ + $(TOP)/ext/rbu/sqlite3rbu.c + SRC += \ ++ $(TOP)/ext/misc/amatch.c \ ++ $(TOP)/ext/misc/appendvfs.c \ ++ $(TOP)/ext/misc/carray.c \ ++ $(TOP)/ext/misc/completion.c \ ++ $(TOP)/ext/misc/csv.c \ ++ $(TOP)/ext/misc/dbdata.c \ ++ $(TOP)/ext/misc/decimal.c \ ++ $(TOP)/ext/misc/eval.c \ ++ $(TOP)/ext/misc/fileio.c \ ++ $(TOP)/ext/misc/ieee754.c \ + $(TOP)/ext/misc/json1.c \ +- $(TOP)/ext/misc/stmt.c ++ $(TOP)/ext/misc/nextchar.c \ ++ $(TOP)/ext/misc/percentile.c \ ++ $(TOP)/ext/misc/regexp.c \ ++ $(TOP)/ext/misc/series.c \ ++ $(TOP)/ext/misc/sha1.c \ ++ $(TOP)/ext/misc/shathree.c \ ++ $(TOP)/ext/misc/sqlar.c \ ++ $(TOP)/ext/misc/stmt.c \ ++ $(TOP)/ext/misc/totype.c \ ++ $(TOP)/ext/misc/uint.c \ ++ $(TOP)/ext/misc/uuid.c \ ++ $(TOP)/ext/misc/zipfile.c + + # Generated source code files + # +@@ -437,35 +461,21 @@ + # Statically linked extensions + # + TESTSRC += \ +- $(TOP)/ext/expert/sqlite3expert.c \ + $(TOP)/ext/expert/test_expert.c \ +- $(TOP)/ext/misc/amatch.c \ +- $(TOP)/ext/misc/carray.c \ + $(TOP)/ext/misc/cksumvfs.c \ + $(TOP)/ext/misc/closure.c \ +- $(TOP)/ext/misc/csv.c \ +- $(TOP)/ext/misc/decimal.c \ +- $(TOP)/ext/misc/eval.c \ + $(TOP)/ext/misc/explain.c \ +- $(TOP)/ext/misc/fileio.c \ + $(TOP)/ext/misc/fuzzer.c \ + $(TOP)/ext/fts5/fts5_tcl.c \ + $(TOP)/ext/fts5/fts5_test_mi.c \ + $(TOP)/ext/fts5/fts5_test_tok.c \ +- $(TOP)/ext/misc/ieee754.c \ + $(TOP)/ext/misc/mmapwarm.c \ +- $(TOP)/ext/misc/nextchar.c \ + $(TOP)/ext/misc/normalize.c \ +- $(TOP)/ext/misc/percentile.c \ + $(TOP)/ext/misc/prefixes.c \ +- $(TOP)/ext/misc/regexp.c \ + $(TOP)/ext/misc/remember.c \ +- $(TOP)/ext/misc/series.c \ + $(TOP)/ext/misc/spellfix.c \ +- $(TOP)/ext/misc/totype.c \ + $(TOP)/ext/misc/unionvtab.c \ + $(TOP)/ext/misc/wholenumber.c \ +- $(TOP)/ext/misc/zipfile.c \ + $(TOP)/ext/userauth/userauth.c + + # Source code to the library files needed by the test fixture +@@ -647,25 +657,25 @@ + + libtclsqlite3.la: tclsqlite.lo libsqlite3.la + $(LTLINK) -no-undefined -o $@ tclsqlite.lo \ +- libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \ ++ libsqlite3.la @TCL_STUB_LIB_SPEC@ \ + -rpath "$(TCLLIBDIR)" \ + -version-info "8:6:8" \ + -avoid-version + +-sqlite3$(TEXE): shell.c sqlite3.c +- $(LTLINK) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \ +- shell.c sqlite3.c \ +- $(LIBREADLINE) $(TLIBS) -rpath "$(libdir)" ++sqlite3$(TEXE): shell.c libsqlite3.la ++ $(LTLINK) $(READLINE_FLAGS) -o $@ \ ++ shell.c libsqlite3.la \ ++ $(LIBREADLINE) + +-sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h +- $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS) ++sqldiff$(TEXE): $(TOP)/tool/sqldiff.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c libsqlite3.la + +-dbhash$(TEXE): $(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h +- $(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS) ++dbhash$(TEXE): $(TOP)/tool/dbhash.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/dbhash.c libsqlite3.la + +-scrub$(TEXE): $(TOP)/ext/misc/scrub.c sqlite3.lo ++scrub$(TEXE): $(TOP)/ext/misc/scrub.c libsqlite3.la + $(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \ +- $(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS) ++ $(TOP)/ext/misc/scrub.c libsqlite3.la + + srcck1$(BEXE): $(TOP)/tool/srcck1.c + $(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c +@@ -776,7 +786,7 @@ + # Rule to build the amalgamation + # + sqlite3.lo: sqlite3.c +- $(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c ++ $(LTCOMPILE) $(SHELL_OPT) $(TEMP_STORE) -c sqlite3.c + + # Rules to build the LEMON compiler generator + # +@@ -1082,18 +1092,6 @@ + # Source files that go into making shell.c + SHELL_SRC = \ + $(TOP)/src/shell.c.in \ +- $(TOP)/ext/misc/appendvfs.c \ +- $(TOP)/ext/misc/completion.c \ +- $(TOP)/ext/misc/decimal.c \ +- $(TOP)/ext/misc/fileio.c \ +- $(TOP)/ext/misc/ieee754.c \ +- $(TOP)/ext/misc/series.c \ +- $(TOP)/ext/misc/shathree.c \ +- $(TOP)/ext/misc/sqlar.c \ +- $(TOP)/ext/misc/uint.c \ +- $(TOP)/ext/expert/sqlite3expert.c \ +- $(TOP)/ext/expert/sqlite3expert.h \ +- $(TOP)/ext/misc/zipfile.c \ + $(TOP)/ext/misc/memtrace.c \ + $(TOP)/src/test_windirent.c + +@@ -1263,11 +1261,11 @@ + + # Fuzz testing + fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db +- ./fuzzcheck$(TEXE) $(FUZZDATA) ++ ./fuzzcheck$(TEXE) --timeout 3600 $(FUZZDATA) + ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db + + valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db +- valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 600 $(FUZZDATA) ++ valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 3600 $(FUZZDATA) + valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db + + # The veryquick.test TCL tests. +@@ -1301,24 +1299,23 @@ + shelltest: $(TESTPROGS) + ./testfixture$(TEXT) $(TOP)/test/permutations.test shell + +-sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in ++sqlite3_analyzer.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c + +-sqlite3_analyzer$(TEXE): sqlite3_analyzer.c +- $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) ++sqlite3_analyzer$(TEXE): sqlite3_analyzer.c libsqlite3.la ++ $(LTLINK) sqlite3_analyzer.c -o $@ libsqlite3.la $(LIBTCL) + +-sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in ++sqltclsh.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c + +-sqltclsh$(TEXE): sqltclsh.c +- $(LTLINK) sqltclsh.c -o $@ $(LIBTCL) $(TLIBS) ++sqltclsh$(TEXE): sqltclsh.c libsqlite3.la ++ $(LTLINK) sqltclsh.c -o $@ libsqlite3.la $(LIBTCL) + +-sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c +- $(LTLINK) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS) ++sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/expert.c libsqlite3.la ++ $(LTLINK) $(TOP)/ext/expert/expert.c -o sqlite3_expert libsqlite3.la + + CHECKER_DEPS =\ + $(TOP)/tool/mkccode.tcl \ +- sqlite3.c \ + $(TOP)/src/tclsqlite.c \ + $(TOP)/ext/repair/sqlite3_checker.tcl \ + $(TOP)/ext/repair/checkindex.c \ +@@ -1329,36 +1326,36 @@ + sqlite3_checker.c: $(CHECKER_DEPS) + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@ + +-sqlite3_checker$(TEXE): sqlite3_checker.c +- $(LTLINK) sqlite3_checker.c -o $@ $(LIBTCL) $(TLIBS) ++sqlite3_checker$(TEXE): sqlite3_checker.c libsqlite3.la ++ $(LTLINK) sqlite3_checker.c -o $@ libsqlite3.la $(LIBTCL) + +-dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo ++dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c libsqlite3.la + $(LTLINK) -DDBDUMP_STANDALONE -o $@ \ +- $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS) ++ $(TOP)/ext/misc/dbdump.c libsqlite3.la + +-dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c +- $(LTLINK)-o $@ $(TOP)/tool/dbtotxt.c ++dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c ++ $(LTLINK) -o $@ $(TOP)/tool/dbtotxt.c + +-showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS) ++showdb$(TEXE): $(TOP)/tool/showdb.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/showdb.c libsqlite3.la + +-showstat4$(TEXE): $(TOP)/tool/showstat4.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS) ++showstat4$(TEXE): $(TOP)/tool/showstat4.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/showstat4.c libsqlite3.la + +-showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS) ++showjournal$(TEXE): $(TOP)/tool/showjournal.c ++ $(LTLINK) -o $@ $(TOP)/tool/showjournal.c + +-showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS) ++showwal$(TEXE): $(TOP)/tool/showwal.c ++ $(LTLINK) -o $@ $(TOP)/tool/showwal.c + + showshm$(TEXE): $(TOP)/tool/showshm.c + $(LTLINK) -o $@ $(TOP)/tool/showshm.c + +-index_usage$(TEXE): $(TOP)/tool/index_usage.c sqlite3.lo +- $(LTLINK) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.lo $(TLIBS) ++index_usage$(TEXE): $(TOP)/tool/index_usage.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/index_usage.c libsqlite3.la + +-changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS) ++changeset$(TEXE): $(TOP)/ext/session/changeset.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c libsqlite3.la + + changesetfuzz$(TEXE): $(TOP)/ext/session/changesetfuzz.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS) +@@ -1383,11 +1380,11 @@ + kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c + $(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS) + +-rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo +- $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS) ++rbu$(EXE): $(TOP)/ext/rbu/rbu.c libsqlite3.la ++ $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c libsqlite3.la + +-loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la +- $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ $(TLIBS) ++loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la ++ $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ + + # This target will fail if the SQLite amalgamation contains any exported + # symbols that do not begin with "sqlite3_". It is run as part of the +--- /configure.ac ++++ /configure.ac +@@ -108,7 +108,7 @@ + ######### + # Figure out whether or not we have these functions + # +-AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64]) ++AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime]) + + ######### + # By default, we use the amalgamation (this may be changed below...) +@@ -582,6 +582,9 @@ + if test "${enable_load_extension}" = "yes" ; then + OPT_FEATURE_FLAGS="" + AC_SEARCH_LIBS(dlopen, dl) ++ if test "${ac_cv_search_dlopen}" = "no" ; then ++ OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" ++ fi + else + OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" + fi diff --git a/dev-db/sqlite/files/sqlite-3.34.1-build_2.2.patch b/dev-db/sqlite/files/sqlite-3.34.1-build_2.2.patch new file mode 100644 index 000000000000..7bb99c63c154 --- /dev/null +++ b/dev-db/sqlite/files/sqlite-3.34.1-build_2.2.patch @@ -0,0 +1,441 @@ +Move some code to libsqlite3.so to avoid duplication. +Initialize some extensions in libsqlite3.so. +Update test suite. + +SQLite revision: 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f + +--- /ext/repair/sqlite3_checker.c.in ++++ /ext/repair/sqlite3_checker.c.in +@@ -2,6 +2,7 @@ + ** Read an SQLite database file and analyze its space utilization. Generate + ** text on standard output. + */ ++#define SQLITE_CORE 1 + #define TCLSH_INIT_PROC sqlite3_checker_init_proc + #define SQLITE_ENABLE_DBPAGE_VTAB 1 + #define SQLITE_ENABLE_JSON1 1 +@@ -14,7 +15,7 @@ + #define SQLITE_OMIT_SHARED_CACHE 1 + #define SQLITE_DEFAULT_MEMSTATUS 0 + #define SQLITE_MAX_EXPR_DEPTH 0 +-INCLUDE sqlite3.c ++#include "sqlite3.h" + INCLUDE $ROOT/src/tclsqlite.c + INCLUDE $ROOT/ext/misc/btreeinfo.c + INCLUDE $ROOT/ext/repair/checkindex.c +--- /src/main.c ++++ /src/main.c +@@ -50,12 +50,36 @@ + #ifdef SQLITE_ENABLE_FTS5 + int sqlite3Fts5Init(sqlite3*); + #endif ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ++int sqlite3DbdataRegister(sqlite3*); ++#endif + #ifdef SQLITE_ENABLE_JSON1 + int sqlite3Json1Init(sqlite3*); + #endif + #ifdef SQLITE_ENABLE_STMTVTAB + int sqlite3StmtVtabInit(sqlite3*); + #endif ++int sqlite3AmatchInit(sqlite3*); ++int sqlite3CarrayInit(sqlite3*); ++int sqlite3CompletionVtabInit(sqlite3*); ++int sqlite3CsvInit(sqlite3*); ++int sqlite3DecimalInit(sqlite3*); ++int sqlite3EvalInit(sqlite3*); ++int sqlite3FileioInit(sqlite3*); ++int sqlite3IeeeInit(sqlite3*); ++int sqlite3NextcharInit(sqlite3*); ++int sqlite3PercentileInit(sqlite3*); ++int sqlite3RegexpInit(sqlite3*); ++int sqlite3SeriesInit(sqlite3*); ++int sqlite3ShaInit(sqlite3*); ++int sqlite3ShathreeInit(sqlite3*); ++int sqlite3TotypeInit(sqlite3*); ++int sqlite3UintInit(sqlite3*); ++int sqlite3UuidInit(sqlite3*); ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) ++int sqlite3ZipfileInit(sqlite3*); ++int sqlite3SqlarInit(sqlite3*); ++#endif + + /* + ** An array of pointers to extension initializer functions for +@@ -83,6 +107,9 @@ + #ifdef SQLITE_ENABLE_DBPAGE_VTAB + sqlite3DbpageRegister, + #endif ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ++ sqlite3DbdataRegister, ++#endif + #ifdef SQLITE_ENABLE_DBSTAT_VTAB + sqlite3DbstatRegister, + #endif +@@ -96,6 +123,27 @@ + #ifdef SQLITE_ENABLE_BYTECODE_VTAB + sqlite3VdbeBytecodeVtabInit, + #endif ++ sqlite3AmatchInit, ++ sqlite3CarrayInit, ++ sqlite3CompletionVtabInit, ++ sqlite3CsvInit, ++ sqlite3DecimalInit, ++ sqlite3EvalInit, ++ sqlite3FileioInit, ++ sqlite3IeeeInit, ++ sqlite3NextcharInit, ++ sqlite3PercentileInit, ++ sqlite3RegexpInit, ++ sqlite3SeriesInit, ++ sqlite3ShaInit, ++ sqlite3ShathreeInit, ++ sqlite3TotypeInit, ++ sqlite3UintInit, ++ sqlite3UuidInit, ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) ++ sqlite3ZipfileInit, ++ sqlite3SqlarInit, ++#endif + }; + + #ifndef SQLITE_AMALGAMATION +--- /src/shell.c.in ++++ /src/shell.c.in +@@ -69,6 +69,7 @@ + #include + #include + #include "sqlite3.h" ++#include "ext/expert/sqlite3expert.h" + typedef sqlite3_int64 i64; + typedef sqlite3_uint64 u64; + typedef unsigned char u8; +@@ -135,6 +136,10 @@ + # define SHELL_USE_LOCAL_GETLINE 1 + #endif + ++#ifdef SQLITE_HAVE_ZLIB ++#include ++#endif ++ + + #if defined(_WIN32) || defined(WIN32) + # if SQLITE_OS_WINRT +@@ -1018,25 +1023,7 @@ + INCLUDE test_windirent.c + #define dirent DIRENT + #endif +-INCLUDE ../ext/misc/shathree.c +-INCLUDE ../ext/misc/fileio.c +-INCLUDE ../ext/misc/completion.c +-INCLUDE ../ext/misc/appendvfs.c + INCLUDE ../ext/misc/memtrace.c +-INCLUDE ../ext/misc/uint.c +-INCLUDE ../ext/misc/decimal.c +-INCLUDE ../ext/misc/ieee754.c +-INCLUDE ../ext/misc/series.c +-#ifdef SQLITE_HAVE_ZLIB +-INCLUDE ../ext/misc/zipfile.c +-INCLUDE ../ext/misc/sqlar.c +-#endif +-INCLUDE ../ext/expert/sqlite3expert.h +-INCLUDE ../ext/expert/sqlite3expert.c +- +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) +-INCLUDE ../ext/misc/dbdata.c +-#endif + + #if defined(SQLITE_ENABLE_SESSION) + /* +@@ -4608,20 +4595,6 @@ + #ifndef SQLITE_OMIT_LOAD_EXTENSION + sqlite3_enable_load_extension(p->db, 1); + #endif +- sqlite3_fileio_init(p->db, 0, 0); +- sqlite3_shathree_init(p->db, 0, 0); +- sqlite3_completion_init(p->db, 0, 0); +- sqlite3_uint_init(p->db, 0, 0); +- sqlite3_decimal_init(p->db, 0, 0); +- sqlite3_ieee_init(p->db, 0, 0); +- sqlite3_series_init(p->db, 0, 0); +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) +- sqlite3_dbdata_init(p->db, 0, 0); +-#endif +-#ifdef SQLITE_HAVE_ZLIB +- sqlite3_zipfile_init(p->db, 0, 0); +- sqlite3_sqlar_init(p->db, 0, 0); +-#endif + sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0, + shellAddSchemaName, 0, 0); + sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0, +@@ -6644,8 +6617,6 @@ + ); + goto end_ar_command; + } +- sqlite3_fileio_init(cmd.db, 0, 0); +- sqlite3_sqlar_init(cmd.db, 0, 0); + sqlite3_create_function(cmd.db, "shell_putsnl", 1, SQLITE_UTF8, cmd.p, + shellPutsFunc, 0, 0); + +@@ -11076,6 +11047,7 @@ + #endif + } + data.out = stdout; ++ extern int sqlite3_appendvfs_init(sqlite3 *, char **, const sqlite3_api_routines *); + sqlite3_appendvfs_init(0,0,0); + + /* Go ahead and open the database file if it already exists. If the +--- /src/test_config.c ++++ /src/test_config.c +@@ -353,6 +353,8 @@ + Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); + #endif + ++ Tcl_SetVar2(interp, "sqlite_options", "decimal", "1", TCL_GLOBAL_ONLY); ++ + #ifdef SQLITE_OMIT_DECLTYPE + Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY); + #else +@@ -540,6 +542,8 @@ + Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); + #endif + ++ Tcl_SetVar2(interp, "sqlite_options", "regexp", "1", TCL_GLOBAL_ONLY); ++ + #ifdef SQLITE_OMIT_REINDEX + Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); + #else +@@ -662,6 +666,8 @@ + Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY); + #endif + ++ Tcl_SetVar2(interp, "sqlite_options", "uint", "1", TCL_GLOBAL_ONLY); ++ + #ifdef SQLITE_OMIT_UTF16 + Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); + #else +--- /test/e_expr.test ++++ /test/e_expr.test +@@ -1079,7 +1079,7 @@ + # + # There is a regexp function if ICU is enabled though. + # +-ifcapable !icu { ++ifcapable !icu&&!regexp { + do_catchsql_test e_expr-18.1.1 { + SELECT regexp('abc', 'def') + } {1 {no such function: regexp}} +--- /test/icu.test ++++ /test/icu.test +@@ -41,7 +41,7 @@ + # + test_expr icu-1.1 {i1='hello'} {i1 REGEXP 'hello'} 1 + test_expr icu-1.2 {i1='hello'} {i1 REGEXP '.ello'} 1 +- test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell'} 0 ++ test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell$'} 0 + test_expr icu-1.4 {i1='hello'} {i1 REGEXP '.ell.*'} 1 + test_expr icu-1.5 {i1=NULL} {i1 REGEXP '.ell.*'} {} + +--- /test/pragma.test ++++ /test/pragma.test +@@ -1370,17 +1370,62 @@ + } ;# ifcapable trigger + + ifcapable schema_pragmas { +- do_test pragma-11.1 { +- execsql2 { +- pragma collation_list; ++ ifcapable decimal { ++ ifcapable uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name UINT seq 1 name decimal seq 2 name RTRIM seq 3 name NOCASE seq 4 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 UINT 2 decimal 3 RTRIM 4 NOCASE 5 BINARY} + } +- } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY} +- do_test pragma-11.2 { +- db collate New_Collation blah... +- execsql { +- pragma collation_list; ++ ifcapable !uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name decimal seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 decimal 2 RTRIM 3 NOCASE 4 BINARY} + } +- } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY} ++ } ++ ifcapable !decimal { ++ ifcapable uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name UINT seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 UINT 2 RTRIM 3 NOCASE 4 BINARY} ++ } ++ ifcapable !uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY} ++ } ++ } + } + + ifcapable schema_pragmas&&tempdb { +--- /test/sessionfuzz.c ++++ /test/sessionfuzz.c +@@ -698,49 +698,6 @@ + #include + #include + #include +-#ifndef OMIT_ZLIB +-#include "zlib.h" +-#endif +- +-/* +-** Implementation of the "sqlar_uncompress(X,SZ)" SQL function +-** +-** Parameter SZ is interpreted as an integer. If it is less than or +-** equal to zero, then this function returns a copy of X. Or, if +-** SZ is equal to the size of X when interpreted as a blob, also +-** return a copy of X. Otherwise, decompress blob X using zlib +-** utility function uncompress() and return the results (another +-** blob). +-*/ +-static void sqlarUncompressFunc( +- sqlite3_context *context, +- int argc, +- sqlite3_value **argv +-){ +-#ifdef OMIT_ZLIB +- sqlite3_result_value(context, argv[0]); +-#else +- uLong nData; +- uLongf sz; +- +- assert( argc==2 ); +- sz = sqlite3_value_int(argv[1]); +- +- if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){ +- sqlite3_result_value(context, argv[0]); +- }else{ +- const Bytef *pData= sqlite3_value_blob(argv[0]); +- Bytef *pOut = sqlite3_malloc(sz); +- if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){ +- sqlite3_result_error(context, "error in uncompress()", -1); +- }else{ +- sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT); +- } +- sqlite3_free(pOut); +- } +-#endif +-} +- + + /* Run a chunk of SQL. If any errors happen, print an error message + ** and exit. +--- /tool/mksqlite3c.tcl ++++ /tool/mksqlite3c.tcl +@@ -129,6 +129,7 @@ + rtree.h + sqlite3session.h + sqlite3.h ++ sqlite3expert.h + sqlite3ext.h + sqlite3rbu.h + sqliteicu.h +@@ -416,6 +417,28 @@ + sqlite3session.c + fts5.c + stmt.c ++ amatch.c ++ appendvfs.c ++ carray.c ++ completion.c ++ csv.c ++ dbdata.c ++ decimal.c ++ eval.c ++ fileio.c ++ ieee754.c ++ nextchar.c ++ percentile.c ++ regexp.c ++ series.c ++ sha1.c ++ shathree.c ++ sqlar.c ++ sqlite3expert.c ++ totype.c ++ uint.c ++ uuid.c ++ zipfile.c + } { + copy_file tsrc/$file + } +--- /tool/sqlite3_analyzer.c.in ++++ /tool/sqlite3_analyzer.c.in +@@ -14,9 +14,6 @@ + #define SQLITE_DEFAULT_MEMSTATUS 0 + #define SQLITE_MAX_EXPR_DEPTH 0 + #define SQLITE_OMIT_LOAD_EXTENSION 1 +-#ifndef USE_EXTERNAL_SQLITE +-INCLUDE sqlite3.c +-#endif + INCLUDE $ROOT/src/tclsqlite.c + + const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){ +--- /tool/sqltclsh.c.in ++++ /tool/sqltclsh.c.in +@@ -27,21 +27,13 @@ + #define SQLITE_OMIT_SHARED_CACHE 1 + #define SQLITE_DEFAULT_MEMSTATUS 0 + #define SQLITE_MAX_EXPR_DEPTH 0 +-INCLUDE sqlite3.c +-INCLUDE $ROOT/ext/misc/appendvfs.c +-#ifdef SQLITE_HAVE_ZLIB +-INCLUDE $ROOT/ext/misc/zipfile.c +-INCLUDE $ROOT/ext/misc/sqlar.c +-#endif ++#include "sqlite3.h" + INCLUDE $ROOT/src/tclsqlite.c + + const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){ + (void)interp; ++ extern int sqlite3_appendvfs_init(sqlite3 *,char **, const sqlite3_api_routines *); + sqlite3_appendvfs_init(0,0,0); +-#ifdef SQLITE_HAVE_ZLIB +- sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init); +- sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init); +-#endif + + return + BEGIN_STRING diff --git a/dev-db/sqlite/files/sqlite-3.35.0-build_1.1.patch b/dev-db/sqlite/files/sqlite-3.35.0-build_1.1.patch new file mode 100644 index 000000000000..1506f3da93e7 --- /dev/null +++ b/dev-db/sqlite/files/sqlite-3.35.0-build_1.1.patch @@ -0,0 +1,375 @@ +Add initialization functions for internal usage in libsqlite3.so. + +SQLite revision: acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b + +--- /ext/misc/amatch.c ++++ /ext/misc/amatch.c +@@ -1480,9 +1480,18 @@ + + #endif /* SQLITE_OMIT_VIRTUALTABLE */ + ++int sqlite3AmatchInit(sqlite3 *db){ ++ int rc = SQLITE_OK; ++#ifndef SQLITE_OMIT_VIRTUALTABLE ++ rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0); ++#endif /* SQLITE_OMIT_VIRTUALTABLE */ ++ return rc; ++} ++ + /* + ** Register the amatch virtual table + */ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -1491,11 +1500,8 @@ + char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ +- int rc = SQLITE_OK; + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Not used */ +-#ifndef SQLITE_OMIT_VIRTUALTABLE +- rc = sqlite3_create_module(db, "approximate_match", &amatchModule, 0); +-#endif /* SQLITE_OMIT_VIRTUALTABLE */ +- return rc; ++ return sqlite3AmatchInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/carray.c ++++ /ext/misc/carray.c +@@ -498,16 +498,8 @@ + + #endif /* SQLITE_OMIT_VIRTUALTABLE */ + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_carray_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3CarrayInit(sqlite3 *db){ + int rc = SQLITE_OK; +- SQLITE_EXTENSION_INIT2(pApi); + #ifndef SQLITE_OMIT_VIRTUALTABLE + rc = sqlite3_create_module(db, "carray", &carrayModule, 0); + #ifdef SQLITE_TEST +@@ -519,3 +511,18 @@ + #endif /* SQLITE_OMIT_VIRTUALTABLE */ + return rc; + } ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) ++#ifdef _WIN32 ++__declspec(dllexport) ++#endif ++int sqlite3_carray_init( ++ sqlite3 *db, ++ char **pzErrMsg, ++ const sqlite3_api_routines *pApi ++){ ++ SQLITE_EXTENSION_INIT2(pApi); ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3CarrayInit(db); ++} ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/completion.c ++++ /ext/misc/completion.c +@@ -483,12 +483,13 @@ + return rc; + } + ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif + int sqlite3_completion_init( +- sqlite3 *db, +- char **pzErrMsg, ++ sqlite3 *db, ++ char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ + int rc = SQLITE_OK; +@@ -499,3 +500,4 @@ + #endif + return rc; + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/csv.c ++++ /ext/misc/csv.c +@@ -928,6 +928,22 @@ + #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ + + ++int sqlite3CsvInit(sqlite3 *db){ ++#ifndef SQLITE_OMIT_VIRTUALTABLE ++ int rc; ++ rc = sqlite3_create_module(db, "csv", &CsvModule, 0); ++#ifdef SQLITE_TEST ++ if( rc==SQLITE_OK ){ ++ rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0); ++ } ++#endif ++ return rc; ++#else ++ return SQLITE_OK; ++#endif ++} ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -941,17 +957,8 @@ + char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ +-#ifndef SQLITE_OMIT_VIRTUALTABLE +- int rc; + SQLITE_EXTENSION_INIT2(pApi); +- rc = sqlite3_create_module(db, "csv", &CsvModule, 0); +-#ifdef SQLITE_TEST +- if( rc==SQLITE_OK ){ +- rc = sqlite3_create_module(db, "csv_wr", &CsvModuleFauxWrite, 0); +- } +-#endif +- return rc; +-#else +- return SQLITE_OK; +-#endif ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3CsvInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/dbdata.c ++++ /ext/misc/dbdata.c +@@ -803,7 +803,7 @@ + /* + ** Invoke this routine to register the "sqlite_dbdata" virtual table module + */ +-static int sqlite3DbdataRegister(sqlite3 *db){ ++int sqlite3DbdataRegister(sqlite3 *db){ + static sqlite3_module dbdata_module = { + 0, /* iVersion */ + 0, /* xCreate */ +@@ -838,6 +838,7 @@ + return rc; + } + ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -849,3 +850,4 @@ + SQLITE_EXTENSION_INIT2(pApi); + return sqlite3DbdataRegister(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/decimal.c ++++ /ext/misc/decimal.c +@@ -590,14 +590,7 @@ + decimal_free(pB); + } + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_decimal_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3DecimalInit(sqlite3 *db){ + int rc = SQLITE_OK; + static const struct { + const char *zFuncName; +@@ -611,10 +604,6 @@ + { "decimal_mul", 2, decimalMulFunc }, + }; + unsigned int i; +- (void)pzErrMsg; /* Unused parameter */ +- +- SQLITE_EXTENSION_INIT2(pApi); +- + for(i=0; i +@@ -101,6 +103,20 @@ + } + + ++int sqlite3SqlarInit(sqlite3 *db){ ++ int rc = SQLITE_OK; ++ rc = sqlite3_create_function(db, "sqlar_compress", 1, ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0, ++ sqlarCompressFunc, 0, 0); ++ if( rc==SQLITE_OK ){ ++ rc = sqlite3_create_function(db, "sqlar_uncompress", 2, ++ SQLITE_UTF8|SQLITE_INNOCUOUS, 0, ++ sqlarUncompressFunc, 0, 0); ++ } ++ return rc; ++} ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -109,16 +125,10 @@ + char **pzErrMsg, + const sqlite3_api_routines *pApi + ){ +- int rc = SQLITE_OK; + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ +- rc = sqlite3_create_function(db, "sqlar_compress", 1, +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0, +- sqlarCompressFunc, 0, 0); +- if( rc==SQLITE_OK ){ +- rc = sqlite3_create_function(db, "sqlar_uncompress", 2, +- SQLITE_UTF8|SQLITE_INNOCUOUS, 0, +- sqlarUncompressFunc, 0, 0); +- } +- return rc; ++ return sqlite3SqlarInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ ++ ++#endif /* SQLITE_HAVE_ZLIB */ +--- /ext/misc/totype.c ++++ /ext/misc/totype.c +@@ -491,17 +491,8 @@ + #pragma warning(default: 4748) + #endif + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_totype_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3TotypeInit(sqlite3 *db){ + int rc = SQLITE_OK; +- SQLITE_EXTENSION_INIT2(pApi); +- (void)pzErrMsg; /* Unused parameter */ + rc = sqlite3_create_function(db, "tointeger", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0, + tointegerFunc, 0, 0); +@@ -512,3 +503,18 @@ + } + return rc; + } ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) ++#ifdef _WIN32 ++__declspec(dllexport) ++#endif ++int sqlite3_totype_init( ++ sqlite3 *db, ++ char **pzErrMsg, ++ const sqlite3_api_routines *pApi ++){ ++ SQLITE_EXTENSION_INIT2(pApi); ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3TotypeInit(db); ++} ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/uint.c ++++ /ext/misc/uint.c +@@ -78,6 +78,11 @@ + return (nKey1 - i) - (nKey2 - j); + } + ++int sqlite3UintInit(sqlite3 *db){ ++ return sqlite3_create_collation(db, "UINT", SQLITE_UTF8, 0, uintCollFunc); ++} ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -88,5 +93,6 @@ + ){ + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ +- return sqlite3_create_collation(db, "uint", SQLITE_UTF8, 0, uintCollFunc); ++ return sqlite3UintInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/uuid.c ++++ /ext/misc/uuid.c +@@ -206,21 +206,12 @@ + sqlite3_result_blob(context, pBlob, 16, SQLITE_TRANSIENT); + } + +-#ifdef _WIN32 +-__declspec(dllexport) +-#endif +-int sqlite3_uuid_init( +- sqlite3 *db, +- char **pzErrMsg, +- const sqlite3_api_routines *pApi +-){ ++int sqlite3UuidInit(sqlite3 *db){ + int rc = SQLITE_OK; +- SQLITE_EXTENSION_INIT2(pApi); +- (void)pzErrMsg; /* Unused parameter */ + rc = sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8|SQLITE_INNOCUOUS, 0, + sqlite3UuidFunc, 0, 0); + if( rc==SQLITE_OK ){ +- rc = sqlite3_create_function(db, "uuid_str", 1, ++ rc = sqlite3_create_function(db, "uuid_str", 1, + SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC, + 0, sqlite3UuidStrFunc, 0, 0); + } +@@ -231,3 +222,18 @@ + } + return rc; + } ++ ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) ++#ifdef _WIN32 ++__declspec(dllexport) ++#endif ++int sqlite3_uuid_init( ++ sqlite3 *db, ++ char **pzErrMsg, ++ const sqlite3_api_routines *pApi ++){ ++ SQLITE_EXTENSION_INIT2(pApi); ++ (void)pzErrMsg; /* Unused parameter */ ++ return sqlite3UuidInit(db); ++} ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ +--- /ext/misc/zipfile.c ++++ /ext/misc/zipfile.c +@@ -24,6 +24,8 @@ + ** * No support for zip64 extensions + ** * Only the "inflate/deflate" (zlib) compression method is supported + */ ++#ifdef SQLITE_HAVE_ZLIB ++ + #include "sqlite3ext.h" + SQLITE_EXTENSION_INIT1 + #include +@@ -2139,7 +2141,7 @@ + /* + ** Register the "zipfile" virtual table. + */ +-static int zipfileRegister(sqlite3 *db){ ++int sqlite3ZipfileInit(sqlite3 *db){ + static sqlite3_module zipfileModule = { + 1, /* iVersion */ + zipfileConnect, /* xCreate */ +@@ -2173,9 +2175,10 @@ + return rc; + } + #else /* SQLITE_OMIT_VIRTUALTABLE */ +-# define zipfileRegister(x) SQLITE_OK ++# define sqlite3ZipfileInit(x) SQLITE_OK + #endif + ++#if !defined(SQLITE_CORE) || defined(SQLITE_TEST) + #ifdef _WIN32 + __declspec(dllexport) + #endif +@@ -2186,5 +2189,8 @@ + ){ + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ +- return zipfileRegister(db); ++ return sqlite3ZipfileInit(db); + } ++#endif /* !defined(SQLITE_CORE) || defined(SQLITE_TEST) */ ++ ++#endif /* SQLITE_HAVE_ZLIB */ diff --git a/dev-db/sqlite/files/sqlite-3.35.0-build_2.1.patch b/dev-db/sqlite/files/sqlite-3.35.0-build_2.1.patch new file mode 100644 index 000000000000..383a4936bf0f --- /dev/null +++ b/dev-db/sqlite/files/sqlite-3.35.0-build_2.1.patch @@ -0,0 +1,292 @@ +Move some code to libsqlite3.so to avoid duplication. +Link executables against libsqlite3.so. +Increase timeout for fuzzcheck. +Update list of optionally available functions. +Fix building with dlopen() not available. + +SQLite revision: acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b + +--- /Makefile.in ++++ /Makefile.in +@@ -313,6 +313,9 @@ + # Source code for extensions + # + SRC += \ ++ $(TOP)/ext/expert/sqlite3expert.c \ ++ $(TOP)/ext/expert/sqlite3expert.h ++SRC += \ + $(TOP)/ext/fts1/fts1.c \ + $(TOP)/ext/fts1/fts1.h \ + $(TOP)/ext/fts1/fts1_hash.c \ +@@ -365,8 +368,29 @@ + $(TOP)/ext/rbu/sqlite3rbu.h \ + $(TOP)/ext/rbu/sqlite3rbu.c + SRC += \ ++ $(TOP)/ext/misc/amatch.c \ ++ $(TOP)/ext/misc/appendvfs.c \ ++ $(TOP)/ext/misc/carray.c \ ++ $(TOP)/ext/misc/completion.c \ ++ $(TOP)/ext/misc/csv.c \ ++ $(TOP)/ext/misc/dbdata.c \ ++ $(TOP)/ext/misc/decimal.c \ ++ $(TOP)/ext/misc/eval.c \ ++ $(TOP)/ext/misc/fileio.c \ ++ $(TOP)/ext/misc/ieee754.c \ + $(TOP)/ext/misc/json1.c \ +- $(TOP)/ext/misc/stmt.c ++ $(TOP)/ext/misc/nextchar.c \ ++ $(TOP)/ext/misc/percentile.c \ ++ $(TOP)/ext/misc/regexp.c \ ++ $(TOP)/ext/misc/series.c \ ++ $(TOP)/ext/misc/sha1.c \ ++ $(TOP)/ext/misc/shathree.c \ ++ $(TOP)/ext/misc/sqlar.c \ ++ $(TOP)/ext/misc/stmt.c \ ++ $(TOP)/ext/misc/totype.c \ ++ $(TOP)/ext/misc/uint.c \ ++ $(TOP)/ext/misc/uuid.c \ ++ $(TOP)/ext/misc/zipfile.c + + # Generated source code files + # +@@ -437,36 +461,21 @@ + # Statically linked extensions + # + TESTSRC += \ +- $(TOP)/ext/expert/sqlite3expert.c \ + $(TOP)/ext/expert/test_expert.c \ +- $(TOP)/ext/misc/amatch.c \ +- $(TOP)/ext/misc/appendvfs.c \ +- $(TOP)/ext/misc/carray.c \ + $(TOP)/ext/misc/cksumvfs.c \ + $(TOP)/ext/misc/closure.c \ +- $(TOP)/ext/misc/csv.c \ +- $(TOP)/ext/misc/decimal.c \ +- $(TOP)/ext/misc/eval.c \ + $(TOP)/ext/misc/explain.c \ +- $(TOP)/ext/misc/fileio.c \ + $(TOP)/ext/misc/fuzzer.c \ + $(TOP)/ext/fts5/fts5_tcl.c \ + $(TOP)/ext/fts5/fts5_test_mi.c \ + $(TOP)/ext/fts5/fts5_test_tok.c \ +- $(TOP)/ext/misc/ieee754.c \ + $(TOP)/ext/misc/mmapwarm.c \ +- $(TOP)/ext/misc/nextchar.c \ + $(TOP)/ext/misc/normalize.c \ +- $(TOP)/ext/misc/percentile.c \ + $(TOP)/ext/misc/prefixes.c \ +- $(TOP)/ext/misc/regexp.c \ + $(TOP)/ext/misc/remember.c \ +- $(TOP)/ext/misc/series.c \ + $(TOP)/ext/misc/spellfix.c \ +- $(TOP)/ext/misc/totype.c \ + $(TOP)/ext/misc/unionvtab.c \ + $(TOP)/ext/misc/wholenumber.c \ +- $(TOP)/ext/misc/zipfile.c \ + $(TOP)/ext/userauth/userauth.c + + # Source code to the library files needed by the test fixture +@@ -648,25 +657,25 @@ + + libtclsqlite3.la: tclsqlite.lo libsqlite3.la + $(LTLINK) -no-undefined -o $@ tclsqlite.lo \ +- libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \ ++ libsqlite3.la @TCL_STUB_LIB_SPEC@ \ + -rpath "$(TCLLIBDIR)" \ + -version-info "8:6:8" \ + -avoid-version + +-sqlite3$(TEXE): shell.c sqlite3.c +- $(LTLINK) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \ +- shell.c sqlite3.c \ +- $(LIBREADLINE) $(TLIBS) -rpath "$(libdir)" ++sqlite3$(TEXE): shell.c libsqlite3.la ++ $(LTLINK) $(READLINE_FLAGS) -o $@ \ ++ shell.c libsqlite3.la \ ++ $(LIBREADLINE) + +-sqldiff$(TEXE): $(TOP)/tool/sqldiff.c sqlite3.lo sqlite3.h +- $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.lo $(TLIBS) ++sqldiff$(TEXE): $(TOP)/tool/sqldiff.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/sqldiff.c libsqlite3.la + +-dbhash$(TEXE): $(TOP)/tool/dbhash.c sqlite3.lo sqlite3.h +- $(LTLINK) -o $@ $(TOP)/tool/dbhash.c sqlite3.lo $(TLIBS) ++dbhash$(TEXE): $(TOP)/tool/dbhash.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/dbhash.c libsqlite3.la + +-scrub$(TEXE): $(TOP)/ext/misc/scrub.c sqlite3.lo ++scrub$(TEXE): $(TOP)/ext/misc/scrub.c libsqlite3.la + $(LTLINK) -o $@ -I. -DSCRUB_STANDALONE \ +- $(TOP)/ext/misc/scrub.c sqlite3.lo $(TLIBS) ++ $(TOP)/ext/misc/scrub.c libsqlite3.la + + srcck1$(BEXE): $(TOP)/tool/srcck1.c + $(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c +@@ -777,7 +786,7 @@ + # Rule to build the amalgamation + # + sqlite3.lo: sqlite3.c +- $(LTCOMPILE) $(TEMP_STORE) -c sqlite3.c ++ $(LTCOMPILE) $(SHELL_OPT) $(TEMP_STORE) -c sqlite3.c + + # Rules to build the LEMON compiler generator + # +@@ -1083,18 +1092,6 @@ + # Source files that go into making shell.c + SHELL_SRC = \ + $(TOP)/src/shell.c.in \ +- $(TOP)/ext/misc/appendvfs.c \ +- $(TOP)/ext/misc/completion.c \ +- $(TOP)/ext/misc/decimal.c \ +- $(TOP)/ext/misc/fileio.c \ +- $(TOP)/ext/misc/ieee754.c \ +- $(TOP)/ext/misc/series.c \ +- $(TOP)/ext/misc/shathree.c \ +- $(TOP)/ext/misc/sqlar.c \ +- $(TOP)/ext/misc/uint.c \ +- $(TOP)/ext/expert/sqlite3expert.c \ +- $(TOP)/ext/expert/sqlite3expert.h \ +- $(TOP)/ext/misc/zipfile.c \ + $(TOP)/ext/misc/memtrace.c \ + $(TOP)/src/test_windirent.c + +@@ -1264,11 +1261,11 @@ + + # Fuzz testing + fuzztest: fuzzcheck$(TEXE) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db +- ./fuzzcheck$(TEXE) $(FUZZDATA) ++ ./fuzzcheck$(TEXE) --timeout 3600 $(FUZZDATA) + ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db + + valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessionfuzz-data1.db +- valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M $(FUZZDATA) ++ valgrind ./fuzzcheck$(TEXE) --cell-size-check --limit-mem 10M --timeout 3600 $(FUZZDATA) + valgrind ./sessionfuzz$(TEXE) run $(TOP)/test/sessionfuzz-data1.db + + # The veryquick.test TCL tests. +@@ -1302,24 +1299,23 @@ + shelltest: $(TESTPROGS) + ./testfixture$(TEXT) $(TOP)/test/permutations.test shell + +-sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in ++sqlite3_analyzer.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqlite3_analyzer.c.in >sqlite3_analyzer.c + +-sqlite3_analyzer$(TEXE): sqlite3_analyzer.c +- $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) ++sqlite3_analyzer$(TEXE): sqlite3_analyzer.c libsqlite3.la ++ $(LTLINK) sqlite3_analyzer.c -o $@ libsqlite3.la $(LIBTCL) + +-sqltclsh.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/ext/misc/appendvfs.c $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in ++sqltclsh.c: $(TOP)/src/tclsqlite.c $(TOP)/tool/sqltclsh.tcl $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/tool/sqltclsh.c.in >sqltclsh.c + +-sqltclsh$(TEXE): sqltclsh.c +- $(LTLINK) sqltclsh.c -o $@ $(LIBTCL) $(TLIBS) ++sqltclsh$(TEXE): sqltclsh.c libsqlite3.la ++ $(LTLINK) sqltclsh.c -o $@ libsqlite3.la $(LIBTCL) + +-sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c +- $(LTLINK) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c $(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(TLIBS) ++sqlite3_expert$(TEXE): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/expert.c libsqlite3.la ++ $(LTLINK) $(TOP)/ext/expert/expert.c -o sqlite3_expert libsqlite3.la + + CHECKER_DEPS =\ + $(TOP)/tool/mkccode.tcl \ +- sqlite3.c \ + $(TOP)/src/tclsqlite.c \ + $(TOP)/ext/repair/sqlite3_checker.tcl \ + $(TOP)/ext/repair/checkindex.c \ +@@ -1330,36 +1326,36 @@ + sqlite3_checker.c: $(CHECKER_DEPS) + $(TCLSH_CMD) $(TOP)/tool/mkccode.tcl $(TOP)/ext/repair/sqlite3_checker.c.in >$@ + +-sqlite3_checker$(TEXE): sqlite3_checker.c +- $(LTLINK) sqlite3_checker.c -o $@ $(LIBTCL) $(TLIBS) ++sqlite3_checker$(TEXE): sqlite3_checker.c libsqlite3.la ++ $(LTLINK) sqlite3_checker.c -o $@ libsqlite3.la $(LIBTCL) + +-dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c sqlite3.lo ++dbdump$(TEXE): $(TOP)/ext/misc/dbdump.c libsqlite3.la + $(LTLINK) -DDBDUMP_STANDALONE -o $@ \ +- $(TOP)/ext/misc/dbdump.c sqlite3.lo $(TLIBS) ++ $(TOP)/ext/misc/dbdump.c libsqlite3.la + +-dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c +- $(LTLINK)-o $@ $(TOP)/tool/dbtotxt.c ++dbtotxt$(TEXE): $(TOP)/tool/dbtotxt.c ++ $(LTLINK) -o $@ $(TOP)/tool/dbtotxt.c + +-showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS) ++showdb$(TEXE): $(TOP)/tool/showdb.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/showdb.c libsqlite3.la + +-showstat4$(TEXE): $(TOP)/tool/showstat4.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS) ++showstat4$(TEXE): $(TOP)/tool/showstat4.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/showstat4.c libsqlite3.la + +-showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS) ++showjournal$(TEXE): $(TOP)/tool/showjournal.c ++ $(LTLINK) -o $@ $(TOP)/tool/showjournal.c + +-showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS) ++showwal$(TEXE): $(TOP)/tool/showwal.c ++ $(LTLINK) -o $@ $(TOP)/tool/showwal.c + + showshm$(TEXE): $(TOP)/tool/showshm.c + $(LTLINK) -o $@ $(TOP)/tool/showshm.c + +-index_usage$(TEXE): $(TOP)/tool/index_usage.c sqlite3.lo +- $(LTLINK) $(SHELL_OPT) -o $@ $(TOP)/tool/index_usage.c sqlite3.lo $(TLIBS) ++index_usage$(TEXE): $(TOP)/tool/index_usage.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/tool/index_usage.c libsqlite3.la + +-changeset$(TEXE): $(TOP)/ext/session/changeset.c sqlite3.lo +- $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c sqlite3.lo $(TLIBS) ++changeset$(TEXE): $(TOP)/ext/session/changeset.c libsqlite3.la ++ $(LTLINK) -o $@ $(TOP)/ext/session/changeset.c libsqlite3.la + + changesetfuzz$(TEXE): $(TOP)/ext/session/changesetfuzz.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/ext/session/changesetfuzz.c sqlite3.lo $(TLIBS) +@@ -1387,11 +1383,11 @@ + kvtest$(TEXE): $(TOP)/test/kvtest.c sqlite3.c + $(LTLINK) $(KV_OPT) -o $@ $(TOP)/test/kvtest.c sqlite3.c $(TLIBS) + +-rbu$(EXE): $(TOP)/ext/rbu/rbu.c $(TOP)/ext/rbu/sqlite3rbu.c sqlite3.lo +- $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c sqlite3.lo $(TLIBS) ++rbu$(EXE): $(TOP)/ext/rbu/rbu.c libsqlite3.la ++ $(LTLINK) -I. -o $@ $(TOP)/ext/rbu/rbu.c libsqlite3.la + +-loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la +- $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ $(TLIBS) ++loadfts$(EXE): $(TOP)/tool/loadfts.c libsqlite3.la ++ $(LTLINK) $(TOP)/tool/loadfts.c libsqlite3.la -o $@ + + # This target will fail if the SQLite amalgamation contains any exported + # symbols that do not begin with "sqlite3_". It is run as part of the +--- /configure.ac ++++ /configure.ac +@@ -108,7 +108,7 @@ + ######### + # Figure out whether or not we have these functions + # +-AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64]) ++AC_CHECK_FUNCS([fdatasync fullfsync gmtime_r isnan localtime_r localtime_s malloc_usable_size posix_fallocate pread pread64 pwrite pwrite64 strchrnul usleep utime]) + + ######### + # By default, we use the amalgamation (this may be changed below...) +@@ -587,6 +587,9 @@ + if test "${enable_load_extension}" = "yes" ; then + OPT_FEATURE_FLAGS="" + AC_SEARCH_LIBS(dlopen, dl) ++ if test "${ac_cv_search_dlopen}" = "no" ; then ++ OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" ++ fi + else + OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" + fi diff --git a/dev-db/sqlite/files/sqlite-3.35.0-build_2.2.patch b/dev-db/sqlite/files/sqlite-3.35.0-build_2.2.patch new file mode 100644 index 000000000000..99350c794495 --- /dev/null +++ b/dev-db/sqlite/files/sqlite-3.35.0-build_2.2.patch @@ -0,0 +1,441 @@ +Move some code to libsqlite3.so to avoid duplication. +Initialize some extensions in libsqlite3.so. +Update test suite. + +SQLite revision: acd63062eb06748bfe9e4886639e4f2b54ea6a496a83f10716abbaba4115500b + +--- /ext/repair/sqlite3_checker.c.in ++++ /ext/repair/sqlite3_checker.c.in +@@ -2,6 +2,7 @@ + ** Read an SQLite database file and analyze its space utilization. Generate + ** text on standard output. + */ ++#define SQLITE_CORE 1 + #define TCLSH_INIT_PROC sqlite3_checker_init_proc + #define SQLITE_ENABLE_DBPAGE_VTAB 1 + #define SQLITE_ENABLE_JSON1 1 +@@ -14,7 +15,7 @@ + #define SQLITE_OMIT_SHARED_CACHE 1 + #define SQLITE_DEFAULT_MEMSTATUS 0 + #define SQLITE_MAX_EXPR_DEPTH 0 +-INCLUDE sqlite3.c ++#include "sqlite3.h" + INCLUDE $ROOT/src/tclsqlite.c + INCLUDE $ROOT/ext/misc/btreeinfo.c + INCLUDE $ROOT/ext/repair/checkindex.c +--- /src/main.c ++++ /src/main.c +@@ -50,12 +50,36 @@ + #ifdef SQLITE_ENABLE_FTS5 + int sqlite3Fts5Init(sqlite3*); + #endif ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ++int sqlite3DbdataRegister(sqlite3*); ++#endif + #ifdef SQLITE_ENABLE_JSON1 + int sqlite3Json1Init(sqlite3*); + #endif + #ifdef SQLITE_ENABLE_STMTVTAB + int sqlite3StmtVtabInit(sqlite3*); + #endif ++int sqlite3AmatchInit(sqlite3*); ++int sqlite3CarrayInit(sqlite3*); ++int sqlite3CompletionVtabInit(sqlite3*); ++int sqlite3CsvInit(sqlite3*); ++int sqlite3DecimalInit(sqlite3*); ++int sqlite3EvalInit(sqlite3*); ++int sqlite3FileioInit(sqlite3*); ++int sqlite3IeeeInit(sqlite3*); ++int sqlite3NextcharInit(sqlite3*); ++int sqlite3PercentileInit(sqlite3*); ++int sqlite3RegexpInit(sqlite3*); ++int sqlite3SeriesInit(sqlite3*); ++int sqlite3ShaInit(sqlite3*); ++int sqlite3ShathreeInit(sqlite3*); ++int sqlite3TotypeInit(sqlite3*); ++int sqlite3UintInit(sqlite3*); ++int sqlite3UuidInit(sqlite3*); ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) ++int sqlite3ZipfileInit(sqlite3*); ++int sqlite3SqlarInit(sqlite3*); ++#endif + + /* + ** An array of pointers to extension initializer functions for +@@ -83,6 +107,9 @@ + #ifdef SQLITE_ENABLE_DBPAGE_VTAB + sqlite3DbpageRegister, + #endif ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ++ sqlite3DbdataRegister, ++#endif + #ifdef SQLITE_ENABLE_DBSTAT_VTAB + sqlite3DbstatRegister, + #endif +@@ -96,6 +123,27 @@ + #ifdef SQLITE_ENABLE_BYTECODE_VTAB + sqlite3VdbeBytecodeVtabInit, + #endif ++ sqlite3AmatchInit, ++ sqlite3CarrayInit, ++ sqlite3CompletionVtabInit, ++ sqlite3CsvInit, ++ sqlite3DecimalInit, ++ sqlite3EvalInit, ++ sqlite3FileioInit, ++ sqlite3IeeeInit, ++ sqlite3NextcharInit, ++ sqlite3PercentileInit, ++ sqlite3RegexpInit, ++ sqlite3SeriesInit, ++ sqlite3ShaInit, ++ sqlite3ShathreeInit, ++ sqlite3TotypeInit, ++ sqlite3UintInit, ++ sqlite3UuidInit, ++#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) ++ sqlite3ZipfileInit, ++ sqlite3SqlarInit, ++#endif + }; + + #ifndef SQLITE_AMALGAMATION +--- /src/shell.c.in ++++ /src/shell.c.in +@@ -69,6 +69,7 @@ + #include + #include + #include "sqlite3.h" ++#include "ext/expert/sqlite3expert.h" + typedef sqlite3_int64 i64; + typedef sqlite3_uint64 u64; + typedef unsigned char u8; +@@ -135,6 +136,10 @@ + # define SHELL_USE_LOCAL_GETLINE 1 + #endif + ++#ifdef SQLITE_HAVE_ZLIB ++#include ++#endif ++ + + #if defined(_WIN32) || defined(WIN32) + # if SQLITE_OS_WINRT +@@ -1018,25 +1023,7 @@ + INCLUDE test_windirent.c + #define dirent DIRENT + #endif +-INCLUDE ../ext/misc/shathree.c +-INCLUDE ../ext/misc/fileio.c +-INCLUDE ../ext/misc/completion.c +-INCLUDE ../ext/misc/appendvfs.c + INCLUDE ../ext/misc/memtrace.c +-INCLUDE ../ext/misc/uint.c +-INCLUDE ../ext/misc/decimal.c +-INCLUDE ../ext/misc/ieee754.c +-INCLUDE ../ext/misc/series.c +-#ifdef SQLITE_HAVE_ZLIB +-INCLUDE ../ext/misc/zipfile.c +-INCLUDE ../ext/misc/sqlar.c +-#endif +-INCLUDE ../ext/expert/sqlite3expert.h +-INCLUDE ../ext/expert/sqlite3expert.c +- +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) +-INCLUDE ../ext/misc/dbdata.c +-#endif + + #if defined(SQLITE_ENABLE_SESSION) + /* +@@ -4608,20 +4595,6 @@ + #ifndef SQLITE_OMIT_LOAD_EXTENSION + sqlite3_enable_load_extension(p->db, 1); + #endif +- sqlite3_fileio_init(p->db, 0, 0); +- sqlite3_shathree_init(p->db, 0, 0); +- sqlite3_completion_init(p->db, 0, 0); +- sqlite3_uint_init(p->db, 0, 0); +- sqlite3_decimal_init(p->db, 0, 0); +- sqlite3_ieee_init(p->db, 0, 0); +- sqlite3_series_init(p->db, 0, 0); +-#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) +- sqlite3_dbdata_init(p->db, 0, 0); +-#endif +-#ifdef SQLITE_HAVE_ZLIB +- sqlite3_zipfile_init(p->db, 0, 0); +- sqlite3_sqlar_init(p->db, 0, 0); +-#endif + sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0, + shellAddSchemaName, 0, 0); + sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0, +@@ -6644,8 +6617,6 @@ + ); + goto end_ar_command; + } +- sqlite3_fileio_init(cmd.db, 0, 0); +- sqlite3_sqlar_init(cmd.db, 0, 0); + sqlite3_create_function(cmd.db, "shell_putsnl", 1, SQLITE_UTF8, cmd.p, + shellPutsFunc, 0, 0); + +@@ -11108,6 +11079,7 @@ + #endif + } + data.out = stdout; ++ extern int sqlite3_appendvfs_init(sqlite3 *, char **, const sqlite3_api_routines *); + sqlite3_appendvfs_init(0,0,0); + + /* Go ahead and open the database file if it already exists. If the +--- /src/test_config.c ++++ /src/test_config.c +@@ -359,6 +359,8 @@ + Tcl_SetVar2(interp, "sqlite_options", "datetime", "1", TCL_GLOBAL_ONLY); + #endif + ++ Tcl_SetVar2(interp, "sqlite_options", "decimal", "1", TCL_GLOBAL_ONLY); ++ + #ifdef SQLITE_OMIT_DECLTYPE + Tcl_SetVar2(interp, "sqlite_options", "decltype", "0", TCL_GLOBAL_ONLY); + #else +@@ -546,6 +548,8 @@ + Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); + #endif + ++ Tcl_SetVar2(interp, "sqlite_options", "regexp", "1", TCL_GLOBAL_ONLY); ++ + #ifdef SQLITE_OMIT_REINDEX + Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); + #else +@@ -668,6 +672,8 @@ + Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY); + #endif + ++ Tcl_SetVar2(interp, "sqlite_options", "uint", "1", TCL_GLOBAL_ONLY); ++ + #ifdef SQLITE_OMIT_UTF16 + Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY); + #else +--- /test/e_expr.test ++++ /test/e_expr.test +@@ -1079,7 +1079,7 @@ + # + # There is a regexp function if ICU is enabled though. + # +-ifcapable !icu { ++ifcapable !icu&&!regexp { + do_catchsql_test e_expr-18.1.1 { + SELECT regexp('abc', 'def') + } {1 {no such function: regexp}} +--- /test/icu.test ++++ /test/icu.test +@@ -41,7 +41,7 @@ + # + test_expr icu-1.1 {i1='hello'} {i1 REGEXP 'hello'} 1 + test_expr icu-1.2 {i1='hello'} {i1 REGEXP '.ello'} 1 +- test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell'} 0 ++ test_expr icu-1.3 {i1='hello'} {i1 REGEXP '.ell$'} 0 + test_expr icu-1.4 {i1='hello'} {i1 REGEXP '.ell.*'} 1 + test_expr icu-1.5 {i1=NULL} {i1 REGEXP '.ell.*'} {} + +--- /test/pragma.test ++++ /test/pragma.test +@@ -1370,17 +1370,62 @@ + } ;# ifcapable trigger + + ifcapable schema_pragmas { +- do_test pragma-11.1 { +- execsql2 { +- pragma collation_list; ++ ifcapable decimal { ++ ifcapable uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name UINT seq 1 name decimal seq 2 name RTRIM seq 3 name NOCASE seq 4 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 UINT 2 decimal 3 RTRIM 4 NOCASE 5 BINARY} + } +- } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY} +- do_test pragma-11.2 { +- db collate New_Collation blah... +- execsql { +- pragma collation_list; ++ ifcapable !uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name decimal seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 decimal 2 RTRIM 3 NOCASE 4 BINARY} + } +- } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY} ++ } ++ ifcapable !decimal { ++ ifcapable uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name UINT seq 1 name RTRIM seq 2 name NOCASE seq 3 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 UINT 2 RTRIM 3 NOCASE 4 BINARY} ++ } ++ ifcapable !uint { ++ do_test pragma-11.1 { ++ execsql2 { ++ pragma collation_list; ++ } ++ } {seq 0 name RTRIM seq 1 name NOCASE seq 2 name BINARY} ++ do_test pragma-11.2 { ++ db collate New_Collation blah... ++ execsql { ++ pragma collation_list; ++ } ++ } {0 New_Collation 1 RTRIM 2 NOCASE 3 BINARY} ++ } ++ } + } + + ifcapable schema_pragmas&&tempdb { +--- /test/sessionfuzz.c ++++ /test/sessionfuzz.c +@@ -698,49 +698,6 @@ + #include + #include + #include +-#ifndef OMIT_ZLIB +-#include "zlib.h" +-#endif +- +-/* +-** Implementation of the "sqlar_uncompress(X,SZ)" SQL function +-** +-** Parameter SZ is interpreted as an integer. If it is less than or +-** equal to zero, then this function returns a copy of X. Or, if +-** SZ is equal to the size of X when interpreted as a blob, also +-** return a copy of X. Otherwise, decompress blob X using zlib +-** utility function uncompress() and return the results (another +-** blob). +-*/ +-static void sqlarUncompressFunc( +- sqlite3_context *context, +- int argc, +- sqlite3_value **argv +-){ +-#ifdef OMIT_ZLIB +- sqlite3_result_value(context, argv[0]); +-#else +- uLong nData; +- uLongf sz; +- +- assert( argc==2 ); +- sz = sqlite3_value_int(argv[1]); +- +- if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){ +- sqlite3_result_value(context, argv[0]); +- }else{ +- const Bytef *pData= sqlite3_value_blob(argv[0]); +- Bytef *pOut = sqlite3_malloc(sz); +- if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){ +- sqlite3_result_error(context, "error in uncompress()", -1); +- }else{ +- sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT); +- } +- sqlite3_free(pOut); +- } +-#endif +-} +- + + /* Run a chunk of SQL. If any errors happen, print an error message + ** and exit. +--- /tool/mksqlite3c.tcl ++++ /tool/mksqlite3c.tcl +@@ -129,6 +129,7 @@ + rtree.h + sqlite3session.h + sqlite3.h ++ sqlite3expert.h + sqlite3ext.h + sqlite3rbu.h + sqliteicu.h +@@ -416,6 +417,28 @@ + sqlite3session.c + fts5.c + stmt.c ++ amatch.c ++ appendvfs.c ++ carray.c ++ completion.c ++ csv.c ++ dbdata.c ++ decimal.c ++ eval.c ++ fileio.c ++ ieee754.c ++ nextchar.c ++ percentile.c ++ regexp.c ++ series.c ++ sha1.c ++ shathree.c ++ sqlar.c ++ sqlite3expert.c ++ totype.c ++ uint.c ++ uuid.c ++ zipfile.c + } { + copy_file tsrc/$file + } +--- /tool/sqlite3_analyzer.c.in ++++ /tool/sqlite3_analyzer.c.in +@@ -14,9 +14,6 @@ + #define SQLITE_DEFAULT_MEMSTATUS 0 + #define SQLITE_MAX_EXPR_DEPTH 0 + #define SQLITE_OMIT_LOAD_EXTENSION 1 +-#ifndef USE_EXTERNAL_SQLITE +-INCLUDE sqlite3.c +-#endif + INCLUDE $ROOT/src/tclsqlite.c + + const char *sqlite3_analyzer_init_proc(Tcl_Interp *interp){ +--- /tool/sqltclsh.c.in ++++ /tool/sqltclsh.c.in +@@ -27,21 +27,13 @@ + #define SQLITE_OMIT_SHARED_CACHE 1 + #define SQLITE_DEFAULT_MEMSTATUS 0 + #define SQLITE_MAX_EXPR_DEPTH 0 +-INCLUDE sqlite3.c +-INCLUDE $ROOT/ext/misc/appendvfs.c +-#ifdef SQLITE_HAVE_ZLIB +-INCLUDE $ROOT/ext/misc/zipfile.c +-INCLUDE $ROOT/ext/misc/sqlar.c +-#endif ++#include "sqlite3.h" + INCLUDE $ROOT/src/tclsqlite.c + + const char *sqlite3_tclapp_init_proc(Tcl_Interp *interp){ + (void)interp; ++ extern int sqlite3_appendvfs_init(sqlite3 *,char **, const sqlite3_api_routines *); + sqlite3_appendvfs_init(0,0,0); +-#ifdef SQLITE_HAVE_ZLIB +- sqlite3_auto_extension((void(*)(void))sqlite3_sqlar_init); +- sqlite3_auto_extension((void(*)(void))sqlite3_zipfile_init); +-#endif + + return + BEGIN_STRING diff --git a/dev-db/sqlite/sqlite-3.34.1.ebuild b/dev-db/sqlite/sqlite-3.34.1.ebuild new file mode 100644 index 000000000000..7339a5c06ba6 --- /dev/null +++ b/dev-db/sqlite/sqlite-3.34.1.ebuild @@ -0,0 +1,427 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +inherit autotools flag-o-matic multilib-minimal toolchain-funcs + +if [[ "${PV}" != "9999" ]]; then + SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))" + DOC_PV="${SRC_PV}" + # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))" +fi + +DESCRIPTION="SQL database engine" +HOMEPAGE="https://sqlite.org/" +if [[ "${PV}" == "9999" ]]; then + SRC_URI="" +else + SRC_URI="https://sqlite.org/2021/${PN}-src-${SRC_PV}.zip + doc? ( https://sqlite.org/2021/${PN}-doc-${DOC_PV}.zip )" +fi + +LICENSE="public-domain" +SLOT="3" +KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="debug doc icu +readline secure-delete static-libs tcl test tools" +if [[ "${PV}" == "9999" ]]; then + PROPERTIES="live" +fi +RESTRICT="!test? ( test )" + +if [[ "${PV}" == "9999" ]]; then + BDEPEND=">=dev-lang/tcl-8.6:0 + dev-vcs/fossil" +else + BDEPEND="app-arch/unzip + >=dev-lang/tcl-8.6:0" +fi +RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}] + icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] ) + readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] ) + tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] ) + tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )" + +if [[ "${PV}" == "9999" ]]; then + S="${WORKDIR}/${PN}" +else + S="${WORKDIR}/${PN}-src-${SRC_PV}" +fi + +_fossil_fetch() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local repo_uri="${2}" + + local -x FOSSIL_HOME="${HOME}" + + mkdir -p "${T}/fossil/${repo_id}" || die + pushd "${T}/fossil/${repo_id}" > /dev/null || die + + if [[ -n "${EVCS_OFFLINE}" ]]; then + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Network activity disabled using EVCS_OFFLINE and clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + else + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + einfo fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" + fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" || die + echo + else + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" . || die + einfo fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" + fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" || die + echo + fi + + ( + addwrite "${distdir}" + mkdir -p "${distdir}/fossil-src/${repo_id}" || die + cp -p "${repo_id}.fossil" "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" || die + ) + fi + + popd > /dev/null || die +} + +_fossil_checkout() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local branch_or_commit="${2}" + local target_directory="${3}" + + local -x FOSSIL_HOME="${HOME}" + + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + + if [[ ! -f "${T}/fossil/${repo_id}/${repo_id}.fossil" ]]; then + mkdir -p "${T}/fossil/${repo_id}" || die + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" "${T}/fossil/${repo_id}" || die + fi + + mkdir "${target_directory}" || die + pushd "${target_directory}" > /dev/null || die + + einfo fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" + fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" || die + echo + + popd > /dev/null || die +} + +fossil_fetch() { + local repo_id="${1}" + local repo_uri="${2}" + local target_directory="${3}" + + local branch_or_commit="${EFOSSIL_COMMIT:-${EFOSSIL_BRANCH:-trunk}}" + + _fossil_fetch "${repo_id}" "${repo_uri}" + _fossil_checkout "${repo_id}" "${branch_or_commit}" "${target_directory}" +} + +src_unpack() { + if [[ "${PV}" == "9999" ]]; then + fossil_fetch sqlite https://sqlite.org/src "${WORKDIR}/${PN}" + if use doc; then + fossil_fetch sqlite-doc https://sqlite.org/docsrc "${WORKDIR}/${PN}-doc" + fi + else + default + fi +} + +src_prepare() { + eapply "${FILESDIR}/"${PN}-3.34.1-build_{1.1,1.2,2.1,2.2}.patch + + eapply_user + + eautoreconf + + multilib_copy_sources +} + +multilib_src_configure() { + local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" + local options=() + + options+=( + --enable-load-extension + --enable-threadsafe + ) + + # Support detection of misuse of SQLite API. + # https://sqlite.org/compile.html#enable_api_armor + append-cppflags -DSQLITE_ENABLE_API_ARMOR + + # Support bytecode and tables_used virtual tables. + # https://sqlite.org/compile.html#enable_bytecode_vtab + # https://sqlite.org/bytecodevtab.html + append-cppflags -DSQLITE_ENABLE_BYTECODE_VTAB + + # Support column metadata functions. + # https://sqlite.org/compile.html#enable_column_metadata + # https://sqlite.org/c3ref/column_database_name.html + append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA + + # Support sqlite_dbpage virtual table. + # https://sqlite.org/compile.html#enable_dbpage_vtab + # https://sqlite.org/dbpage.html + append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB + + # Support dbstat virtual table. + # https://sqlite.org/compile.html#enable_dbstat_vtab + # https://sqlite.org/dbstat.html + append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB + + # Support sqlite3_serialize() and sqlite3_deserialize() functions. + # https://sqlite.org/compile.html#enable_deserialize + # https://sqlite.org/c3ref/serialize.html + # https://sqlite.org/c3ref/deserialize.html + append-cppflags -DSQLITE_ENABLE_DESERIALIZE + + # Support comments in output of EXPLAIN. + # https://sqlite.org/compile.html#enable_explain_comments + append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS + + # Support Full-Text Search versions 3, 4 and 5. + # https://sqlite.org/compile.html#enable_fts3 + # https://sqlite.org/compile.html#enable_fts3_parenthesis + # https://sqlite.org/compile.html#enable_fts4 + # https://sqlite.org/compile.html#enable_fts5 + # https://sqlite.org/fts3.html + # https://sqlite.org/fts5.html + append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 + options+=(--enable-fts5) + + # Support hidden columns. + append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS + + # Support JSON1 extension. + # https://sqlite.org/compile.html#enable_json1 + # https://sqlite.org/json1.html + append-cppflags -DSQLITE_ENABLE_JSON1 + + # Support memsys5 memory allocator. + # https://sqlite.org/compile.html#enable_memsys5 + # https://sqlite.org/malloc.html#memsys5 + append-cppflags -DSQLITE_ENABLE_MEMSYS5 + + # Support sqlite3_normalized_sql() function. + # https://sqlite.org/c3ref/expanded_sql.html + append-cppflags -DSQLITE_ENABLE_NORMALIZE + + # Support sqlite_offset() function. + # https://sqlite.org/compile.html#enable_offset_sql_func + # https://sqlite.org/lang_corefunc.html#sqlite_offset + append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC + + # Support pre-update hook functions. + # https://sqlite.org/compile.html#enable_preupdate_hook + # https://sqlite.org/c3ref/preupdate_count.html + append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK + + # Support Resumable Bulk Update extension. + # https://sqlite.org/compile.html#enable_rbu + # https://sqlite.org/rbu.html + append-cppflags -DSQLITE_ENABLE_RBU + + # Support R*Trees. + # https://sqlite.org/compile.html#enable_rtree + # https://sqlite.org/compile.html#enable_geopoly + # https://sqlite.org/rtree.html + # https://sqlite.org/geopoly.html + append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY + + # Support Session extension. + # https://sqlite.org/compile.html#enable_session + # https://sqlite.org/sessionintro.html + append-cppflags -DSQLITE_ENABLE_SESSION + + # Support scan status functions. + # https://sqlite.org/compile.html#enable_stmt_scanstatus + # https://sqlite.org/c3ref/stmt_scanstatus.html + # https://sqlite.org/c3ref/stmt_scanstatus_reset.html + append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS + + # Support sqlite_stmt virtual table. + # https://sqlite.org/compile.html#enable_stmtvtab + # https://sqlite.org/stmt.html + append-cppflags -DSQLITE_ENABLE_STMTVTAB + + # Support unknown() function. + # https://sqlite.org/compile.html#enable_unknown_sql_function + append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + + # Support unlock notification. + # https://sqlite.org/compile.html#enable_unlock_notify + # https://sqlite.org/c3ref/unlock_notify.html + # https://sqlite.org/unlock_notify.html + append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY + + # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements. + # https://sqlite.org/compile.html#enable_update_delete_limit + # https://sqlite.org/lang_delete.html#optional_limit_and_order_by_clauses + # https://sqlite.org/lang_update.html#optional_limit_and_order_by_clauses + append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT + + # Support soundex() function. + # https://sqlite.org/compile.html#soundex + # https://sqlite.org/lang_corefunc.html#soundex + append-cppflags -DSQLITE_SOUNDEX + + # Support URI filenames. + # https://sqlite.org/compile.html#use_uri + # https://sqlite.org/uri.html + append-cppflags -DSQLITE_USE_URI + + # debug USE flag. + options+=($(use_enable debug)) + + # icu USE flag. + if use icu; then + # Support ICU extension. + # https://sqlite.org/compile.html#enable_icu + append-cppflags -DSQLITE_ENABLE_ICU + sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed" + fi + + # readline USE flag. + options+=( + --disable-editline + $(use_enable readline) + ) + if use readline; then + options+=(--with-readline-inc="-I${ESYSROOT}/usr/include/readline") + fi + + # secure-delete USE flag. + if use secure-delete; then + # Enable secure_delete pragma by default. + # https://sqlite.org/compile.html#secure_delete + # https://sqlite.org/pragma.html#pragma_secure_delete + append-cppflags -DSQLITE_SECURE_DELETE + fi + + # static-libs USE flag. + options+=($(use_enable static-libs static)) + + # tcl, test, tools USE flags. + options+=(--enable-tcl) + + if [[ "${CHOST}" == *-mint* ]]; then + # sys/mman.h not available in MiNTLib. + # https://sqlite.org/compile.html#omit_wal + append-cppflags -DSQLITE_OMIT_WAL + fi + + if [[ "${ABI}" == "x86" ]]; then + if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then + append-cflags -mfpmath=sse + else + append-cflags -ffloat-store + fi + fi + + econf "${options[@]}" +} + +multilib_src_compile() { + emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" + + if use tools && multilib_is_native_abi; then + emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh + fi + + if [[ "${PV}" == "9999" ]] && use doc && multilib_is_native_abi; then + emake tclsqlite3.c + + local build_directory="$(pwd)" + build_directory="${build_directory##*/}" + + mkdir "${WORKDIR}/${PN}-doc-build" || die + pushd "${WORKDIR}/${PN}-doc-build" > /dev/null || die + + emake -f "../${PN}-doc/Makefile" -j1 SRC="../${PN}" BLD="../${build_directory}" DOC="../${PN}-doc" CC="$(tc-getBUILD_CC)" TCLINC="" TCLFLAGS="$($(tc-getBUILD_PKG_CONFIG) --libs tcl) -ldl -lm" base doc + rmdir doc/matrix{/*,} || die + + popd > /dev/null || die + fi +} + +multilib_src_test() { + if [[ "${EUID}" -eq 0 ]]; then + ewarn "Skipping tests due to root permissions" + return + fi + + local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}" + + emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test) +} + +multilib_src_install() { + emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install + + if use tools && multilib_is_native_abi; then + install_tool() { + if [[ -f ".libs/${1}" ]]; then + newbin ".libs/${1}" "${2}" + else + newbin "${1}" "${2}" + fi + } + + install_tool changeset sqlite3-changeset + install_tool dbdump sqlite3-db-dump + install_tool dbhash sqlite3-db-hash + install_tool dbtotxt sqlite3-db-to-txt + install_tool index_usage sqlite3-index-usage + install_tool rbu sqlite3-rbu + install_tool scrub sqlite3-scrub + install_tool showdb sqlite3-show-db + install_tool showjournal sqlite3-show-journal + install_tool showshm sqlite3-show-shm + install_tool showstat4 sqlite3-show-stat4 + install_tool showwal sqlite3-show-wal + install_tool sqldiff sqlite3-diff + install_tool sqlite3_analyzer sqlite3-analyzer + install_tool sqlite3_checker sqlite3-checker + install_tool sqlite3_expert sqlite3-expert + install_tool sqltclsh sqlite3-tclsh + + unset -f install_tool + fi +} + +multilib_src_install_all() { + find "${ED}" -name "*.la" -delete || die + + doman sqlite3.1 + + if use doc; then + if [[ "${PV}" == "9999" ]]; then + pushd "${WORKDIR}/${PN}-doc-build/doc" > /dev/null || die + else + pushd "${WORKDIR}/${PN}-doc-${DOC_PV}" > /dev/null || die + fi + + find "(" -name "*.db" -o -name "*.txt" ")" -delete || die + if [[ "${PV}" != "9999" ]]; then + rm search search.d/admin || die + rmdir search.d || die + find -name "*~" -delete || die + fi + + ( + docinto html + dodoc -r * + ) + + popd > /dev/null || die + fi +} diff --git a/dev-db/sqlite/sqlite-3.35.0.ebuild b/dev-db/sqlite/sqlite-3.35.0.ebuild new file mode 100644 index 000000000000..d04438ce2cb9 --- /dev/null +++ b/dev-db/sqlite/sqlite-3.35.0.ebuild @@ -0,0 +1,427 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +inherit autotools flag-o-matic multilib-minimal toolchain-funcs + +if [[ "${PV}" != "9999" ]]; then + SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))" + DOC_PV="${SRC_PV}" + # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))" +fi + +DESCRIPTION="SQL database engine" +HOMEPAGE="https://sqlite.org/" +if [[ "${PV}" == "9999" ]]; then + SRC_URI="" +else + SRC_URI="https://sqlite.org/2021/${PN}-src-${SRC_PV}.zip + doc? ( https://sqlite.org/2021/${PN}-doc-${DOC_PV}.zip )" +fi + +LICENSE="public-domain" +SLOT="3" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="debug doc icu +readline secure-delete static-libs tcl test tools" +if [[ "${PV}" == "9999" ]]; then + PROPERTIES="live" +fi +RESTRICT="!test? ( test )" + +if [[ "${PV}" == "9999" ]]; then + BDEPEND=">=dev-lang/tcl-8.6:0 + dev-vcs/fossil" +else + BDEPEND="app-arch/unzip + >=dev-lang/tcl-8.6:0" +fi +RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}] + icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] ) + readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] ) + tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] ) + tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )" + +if [[ "${PV}" == "9999" ]]; then + S="${WORKDIR}/${PN}" +else + S="${WORKDIR}/${PN}-src-${SRC_PV}" +fi + +_fossil_fetch() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local repo_uri="${2}" + + local -x FOSSIL_HOME="${HOME}" + + mkdir -p "${T}/fossil/${repo_id}" || die + pushd "${T}/fossil/${repo_id}" > /dev/null || die + + if [[ -n "${EVCS_OFFLINE}" ]]; then + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Network activity disabled using EVCS_OFFLINE and clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + else + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + einfo fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" + fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" || die + echo + else + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" . || die + einfo fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" + fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" || die + echo + fi + + ( + addwrite "${distdir}" + mkdir -p "${distdir}/fossil-src/${repo_id}" || die + cp -p "${repo_id}.fossil" "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" || die + ) + fi + + popd > /dev/null || die +} + +_fossil_checkout() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local branch_or_commit="${2}" + local target_directory="${3}" + + local -x FOSSIL_HOME="${HOME}" + + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + + if [[ ! -f "${T}/fossil/${repo_id}/${repo_id}.fossil" ]]; then + mkdir -p "${T}/fossil/${repo_id}" || die + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" "${T}/fossil/${repo_id}" || die + fi + + mkdir "${target_directory}" || die + pushd "${target_directory}" > /dev/null || die + + einfo fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" + fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" || die + echo + + popd > /dev/null || die +} + +fossil_fetch() { + local repo_id="${1}" + local repo_uri="${2}" + local target_directory="${3}" + + local branch_or_commit="${EFOSSIL_COMMIT:-${EFOSSIL_BRANCH:-trunk}}" + + _fossil_fetch "${repo_id}" "${repo_uri}" + _fossil_checkout "${repo_id}" "${branch_or_commit}" "${target_directory}" +} + +src_unpack() { + if [[ "${PV}" == "9999" ]]; then + fossil_fetch sqlite https://sqlite.org/src "${WORKDIR}/${PN}" + if use doc; then + fossil_fetch sqlite-doc https://sqlite.org/docsrc "${WORKDIR}/${PN}-doc" + fi + else + default + fi +} + +src_prepare() { + eapply "${FILESDIR}/"${PN}-3.35.0-build_{1.1,1.2,2.1,2.2}.patch + + eapply_user + + eautoreconf + + multilib_copy_sources +} + +multilib_src_configure() { + local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" + local options=() + + options+=( + --enable-load-extension + --enable-threadsafe + ) + + # Support detection of misuse of SQLite API. + # https://sqlite.org/compile.html#enable_api_armor + append-cppflags -DSQLITE_ENABLE_API_ARMOR + + # Support bytecode and tables_used virtual tables. + # https://sqlite.org/compile.html#enable_bytecode_vtab + # https://sqlite.org/bytecodevtab.html + append-cppflags -DSQLITE_ENABLE_BYTECODE_VTAB + + # Support column metadata functions. + # https://sqlite.org/compile.html#enable_column_metadata + # https://sqlite.org/c3ref/column_database_name.html + append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA + + # Support sqlite_dbpage virtual table. + # https://sqlite.org/compile.html#enable_dbpage_vtab + # https://sqlite.org/dbpage.html + append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB + + # Support dbstat virtual table. + # https://sqlite.org/compile.html#enable_dbstat_vtab + # https://sqlite.org/dbstat.html + append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB + + # Support sqlite3_serialize() and sqlite3_deserialize() functions. + # https://sqlite.org/compile.html#enable_deserialize + # https://sqlite.org/c3ref/serialize.html + # https://sqlite.org/c3ref/deserialize.html + append-cppflags -DSQLITE_ENABLE_DESERIALIZE + + # Support comments in output of EXPLAIN. + # https://sqlite.org/compile.html#enable_explain_comments + append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS + + # Support Full-Text Search versions 3, 4 and 5. + # https://sqlite.org/compile.html#enable_fts3 + # https://sqlite.org/compile.html#enable_fts3_parenthesis + # https://sqlite.org/compile.html#enable_fts4 + # https://sqlite.org/compile.html#enable_fts5 + # https://sqlite.org/fts3.html + # https://sqlite.org/fts5.html + append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 + options+=(--enable-fts5) + + # Support hidden columns. + append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS + + # Support JSON1 extension. + # https://sqlite.org/compile.html#enable_json1 + # https://sqlite.org/json1.html + append-cppflags -DSQLITE_ENABLE_JSON1 + + # Support memsys5 memory allocator. + # https://sqlite.org/compile.html#enable_memsys5 + # https://sqlite.org/malloc.html#memsys5 + append-cppflags -DSQLITE_ENABLE_MEMSYS5 + + # Support sqlite3_normalized_sql() function. + # https://sqlite.org/c3ref/expanded_sql.html + append-cppflags -DSQLITE_ENABLE_NORMALIZE + + # Support sqlite_offset() function. + # https://sqlite.org/compile.html#enable_offset_sql_func + # https://sqlite.org/lang_corefunc.html#sqlite_offset + append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC + + # Support pre-update hook functions. + # https://sqlite.org/compile.html#enable_preupdate_hook + # https://sqlite.org/c3ref/preupdate_count.html + append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK + + # Support Resumable Bulk Update extension. + # https://sqlite.org/compile.html#enable_rbu + # https://sqlite.org/rbu.html + append-cppflags -DSQLITE_ENABLE_RBU + + # Support R*Trees. + # https://sqlite.org/compile.html#enable_rtree + # https://sqlite.org/compile.html#enable_geopoly + # https://sqlite.org/rtree.html + # https://sqlite.org/geopoly.html + append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY + + # Support Session extension. + # https://sqlite.org/compile.html#enable_session + # https://sqlite.org/sessionintro.html + append-cppflags -DSQLITE_ENABLE_SESSION + + # Support scan status functions. + # https://sqlite.org/compile.html#enable_stmt_scanstatus + # https://sqlite.org/c3ref/stmt_scanstatus.html + # https://sqlite.org/c3ref/stmt_scanstatus_reset.html + append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS + + # Support sqlite_stmt virtual table. + # https://sqlite.org/compile.html#enable_stmtvtab + # https://sqlite.org/stmt.html + append-cppflags -DSQLITE_ENABLE_STMTVTAB + + # Support unknown() function. + # https://sqlite.org/compile.html#enable_unknown_sql_function + append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + + # Support unlock notification. + # https://sqlite.org/compile.html#enable_unlock_notify + # https://sqlite.org/c3ref/unlock_notify.html + # https://sqlite.org/unlock_notify.html + append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY + + # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements. + # https://sqlite.org/compile.html#enable_update_delete_limit + # https://sqlite.org/lang_delete.html#optional_limit_and_order_by_clauses + # https://sqlite.org/lang_update.html#optional_limit_and_order_by_clauses + append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT + + # Support soundex() function. + # https://sqlite.org/compile.html#soundex + # https://sqlite.org/lang_corefunc.html#soundex + append-cppflags -DSQLITE_SOUNDEX + + # Support URI filenames. + # https://sqlite.org/compile.html#use_uri + # https://sqlite.org/uri.html + append-cppflags -DSQLITE_USE_URI + + # debug USE flag. + options+=($(use_enable debug)) + + # icu USE flag. + if use icu; then + # Support ICU extension. + # https://sqlite.org/compile.html#enable_icu + append-cppflags -DSQLITE_ENABLE_ICU + sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed" + fi + + # readline USE flag. + options+=( + --disable-editline + $(use_enable readline) + ) + if use readline; then + options+=(--with-readline-inc="-I${ESYSROOT}/usr/include/readline") + fi + + # secure-delete USE flag. + if use secure-delete; then + # Enable secure_delete pragma by default. + # https://sqlite.org/compile.html#secure_delete + # https://sqlite.org/pragma.html#pragma_secure_delete + append-cppflags -DSQLITE_SECURE_DELETE + fi + + # static-libs USE flag. + options+=($(use_enable static-libs static)) + + # tcl, test, tools USE flags. + options+=(--enable-tcl) + + if [[ "${CHOST}" == *-mint* ]]; then + # sys/mman.h not available in MiNTLib. + # https://sqlite.org/compile.html#omit_wal + append-cppflags -DSQLITE_OMIT_WAL + fi + + if [[ "${ABI}" == "x86" ]]; then + if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then + append-cflags -mfpmath=sse + else + append-cflags -ffloat-store + fi + fi + + econf "${options[@]}" +} + +multilib_src_compile() { + emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" + + if use tools && multilib_is_native_abi; then + emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh + fi + + if [[ "${PV}" == "9999" ]] && use doc && multilib_is_native_abi; then + emake tclsqlite3.c + + local build_directory="$(pwd)" + build_directory="${build_directory##*/}" + + mkdir "${WORKDIR}/${PN}-doc-build" || die + pushd "${WORKDIR}/${PN}-doc-build" > /dev/null || die + + emake -f "../${PN}-doc/Makefile" -j1 SRC="../${PN}" BLD="../${build_directory}" DOC="../${PN}-doc" CC="$(tc-getBUILD_CC)" TCLINC="" TCLFLAGS="$($(tc-getBUILD_PKG_CONFIG) --libs tcl) -ldl -lm" base doc + rmdir doc/matrix{/*,} || die + + popd > /dev/null || die + fi +} + +multilib_src_test() { + if [[ "${EUID}" -eq 0 ]]; then + ewarn "Skipping tests due to root permissions" + return + fi + + local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}" + + emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test) +} + +multilib_src_install() { + emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install + + if use tools && multilib_is_native_abi; then + install_tool() { + if [[ -f ".libs/${1}" ]]; then + newbin ".libs/${1}" "${2}" + else + newbin "${1}" "${2}" + fi + } + + install_tool changeset sqlite3-changeset + install_tool dbdump sqlite3-db-dump + install_tool dbhash sqlite3-db-hash + install_tool dbtotxt sqlite3-db-to-txt + install_tool index_usage sqlite3-index-usage + install_tool rbu sqlite3-rbu + install_tool scrub sqlite3-scrub + install_tool showdb sqlite3-show-db + install_tool showjournal sqlite3-show-journal + install_tool showshm sqlite3-show-shm + install_tool showstat4 sqlite3-show-stat4 + install_tool showwal sqlite3-show-wal + install_tool sqldiff sqlite3-diff + install_tool sqlite3_analyzer sqlite3-analyzer + install_tool sqlite3_checker sqlite3-checker + install_tool sqlite3_expert sqlite3-expert + install_tool sqltclsh sqlite3-tclsh + + unset -f install_tool + fi +} + +multilib_src_install_all() { + find "${ED}" -name "*.la" -delete || die + + doman sqlite3.1 + + if use doc; then + if [[ "${PV}" == "9999" ]]; then + pushd "${WORKDIR}/${PN}-doc-build/doc" > /dev/null || die + else + pushd "${WORKDIR}/${PN}-doc-${DOC_PV}" > /dev/null || die + fi + + find "(" -name "*.db" -o -name "*.txt" ")" -delete || die + if [[ "${PV}" != "9999" ]]; then + rm search search.d/admin || die + rmdir search.d || die + find -name "*~" -delete || die + fi + + ( + docinto html + dodoc -r * + ) + + popd > /dev/null || die + fi +} diff --git a/dev-db/sqlite/sqlite-3.35.1.ebuild b/dev-db/sqlite/sqlite-3.35.1.ebuild new file mode 100644 index 000000000000..d04438ce2cb9 --- /dev/null +++ b/dev-db/sqlite/sqlite-3.35.1.ebuild @@ -0,0 +1,427 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +inherit autotools flag-o-matic multilib-minimal toolchain-funcs + +if [[ "${PV}" != "9999" ]]; then + SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))" + DOC_PV="${SRC_PV}" + # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))" +fi + +DESCRIPTION="SQL database engine" +HOMEPAGE="https://sqlite.org/" +if [[ "${PV}" == "9999" ]]; then + SRC_URI="" +else + SRC_URI="https://sqlite.org/2021/${PN}-src-${SRC_PV}.zip + doc? ( https://sqlite.org/2021/${PN}-doc-${DOC_PV}.zip )" +fi + +LICENSE="public-domain" +SLOT="3" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="debug doc icu +readline secure-delete static-libs tcl test tools" +if [[ "${PV}" == "9999" ]]; then + PROPERTIES="live" +fi +RESTRICT="!test? ( test )" + +if [[ "${PV}" == "9999" ]]; then + BDEPEND=">=dev-lang/tcl-8.6:0 + dev-vcs/fossil" +else + BDEPEND="app-arch/unzip + >=dev-lang/tcl-8.6:0" +fi +RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}] + icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] ) + readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] ) + tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] ) + tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )" + +if [[ "${PV}" == "9999" ]]; then + S="${WORKDIR}/${PN}" +else + S="${WORKDIR}/${PN}-src-${SRC_PV}" +fi + +_fossil_fetch() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local repo_uri="${2}" + + local -x FOSSIL_HOME="${HOME}" + + mkdir -p "${T}/fossil/${repo_id}" || die + pushd "${T}/fossil/${repo_id}" > /dev/null || die + + if [[ -n "${EVCS_OFFLINE}" ]]; then + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Network activity disabled using EVCS_OFFLINE and clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + else + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + einfo fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" + fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" || die + echo + else + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" . || die + einfo fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" + fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" || die + echo + fi + + ( + addwrite "${distdir}" + mkdir -p "${distdir}/fossil-src/${repo_id}" || die + cp -p "${repo_id}.fossil" "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" || die + ) + fi + + popd > /dev/null || die +} + +_fossil_checkout() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local branch_or_commit="${2}" + local target_directory="${3}" + + local -x FOSSIL_HOME="${HOME}" + + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + + if [[ ! -f "${T}/fossil/${repo_id}/${repo_id}.fossil" ]]; then + mkdir -p "${T}/fossil/${repo_id}" || die + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" "${T}/fossil/${repo_id}" || die + fi + + mkdir "${target_directory}" || die + pushd "${target_directory}" > /dev/null || die + + einfo fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" + fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" || die + echo + + popd > /dev/null || die +} + +fossil_fetch() { + local repo_id="${1}" + local repo_uri="${2}" + local target_directory="${3}" + + local branch_or_commit="${EFOSSIL_COMMIT:-${EFOSSIL_BRANCH:-trunk}}" + + _fossil_fetch "${repo_id}" "${repo_uri}" + _fossil_checkout "${repo_id}" "${branch_or_commit}" "${target_directory}" +} + +src_unpack() { + if [[ "${PV}" == "9999" ]]; then + fossil_fetch sqlite https://sqlite.org/src "${WORKDIR}/${PN}" + if use doc; then + fossil_fetch sqlite-doc https://sqlite.org/docsrc "${WORKDIR}/${PN}-doc" + fi + else + default + fi +} + +src_prepare() { + eapply "${FILESDIR}/"${PN}-3.35.0-build_{1.1,1.2,2.1,2.2}.patch + + eapply_user + + eautoreconf + + multilib_copy_sources +} + +multilib_src_configure() { + local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" + local options=() + + options+=( + --enable-load-extension + --enable-threadsafe + ) + + # Support detection of misuse of SQLite API. + # https://sqlite.org/compile.html#enable_api_armor + append-cppflags -DSQLITE_ENABLE_API_ARMOR + + # Support bytecode and tables_used virtual tables. + # https://sqlite.org/compile.html#enable_bytecode_vtab + # https://sqlite.org/bytecodevtab.html + append-cppflags -DSQLITE_ENABLE_BYTECODE_VTAB + + # Support column metadata functions. + # https://sqlite.org/compile.html#enable_column_metadata + # https://sqlite.org/c3ref/column_database_name.html + append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA + + # Support sqlite_dbpage virtual table. + # https://sqlite.org/compile.html#enable_dbpage_vtab + # https://sqlite.org/dbpage.html + append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB + + # Support dbstat virtual table. + # https://sqlite.org/compile.html#enable_dbstat_vtab + # https://sqlite.org/dbstat.html + append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB + + # Support sqlite3_serialize() and sqlite3_deserialize() functions. + # https://sqlite.org/compile.html#enable_deserialize + # https://sqlite.org/c3ref/serialize.html + # https://sqlite.org/c3ref/deserialize.html + append-cppflags -DSQLITE_ENABLE_DESERIALIZE + + # Support comments in output of EXPLAIN. + # https://sqlite.org/compile.html#enable_explain_comments + append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS + + # Support Full-Text Search versions 3, 4 and 5. + # https://sqlite.org/compile.html#enable_fts3 + # https://sqlite.org/compile.html#enable_fts3_parenthesis + # https://sqlite.org/compile.html#enable_fts4 + # https://sqlite.org/compile.html#enable_fts5 + # https://sqlite.org/fts3.html + # https://sqlite.org/fts5.html + append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 + options+=(--enable-fts5) + + # Support hidden columns. + append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS + + # Support JSON1 extension. + # https://sqlite.org/compile.html#enable_json1 + # https://sqlite.org/json1.html + append-cppflags -DSQLITE_ENABLE_JSON1 + + # Support memsys5 memory allocator. + # https://sqlite.org/compile.html#enable_memsys5 + # https://sqlite.org/malloc.html#memsys5 + append-cppflags -DSQLITE_ENABLE_MEMSYS5 + + # Support sqlite3_normalized_sql() function. + # https://sqlite.org/c3ref/expanded_sql.html + append-cppflags -DSQLITE_ENABLE_NORMALIZE + + # Support sqlite_offset() function. + # https://sqlite.org/compile.html#enable_offset_sql_func + # https://sqlite.org/lang_corefunc.html#sqlite_offset + append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC + + # Support pre-update hook functions. + # https://sqlite.org/compile.html#enable_preupdate_hook + # https://sqlite.org/c3ref/preupdate_count.html + append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK + + # Support Resumable Bulk Update extension. + # https://sqlite.org/compile.html#enable_rbu + # https://sqlite.org/rbu.html + append-cppflags -DSQLITE_ENABLE_RBU + + # Support R*Trees. + # https://sqlite.org/compile.html#enable_rtree + # https://sqlite.org/compile.html#enable_geopoly + # https://sqlite.org/rtree.html + # https://sqlite.org/geopoly.html + append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY + + # Support Session extension. + # https://sqlite.org/compile.html#enable_session + # https://sqlite.org/sessionintro.html + append-cppflags -DSQLITE_ENABLE_SESSION + + # Support scan status functions. + # https://sqlite.org/compile.html#enable_stmt_scanstatus + # https://sqlite.org/c3ref/stmt_scanstatus.html + # https://sqlite.org/c3ref/stmt_scanstatus_reset.html + append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS + + # Support sqlite_stmt virtual table. + # https://sqlite.org/compile.html#enable_stmtvtab + # https://sqlite.org/stmt.html + append-cppflags -DSQLITE_ENABLE_STMTVTAB + + # Support unknown() function. + # https://sqlite.org/compile.html#enable_unknown_sql_function + append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + + # Support unlock notification. + # https://sqlite.org/compile.html#enable_unlock_notify + # https://sqlite.org/c3ref/unlock_notify.html + # https://sqlite.org/unlock_notify.html + append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY + + # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements. + # https://sqlite.org/compile.html#enable_update_delete_limit + # https://sqlite.org/lang_delete.html#optional_limit_and_order_by_clauses + # https://sqlite.org/lang_update.html#optional_limit_and_order_by_clauses + append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT + + # Support soundex() function. + # https://sqlite.org/compile.html#soundex + # https://sqlite.org/lang_corefunc.html#soundex + append-cppflags -DSQLITE_SOUNDEX + + # Support URI filenames. + # https://sqlite.org/compile.html#use_uri + # https://sqlite.org/uri.html + append-cppflags -DSQLITE_USE_URI + + # debug USE flag. + options+=($(use_enable debug)) + + # icu USE flag. + if use icu; then + # Support ICU extension. + # https://sqlite.org/compile.html#enable_icu + append-cppflags -DSQLITE_ENABLE_ICU + sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed" + fi + + # readline USE flag. + options+=( + --disable-editline + $(use_enable readline) + ) + if use readline; then + options+=(--with-readline-inc="-I${ESYSROOT}/usr/include/readline") + fi + + # secure-delete USE flag. + if use secure-delete; then + # Enable secure_delete pragma by default. + # https://sqlite.org/compile.html#secure_delete + # https://sqlite.org/pragma.html#pragma_secure_delete + append-cppflags -DSQLITE_SECURE_DELETE + fi + + # static-libs USE flag. + options+=($(use_enable static-libs static)) + + # tcl, test, tools USE flags. + options+=(--enable-tcl) + + if [[ "${CHOST}" == *-mint* ]]; then + # sys/mman.h not available in MiNTLib. + # https://sqlite.org/compile.html#omit_wal + append-cppflags -DSQLITE_OMIT_WAL + fi + + if [[ "${ABI}" == "x86" ]]; then + if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then + append-cflags -mfpmath=sse + else + append-cflags -ffloat-store + fi + fi + + econf "${options[@]}" +} + +multilib_src_compile() { + emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" + + if use tools && multilib_is_native_abi; then + emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh + fi + + if [[ "${PV}" == "9999" ]] && use doc && multilib_is_native_abi; then + emake tclsqlite3.c + + local build_directory="$(pwd)" + build_directory="${build_directory##*/}" + + mkdir "${WORKDIR}/${PN}-doc-build" || die + pushd "${WORKDIR}/${PN}-doc-build" > /dev/null || die + + emake -f "../${PN}-doc/Makefile" -j1 SRC="../${PN}" BLD="../${build_directory}" DOC="../${PN}-doc" CC="$(tc-getBUILD_CC)" TCLINC="" TCLFLAGS="$($(tc-getBUILD_PKG_CONFIG) --libs tcl) -ldl -lm" base doc + rmdir doc/matrix{/*,} || die + + popd > /dev/null || die + fi +} + +multilib_src_test() { + if [[ "${EUID}" -eq 0 ]]; then + ewarn "Skipping tests due to root permissions" + return + fi + + local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}" + + emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test) +} + +multilib_src_install() { + emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install + + if use tools && multilib_is_native_abi; then + install_tool() { + if [[ -f ".libs/${1}" ]]; then + newbin ".libs/${1}" "${2}" + else + newbin "${1}" "${2}" + fi + } + + install_tool changeset sqlite3-changeset + install_tool dbdump sqlite3-db-dump + install_tool dbhash sqlite3-db-hash + install_tool dbtotxt sqlite3-db-to-txt + install_tool index_usage sqlite3-index-usage + install_tool rbu sqlite3-rbu + install_tool scrub sqlite3-scrub + install_tool showdb sqlite3-show-db + install_tool showjournal sqlite3-show-journal + install_tool showshm sqlite3-show-shm + install_tool showstat4 sqlite3-show-stat4 + install_tool showwal sqlite3-show-wal + install_tool sqldiff sqlite3-diff + install_tool sqlite3_analyzer sqlite3-analyzer + install_tool sqlite3_checker sqlite3-checker + install_tool sqlite3_expert sqlite3-expert + install_tool sqltclsh sqlite3-tclsh + + unset -f install_tool + fi +} + +multilib_src_install_all() { + find "${ED}" -name "*.la" -delete || die + + doman sqlite3.1 + + if use doc; then + if [[ "${PV}" == "9999" ]]; then + pushd "${WORKDIR}/${PN}-doc-build/doc" > /dev/null || die + else + pushd "${WORKDIR}/${PN}-doc-${DOC_PV}" > /dev/null || die + fi + + find "(" -name "*.db" -o -name "*.txt" ")" -delete || die + if [[ "${PV}" != "9999" ]]; then + rm search search.d/admin || die + rmdir search.d || die + find -name "*~" -delete || die + fi + + ( + docinto html + dodoc -r * + ) + + popd > /dev/null || die + fi +} diff --git a/dev-db/sqlite/sqlite-3.35.2.ebuild b/dev-db/sqlite/sqlite-3.35.2.ebuild new file mode 100644 index 000000000000..d04438ce2cb9 --- /dev/null +++ b/dev-db/sqlite/sqlite-3.35.2.ebuild @@ -0,0 +1,427 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +inherit autotools flag-o-matic multilib-minimal toolchain-funcs + +if [[ "${PV}" != "9999" ]]; then + SRC_PV="$(printf "%u%02u%02u%02u" $(ver_rs 1- " "))" + DOC_PV="${SRC_PV}" + # DOC_PV="$(printf "%u%02u%02u00" $(ver_rs 1-3 " "))" +fi + +DESCRIPTION="SQL database engine" +HOMEPAGE="https://sqlite.org/" +if [[ "${PV}" == "9999" ]]; then + SRC_URI="" +else + SRC_URI="https://sqlite.org/2021/${PN}-src-${SRC_PV}.zip + doc? ( https://sqlite.org/2021/${PN}-doc-${DOC_PV}.zip )" +fi + +LICENSE="public-domain" +SLOT="3" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="debug doc icu +readline secure-delete static-libs tcl test tools" +if [[ "${PV}" == "9999" ]]; then + PROPERTIES="live" +fi +RESTRICT="!test? ( test )" + +if [[ "${PV}" == "9999" ]]; then + BDEPEND=">=dev-lang/tcl-8.6:0 + dev-vcs/fossil" +else + BDEPEND="app-arch/unzip + >=dev-lang/tcl-8.6:0" +fi +RDEPEND="sys-libs/zlib:0=[${MULTILIB_USEDEP}] + icu? ( dev-libs/icu:0=[${MULTILIB_USEDEP}] ) + readline? ( sys-libs/readline:0=[${MULTILIB_USEDEP}] ) + tcl? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] ) + tools? ( dev-lang/tcl:0=[${MULTILIB_USEDEP}] )" +DEPEND="${RDEPEND} + test? ( >=dev-lang/tcl-8.6:0[${MULTILIB_USEDEP}] )" + +if [[ "${PV}" == "9999" ]]; then + S="${WORKDIR}/${PN}" +else + S="${WORKDIR}/${PN}-src-${SRC_PV}" +fi + +_fossil_fetch() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local repo_uri="${2}" + + local -x FOSSIL_HOME="${HOME}" + + mkdir -p "${T}/fossil/${repo_id}" || die + pushd "${T}/fossil/${repo_id}" > /dev/null || die + + if [[ -n "${EVCS_OFFLINE}" ]]; then + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Network activity disabled using EVCS_OFFLINE and clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + else + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + einfo fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" + fossil clone --verbose "${repo_uri}" "${repo_id}.fossil" || die + echo + else + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" . || die + einfo fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" + fossil pull --repository "${repo_id}.fossil" --verbose "${repo_uri}" || die + echo + fi + + ( + addwrite "${distdir}" + mkdir -p "${distdir}/fossil-src/${repo_id}" || die + cp -p "${repo_id}.fossil" "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" || die + ) + fi + + popd > /dev/null || die +} + +_fossil_checkout() { + local distdir="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}" + local repo_id="${1}" + local branch_or_commit="${2}" + local target_directory="${3}" + + local -x FOSSIL_HOME="${HOME}" + + if [[ ! -f "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" ]]; then + die "Clone of repository missing: \"${distdir}/fossil-src/${repo_id}/${repo_id}.fossil\"" + fi + + if [[ ! -f "${T}/fossil/${repo_id}/${repo_id}.fossil" ]]; then + mkdir -p "${T}/fossil/${repo_id}" || die + cp -p "${distdir}/fossil-src/${repo_id}/${repo_id}.fossil" "${T}/fossil/${repo_id}" || die + fi + + mkdir "${target_directory}" || die + pushd "${target_directory}" > /dev/null || die + + einfo fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" + fossil open --quiet "${T}/fossil/${repo_id}/${repo_id}.fossil" "${branch_or_commit}" || die + echo + + popd > /dev/null || die +} + +fossil_fetch() { + local repo_id="${1}" + local repo_uri="${2}" + local target_directory="${3}" + + local branch_or_commit="${EFOSSIL_COMMIT:-${EFOSSIL_BRANCH:-trunk}}" + + _fossil_fetch "${repo_id}" "${repo_uri}" + _fossil_checkout "${repo_id}" "${branch_or_commit}" "${target_directory}" +} + +src_unpack() { + if [[ "${PV}" == "9999" ]]; then + fossil_fetch sqlite https://sqlite.org/src "${WORKDIR}/${PN}" + if use doc; then + fossil_fetch sqlite-doc https://sqlite.org/docsrc "${WORKDIR}/${PN}-doc" + fi + else + default + fi +} + +src_prepare() { + eapply "${FILESDIR}/"${PN}-3.35.0-build_{1.1,1.2,2.1,2.2}.patch + + eapply_user + + eautoreconf + + multilib_copy_sources +} + +multilib_src_configure() { + local -x CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" + local options=() + + options+=( + --enable-load-extension + --enable-threadsafe + ) + + # Support detection of misuse of SQLite API. + # https://sqlite.org/compile.html#enable_api_armor + append-cppflags -DSQLITE_ENABLE_API_ARMOR + + # Support bytecode and tables_used virtual tables. + # https://sqlite.org/compile.html#enable_bytecode_vtab + # https://sqlite.org/bytecodevtab.html + append-cppflags -DSQLITE_ENABLE_BYTECODE_VTAB + + # Support column metadata functions. + # https://sqlite.org/compile.html#enable_column_metadata + # https://sqlite.org/c3ref/column_database_name.html + append-cppflags -DSQLITE_ENABLE_COLUMN_METADATA + + # Support sqlite_dbpage virtual table. + # https://sqlite.org/compile.html#enable_dbpage_vtab + # https://sqlite.org/dbpage.html + append-cppflags -DSQLITE_ENABLE_DBPAGE_VTAB + + # Support dbstat virtual table. + # https://sqlite.org/compile.html#enable_dbstat_vtab + # https://sqlite.org/dbstat.html + append-cppflags -DSQLITE_ENABLE_DBSTAT_VTAB + + # Support sqlite3_serialize() and sqlite3_deserialize() functions. + # https://sqlite.org/compile.html#enable_deserialize + # https://sqlite.org/c3ref/serialize.html + # https://sqlite.org/c3ref/deserialize.html + append-cppflags -DSQLITE_ENABLE_DESERIALIZE + + # Support comments in output of EXPLAIN. + # https://sqlite.org/compile.html#enable_explain_comments + append-cppflags -DSQLITE_ENABLE_EXPLAIN_COMMENTS + + # Support Full-Text Search versions 3, 4 and 5. + # https://sqlite.org/compile.html#enable_fts3 + # https://sqlite.org/compile.html#enable_fts3_parenthesis + # https://sqlite.org/compile.html#enable_fts4 + # https://sqlite.org/compile.html#enable_fts5 + # https://sqlite.org/fts3.html + # https://sqlite.org/fts5.html + append-cppflags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 + options+=(--enable-fts5) + + # Support hidden columns. + append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS + + # Support JSON1 extension. + # https://sqlite.org/compile.html#enable_json1 + # https://sqlite.org/json1.html + append-cppflags -DSQLITE_ENABLE_JSON1 + + # Support memsys5 memory allocator. + # https://sqlite.org/compile.html#enable_memsys5 + # https://sqlite.org/malloc.html#memsys5 + append-cppflags -DSQLITE_ENABLE_MEMSYS5 + + # Support sqlite3_normalized_sql() function. + # https://sqlite.org/c3ref/expanded_sql.html + append-cppflags -DSQLITE_ENABLE_NORMALIZE + + # Support sqlite_offset() function. + # https://sqlite.org/compile.html#enable_offset_sql_func + # https://sqlite.org/lang_corefunc.html#sqlite_offset + append-cppflags -DSQLITE_ENABLE_OFFSET_SQL_FUNC + + # Support pre-update hook functions. + # https://sqlite.org/compile.html#enable_preupdate_hook + # https://sqlite.org/c3ref/preupdate_count.html + append-cppflags -DSQLITE_ENABLE_PREUPDATE_HOOK + + # Support Resumable Bulk Update extension. + # https://sqlite.org/compile.html#enable_rbu + # https://sqlite.org/rbu.html + append-cppflags -DSQLITE_ENABLE_RBU + + # Support R*Trees. + # https://sqlite.org/compile.html#enable_rtree + # https://sqlite.org/compile.html#enable_geopoly + # https://sqlite.org/rtree.html + # https://sqlite.org/geopoly.html + append-cppflags -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY + + # Support Session extension. + # https://sqlite.org/compile.html#enable_session + # https://sqlite.org/sessionintro.html + append-cppflags -DSQLITE_ENABLE_SESSION + + # Support scan status functions. + # https://sqlite.org/compile.html#enable_stmt_scanstatus + # https://sqlite.org/c3ref/stmt_scanstatus.html + # https://sqlite.org/c3ref/stmt_scanstatus_reset.html + append-cppflags -DSQLITE_ENABLE_STMT_SCANSTATUS + + # Support sqlite_stmt virtual table. + # https://sqlite.org/compile.html#enable_stmtvtab + # https://sqlite.org/stmt.html + append-cppflags -DSQLITE_ENABLE_STMTVTAB + + # Support unknown() function. + # https://sqlite.org/compile.html#enable_unknown_sql_function + append-cppflags -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + + # Support unlock notification. + # https://sqlite.org/compile.html#enable_unlock_notify + # https://sqlite.org/c3ref/unlock_notify.html + # https://sqlite.org/unlock_notify.html + append-cppflags -DSQLITE_ENABLE_UNLOCK_NOTIFY + + # Support LIMIT and ORDER BY clauses on DELETE and UPDATE statements. + # https://sqlite.org/compile.html#enable_update_delete_limit + # https://sqlite.org/lang_delete.html#optional_limit_and_order_by_clauses + # https://sqlite.org/lang_update.html#optional_limit_and_order_by_clauses + append-cppflags -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT + + # Support soundex() function. + # https://sqlite.org/compile.html#soundex + # https://sqlite.org/lang_corefunc.html#soundex + append-cppflags -DSQLITE_SOUNDEX + + # Support URI filenames. + # https://sqlite.org/compile.html#use_uri + # https://sqlite.org/uri.html + append-cppflags -DSQLITE_USE_URI + + # debug USE flag. + options+=($(use_enable debug)) + + # icu USE flag. + if use icu; then + # Support ICU extension. + # https://sqlite.org/compile.html#enable_icu + append-cppflags -DSQLITE_ENABLE_ICU + sed -e "s/^TLIBS = @LIBS@/& -licui18n -licuuc/" -i Makefile.in || die "sed failed" + fi + + # readline USE flag. + options+=( + --disable-editline + $(use_enable readline) + ) + if use readline; then + options+=(--with-readline-inc="-I${ESYSROOT}/usr/include/readline") + fi + + # secure-delete USE flag. + if use secure-delete; then + # Enable secure_delete pragma by default. + # https://sqlite.org/compile.html#secure_delete + # https://sqlite.org/pragma.html#pragma_secure_delete + append-cppflags -DSQLITE_SECURE_DELETE + fi + + # static-libs USE flag. + options+=($(use_enable static-libs static)) + + # tcl, test, tools USE flags. + options+=(--enable-tcl) + + if [[ "${CHOST}" == *-mint* ]]; then + # sys/mman.h not available in MiNTLib. + # https://sqlite.org/compile.html#omit_wal + append-cppflags -DSQLITE_OMIT_WAL + fi + + if [[ "${ABI}" == "x86" ]]; then + if $(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P -dM - < /dev/null 2> /dev/null | grep -q "^#define __SSE__ 1$"; then + append-cflags -mfpmath=sse + else + append-cflags -ffloat-store + fi + fi + + econf "${options[@]}" +} + +multilib_src_compile() { + emake HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" + + if use tools && multilib_is_native_abi; then + emake changeset dbdump dbhash dbtotxt index_usage rbu scrub showdb showjournal showshm showstat4 showwal sqldiff sqlite3_analyzer sqlite3_checker sqlite3_expert sqltclsh + fi + + if [[ "${PV}" == "9999" ]] && use doc && multilib_is_native_abi; then + emake tclsqlite3.c + + local build_directory="$(pwd)" + build_directory="${build_directory##*/}" + + mkdir "${WORKDIR}/${PN}-doc-build" || die + pushd "${WORKDIR}/${PN}-doc-build" > /dev/null || die + + emake -f "../${PN}-doc/Makefile" -j1 SRC="../${PN}" BLD="../${build_directory}" DOC="../${PN}-doc" CC="$(tc-getBUILD_CC)" TCLINC="" TCLFLAGS="$($(tc-getBUILD_PKG_CONFIG) --libs tcl) -ldl -lm" base doc + rmdir doc/matrix{/*,} || die + + popd > /dev/null || die + fi +} + +multilib_src_test() { + if [[ "${EUID}" -eq 0 ]]; then + ewarn "Skipping tests due to root permissions" + return + fi + + local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}" + + emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test) +} + +multilib_src_install() { + emake DESTDIR="${D}" HAVE_TCL="$(usex tcl 1 "")" TCLLIBDIR="${EPREFIX}/usr/$(get_libdir)/${P}" install + + if use tools && multilib_is_native_abi; then + install_tool() { + if [[ -f ".libs/${1}" ]]; then + newbin ".libs/${1}" "${2}" + else + newbin "${1}" "${2}" + fi + } + + install_tool changeset sqlite3-changeset + install_tool dbdump sqlite3-db-dump + install_tool dbhash sqlite3-db-hash + install_tool dbtotxt sqlite3-db-to-txt + install_tool index_usage sqlite3-index-usage + install_tool rbu sqlite3-rbu + install_tool scrub sqlite3-scrub + install_tool showdb sqlite3-show-db + install_tool showjournal sqlite3-show-journal + install_tool showshm sqlite3-show-shm + install_tool showstat4 sqlite3-show-stat4 + install_tool showwal sqlite3-show-wal + install_tool sqldiff sqlite3-diff + install_tool sqlite3_analyzer sqlite3-analyzer + install_tool sqlite3_checker sqlite3-checker + install_tool sqlite3_expert sqlite3-expert + install_tool sqltclsh sqlite3-tclsh + + unset -f install_tool + fi +} + +multilib_src_install_all() { + find "${ED}" -name "*.la" -delete || die + + doman sqlite3.1 + + if use doc; then + if [[ "${PV}" == "9999" ]]; then + pushd "${WORKDIR}/${PN}-doc-build/doc" > /dev/null || die + else + pushd "${WORKDIR}/${PN}-doc-${DOC_PV}" > /dev/null || die + fi + + find "(" -name "*.db" -o -name "*.txt" ")" -delete || die + if [[ "${PV}" != "9999" ]]; then + rm search search.d/admin || die + rmdir search.d || die + find -name "*~" -delete || die + fi + + ( + docinto html + dodoc -r * + ) + + popd > /dev/null || die + fi +} -- cgit v1.2.3