* [gentoo-guru] [PATCH 0/3] New eclass for review
@ 2022-06-06 10:20 Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass Anna (cybertailor) Vyalkova
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Anna (cybertailor) Vyalkova @ 2022-06-06 10:20 UTC (permalink / raw
To: gentoo-guru
I need feedback for a new eclass.
BTW, this eclass doesn't work with ccache. Any idea how to fix it?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass
2022-06-06 10:20 [gentoo-guru] [PATCH 0/3] New eclass for review Anna (cybertailor) Vyalkova
@ 2022-06-06 10:20 ` Anna (cybertailor) Vyalkova
2022-06-06 11:07 ` Andrew Ammerlaan
2022-06-06 10:20 ` [gentoo-guru] [PATCH 2/3] dev-cpp/libcutl: use build2 eclass Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 3/3] dev-cpp/libstudxml: " Anna (cybertailor) Vyalkova
2 siblings, 1 reply; 6+ messages in thread
From: Anna (cybertailor) Vyalkova @ 2022-06-06 10:20 UTC (permalink / raw
To: gentoo-guru
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/build2.eclass | 150 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 150 insertions(+)
create mode 100644 eclass/build2.eclass
diff --git a/eclass/build2.eclass b/eclass/build2.eclass
new file mode 100644
index 000000000..002b08c6e
--- /dev/null
+++ b/eclass/build2.eclass
@@ -0,0 +1,150 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: build2.eclass
+# @MAINTAINER:
+# Anna Vyalkova <cyber+gentoo@sysrq.in>
+# @AUTHOR:
+# Anna Vyalkova <cyber+gentoo@sysrq.in>
+# @SUPPORTED_EAPIS: 8
+# @BLURB: eclass for packages using build2
+# @DESCRIPTION:
+# Utility eclass providing wrapper functions for the build2 build system along
+# with default phase functions.
+
+case ${EAPI:-0} in
+ 8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported."
+esac
+
+if [[ ! ${_BUILD2_ECLASS} ]]; then
+
+inherit edo multiprocessing toolchain-funcs
+
+fi
+
+EXPORT_FUNCTIONS src_configure src_compile src_test src_install
+
+if [[ ! ${_BUILD2_ECLASS} ]]; then
+
+# @ECLASS_VARIABLE: BUILD2_VERBOSITY
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Determines what kind of output to show when executing commands. All possible
+# options are listed in b(1).
+: ${BUILD2_VERBOSITY:=2}
+
+BDEPEND="dev-util/build2"
+
+# @FUNCTION: build2_src_configure
+# @DESCRIPTION:
+# Set build2 preferences to match user settings. Configure toolchain, build
+# flags and installation prefix.
+build2_src_configure() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ -z ${mybargs} ]] && declare -a mybargs=()
+ local mybargstype=$(declare -p mybargs 2>&-)
+ if [[ "${mybargstype}" != "declare -a mybargs="* ]]; then
+ die "mybargs must be declared as array"
+ fi
+
+ local bargs=(
+ config.cxx="$(tc-getCXX)"
+ config.cxx.coptions="${CXXFLAGS}"
+ config.cxx.loptions="${LDFLAGS}"
+ config.c="$(tc-getCC)"
+ config.cc.coptions="${CFLAGS}"
+ config.cc.loptions="${LDFLAGS}"
+ config.bin.ar="$(tc-getAR)"
+ config.bin.ranlib="$(tc-getRANLIB)"
+ config.bin.lib=shared
+ config.install.root="${EPREFIX}"/usr
+ config.install.lib="${EPREFIX}"/usr/$(get_libdir)
+ config.install.doc="${EPREFIX}"/usr/share/doc/${PF}
+ "${mybargs[@]}"
+ --jobs $(makeopts_jobs)
+ --verbose "${BUILD2_VERBOSITY}"
+ )
+
+ edo b configure "${bargs[@]}"
+}
+
+# @FUNCTION: build2_src_compile
+# @USAGE: [<b args>...]
+# @DESCRIPTION:
+# General function for compiling with build2. Tests are built conditionally.
+build2_src_compile() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local build_tests=no
+ local bargs=(
+ "${@}"
+ --jobs $(makeopts_jobs)
+ --verbose "${BUILD2_VERBOSITY}"
+ )
+
+ edo b update-for-install "${bargs[@]}"
+ has test ${FEATURES} && edo b update-for-test "${bargs[@]}"
+}
+
+# @FUNCTION: build2_src_test
+# @USAGE: [<b args>...]
+# @DESCRIPTION:
+# Test the package using "b test".
+build2_src_test() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local bargs=(
+ "${@}"
+ --jobs $(makeopts_jobs)
+ --verbose "${BUILD2_VERBOSITY}"
+ )
+
+ edo b test "${bargs[@]}"
+}
+
+# @FUNCTION: build2_src_install
+# @USAGE: [<b args>...]
+# @DESCRIPTION:
+# Install the package using "b install".
+build2_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local bargs=(
+ config.install.chroot="${D}"
+ "${@}"
+ --jobs $(makeopts_jobs)
+ --verbose "${BUILD2_VERBOSITY}"
+ )
+
+ edo b install "${bargs[@]}"
+ einstalldocs
+}
+
+# @FUNCTION: build2_pkg_die
+# @INTERNAL
+# @DESCRIPTION:
+# EBUILD_DEATH_HOOK function to display a warning if ccache is enabled.
+
+if ! has build2_pkg_die ${EBUILD_DEATH_HOOKS}; then
+ EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} build2_pkg_die"
+fi
+
+build2_pkg_die() {
+ if [[ "${EBUILD_PHASE}" != "compile" ]]; then
+ return
+ fi
+
+ if has ccache ${FEATURES}; then
+ # build2 doesn't support ccache:
+ # https://github.com/build2/build2/issues/86#issuecomment-647401742
+ ewarn
+ ewarn "!!! You have enabled ccache. Please try disabling ccache"
+ ewarn "!!! before reporting a bug."
+ ewarn
+ fi
+}
+
+_BUILD2_ECLASS=1
+fi
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-guru] [PATCH 2/3] dev-cpp/libcutl: use build2 eclass
2022-06-06 10:20 [gentoo-guru] [PATCH 0/3] New eclass for review Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass Anna (cybertailor) Vyalkova
@ 2022-06-06 10:20 ` Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 3/3] dev-cpp/libstudxml: " Anna (cybertailor) Vyalkova
2 siblings, 0 replies; 6+ messages in thread
From: Anna (cybertailor) Vyalkova @ 2022-06-06 10:20 UTC (permalink / raw
To: gentoo-guru
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
---
dev-cpp/libcutl/libcutl-1.11.0_beta9.ebuild | 55 +++------------------
1 file changed, 6 insertions(+), 49 deletions(-)
diff --git a/dev-cpp/libcutl/libcutl-1.11.0_beta9.ebuild b/dev-cpp/libcutl/libcutl-1.11.0_beta9.ebuild
index 12b258c0b..187eb5e62 100644
--- a/dev-cpp/libcutl/libcutl-1.11.0_beta9.ebuild
+++ b/dev-cpp/libcutl/libcutl-1.11.0_beta9.ebuild
@@ -1,61 +1,18 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MY_P="${PN}-$(ver_cut 1-3)-b.$(ver_cut 5)"
-inherit edo multiprocessing
+inherit build2
SRC_URI="https://pkg.cppget.org/1/beta/${PN}/${MY_P}.tar.gz"
-KEYWORDS='~amd64 ~x86'
-DESCRIPTION='C++ utility library'
-HOMEPAGE='https://www.codesynthesis.com/projects/libcutl/'
-LICENSE='MIT'
+DESCRIPTION="C++ utility library"
+HOMEPAGE="https://www.codesynthesis.com/projects/libcutl/"
-SLOT='0'
-IUSE='test'
-RESTRICT='!test? ( test )'
-
-BDEPEND='dev-util/build2'
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+LICENSE="MIT"
S="${WORKDIR}/${MY_P}"
-
-src_configure() {
- edo b configure \
- config.cc.coptions="${CFLAGS}" \
- config.cc.loptions="${LDFLAGS}" \
- config.cxx.coptions="${CXXFLAGS}" \
- config.cxx.loptions="${LDFLAGS}" \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
-}
-
-src_compile() {
- edo b update-for-install \
- config.install.root="${EPREFIX}"/usr \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
- use test && edo b update-for-test \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
-}
-
-src_test() {
- edo b test \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
-}
-
-src_install() {
- edo b install \
- config.install.chroot="${D}" \
- config.install.root="${EPREFIX}"/usr \
- config.install.lib="${EPREFIX}"/usr/$(get_libdir) \
- config.install.doc="${EPREFIX}"/usr/share/doc/${PF} \
- --no-progress
-}
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [gentoo-guru] [PATCH 3/3] dev-cpp/libstudxml: use build2 eclass
2022-06-06 10:20 [gentoo-guru] [PATCH 0/3] New eclass for review Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 2/3] dev-cpp/libcutl: use build2 eclass Anna (cybertailor) Vyalkova
@ 2022-06-06 10:20 ` Anna (cybertailor) Vyalkova
2 siblings, 0 replies; 6+ messages in thread
From: Anna (cybertailor) Vyalkova @ 2022-06-06 10:20 UTC (permalink / raw
To: gentoo-guru
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
---
.../libstudxml/libstudxml-1.1.0_beta10.ebuild | 57 +++----------------
1 file changed, 7 insertions(+), 50 deletions(-)
diff --git a/dev-cpp/libstudxml/libstudxml-1.1.0_beta10.ebuild b/dev-cpp/libstudxml/libstudxml-1.1.0_beta10.ebuild
index 8311e6323..f998177bc 100644
--- a/dev-cpp/libstudxml/libstudxml-1.1.0_beta10.ebuild
+++ b/dev-cpp/libstudxml/libstudxml-1.1.0_beta10.ebuild
@@ -1,61 +1,18 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
MY_P="${PN}-$(ver_cut 1-3)-b.$(ver_cut 5)"
-inherit multiprocessing
+inherit build2
SRC_URI="https://pkg.cppget.org/1/beta/${PN}/${MY_P}.tar.gz"
-KEYWORDS='~amd64 ~x86'
-DESCRIPTION='Streaming XML pull parser/serializer for modern C++'
-HOMEPAGE='https://www.codesynthesis.com/projects/libstudxml/'
-LICENSE='MIT'
+DESCRIPTION="Streaming XML pull parser/serializer for modern C++"
+HOMEPAGE="https://www.codesynthesis.com/projects/libstudxml/"
-SLOT='0'
-IUSE='test'
-RESTRICT='!test? ( test )'
-
-BDEPEND='dev-util/build2'
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+LICENSE="MIT"
S="${WORKDIR}/${MY_P}"
-
-src_configure() {
- b configure \
- config.cc.coptions="${CFLAGS}" \
- config.cc.loptions="${LDFLAGS}" \
- config.cxx.coptions="${CXXFLAGS}" \
- config.cxx.loptions="${LDFLAGS}" \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
-}
-
-src_compile() {
- b update-for-install \
- config.install.root="${EPREFIX}"/usr \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
- use test && b update-for-test \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
-}
-
-src_test() {
- b test \
- --jobs $(makeopts_jobs) \
- --no-progress \
- --verbose 2
-}
-
-src_install() {
- b install \
- config.install.chroot="${D}" \
- config.install.root="${EPREFIX}"/usr \
- config.install.lib="${EPREFIX}"/usr/$(get_libdir) \
- config.install.doc="${EPREFIX}"/usr/share/doc/${PF} \
- --no-progress
-}
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass
2022-06-06 10:20 ` [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass Anna (cybertailor) Vyalkova
@ 2022-06-06 11:07 ` Andrew Ammerlaan
2022-06-06 11:17 ` A.V.
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Ammerlaan @ 2022-06-06 11:07 UTC (permalink / raw
To: gentoo-guru
On 06/06/2022 12:20, Anna (cybertailor) Vyalkova wrote:
> Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
> ---
> eclass/build2.eclass | 150 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 150 insertions(+)
> create mode 100644 eclass/build2.eclass
>
> diff --git a/eclass/build2.eclass b/eclass/build2.eclass
> new file mode 100644
> index 000000000..002b08c6e
> --- /dev/null
> +++ b/eclass/build2.eclass
> @@ -0,0 +1,150 @@
> +# Copyright 2022 Gentoo Authors
> +# Distributed under the terms of the GNU General Public License v2
> +
> +# @ECLASS: build2.eclass
> +# @MAINTAINER:
> +# Anna Vyalkova <cyber+gentoo@sysrq.in>
> +# @AUTHOR:
> +# Anna Vyalkova <cyber+gentoo@sysrq.in>
> +# @SUPPORTED_EAPIS: 8
> +# @BLURB: eclass for packages using build2
> +# @DESCRIPTION:
> +# Utility eclass providing wrapper functions for the build2 build system along
> +# with default phase functions.
> +
> +case ${EAPI:-0} in
> + 8) ;;
> + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported."
> +esac
> +
> +if [[ ! ${_BUILD2_ECLASS} ]]; then
> +
> +inherit edo multiprocessing toolchain-funcs
> +
> +fi
> +
> +EXPORT_FUNCTIONS src_configure src_compile src_test src_install
I think this should also be within the if. If we accidentally inherit it
twice somehow then we should not export the functions twice, right?
> +
> +if [[ ! ${_BUILD2_ECLASS} ]]; then
> +
> +# @ECLASS_VARIABLE: BUILD2_VERBOSITY
> +# @USER_VARIABLE
> +# @DESCRIPTION:
> +# Determines what kind of output to show when executing commands. All possible
> +# options are listed in b(1).
> +: ${BUILD2_VERBOSITY:=2}
> +
> +BDEPEND="dev-util/build2"
> +
> +# @FUNCTION: build2_src_configure
> +# @DESCRIPTION:
> +# Set build2 preferences to match user settings. Configure toolchain, build
> +# flags and installation prefix.
> +build2_src_configure() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + [[ -z ${mybargs} ]] && declare -a mybargs=()
> + local mybargstype=$(declare -p mybargs 2>&-)
> + if [[ "${mybargstype}" != "declare -a mybargs="* ]]; then
> + die "mybargs must be declared as array"
> + fi
> +
> + local bargs=(
> + config.cxx="$(tc-getCXX)"
> + config.cxx.coptions="${CXXFLAGS}"
> + config.cxx.loptions="${LDFLAGS}"
> + config.c="$(tc-getCC)"
> + config.cc.coptions="${CFLAGS}"
> + config.cc.loptions="${LDFLAGS}"
> + config.bin.ar="$(tc-getAR)"
> + config.bin.ranlib="$(tc-getRANLIB)"
> + config.bin.lib=shared
> + config.install.root="${EPREFIX}"/usr
> + config.install.lib="${EPREFIX}"/usr/$(get_libdir)
> + config.install.doc="${EPREFIX}"/usr/share/doc/${PF}
> + "${mybargs[@]}"
> + --jobs $(makeopts_jobs)
> + --verbose "${BUILD2_VERBOSITY}"
> + )
> +
> + edo b configure "${bargs[@]}"
> +}
> +
> +# @FUNCTION: build2_src_compile
> +# @USAGE: [<b args>...]
> +# @DESCRIPTION:
> +# General function for compiling with build2. Tests are built conditionally.
> +build2_src_compile() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + local build_tests=no
> + local bargs=(
> + "${@}"
> + --jobs $(makeopts_jobs)
> + --verbose "${BUILD2_VERBOSITY}"
> + )
> +
> + edo b update-for-install "${bargs[@]}"
> + has test ${FEATURES} && edo b update-for-test "${bargs[@]}"
> +}
> +
> +# @FUNCTION: build2_src_test
> +# @USAGE: [<b args>...]
> +# @DESCRIPTION:
> +# Test the package using "b test".
> +build2_src_test() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + local bargs=(
> + "${@}"
> + --jobs $(makeopts_jobs)
> + --verbose "${BUILD2_VERBOSITY}"
> + )
> +
> + edo b test "${bargs[@]}"
> +}
> +
> +# @FUNCTION: build2_src_install
> +# @USAGE: [<b args>...]
> +# @DESCRIPTION:
> +# Install the package using "b install".
> +build2_src_install() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + local bargs=(
> + config.install.chroot="${D}"
> + "${@}"
> + --jobs $(makeopts_jobs)
> + --verbose "${BUILD2_VERBOSITY}"
> + )
> +
> + edo b install "${bargs[@]}"
> + einstalldocs
> +}
> +
> +# @FUNCTION: build2_pkg_die
> +# @INTERNAL
> +# @DESCRIPTION:
> +# EBUILD_DEATH_HOOK function to display a warning if ccache is enabled.
> +
> +if ! has build2_pkg_die ${EBUILD_DEATH_HOOKS}; then
> + EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} build2_pkg_die"
> +fi
> +
> +build2_pkg_die() {
> + if [[ "${EBUILD_PHASE}" != "compile" ]]; then
> + return
> + fi
> +
> + if has ccache ${FEATURES}; then
> + # build2 doesn't support ccache:
> + # https://github.com/build2/build2/issues/86#issuecomment-647401742
> + ewarn
> + ewarn "!!! You have enabled ccache. Please try disabling ccache"
> + ewarn "!!! before reporting a bug."
> + ewarn
> + fi
> +}
> +
> +_BUILD2_ECLASS=1
> +fi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass
2022-06-06 11:07 ` Andrew Ammerlaan
@ 2022-06-06 11:17 ` A.V.
0 siblings, 0 replies; 6+ messages in thread
From: A.V. @ 2022-06-06 11:17 UTC (permalink / raw
To: gentoo-guru
On 2022-06-06 13:07, Andrew Ammerlaan wrote:
> On 06/06/2022 12:20, Anna (cybertailor) Vyalkova wrote:
> > Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
> > ---
> > eclass/build2.eclass | 150 +++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 150 insertions(+)
> > create mode 100644 eclass/build2.eclass
> >
> > diff --git a/eclass/build2.eclass b/eclass/build2.eclass
> > new file mode 100644
> > index 000000000..002b08c6e
> > --- /dev/null
> > +++ b/eclass/build2.eclass
> > @@ -0,0 +1,150 @@
> > +# Copyright 2022 Gentoo Authors
> > +# Distributed under the terms of the GNU General Public License v2
> > +
> > +# @ECLASS: build2.eclass
> > +# @MAINTAINER:
> > +# Anna Vyalkova <cyber+gentoo@sysrq.in>
> > +# @AUTHOR:
> > +# Anna Vyalkova <cyber+gentoo@sysrq.in>
> > +# @SUPPORTED_EAPIS: 8
> > +# @BLURB: eclass for packages using build2
> > +# @DESCRIPTION:
> > +# Utility eclass providing wrapper functions for the build2 build system along
> > +# with default phase functions.
> > +
> > +case ${EAPI:-0} in
> > + 8) ;;
> > + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported."
> > +esac
> > +
> > +if [[ ! ${_BUILD2_ECLASS} ]]; then
> > +
> > +inherit edo multiprocessing toolchain-funcs
> > +
> > +fi
> > +
> > +EXPORT_FUNCTIONS src_configure src_compile src_test src_install
>
> I think this should also be within the if. If we accidentally inherit it
> twice somehow then we should not export the functions twice, right?
EXPORT_FUNCTIONS must be placed outside of the inherit guard:
https://devmanual.gentoo.org/eclass-writing/index.html#inherit-guards
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-24 22:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-06 10:20 [gentoo-guru] [PATCH 0/3] New eclass for review Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 1/3] build2.eclass: new eclass Anna (cybertailor) Vyalkova
2022-06-06 11:07 ` Andrew Ammerlaan
2022-06-06 11:17 ` A.V.
2022-06-06 10:20 ` [gentoo-guru] [PATCH 2/3] dev-cpp/libcutl: use build2 eclass Anna (cybertailor) Vyalkova
2022-06-06 10:20 ` [gentoo-guru] [PATCH 3/3] dev-cpp/libstudxml: " Anna (cybertailor) Vyalkova
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox