summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-05-18 20:37:37 +0000
committerSam James <sam@gentoo.org>2022-05-18 20:37:37 +0000
commit1a536e7e575df3fb58dd7d6cf56ec0809718a796 (patch)
tree279058fe38bbe46ac4957ce49ac2073696500312 /sys-block/gparted
parentsci-mathematics/lean: drop old 3.41.0 (diff)
downloadgentoo-1a536e7e575df3fb58dd7d6cf56ec0809718a796.tar.gz
gentoo-1a536e7e575df3fb58dd7d6cf56ec0809718a796.tar.bz2
gentoo-1a536e7e575df3fb58dd7d6cf56ec0809718a796.zip
sys-block/gparted: fix build with musl
Revbump as switching to POSIX basename could in theory (but as per patch, shouldn't) change runtime behaviour for glibc. Closes: https://bugs.gentoo.org/837794 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-block/gparted')
-rw-r--r--sys-block/gparted/files/gparted-1.4.0-musl-basename.patch53
-rw-r--r--sys-block/gparted/gparted-1.4.0-r1.ebuild95
2 files changed, 148 insertions, 0 deletions
diff --git a/sys-block/gparted/files/gparted-1.4.0-musl-basename.patch b/sys-block/gparted/files/gparted-1.4.0-musl-basename.patch
new file mode 100644
index 000000000000..eeba8867ed42
--- /dev/null
+++ b/sys-block/gparted/files/gparted-1.4.0-musl-basename.patch
@@ -0,0 +1,53 @@
+https://gitlab.gnome.org/GNOME/gparted/-/merge_requests/99.patch
+https://bugs.gentoo.org/837794
+
+From 45c00927b72319f00855c7feaf4dcf109b3e4414 Mon Sep 17 00:00:00 2001
+From: Markus Volk <f_l_k@t-online.de>
+Date: Fri, 8 Apr 2022 08:58:46 +0000
+Subject: [PATCH] Use POSIX basename() in BCache_Info.cc (!99)
+
+Musl libc [1][2] doesn't implement the GNU variant of basename() [3][4],
+obtained via #include <string.h>. Therefore GParted fails to build on
+such distributions:
+
+ fdebug-prefix-map=TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/gparted/1.4.0-r0/recipe-sysroot-native=-fvisibility-inlines-hidden -c -o ../../gparted-1.4.0/src/BCache_Info.cc:52:33:
+
+ error: use of undeclared identifier 'basename'; did you mean 'g_basename'?
+ return "/dev/" + Glib::ustring(basename(buf));
+ ^~~~~~~~
+ g_basename
+
+Fix by using the POSIX implementation of basename() [5] instead,
+obtained via #include <libgen.h>, which musl libc does implement [6].
+Note that the POSIX implementation of basename() is allowed to modify
+the string passed to it. This is okay because
+BCache_Info::get_bcache_device() is using a modifiable local character
+buffer.
+
+[1] musl libc
+ https://musl.libc.org/
+[2] Projects using musl
+ https://wiki.musl-libc.org/projects-using-musl.html
+[3] The GNU C Library, 5.10 Finding Tokens in a String
+ https://www.gnu.org/software/libc/manual/html_node/Finding-Tokens-in-a-String.html
+[4] basename(3) - Linux manual page
+ https://man7.org/linux/man-pages/man3/basename.3.html
+[5] POSIX basename()
+ https://pubs.opengroup.org/onlinepubs/009695399/functions/basename.html
+[6] musl source, basename.c
+ http://git.musl-libc.org/cgit/musl/tree/src/misc/basename.c
+
+Closes !99 - Fix undeclared identifier 'basename' build failure with
+ musl libc
+--- a/src/BCache_Info.cc
++++ b/src/BCache_Info.cc
+@@ -17,7 +17,7 @@
+
+ #include "BCache_Info.h"
+
+-#include <string.h> // GNU version of basename()
++#include <libgen.h> // POSIX version of basename()
+ #include <unistd.h>
+ #include <glibmm/ustring.h>
+ #include <glibmm/fileutils.h>
+GitLab
diff --git a/sys-block/gparted/gparted-1.4.0-r1.ebuild b/sys-block/gparted/gparted-1.4.0-r1.ebuild
new file mode 100644
index 000000000000..4fa2d910bc99
--- /dev/null
+++ b/sys-block/gparted/gparted-1.4.0-r1.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit gnome2 optfeature virtualx
+
+DESCRIPTION="Partition editor for graphically managing your disk partitions"
+HOMEPAGE="https://gparted.org/ https://gitlab.gnome.org/GNOME/gparted/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2+ FDL-1.2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+IUSE="kde policykit wayland"
+
+DEPEND="
+ !policykit? (
+ kde? ( >=kde-plasma/kde-cli-tools-5.8.6-r1[kdesu] ) )
+ policykit? ( >=sys-auth/polkit-0.102 )
+ >=dev-cpp/glibmm-2.56.1:2
+ >=dev-cpp/gtkmm-3.24:3.0
+ >=dev-libs/glib-2.58.3-r1:2
+ >=sys-block/parted-3.2:=
+ >=dev-libs/libsigc++-2.10.1:2
+"
+RDEPEND="${DEPEND}
+ >=sys-apps/util-linux-2.33.2
+ wayland? ( x11-apps/xhost )
+"
+BDEPEND="
+ app-text/docbook-xml-dtd:4.1.2
+ >=dev-util/intltool-0.51.0-r2
+ dev-util/itstool
+ sys-devel/gettext
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.1-musl-nullptr.patch
+ "${FILESDIR}"/${PN}-1.4.0-musl-basename.patch
+)
+
+src_configure() {
+ gnome2_src_configure \
+ --enable-doc \
+ --enable-online-resize \
+ $(use_enable wayland xhost-root) \
+ GKSUPROG=kdesu \
+ ac_cv_prog_have_scrollkeeper_update=no
+}
+
+src_install() {
+ gnome2_src_install
+
+ local _ddir="${D}"/usr/share/applications
+ local _bdir="${D}"/usr/bin
+
+ if ! use policykit; then
+ if use kde; then
+ cp "${_ddir}"/gparted{,-kde}.desktop || die
+ cp "${_bdir}"/gparted{,-kde} || die
+ sed -i -e '/Exec/ s:gparted:gparted-kde:' "${_ddir}"/gparted-kde.desktop || die
+ echo 'OnlyShowIn=KDE;' >> "${_ddir}"/gparted-kde.desktop || die
+ fi
+ else
+ sed -i -e 's:kdesu::' "${_bdir}"/gparted || die
+ fi
+
+ mv "${ED}"/usr/share/{appdata,metainfo}
+}
+
+src_test() {
+ virtx emake check
+}
+
+pkg_postinst() {
+ gnome2_pkg_postinst
+
+ optfeature_header
+ optfeature "BTRFS support" sys-fs/btrfs-progs
+ optfeature "DMRAID support" sys-fs/dmraid sys-fs/multipath-tools
+ optfeature "Encrypted device / LUKS support" sys-fs/cryptsetup
+ optfeature "exFAT support" sys-fs/exfatprogs
+ optfeature "EXT2/EXT3/EXT4 support" sys-fs/e2fsprogs
+ optfeature "F2FS support" sys-fs/f2fs-tools
+ optfeature "FAT support" sys-fs/dosfstools sys-fs/mtools
+ optfeature "HFS support" sys-fs/diskdev_cmds sys-fs/hfsutils virtual/udev
+ optfeature "JFS support" sys-fs/jfsutils
+ optfeature "MDADM support" sys-fs/mdadm
+ optfeature "NTFS support" sys-fs/ntfs3g[ntfsprogs]
+ optfeature "Reiser4 support" sys-fs/reiser4progs
+ optfeature "ReiserFS support" sys-fs/reiserfsprogs
+ optfeature "UDF support" sys-fs/udftools
+ optfeature "XFS support" sys-fs/xfsprogs sys-fs/xfsdump
+}