* [gentoo-commits] proj/musl:master commit in: sys-fs/reiserfsprogs/files/, sys-fs/reiserfsprogs/
@ 2021-04-19 1:47 Dave Hughes
0 siblings, 0 replies; only message in thread
From: Dave Hughes @ 2021-04-19 1:47 UTC (permalink / raw
To: gentoo-commits
commit: ee9110eaa82a0371f82d77b290cc7c1eda878133
Author: Dave Hughes <davidhughes205 <AT> gmail <DOT> com>
AuthorDate: Mon Apr 19 01:46:50 2021 +0000
Commit: Dave Hughes <davidhughes205 <AT> gmail <DOT> com>
CommitDate: Mon Apr 19 01:47:04 2021 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=ee9110ea
sys-fs/reiserfsprogs: import with patches for musl support
Bug: https://bugs.gentoo.org/560318
Closes: https://bugs.gentoo.org/560318
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Dave Hughes <davidhughes205 <AT> gmail.com>
sys-fs/reiserfsprogs/Manifest | 1 +
.../reiserfsprogs/files/musl-__compar_fn_t.patch | 20 ++
sys-fs/reiserfsprogs/files/musl-loff_t.patch | 15 ++
.../files/musl-long_long_min_max.patch | 21 ++
sys-fs/reiserfsprogs/files/musl-prints.patch | 230 +++++++++++++++++++++
.../files/reiserfsprogs-3.6.25-no_acl.patch | 12 ++
.../files/reiserfsprogs-3.6.27-loff_t.patch | 16 ++
sys-fs/reiserfsprogs/metadata.xml | 8 +
sys-fs/reiserfsprogs/reiserfsprogs-3.6.27.ebuild | 63 ++++++
9 files changed, 386 insertions(+)
diff --git a/sys-fs/reiserfsprogs/Manifest b/sys-fs/reiserfsprogs/Manifest
new file mode 100644
index 0000000..29d2105
--- /dev/null
+++ b/sys-fs/reiserfsprogs/Manifest
@@ -0,0 +1 @@
+DIST reiserfsprogs-3.6.27.tar.xz 449176 BLAKE2B cd22120faa4d6d11ab545349fde5304f41cf3ca88b2c988255b7ca0e87961c9ccaa3095cad086e479a2b50627ad9bf3e90b2af46ddda64abc119e2a6755b8341 SHA512 bc524aa1ad7f8502238761fd185bfb8473048947bd579e2803c73371928c6b245e0d90bd9d458f4bebcbf163892dbc9f4bae65aec68ebbaa436be7451c13f50c
diff --git a/sys-fs/reiserfsprogs/files/musl-__compar_fn_t.patch b/sys-fs/reiserfsprogs/files/musl-__compar_fn_t.patch
new file mode 100644
index 0000000..986cc30
--- /dev/null
+++ b/sys-fs/reiserfsprogs/files/musl-__compar_fn_t.patch
@@ -0,0 +1,20 @@
+https://github.com/void-linux/void-packages/tree/master/srcpkgs/reiserfsprogs/patches
+
+Define _GNU_SOURCE for the declaration of loff_t in fcntl.h
+Add missing typedefs for __compar_fn_t and compare_fn_t for
+non __GLIBC__ case.
+
+--- a/include/misc.h
++++ b/include/misc.h
+@@ -35,6 +35,11 @@
+
+ #define INVAL_PTR (void *)-1
+
++#if !defined(__GLIBC__)
++typedef int (*__compar_fn_t) (const void*, const void*);
++typedef __compar_fn_t comparison_fn_t;
++#endif
++
+ void check_memory_msg(void);
+ void die(const char *fmt, ...) __attribute__ ((format(printf, 1, 2)));
+ void *getmem(int size);
diff --git a/sys-fs/reiserfsprogs/files/musl-loff_t.patch b/sys-fs/reiserfsprogs/files/musl-loff_t.patch
new file mode 100644
index 0000000..b012c86
--- /dev/null
+++ b/sys-fs/reiserfsprogs/files/musl-loff_t.patch
@@ -0,0 +1,15 @@
+https://github.com/void-linux/void-packages/tree/master/srcpkgs/reiserfsprogs/patches
+
+See https://www.openwall.com/lists/musl/2013/01/23/6
+--- a/include/reiserfs_lib.h
++++ b/include/reiserfs_lib.h
+@@ -3,6 +3,10 @@
+ * reiserfsprogs/README
+ */
+
++#if !defined(__GLIBC__)
++#define loff_t off_t
++#endif
++
+ #ifndef REISERFSPROGS_LIB_H
+ #define REISERFSPROGS_LIB_H
diff --git a/sys-fs/reiserfsprogs/files/musl-long_long_min_max.patch b/sys-fs/reiserfsprogs/files/musl-long_long_min_max.patch
new file mode 100644
index 0000000..2a11463
--- /dev/null
+++ b/sys-fs/reiserfsprogs/files/musl-long_long_min_max.patch
@@ -0,0 +1,21 @@
+https://github.com/void-linux/void-packages/tree/master/srcpkgs/reiserfsprogs/patches
+
+Add definitions for LONG_LONG_MIN and _MAX derived
+from the values for int64_t.
+
+--- a/resize_reiserfs/resize_reiserfs.c
++++ b/resize_reiserfs/resize_reiserfs.c
+@@ -15,6 +15,13 @@
+ #include "resize.h"
+ #include <limits.h>
+
++#if !defined(__GLIBC__)
++/* These are not defined in musl libc */
++#include <stdint.h>
++#define LONG_LONG_MIN INT64_MIN
++#define LONG_LONG_MAX INT64_MAX
++#endif
++
+ static int opt_banner = 0;
+ static int opt_skipj = 0;
+ int opt_force = 0;
diff --git a/sys-fs/reiserfsprogs/files/musl-prints.patch b/sys-fs/reiserfsprogs/files/musl-prints.patch
new file mode 100644
index 0000000..ae574a1
--- /dev/null
+++ b/sys-fs/reiserfsprogs/files/musl-prints.patch
@@ -0,0 +1,230 @@
+https://github.com/void-linux/void-packages/tree/master/srcpkgs/reiserfsprogs/patches
+
+--- a/reiserfscore/prints.c
++++ b/reiserfscore/prints.c
+@@ -7,8 +7,11 @@
+
+ #include "includes.h"
+ #include <stdarg.h>
++#include <stdint.h>
+ #include <limits.h>
++#if defined(__GLIBC__)
+ #include <printf.h>
++#endif
+ #include <limits.h>
+ #include <time.h>
+
+@@ -16,6 +19,38 @@
+ # include <uuid/uuid.h>
+ #endif
+
++
++char ftypelet (mode_t mode)
++{
++ if (S_ISBLK (mode))
++ return 'b';
++ if (S_ISCHR (mode))
++ return 'c';
++ if (S_ISDIR (mode))
++ return 'd';
++ if (S_ISREG (mode))
++ return '-';
++ if (S_ISFIFO (mode))
++ return 'p';
++ if (S_ISLNK (mode))
++ return 'l';
++ if (S_ISSOCK (mode))
++ return 's';
++ return '?';
++}
++
++
++static int rwx (FILE * stream, mode_t mode)
++{
++ return fprintf (stream, "%c%c%c",
++ (mode & S_IRUSR) ? 'r' : '-',
++ (mode & S_IWUSR) ? 'w' : '-',
++ (mode & S_IXUSR) ? 'x' : '-');
++}
++
++#if defined(__GLIBC__)
++
++
+ #ifndef HAVE_REGISTER_PRINTF_SPECIFIER
+ #define register_printf_specifier(x, y, z) register_printf_function(x, y, z)
+ static int arginfo_ptr(const struct printf_info *info, size_t n, int *argtypes)
+@@ -129,33 +164,6 @@ static int print_disk_child(FILE * stream,
+ FPRINTF;
+ }
+
+-char ftypelet(mode_t mode)
+-{
+- if (S_ISBLK(mode))
+- return 'b';
+- if (S_ISCHR(mode))
+- return 'c';
+- if (S_ISDIR(mode))
+- return 'd';
+- if (S_ISREG(mode))
+- return '-';
+- if (S_ISFIFO(mode))
+- return 'p';
+- if (S_ISLNK(mode))
+- return 'l';
+- if (S_ISSOCK(mode))
+- return 's';
+- return '?';
+-}
+-
+-static int rwx(FILE * stream, mode_t mode)
+-{
+- return fprintf(stream, "%c%c%c",
+- (mode & S_IRUSR) ? 'r' : '-',
+- (mode & S_IWUSR) ? 'w' : '-',
+- (mode & S_IXUSR) ? 'x' : '-');
+-}
+-
+ /* %M */
+ static int print_sd_mode(FILE * stream,
+ const struct printf_info *info,
+@@ -211,6 +219,140 @@ void reiserfs_warning(FILE * fp, const char *fmt, ...)
+ va_end(args);
+ }
+
++#else /* defined(__GLIBC__) */
++
++typedef void* void_ptr;
++
++void reiserfs_warning (FILE * fp, const char * fmt, ...)
++{
++ char * buffer;
++ int len;
++ char format_buf[32];
++ char* dst = format_buf;
++ char* end = &dst[30];
++ const struct buffer_head * bh;
++ const struct item_head * ih;
++ const struct disk_child * dc;
++ const struct reiserfs_key * key;
++ uint16_t mode;
++#if defined(HAVE_LIBUUID) && defined(HAVE_UUID_UUID_H)
++ const unsigned char *uuid;
++ char uuid_buf[37];
++#endif
++ va_list args;
++ int esc = 0;
++
++ va_start (args, fmt);
++ while (*fmt) {
++ int ch = *fmt++;
++ if (esc) {
++ switch (ch) {
++ case '%':
++ fputc(ch, fp);
++ esc = 0;
++ break;
++ case 'b': // block head
++ bh = (const struct buffer_head *) va_arg(args, void_ptr);
++ len = asprintf(&buffer, "level=%d, nr_items=%d, free_space=%d rdkey",
++ B_LEVEL (bh), B_NR_ITEMS (bh), B_FREE_SPACE (bh));
++ *dst++ = 's';
++ *dst = '\0';
++ fprintf(fp, format_buf, buffer);
++ esc = 0;
++ break;
++ case 'K': // short key
++ key = (const struct reiserfs_key *) va_arg(args, void_ptr);
++ len = asprintf(&buffer, "[%u %u]", get_key_dirid (key),
++ get_key_objectid (key));
++ *dst++ = 's';
++ *dst = '\0';
++ fprintf(fp, format_buf, buffer);
++ esc = 0;
++ break;
++ case 'k': // key
++ key = (const struct reiserfs_key *) va_arg(args, void_ptr);
++ len = asprintf(&buffer, "[%u %u 0x%Lx %s (%d)]",
++ get_key_dirid (key), get_key_objectid (key),
++ (unsigned long long)get_offset (key), key_of_what (key), get_type (key));
++ *dst++ = 's';
++ *dst = '\0';
++ fprintf(fp, format_buf, buffer);
++ esc = 0;
++ break;
++ case 'H': // item head
++ ih = (const struct item_head *) va_arg(args, void_ptr);
++ len = asprintf(&buffer, "%u %u 0x%Lx %s (%d), "
++ "len %u, location %u entry count %u, fsck need %u, format %s",
++ get_key_dirid (&ih->ih_key), get_key_objectid (&ih->ih_key),
++ (unsigned long long)get_offset (&ih->ih_key), key_of_what (&ih->ih_key),
++ get_type (&ih->ih_key), get_ih_item_len (ih), get_ih_location (ih),
++ get_ih_entry_count (ih), get_ih_flags (ih),
++ get_ih_key_format (ih) == KEY_FORMAT_2 ?
++ "new" :
++ ((get_ih_key_format (ih) == KEY_FORMAT_1) ? "old" : "BAD"));
++ *dst++ = 's';
++ *dst = '\0';
++ fprintf(fp, format_buf, buffer);
++ esc = 0;
++ break;
++ case 'y': // disk child
++ dc = (const struct disk_child *) va_arg(args, void_ptr);
++ len = asprintf(&buffer, "[dc_number=%u, dc_size=%u]", get_dc_child_blocknr (dc),
++ get_dc_child_size (dc));
++ *dst++ = 's';
++ *dst = '\0';
++ fprintf(fp, format_buf, buffer);
++ esc = 0;
++ break;
++ case 'M': // sd mode
++ mode = (mode_t) va_arg(args, void_ptr);
++ fputc(ftypelet (mode), fp);
++ rwx (fp, (mode & 0700) << 0);
++ rwx (fp, (mode & 0070) << 3);
++ rwx (fp, (mode & 0007) << 6);
++ esc = 0;
++ break;
++ case 'U': // UUID
++#if defined(HAVE_LIBUUID) && defined(HAVE_UUID_UUID_H)
++ uuid = (const unsigned char *) va_arg(args, void_ptr);
++ uuid_buf[36] = '\0';
++ uuid_unparse(uuid, uuid_buf);
++ fprintf(fp, "%s", uuid_buf);
++#else
++ fprintf(fp, "<no libuuid installed>");
++#endif
++ esc = 0;
++ break;
++ case '-': case '+': case '#': case '.':
++ case '0': case '1': case '2': case '3': case '4':
++ case '5': case '6': case '7': case '8': case '9':
++ case 'l': case 'L': case 'h':
++ // non-terminal format modifiers
++ if (dst < end)
++ *dst++ = ch;
++ break;
++ default:
++ *dst++ = ch;
++ *dst = '\0';
++ fprintf(fp, format_buf, va_arg(args, void_ptr));
++ esc = 0;
++ break;
++ }
++ } else if (ch == '%') {
++ esc = 1;
++ dst = format_buf;
++ end = &dst[30]; // leave room for final "s\0"
++ *dst++ = ch;
++ } else {
++ fputc(ch, fp);
++ }
++ }
++
++ va_end (args);
++}
++
++#endif /* !defined(__GLIBC__) */
++
+ static void print_directory_item(FILE *fp, reiserfs_filsys_t fs,
+ struct buffer_head *bh, struct item_head *ih)
+ {
diff --git a/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.25-no_acl.patch b/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.25-no_acl.patch
new file mode 100644
index 0000000..6a37681
--- /dev/null
+++ b/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.25-no_acl.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/585978
+
+--- a/reiserfscore/xattr.c
++++ b/reiserfscore/xattr.c
+@@ -1,7 +1,6 @@
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <errno.h>
+-#include <sys/acl.h>
+ #include "reiserfs_lib.h"
+
+ static inline unsigned short from32to16(unsigned int x)
diff --git a/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.27-loff_t.patch b/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.27-loff_t.patch
new file mode 100644
index 0000000..9ab8519
--- /dev/null
+++ b/sys-fs/reiserfsprogs/files/reiserfsprogs-3.6.27-loff_t.patch
@@ -0,0 +1,16 @@
+glibc-2.28 did hide loff_t indef system-specific macros:
+ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=663e7d784977f6b15c0cab73f754f9f39c9c0c2c
+
+This caused build failure:
+ ../include/reiserfs_lib.h:300:55: error: unknown type name 'loff_t'; did you mean 'off_t'?
+
+Re-enable extensions to pull loff_t back.
+
+https://bugs.gentoo.org/663930
+--- a/configure.ac
++++ b/configure.ac
+@@ -23,2 +23,4 @@ AC_PROG_MAKE_SET
+ AC_PROG_LIBTOOL
++dnl pull in loff_t from glibc
++AC_USE_SYSTEM_EXTENSIONS
+
diff --git a/sys-fs/reiserfsprogs/metadata.xml b/sys-fs/reiserfsprogs/metadata.xml
new file mode 100644
index 0000000..56c1244
--- /dev/null
+++ b/sys-fs/reiserfsprogs/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>base-system@gentoo.org</email>
+ <name>Gentoo Base System</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-fs/reiserfsprogs/reiserfsprogs-3.6.27.ebuild b/sys-fs/reiserfsprogs/reiserfsprogs-3.6.27.ebuild
new file mode 100644
index 0000000..3cc96f1
--- /dev/null
+++ b/sys-fs/reiserfsprogs/reiserfsprogs-3.6.27.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic usr-ldscript
+
+DESCRIPTION="Reiserfs Utilities"
+HOMEPAGE="https://www.kernel.org/pub/linux/utils/fs/reiserfs/"
+SRC_URI="https://www.kernel.org/pub/linux/utils/fs/reiserfs/${P}.tar.xz
+ https://www.kernel.org/pub/linux/kernel/people/jeffm/${PN}/v${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv -sparc x86 ~amd64-linux ~x86-linux"
+IUSE="static-libs"
+
+BDEPEND="
+ elibc_musl? ( sys-libs/obstack-standalone )
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-3.6.25-no_acl.patch"
+ "${FILESDIR}/${PN}-3.6.27-loff_t.patch"
+)
+
+src_prepare() {
+ default
+
+ if use elibc_musl ; then
+ eapply "${FILESDIR}/musl-__compar_fn_t.patch"
+ eapply "${FILESDIR}/musl-loff_t.patch"
+ eapply "${FILESDIR}/musl-long_long_min_max.patch"
+ eapply "${FILESDIR}/musl-prints.patch"
+ fi
+
+ eautoreconf
+}
+
+src_configure() {
+ append-flags -std=gnu89 #427300
+ use elibc_musl && append-ldflags -lobstack
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --libdir="${EPREFIX}/$(get_libdir)"
+ --sbindir="${EPREFIX}/sbin"
+ $(use_enable static-libs static)
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_install() {
+ default
+ dodir /usr/$(get_libdir)
+ mv "${ED}"/$(get_libdir)/pkgconfig "${ED}"/usr/$(get_libdir) || die
+
+ if use static-libs ; then
+ mv "${ED}"/$(get_libdir)/*a "${ED}"/usr/$(get_libdir) || die
+ gen_usr_ldscript libreiserfscore.so
+ else
+ find "${ED}" -type f \( -name "*.a" -o -name "*.la" \) -delete
+ fi
+}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-19 1:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-19 1:47 [gentoo-commits] proj/musl:master commit in: sys-fs/reiserfsprogs/files/, sys-fs/reiserfsprogs/ Dave Hughes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox