commit:     fc3e6bec182a65e82d3bc2c66922fe13795e8b9d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  6 03:19:08 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  6 03:19:45 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc3e6bec

sys-apps/dtc: add 1.7.0 (now with meson!)

This fixes the build on macOS as well, because we're using a proper build
system now (install_name was wrong before).

Reported-by: Konstantin Kliakhandler
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/dtc/Manifest                          |  1 +
 sys-apps/dtc/dtc-1.7.0.ebuild                  | 51 +++++++++++++++++++
 sys-apps/dtc/dtc-9999.ebuild                   | 68 ++++++--------------------
 sys-apps/dtc/files/dtc-1.7.0-meson-macos.patch | 39 +++++++++++++++
 sys-apps/dtc/files/dtc-1.7.0-meson-tests.patch | 27 ++++++++++
 5 files changed, 134 insertions(+), 52 deletions(-)

diff --git a/sys-apps/dtc/Manifest b/sys-apps/dtc/Manifest
index 993154b8a266..48789513fcd2 100644
--- a/sys-apps/dtc/Manifest
+++ b/sys-apps/dtc/Manifest
@@ -1 +1,2 @@
 DIST dtc-1.6.0.tar.xz 158584 BLAKE2B 
47b15b5df7f5d87369d6daaad87f2989a80865f2fab19f89d050d390a9f8319bcd86a36e12f7cc8d62947bb4d1335769071d0e3ea0a6e16861aea163e78f4696
 SHA512 
15433b24f1d6b7ed1f8066d050bd1bcbf988731aa38147564e3dd04b5f69af8d69e03befdc621a768526c620425a9bdd24aad4f9ff135930d6a1eeb0625f7de3
+DIST dtc-1.7.0.tar.xz 165548 BLAKE2B 
de433a1034b7ef75559bf39f85695d0b275cfd17bf100c12b6186e226a65659053f9b5a053f20e64a5a0670ea3e728edd0e624c26287bd264594569408065bab
 SHA512 
d3ba6902a9a2f2cdbaff55f12fca3cfe4a1ec5779074a38e3d8b88097c7abc981835957e8ce72971e10c131e05fde0b1b961768e888ff96d89e42c75edb53afb

diff --git a/sys-apps/dtc/dtc-1.7.0.ebuild b/sys-apps/dtc/dtc-1.7.0.ebuild
new file mode 100644
index 000000000000..8efc03c0d12b
--- /dev/null
+++ b/sys-apps/dtc/dtc-1.7.0.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson toolchain-funcs
+
+if [[ ${PV} == 9999 ]] ; then
+       EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/dtc/dtc.git"
+       inherit git-r3
+else
+       SRC_URI="https://www.kernel.org/pub/software/utils/${PN}/${P}.tar.xz";
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+
+DESCRIPTION="Open Firmware device tree compiler"
+HOMEPAGE="https://devicetree.org/ 
https://git.kernel.org/cgit/utils/dtc/dtc.git/";
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="static-libs yaml"
+
+BDEPEND="
+       sys-devel/bison
+       sys-devel/flex
+       virtual/pkgconfig
+"
+RDEPEND="yaml? ( dev-libs/libyaml )"
+DEPEND="${RDEPEND}"
+
+DOCS=(
+       Documentation/dt-object-internal.txt
+       Documentation/dts-format.txt
+       Documentation/manual.txt
+)
+
+PATCHES=(
+       "${FILESDIR}"/${P}-meson-tests.patch
+       "${FILESDIR}"/${P}-meson-macos.patch
+)
+
+src_configure() {
+       local emesonargs=(
+               -Ddefault_library=$(usex static-libs both shared)
+               -Dpython=disabled
+               -Dvalgrind=disabled # only used for some tests
+               $(meson_feature yaml)
+       )
+
+       meson_src_configure
+}

diff --git a/sys-apps/dtc/dtc-9999.ebuild b/sys-apps/dtc/dtc-9999.ebuild
index 4f65bb653123..2f21c8739ec9 100644
--- a/sys-apps/dtc/dtc-9999.ebuild
+++ b/sys-apps/dtc/dtc-9999.ebuild
@@ -1,16 +1,16 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
-inherit toolchain-funcs
+inherit meson toolchain-funcs
 
-if [[ ${PV} == "9999" ]] ; then
+if [[ ${PV} == 9999 ]] ; then
        EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/dtc/dtc.git"
        inherit git-r3
 else
        SRC_URI="https://www.kernel.org/pub/software/utils/${PN}/${P}.tar.xz";
-       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86"
 fi
 
 DESCRIPTION="Open Firmware device tree compiler"
@@ -25,58 +25,22 @@ BDEPEND="
        sys-devel/flex
        virtual/pkgconfig
 "
-RDEPEND="yaml? ( dev-libs/libyaml )"
+RDEPEND="yaml? ( >=dev-libs/libyaml-0.2.3 )"
 DEPEND="${RDEPEND}"
 
-DOCS="
+DOCS=(
        Documentation/dt-object-internal.txt
        Documentation/dts-format.txt
        Documentation/manual.txt
-"
-
-_emake() {
-       # valgrind is used only in 'make checkm'
-       emake \
-               NO_PYTHON=1 \
-               NO_VALGRIND=1 \
-               NO_YAML=$(usex !yaml 1 0) \
-               \
-               AR="$(tc-getAR)" \
-               CC="$(tc-getCC)" \
-               PKG_CONFIG="$(tc-getPKG_CONFIG)" \
-               \
-               V=1 \
-               \
-               PREFIX="${EPREFIX}/usr" \
-               \
-               LIBDIR="\$(PREFIX)/$(get_libdir)" \
-               \
-               "$@"
-}
-
-src_prepare() {
-       default
-
-       sed -i \
-               -e '/^CFLAGS =/s:=:+=:' \
-               -e '/^CPPFLAGS =/s:=:+=:' \
-               -e 's:-Werror::' \
-               -e 's:-g -Os::' \
-               Makefile || die
-
-       tc-export AR CC PKG_CONFIG
-}
-
-src_compile() {
-       _emake
-}
-
-src_test() {
-       _emake check
-}
+)
 
-src_install() {
-       _emake DESTDIR="${D}" install
+src_configure() {
+       local emesonargs=(
+               -Ddefault_library=$(usex static-libs both shared)
+               -Dpython=disabled
+               -Dvalgrind=disabled # only used for some tests
+               $(meson_feature yaml)
+       )
 
-       use static-libs || find "${ED}" -name '*.a' -delete
+       meson_src_configure
 }

diff --git a/sys-apps/dtc/files/dtc-1.7.0-meson-macos.patch 
b/sys-apps/dtc/files/dtc-1.7.0-meson-macos.patch
new file mode 100644
index 000000000000..473cd9a29e1a
--- /dev/null
+++ b/sys-apps/dtc/files/dtc-1.7.0-meson-macos.patch
@@ -0,0 +1,39 @@
+https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=71a8b8ef0adf01af4c78c739e04533a35c1dc89c
+
+From 71a8b8ef0adf01af4c78c739e04533a35c1dc89c Mon Sep 17 00:00:00 2001
+From: Otavio Salvador <[email protected]>
+Date: Wed, 31 May 2023 11:41:42 -0300
+Subject: libfdt: meson: Fix linking on macOS linker
+
+-undefined error is the equivalent of --no-undefined for the macOS
+linker, but -undefined would also be understood as a valid argument for
+GNU ld so we use the supported linker variant.
+
+Signed-off-by: Otavio Salvador <[email protected]>
+Signed-off-by: David Gibson <[email protected]>
+--- a/libfdt/meson.build
++++ b/libfdt/meson.build
+@@ -16,10 +16,20 @@ sources = files(
+   'fdt_wip.c',
+ )
+ 
++link_args = []
++if cc.has_link_argument('-Wl,--no-undefined')
++    link_args += '-Wl,--no-undefined'
++else
++    # -undefined error is the equivalent of --no-undefined for the macOS 
linker,
++    # but -undefined would also be understood as a valid argument for GNU ld!
++    link_args += cc.get_supported_link_arguments('-Wl,-undefined,error')
++endif
++
++link_args += version_script
+ libfdt = library(
+   'fdt', sources,
+   version: '1.6.0',
+-  link_args: ['-Wl,--no-undefined', version_script],
++  link_args: link_args,
+   link_depends: 'version.lds',
+   install: true,
+ )
+-- 
+cgit

diff --git a/sys-apps/dtc/files/dtc-1.7.0-meson-tests.patch 
b/sys-apps/dtc/files/dtc-1.7.0-meson-tests.patch
new file mode 100644
index 000000000000..0bc2d71aea1c
--- /dev/null
+++ b/sys-apps/dtc/files/dtc-1.7.0-meson-tests.patch
@@ -0,0 +1,27 @@
+https://git.kernel.org/pub/scm/utils/dtc/dtc.git/patch/?id=32174a66efa4ad19fc6a2a6422e4af2ae4f055cb
+
+From 32174a66efa4ad19fc6a2a6422e4af2ae4f055cb Mon Sep 17 00:00:00 2001
+From: David Gibson <[email protected]>
+Date: Tue, 28 Feb 2023 10:33:58 +1100
+Subject: meson: Fix cell overflow tests when running from meson
+
+Because meson always builds out-of-tree we need to reference things in the
+original source tree via $SRCDIR from run_tests.sh.  We forgot a couple of
+cases for the cell overflow tests.  Fix them.
+
+Signed-off-by: David Gibson <[email protected]>
+--- a/tests/run_tests.sh
++++ b/tests/run_tests.sh
+@@ -519,8 +519,8 @@ libfdt_tests () {
+     check_tests "$SRCDIR/phandle-args-overflow.dts" clocks_property
+ 
+     ## https://github.com/dgibson/dtc/issues/74
+-    run_dtc_test -I dts -O dtb -o cell-overflow-results.test.dtb 
cell-overflow-results.dts
+-    run_dtc_test -I dts -O dtb -o cell-overflow.test.dtb cell-overflow.dts
++    run_dtc_test -I dts -O dtb -o cell-overflow-results.test.dtb 
"$SRCDIR/cell-overflow-results.dts"
++    run_dtc_test -I dts -O dtb -o cell-overflow.test.dtb 
"$SRCDIR/cell-overflow.dts"
+     run_test dtbs_equal_ordered cell-overflow.test.dtb 
cell-overflow-results.test.dtb
+ 
+     # check full tests
+-- 
+cgit

Reply via email to