public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anna Vyalkova" <cyber+gentoo@sysrq.in>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/
Date: Thu, 22 Jul 2021 08:29:32 +0000 (UTC)	[thread overview]
Message-ID: <1626942459.708b16c5bb904fd2f07a47982c9632c767580fb0.cybertailor@gentoo> (raw)

commit:     708b16c5bb904fd2f07a47982c9632c767580fb0
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Thu Jul 22 08:10:46 2021 +0000
Commit:     Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
CommitDate: Thu Jul 22 08:27:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=708b16c5

boinc.eclass: new eclass

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 eclass/boinc.eclass | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 200 insertions(+)

diff --git a/eclass/boinc.eclass b/eclass/boinc.eclass
new file mode 100644
index 000000000..d16d6e250
--- /dev/null
+++ b/eclass/boinc.eclass
@@ -0,0 +1,200 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: boinc.eclass
+# @MAINTAINER:
+# Anna Vyalkova <cyber+gentoo@sysrq.in>
+# @SUPPORTED_EAPIS: 8
+# @BLURB: An eclass to build BOINC applications and libraries.
+# @DESCRIPTION:
+# This eclass provides helper functions to build BOINC applications and libraries.
+
+inherit toolchain-funcs
+
+case ${EAPI} in
+	8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI} unsupported."
+esac
+
+# @ECLASS-VARIABLE: BOINC_SUBMODULE
+# @PRE_INHERIT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set this variable to a subdirectory relative to BOINC source repository,
+# if software cannot be built outside it (for example, if some required
+# headers are missing in sci-misc/boinc).
+#
+# If unset, no functions will be exported.
+
+# @ECLASS-VARIABLE: BOINC_S
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If defined this variable determines the source directory name after
+# unpacking. This defaults to package name and version. Note that this
+# variable supports a wildcard mechanism to help with github tarballs
+# that contain the commit hash as part of the directory name.
+
+if [[ ${BOINC_SUBMODULE} ]]; then
+	EXPORT_FUNCTIONS src_unpack src_prepare src_configure
+fi
+
+if [[ ! ${_BOINC_ECLASS} ]]; then
+
+# @FUNCTION: get_boinc_src
+# @USAGE: <SRC_URI|S> <release> [client|server]
+# @RETURN: SRC_URI snippet or temporary build directory for given BOINC release
+get_boinc_src() {
+	local query_var=${1}
+	local RELEASE_PATCH=${2}
+	local RELEASE_MINOR=$(ver_cut 1-2 ${RELEASE_PATCH})
+	local RELEASE_TYPE=${3:-client}
+
+	local SUFFIX=
+	case ${RELEASE_TYPE} in
+		server) SUFFIX="-server" ;;
+		client) ;;
+		*) die "${FUNCNAME}: unknown release type '${RELEASE_TYPE}'"
+	esac
+
+	local _SRC_URI="https://github.com/BOINC/boinc/archive"
+	_SRC_URI+="${RELEASE_TYPE}_release/${RELEASE_MINOR}/${RELEASE_PATCH}.tar.gz"
+	_SRC_URI+=" -> boinc${SUFFIX}-${RELEASE_PATCH}.tar.gz"
+
+	local _S="${WORKDIR}/boinc-${RELEASE_TYPE}_release-${RELEASE_MINOR}-${RELEASE_PATCH}"
+
+	case ${query_var} in
+		SRC_URI) echo "${_SRC_URI}" ;;
+		S) echo "${_S}" ;;
+		*) die "${FUNCNAME}: unknown variable to query (${query_var})"
+	esac
+
+}
+
+# @ECLASS-VARIABLE: BOINC_BUILD_DIR
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# Temporary build directory, where BOINC sources are located.
+
+# @FUNCTION: boinc_require_source
+# @USAGE: [boinc version] [client|server]
+# @DESCRIPTION:
+# Set up SRC_URI and S for building application within BOINC source tree.
+#
+# This function must be called in global scope, after BOINC_SUBMODULE
+# and SRC_URI have been declared. Take care not to overwrite the variables
+# set by it.
+#
+# If no BOINC version is given, this function assumes it equal to client
+# release $PV.
+boinc_require_source() {
+	local boinc_version=${1:-${PV}}
+	SRC_URI+=" $(get_boinc_src SRC_URI ${boinc_version} ${2})"
+
+	readonly BOINC_BUILD_DIR="$(get_boinc_src S ${boinc_version} ${2})"
+	S="${BOINC_BUILD_DIR}/${BOINC_SUBMODULE}"
+}
+
+# @FUNCTION: boinc_enable_autotools
+# @USAGE: [econf args...]
+# @DESCRIPTION:
+# Configure BOINC source tree using autotools.
+#
+# If no arguments are given, econf will be called
+# with --enable-pkg-devel flag.
+#
+# This function must be called in global scope.
+boinc_enable_autotools() {
+	inherit autotools
+	_BOINC_RUN_AUTOTOOLS=1
+	_BOINC_ECONF_ARGS=${@:---enable-pkg-devel}
+}
+
+# @FUNCTION: boinc_override_config
+# @USAGE: <config.h>
+# @DESCRIPTION:
+# Some applications do not need autotools to build but
+# use a few HAVE_* defines.
+
+# If you want to save ~40 seconds and really know what
+# to do, pass prepared config.h to this function.
+#
+# This function must be called in global scope.
+boinc_override_config() {
+	_BOINC_CONFIG_OVERRIDE="${1}"
+}
+
+# @FUNCTION: boinc_builddir_check
+# @USAGE:
+# @DESCRIPTION:
+# Make sure BOINC_BUILD_DIR has a value.
+boinc_builddir_check() {
+	if [[ ! ${BOINC_BUILD_DIR} ]]; then
+		eerror "BOINC_BUILD_DIR is not set."
+		die "Did you forget to call boinc_require_source?"
+	fi
+
+	mkdir -p ${BOINC_BUILD_DIR} || die
+}
+
+boinc_src_unpack() {
+	default_src_unpack
+	boinc_builddir_check
+
+	[[ -d ${S} ]] && \
+		return
+
+	# Special case, for the always-lovely GitHub fetches. With this,
+	# we allow the star glob to just expand to whatever directory it's
+	# called.
+	if [[ "${BOINC_S:=${P}}" = *"*"* ]]; then
+		pushd "${WORKDIR}" >/dev/null || die
+		local shopt_save=$(shopt -p nullglob)
+		shopt -s nullglob
+
+		# use an array to trigger filename expansion
+		BOINC_S=( ${BOINC_S} )
+		if [[ ${#BOINC_S[@]} -gt 1 ]]; then
+			die "BOINC_S did expand to multiple paths: ${BOINC_S[*]}"
+		fi
+
+		${shopt_save}
+		popd >/dev/null || die
+	fi
+
+	mkdir -p "$(dirname "${S}")" || die
+	mv "${WORKDIR}/${BOINC_S}" "${S}" || die
+}
+
+boinc_src_prepare() {
+	boinc_builddir_check
+	default_src_prepare
+
+	if [[ ${_BOINC_RUN_AUTOTOOLS} ]]; then
+		pushd "${BOINC_BUILD_DIR}" >/dev/null || die
+		eautoreconf
+		popd >/dev/null || die
+	fi
+}
+
+boinc_src_configure() {
+	boinc_builddir_check
+	pushd "${BOINC_BUILD_DIR}" >/dev/null || die
+
+	bash ./generate_svn_version.sh || \
+		die "generating svn_version.h failed"
+
+	if [[ ${_BOINC_RUN_AUTOTOOLS} ]]; then
+		econf "${_BOINC_ECONF_ARGS[@]}"
+	else
+		tc-export AR CC CPP CXX LD OBJDUMP RANLIB
+	fi
+
+	if [[ ${_BOINC_CONFIG_OVERRIDE} ]]; then
+		cp "${_BOINC_CONFIG_OVERRIDE}" config.h || die
+	fi
+
+	popd >/dev/null || die
+}
+
+_BOINC_ECLASS=1
+fi


             reply	other threads:[~2021-07-22  8:29 UTC|newest]

Thread overview: 179+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  8:29 Anna Vyalkova [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-28 10:44 [gentoo-commits] repo/proj/guru:dev commit in: eclass/ Anna Vyalkova
2024-11-26 14:15 Anna Vyalkova
2024-10-18 14:25 Anna Vyalkova
2024-07-14 17:47 Florian Schmaus
2024-07-14  7:27 Anna Vyalkova
2024-07-14  7:27 Anna Vyalkova
2024-07-14  7:27 Anna Vyalkova
2024-07-14  7:27 Anna Vyalkova
2024-07-14  7:27 Anna Vyalkova
2024-07-14  7:27 Anna Vyalkova
2024-07-14  7:27 Anna Vyalkova
2024-07-01  2:10 Anna Vyalkova
2024-04-27  9:50 Anna Vyalkova
2024-04-01 11:32 [gentoo-commits] repo/proj/guru:master " Julien Roy
2024-04-01 11:18 ` [gentoo-commits] repo/proj/guru:dev " Julien Roy
2024-03-31 17:57 [gentoo-commits] repo/proj/guru:master " Julien Roy
2024-03-31 17:49 ` [gentoo-commits] repo/proj/guru:dev " Julien Roy
2024-03-31 17:49 Julien Roy
2024-02-04 19:32 Anna Vyalkova
2024-02-04 19:32 Anna Vyalkova
2024-02-04 19:26 Anna Vyalkova
2024-02-04 19:26 Anna Vyalkova
2024-01-22 17:52 Anna Vyalkova
2024-01-22 10:54 Anna Vyalkova
2024-01-21 22:50 Anna Vyalkova
2024-01-20  7:12 Anna Vyalkova
2024-01-01 21:27 Anna Vyalkova
2023-10-05 13:10 David Roman
2023-10-04 20:53 Anna Figueiredo Gomes
2023-08-30  5:30 Viorel Munteanu
2023-08-07  5:59 Haelwenn Monnier
2023-08-06 12:22 Haelwenn Monnier
2023-08-04  7:26 Florian Schmaus
2023-08-04  7:26 Florian Schmaus
2023-07-17 14:24 [gentoo-commits] repo/proj/guru:master " Florian Schmaus
2023-07-17 14:24 ` [gentoo-commits] repo/proj/guru:dev " Florian Schmaus
2023-06-24 19:22 Haelwenn Monnier
2023-05-21 16:27 Anna Vyalkova
2023-05-21 16:27 Anna Vyalkova
2023-05-09 19:30 Anna Vyalkova
2023-05-09 15:43 Anna Vyalkova
2023-05-09 15:43 Anna Vyalkova
2023-05-09 15:43 Anna Vyalkova
2023-05-09 15:43 Anna Vyalkova
2023-05-08 16:45 Anna Vyalkova
2023-05-06 18:00 Anna Vyalkova
2023-05-06 17:52 Anna Vyalkova
2023-05-06 15:55 Anna Vyalkova
2023-04-12 18:44 Jonas Frei
2023-04-06 14:09 Anna Vyalkova
2023-04-06 14:09 Anna Vyalkova
2023-03-31 18:48 Anna Vyalkova
2023-03-31 18:48 Anna Vyalkova
2023-03-31 18:14 Jonas Frei
2023-02-27  3:42 Anna Vyalkova
2023-02-27  3:42 Anna Vyalkova
2023-01-15 15:14 Anna Figueiredo Gomes
2023-01-08  2:17 Anna Vyalkova
2022-12-08 17:02 Anna Figueiredo Gomes
2022-11-26 13:51 Anna Vyalkova
2022-11-26 13:51 Anna Vyalkova
2022-11-26 13:51 Anna Vyalkova
2022-11-26 13:51 Anna Vyalkova
2022-11-25 17:54 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25 11:37 Anna Vyalkova
2022-11-25  2:44 Anna Figueiredo Gomes
2022-11-25  2:38 Anna Figueiredo Gomes
2022-11-16 15:09 Anna Vyalkova
2022-11-16 14:30 Anna Vyalkova
2022-11-16 14:30 Anna Vyalkova
2022-11-10  0:50 Anna Figueiredo Gomes
2022-11-09  9:25 Anna Vyalkova
2022-11-08 19:20 Anna Vyalkova
2022-11-08 17:55 Anna Vyalkova
2022-11-08 17:55 Anna Vyalkova
2022-11-05 14:41 Anna Vyalkova
2022-07-20  9:33 Anna Vyalkova
2022-07-19  6:33 Anna Vyalkova
2022-07-19  6:07 Anna Vyalkova
2022-07-19  6:07 Anna Vyalkova
2022-07-16 21:08 Anna Vyalkova
2022-07-16 13:44 Anna Vyalkova
2022-07-16 13:44 Anna Vyalkova
2022-07-16 13:44 Anna Vyalkova
2022-07-16 13:44 Anna Vyalkova
2022-07-16 13:44 Anna Vyalkova
2022-07-16 13:44 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-13  2:31 Anna Vyalkova
2022-07-12 12:06 Robert Greener
2022-07-12 12:06 Robert Greener
2022-07-12 12:06 Robert Greener
2022-07-12 12:06 Robert Greener
2022-07-10  3:36 Anna Vyalkova
2022-07-05 20:09 Anna Vyalkova
2022-07-05 20:09 Anna Vyalkova
2022-07-05 20:09 Anna Vyalkova
2022-06-30  6:01 Anna Vyalkova
2022-06-30  6:01 Anna Vyalkova
2022-06-30  6:01 Anna Vyalkova
2022-06-29 11:52 Anna Vyalkova
2022-06-29 11:52 Anna Vyalkova
2022-06-26  2:36 Alessandro Barbieri
2022-06-25 19:42 Anna Vyalkova
2022-06-25 17:43 Anna Vyalkova
2022-06-25 17:43 Anna Vyalkova
2022-06-15 22:41 Alessandro Barbieri
2022-06-14  9:12 Alessandro Barbieri
2022-06-14  8:00 Alessandro Barbieri
2022-06-14  8:00 Alessandro Barbieri
2022-06-07  6:26 Anna Vyalkova
2022-06-02  1:23 Alessandro Barbieri
2022-06-02  1:23 Alessandro Barbieri
2022-05-31 13:14 Nicola Smaniotto
2022-05-28 21:19 Alessandro Barbieri
2022-05-11 11:29 Alessandro Barbieri
2022-05-08  1:58 Alessandro Barbieri
2022-05-07  7:25 Alessandro Barbieri
2022-05-07  2:11 Alessandro Barbieri
2022-05-07  2:11 Alessandro Barbieri
2022-05-07  2:11 Alessandro Barbieri
2022-05-07  0:48 Alessandro Barbieri
2022-05-07  0:48 Alessandro Barbieri
2022-05-06 16:34 Alessandro Barbieri
2022-05-05  7:32 Alessandro Barbieri
2022-05-05  7:32 Alessandro Barbieri
2022-05-05  7:32 Alessandro Barbieri
2022-04-24 16:46 Nicola Smaniotto
2022-04-19 18:31 Alessandro Barbieri
2022-04-16 16:20 Alessandro Barbieri
2022-04-15 20:34 Alessandro Barbieri
2022-04-15 20:34 Alessandro Barbieri
2022-04-14  9:26 Nicola Smaniotto
2022-04-11  9:41 Anna Vyalkova
2022-04-11  9:41 Anna Vyalkova
2022-04-11  9:41 Anna Vyalkova
2022-03-31  7:24 Anna Vyalkova
2022-02-17 21:11 Anna Vyalkova
2022-02-17 21:11 Anna Vyalkova
2021-10-05 21:24 Alessandro Barbieri
2021-09-29 13:14 Alessandro Barbieri
2021-09-29 13:08 Alessandro Barbieri
2021-09-08 10:46 Alessandro Barbieri
2021-07-25 18:15 Anna Vyalkova
2021-07-22  8:29 Anna Vyalkova
2021-06-17 16:01 Alessandro Barbieri
2021-05-31 23:15 Alessandro Barbieri
2021-05-24 14:49 Alessandro Barbieri
2021-05-17 10:16 Alessandro Barbieri
2021-03-16  0:55 Alessandro Barbieri
2021-03-14 22:58 Alessandro Barbieri
2021-03-14 22:49 Alessandro Barbieri
2020-12-06 10:46 Andrew Ammerlaan
2020-05-06 23:36 Alessandro Barbieri
2020-05-06 23:36 Alessandro Barbieri
2020-05-01 11:45 Kurt Kanzenbach
2020-04-28  8:01 [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-28  8:00 ` [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-28  7:44 [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-28  7:44 ` [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-21 10:23 [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-21 10:22 ` [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-21 10:20 [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-21 10:20 ` [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-07  7:42 [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-06 19:36 ` [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-07  7:42 [gentoo-commits] repo/proj/guru:master " Andrew Ammerlaan
2020-04-06 18:45 ` [gentoo-commits] repo/proj/guru:dev " Andrew Ammerlaan
2020-04-07  7:27 Andrew Ammerlaan
2020-04-07  7:16 Andrew Ammerlaan
2020-04-06 18:26 Andrew Ammerlaan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1626942459.708b16c5bb904fd2f07a47982c9632c767580fb0.cybertailor@gentoo \
    --to=cyber+gentoo@sysrq.in \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox