1 |
commit: 1a536e7e575df3fb58dd7d6cf56ec0809718a796 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 18 20:37:37 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 18 20:37:37 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a536e7e |
7 |
|
8 |
sys-block/gparted: fix build with musl |
9 |
|
10 |
Revbump as switching to POSIX basename could in theory (but as per |
11 |
patch, shouldn't) change runtime behaviour for glibc. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/837794 |
14 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
15 |
|
16 |
.../files/gparted-1.4.0-musl-basename.patch | 53 ++++++++++++ |
17 |
sys-block/gparted/gparted-1.4.0-r1.ebuild | 95 ++++++++++++++++++++++ |
18 |
2 files changed, 148 insertions(+) |
19 |
|
20 |
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 |
21 |
new file mode 100644 |
22 |
index 000000000000..eeba8867ed42 |
23 |
--- /dev/null |
24 |
+++ b/sys-block/gparted/files/gparted-1.4.0-musl-basename.patch |
25 |
@@ -0,0 +1,53 @@ |
26 |
+https://gitlab.gnome.org/GNOME/gparted/-/merge_requests/99.patch |
27 |
+https://bugs.gentoo.org/837794 |
28 |
+ |
29 |
+From 45c00927b72319f00855c7feaf4dcf109b3e4414 Mon Sep 17 00:00:00 2001 |
30 |
+From: Markus Volk <f_l_k@××××××××.de> |
31 |
+Date: Fri, 8 Apr 2022 08:58:46 +0000 |
32 |
+Subject: [PATCH] Use POSIX basename() in BCache_Info.cc (!99) |
33 |
+ |
34 |
+Musl libc [1][2] doesn't implement the GNU variant of basename() [3][4], |
35 |
+obtained via #include <string.h>. Therefore GParted fails to build on |
36 |
+such distributions: |
37 |
+ |
38 |
+ 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: |
39 |
+ |
40 |
+ error: use of undeclared identifier 'basename'; did you mean 'g_basename'? |
41 |
+ return "/dev/" + Glib::ustring(basename(buf)); |
42 |
+ ^~~~~~~~ |
43 |
+ g_basename |
44 |
+ |
45 |
+Fix by using the POSIX implementation of basename() [5] instead, |
46 |
+obtained via #include <libgen.h>, which musl libc does implement [6]. |
47 |
+Note that the POSIX implementation of basename() is allowed to modify |
48 |
+the string passed to it. This is okay because |
49 |
+BCache_Info::get_bcache_device() is using a modifiable local character |
50 |
+buffer. |
51 |
+ |
52 |
+[1] musl libc |
53 |
+ https://musl.libc.org/ |
54 |
+[2] Projects using musl |
55 |
+ https://wiki.musl-libc.org/projects-using-musl.html |
56 |
+[3] The GNU C Library, 5.10 Finding Tokens in a String |
57 |
+ https://www.gnu.org/software/libc/manual/html_node/Finding-Tokens-in-a-String.html |
58 |
+[4] basename(3) - Linux manual page |
59 |
+ https://man7.org/linux/man-pages/man3/basename.3.html |
60 |
+[5] POSIX basename() |
61 |
+ https://pubs.opengroup.org/onlinepubs/009695399/functions/basename.html |
62 |
+[6] musl source, basename.c |
63 |
+ http://git.musl-libc.org/cgit/musl/tree/src/misc/basename.c |
64 |
+ |
65 |
+Closes !99 - Fix undeclared identifier 'basename' build failure with |
66 |
+ musl libc |
67 |
+--- a/src/BCache_Info.cc |
68 |
++++ b/src/BCache_Info.cc |
69 |
+@@ -17,7 +17,7 @@ |
70 |
+ |
71 |
+ #include "BCache_Info.h" |
72 |
+ |
73 |
+-#include <string.h> // GNU version of basename() |
74 |
++#include <libgen.h> // POSIX version of basename() |
75 |
+ #include <unistd.h> |
76 |
+ #include <glibmm/ustring.h> |
77 |
+ #include <glibmm/fileutils.h> |
78 |
+GitLab |
79 |
|
80 |
diff --git a/sys-block/gparted/gparted-1.4.0-r1.ebuild b/sys-block/gparted/gparted-1.4.0-r1.ebuild |
81 |
new file mode 100644 |
82 |
index 000000000000..4fa2d910bc99 |
83 |
--- /dev/null |
84 |
+++ b/sys-block/gparted/gparted-1.4.0-r1.ebuild |
85 |
@@ -0,0 +1,95 @@ |
86 |
+# Copyright 1999-2022 Gentoo Authors |
87 |
+# Distributed under the terms of the GNU General Public License v2 |
88 |
+ |
89 |
+EAPI=7 |
90 |
+inherit gnome2 optfeature virtualx |
91 |
+ |
92 |
+DESCRIPTION="Partition editor for graphically managing your disk partitions" |
93 |
+HOMEPAGE="https://gparted.org/ https://gitlab.gnome.org/GNOME/gparted/" |
94 |
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" |
95 |
+ |
96 |
+LICENSE="GPL-2+ FDL-1.2+" |
97 |
+SLOT="0" |
98 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" |
99 |
+IUSE="kde policykit wayland" |
100 |
+ |
101 |
+DEPEND=" |
102 |
+ !policykit? ( |
103 |
+ kde? ( >=kde-plasma/kde-cli-tools-5.8.6-r1[kdesu] ) ) |
104 |
+ policykit? ( >=sys-auth/polkit-0.102 ) |
105 |
+ >=dev-cpp/glibmm-2.56.1:2 |
106 |
+ >=dev-cpp/gtkmm-3.24:3.0 |
107 |
+ >=dev-libs/glib-2.58.3-r1:2 |
108 |
+ >=sys-block/parted-3.2:= |
109 |
+ >=dev-libs/libsigc++-2.10.1:2 |
110 |
+" |
111 |
+RDEPEND="${DEPEND} |
112 |
+ >=sys-apps/util-linux-2.33.2 |
113 |
+ wayland? ( x11-apps/xhost ) |
114 |
+" |
115 |
+BDEPEND=" |
116 |
+ app-text/docbook-xml-dtd:4.1.2 |
117 |
+ >=dev-util/intltool-0.51.0-r2 |
118 |
+ dev-util/itstool |
119 |
+ sys-devel/gettext |
120 |
+ virtual/pkgconfig |
121 |
+" |
122 |
+ |
123 |
+PATCHES=( |
124 |
+ "${FILESDIR}"/${PN}-1.3.1-musl-nullptr.patch |
125 |
+ "${FILESDIR}"/${PN}-1.4.0-musl-basename.patch |
126 |
+) |
127 |
+ |
128 |
+src_configure() { |
129 |
+ gnome2_src_configure \ |
130 |
+ --enable-doc \ |
131 |
+ --enable-online-resize \ |
132 |
+ $(use_enable wayland xhost-root) \ |
133 |
+ GKSUPROG=kdesu \ |
134 |
+ ac_cv_prog_have_scrollkeeper_update=no |
135 |
+} |
136 |
+ |
137 |
+src_install() { |
138 |
+ gnome2_src_install |
139 |
+ |
140 |
+ local _ddir="${D}"/usr/share/applications |
141 |
+ local _bdir="${D}"/usr/bin |
142 |
+ |
143 |
+ if ! use policykit; then |
144 |
+ if use kde; then |
145 |
+ cp "${_ddir}"/gparted{,-kde}.desktop || die |
146 |
+ cp "${_bdir}"/gparted{,-kde} || die |
147 |
+ sed -i -e '/Exec/ s:gparted:gparted-kde:' "${_ddir}"/gparted-kde.desktop || die |
148 |
+ echo 'OnlyShowIn=KDE;' >> "${_ddir}"/gparted-kde.desktop || die |
149 |
+ fi |
150 |
+ else |
151 |
+ sed -i -e 's:kdesu::' "${_bdir}"/gparted || die |
152 |
+ fi |
153 |
+ |
154 |
+ mv "${ED}"/usr/share/{appdata,metainfo} |
155 |
+} |
156 |
+ |
157 |
+src_test() { |
158 |
+ virtx emake check |
159 |
+} |
160 |
+ |
161 |
+pkg_postinst() { |
162 |
+ gnome2_pkg_postinst |
163 |
+ |
164 |
+ optfeature_header |
165 |
+ optfeature "BTRFS support" sys-fs/btrfs-progs |
166 |
+ optfeature "DMRAID support" sys-fs/dmraid sys-fs/multipath-tools |
167 |
+ optfeature "Encrypted device / LUKS support" sys-fs/cryptsetup |
168 |
+ optfeature "exFAT support" sys-fs/exfatprogs |
169 |
+ optfeature "EXT2/EXT3/EXT4 support" sys-fs/e2fsprogs |
170 |
+ optfeature "F2FS support" sys-fs/f2fs-tools |
171 |
+ optfeature "FAT support" sys-fs/dosfstools sys-fs/mtools |
172 |
+ optfeature "HFS support" sys-fs/diskdev_cmds sys-fs/hfsutils virtual/udev |
173 |
+ optfeature "JFS support" sys-fs/jfsutils |
174 |
+ optfeature "MDADM support" sys-fs/mdadm |
175 |
+ optfeature "NTFS support" sys-fs/ntfs3g[ntfsprogs] |
176 |
+ optfeature "Reiser4 support" sys-fs/reiser4progs |
177 |
+ optfeature "ReiserFS support" sys-fs/reiserfsprogs |
178 |
+ optfeature "UDF support" sys-fs/udftools |
179 |
+ optfeature "XFS support" sys-fs/xfsprogs sys-fs/xfsdump |
180 |
+} |