Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 322059
Collapse All | Expand All

(-)/var/lib/layman/mysql-overlay/eclass/mysql.eclass (-137 / +88 lines)
Lines 40-45 Link Here
40
					pkg_preinst pkg_postinst \
40
					pkg_preinst pkg_postinst \
41
					pkg_config pkg_postrm
41
					pkg_config pkg_postrm
42
		IUSE_DEFAULT_ON='+'
42
		IUSE_DEFAULT_ON='+'
43
		IUSE_DEFAULT_OFF='-'
43
		;;
44
		;;
44
	0 | 1)
45
	0 | 1)
45
		EXPORT_FUNCTIONS pkg_setup \
46
		EXPORT_FUNCTIONS pkg_setup \
Lines 103-118 Link Here
103
	MYSQL_COMMUNITY_FEATURES=0
104
	MYSQL_COMMUNITY_FEATURES=0
104
fi
105
fi
105
106
106
# @ECLASS-VARIABLE: XTRADB_VER
107
# @DESCRIPTION:
108
# Version of the XTRADB storage engine
109
XTRADB_VER="${XTRADB_VER}"
110
111
# @ECLASS-VARIABLE: PERCONA_VER
112
# @DESCRIPTION:
113
# Designation by PERCONA for a MySQL version to apply an XTRADB release
114
PERCONA_VER="${PERCONA_VER}"
115
116
# Be warned, *DEPEND are version-dependant
107
# Be warned, *DEPEND are version-dependant
117
# These are used for both runtime and compiletime
108
# These are used for both runtime and compiletime
118
DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d )
109
DEPEND="ssl? ( >=dev-libs/openssl-0.9.6d )
Lines 170-176 Link Here
170
fi
161
fi
171
162
172
# Define correct SRC_URIs
163
# Define correct SRC_URIs
173
SRC_URI="${SERVER_URI}"
164
SRC_URI="${SERVER_URI} ${GO_MYSQL_PATCHES}"
174
165
175
# Gentoo patches to MySQL
166
# Gentoo patches to MySQL
176
[[ ${MY_EXTRAS_VER} != live ]] \
167
[[ ${MY_EXTRAS_VER} != live ]] \
Lines 179-184 Link Here
179
		http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
170
		http://g3nt8.org/patches/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
180
		http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
171
		http://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
181
172
173
for str in ${MYSQL_STORAGE} ; do
174
	STORAGE_USE="${str/-*/}"
175
	SRC_URI="${SRC_URI} http://ftp.disconnected-by-peer.at/mysql/mysql-storage-${str}.tar.gz"
176
	STORAGE_IUSE="${STORAGE_IUSE} ${STORAGE_USE}"
177
#	IUSE="{IUSE} ${IUSE_DEFAULT_OFF}${STORAGE_USE}"
178
done
179
182
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
180
DESCRIPTION="A fast, multi-threaded, multi-user SQL database server."
183
HOMEPAGE="http://www.mysql.com/"
181
HOMEPAGE="http://www.mysql.com/"
184
if [[ "${PN}" == "mariadb" ]]; then
182
if [[ "${PN}" == "mariadb" ]]; then
Lines 213-267 Link Here
213
[[ "${PN}" == "mariadb" ]] \
211
[[ "${PN}" == "mariadb" ]] \
214
&& IUSE="${IUSE} libevent"
212
&& IUSE="${IUSE} libevent"
215
213
216
# MariaDB has integrated PBXT
214
[[ "${PN}" == "mariadb" ]] \
217
# PBXT_VERSION means that we have a PBXT patch for this PV
215
&& STORAGE_IUSE="${STORAGE_IUSE} pbxt xtradb"
218
# PBXT was only introduced after 5.1.12
219
pbxt_patch_available() {
220
	[[ "${PN}" != "mariadb" ]] \
221
	&& mysql_version_is_at_least "5.1.12" \
222
	&& [[ -n "${PBXT_VERSION}" ]]
223
	return $?
224
}
225
226
pbxt_available() {
227
	pbxt_patch_available || [[ "${PN}" == "mariadb" ]]
228
	return $?
229
}
230
231
# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
232
# MariaDB has integrated XtraDB
233
# XTRADB_VERS means that we have a XTRADB patch for this PV
234
# XTRADB was only introduced after 5.1.26
235
xtradb_patch_available() {
236
	[[ "${PN}" != "mariadb" ]] \
237
	&& mysql_version_is_at_least "5.1.26" \
238
	&& [[ -n "${XTRADB_VER}" && -n "${PERCONA_VER}" ]]
239
	return $?
240
}
241
242
216
243
pbxt_patch_available \
217
IUSE="${IUSE} ${STORAGE_IUSE}"
244
&& PBXT_P="pbxt-${PBXT_VERSION}" \
245
&& PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz" \
246
&& SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )" \
247
248
# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
249
# vs. built outside the dir
250
pbxt_available \
251
&& IUSE="${IUSE} pbxt" \
252
&& mysql_version_is_at_least "5.1.40" \
253
&& PBXT_NEWSTYLE=1
254
255
xtradb_patch_available \
256
&& XTRADB_P="percona-xtradb-${XTRADB_VER}" \
257
&& XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz" \
258
&& XTRADB_SRC_B1="http://www.percona.com/" \
259
&& XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/" \
260
&& XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}" \
261
&& XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}" \
262
&& XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}" \
263
&& SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )" \
264
&& IUSE="${IUSE} xtradb"
265
218
266
#
219
#
267
# HELPER FUNCTIONS:
220
# HELPER FUNCTIONS:
Lines 589-595 Link Here
589
		# not added yet: ibmdb2i
542
		# not added yet: ibmdb2i
590
		# Not supporting as examples: example,daemon_example,ftexample 
543
		# Not supporting as examples: example,daemon_example,ftexample 
591
		plugins_sta="${plugins_sta} partition"
544
		plugins_sta="${plugins_sta} partition"
592
		plugins_dyn="${plugins_sta} federated"
545
		plugins_dyn="${plugins_dyn} federated"
593
546
594
		if [[ "${PN}" != "mariadb" ]] ; then
547
		if [[ "${PN}" != "mariadb" ]] ; then
595
			elog "Before using the Federated storage engine, please be sure to read"
548
			elog "Before using the Federated storage engine, please be sure to read"
Lines 623-640 Link Here
623
	if [[ "${PN}" == "mariadb" ]] ; then
576
	if [[ "${PN}" == "mariadb" ]] ; then
624
		# In MariaDB, InnoDB is packaged in the xtradb directory, so it's not
577
		# In MariaDB, InnoDB is packaged in the xtradb directory, so it's not
625
		# caught above.
578
		# caught above.
626
		plugins_sta="${plugins_sta},maria,innobase"
579
		plugins_sta="${plugins_sta} maria innobase"
627
		myconf="${myconf} $(use_with libevent)"
580
		myconf="${myconf} $(use_with libevent)"
628
		# This is not optional, without it several upstream testcases fail.
581
		# This is not optional, without it several upstream testcases fail.
629
		# Also strongly recommended by upstream.
582
		# Also strongly recommended by upstream.
630
		myconf="${myconf} --with-maria-tmp-tables"
583
		myconf="${myconf} --with-maria-tmp-tables"
631
	fi
584
	fi
632
	
585
	
633
	if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then
586
	for str in ${STORAGE_IUSE} ; do
634
		use pbxt \
587
		if use ${str} ; then
635
		&& plugins_dyn="${plugins_dyn} pbxt" \
588
			# don't confuse autoconf by specifying the plugins two or more times
636
		|| plugins_dis="${plugins_dis} pbxt"
589
			[[ -e "${S}"/storage/${str} ]] && plugins_dyn="${plugins_dyn} ${str}"
637
	fi
590
		elif ! use ${str} ; then
591
			# don't confuse autoconf by specifying the plugins two or more times
592
			[[ -e "${S}"/storage/${str} ]] && plugins_dis="${plugins_dis} ${str}"
593
		else
594
			# don't confuse autoconf by specifying the plugins two or more times
595
			[[ -e "${S}"/storage/${str} ]] && plugins_sta="${plugins_sta} ${str}"
596
		fi
597
		# suppress error message
598
		[[ ${str} = "innodb" ]] && str="innobase"
599
		[[ ${str} = "xtradb" ]] && str="innobase"
600
		[[ ! -e "${S}"/storage/${str} ]] && eerror "use ${str} but no ${str} plugin"
601
		if [ -e "${S}"/storage/${str}/setup.sh ]; then
602
			pushd storage/${str}
603
			sh setup.sh
604
			popd
605
		fi
606
	done
638
607
639
	use static && \
608
	use static && \
640
	plugins_sta="${plugins_sta} ${plugins_dyn}" && \
609
	plugins_sta="${plugins_sta} ${plugins_dyn}" && \
Lines 653-691 Link Here
653
	done
622
	done
654
}
623
}
655
624
656
pbxt_src_configure() {
657
	mysql_init_vars
658
659
	pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
660
661
	einfo "Reconfiguring dir '${PWD}'"
662
	AT_GNUCONF_UPDATE="yes" eautoreconf
663
664
	local myconf=""
665
	myconf="${myconf} --with-mysql=${S} --libdir=/usr/$(get_libdir)"
666
	use debug && myconf="${myconf} --with-debug=full"
667
	econf ${myconf} || die "Problem configuring PBXT storage engine"
668
}
669
670
pbxt_src_compile() {
671
672
	# Be backwards compatible for now
673
	if [[ $EAPI != 2 ]]; then
674
		pbxt_src_configure
675
	fi
676
	# TODO: is it safe/needed to use emake here ?
677
	make || die "Problem making PBXT storage engine (${myconf})"
678
679
	popd
680
	# TODO: modify test suite for PBXT
681
}
682
683
pbxt_src_install() {
684
	pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null
685
		emake install DESTDIR="${D}" || die "Failed to install PBXT"
686
	popd
687
}
688
689
#
625
#
690
# EBUILD FUNCTIONS
626
# EBUILD FUNCTIONS
691
#
627
#
Lines 727-741 Link Here
727
		eerror "${M}"
663
		eerror "${M}"
728
		die "${M}"
664
		die "${M}"
729
	fi
665
	fi
730
	
731
	if mysql_version_is_at_least "5.1" \
732
	&& xtradb_patch_available \
733
	&& use xtradb \
734
	&& use embedded ; then
735
		M="USE flags 'xtradb' and 'embedded' conflict and cause build failures"
736
		eerror "${M}"
737
		die "${M}"
738
	fi
739
666
740
	# Bug #290570, 284946, 307251
667
	# Bug #290570, 284946, 307251
741
	# Upstream changes made us need a fairly new GCC4.
668
	# Upstream changes made us need a fairly new GCC4.
Lines 778-783 Link Here
778
	mysql_init_vars
705
	mysql_init_vars
779
706
780
	unpack ${A}
707
	unpack ${A}
708
709
	for str in ${MYSQL_STORAGE} ; do
710
		storage_name="${str/-*/}"
711
		einfo "Moving ${str/-/ Storage Engine Version } in place"
712
		pushd "${WORKDIR}/${MY_SOURCEDIR}"/storage
713
		i="${WORKDIR}/mysql-storage-${str}"
714
		o="${storage_name}"
715
		# Have we been here already ? or are we updating the included engine !
716
		[ -h "${o}" ] && rm -f "${o}"
717
		# Or maybe we haven't
718
		[ -d "${i}" -a ! -d "${o}" ] && cp -R  "${i}"/* "${WORKDIR}/${MY_SOURCEDIR}"
719
		popd
720
	done
721
781
	# Grab the patches
722
	# Grab the patches
782
	[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack
723
	[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git_src_unpack
783
724
Lines 800-806 Link Here
800
	EPATCH_SUFFIX="patch"
741
	EPATCH_SUFFIX="patch"
801
	mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
742
	mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
802
	# Clean out old items
743
	# Clean out old items
803
	rm -f "${EPATCH_SOURCE}"/*
744
	#rm -f "${EPATCH_SOURCE}"/*
804
	# Now link in right patches
745
	# Now link in right patches
805
	mysql_mv_patches
746
	mysql_mv_patches
806
	# And apply
747
	# And apply
Lines 832-857 Link Here
832
773
833
	local rebuilddirlist d
774
	local rebuilddirlist d
834
775
835
	if xtradb_patch_available && use xtradb ; then
776
	if mysql_version_is_at_least "5.1.26" && use xtradb && use innodb ; then
836
		einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)"
777
		eerror "Percona XtraDB and Innobase innoDB can not be insalled at the same time."
837
		pushd "${S}"/storage >/dev/null
778
	elif mysql_version_is_at_least "5.1.26" && use xtradb && ! use innodb ; then
779
		einfo "Replacing InnoDB with Percona XtraDB"
780
		einfo "Removing InnoDB Plugin Storage Engine"
781
		pushd "${S}"/storage
782
		# the innodb_plugin is a reason for compile errors if we replace innobase
783
		i="innodb_plugin"
784
		o="${WORKDIR}/storage-${i}.mysql-upstream"
785
		# Have we been here already?
786
		[ -h "${i}" ] && rm -f "${i}"
787
		# Or maybe we haven't
788
		[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
838
		i="innobase"
789
		i="innobase"
839
		o="${WORKDIR}/storage-${i}.mysql-upstream"
790
		o="${WORKDIR}/storage-${i}.mysql-upstream"
840
		# Have we been here already?
791
		# Have we been here already?
841
		[ -d "${o}" ] && rm -f "${i}"
792
		[ -h "${i}" ] && rm -f "${i}"
842
		# Or maybe we haven't
793
		# Or maybe we haven't
843
		[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
794
		[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
844
		cp -ral "${WORKDIR}/${XTRADB_P}" "${i}"
795
		mv -f "xtradb" "${i}"
845
		popd >/dev/null
796
		rm -rf "innodb"
846
	fi
797
		popd
847
	
798
	elif mysql_version_is_at_least "5.1.26" && use innodb && ! use xtradb ; then
848
	if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then
799
		einfo "Replacing InnoDB with Innobase innoDB"
849
		einfo "Adding storage engine: PBXT"
800
		einfo "Removing InnoDB Plugin Storage Engine"
850
		pushd "${S}"/storage >/dev/null
801
		pushd "${S}"/storage
851
		i='pbxt'
802
		# the innodb_plugin is a reason for compile errors if we replace innobase
852
		[ -d "${i}" ] && rm -rf "${i}"
803
		i="innodb_plugin"
853
		cp -ral "${WORKDIR}/${PBXT_P}" "${i}"
804
		o="${WORKDIR}/storage-${i}.mysql-upstream"
854
		popd >/dev/null
805
		# Have we been here already?
806
		[ -h "${i}" ] && rm -f "${i}"
807
		# Or maybe we haven't
808
		[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
809
		i="innobase"
810
		o="${WORKDIR}/storage-${i}.mysql-upstream"
811
		# Have we been here already?
812
		[ -h "${i}" ] && rm -f "${i}"
813
		# Or maybe we haven't
814
		[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}"
815
		mv -f "innodb" "${i}"
816
		rm -rf "xtradb"
817
		popd
855
	fi
818
	fi
856
819
857
	if mysql_version_is_at_least "5.1.12" ; then
820
	if mysql_version_is_at_least "5.1.12" ; then
Lines 954-963 Link Here
954
	find . -type f -name Makefile -print0 \
917
	find . -type f -name Makefile -print0 \
955
	| xargs -0 -n100 sed -i \
918
	| xargs -0 -n100 sed -i \
956
	-e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
919
	-e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|'
957
958
	if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
959
		pbxt_patch_available && use pbxt && pbxt_src_configure
960
	fi
961
}
920
}
962
921
963
# @FUNCTION: mysql_src_compile
922
# @FUNCTION: mysql_src_compile
Lines 971-980 Link Here
971
	esac
930
	esac
972
931
973
	emake || die "emake failed"
932
	emake || die "emake failed"
974
975
	if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
976
		pbxt_patch_available && use pbxt && pbxt_src_compile
977
	fi
978
}
933
}
979
934
980
# @FUNCTION: mysql_src_install
935
# @FUNCTION: mysql_src_install
Lines 990-999 Link Here
990
		testroot="${MY_SHAREDSTATEDIR}" \
945
		testroot="${MY_SHAREDSTATEDIR}" \
991
		|| die "emake install failed"
946
		|| die "emake install failed"
992
947
993
	if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then
994
		pbxt_patch_available && use pbxt && pbxt_src_install
995
	fi
996
997
	# Convenience links
948
	# Convenience links
998
	einfo "Making Convenience links for mysqlcheck multi-call binary"
949
	einfo "Making Convenience links for mysqlcheck multi-call binary"
999
	dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
950
	dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
Lines 1146-1152 Link Here
1146
		einfo
1097
		einfo
1147
	fi
1098
	fi
1148
1099
1149
	if pbxt_available && use pbxt ; then
1100
	if use pbxt ; then
1150
		# TODO: explain it better
1101
		# TODO: explain it better
1151
		elog "    mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';"
1102
		elog "    mysql> INSTALL PLUGIN pbxt SONAME 'libpbxt.so';"
1152
		elog "    mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;"
1103
		elog "    mysql> CREATE TABLE t1 (c1 int, c2 text) ENGINE=pbxt;"

Return to bug 322059