From 0c2433fca87fbcb2c38b69deb3267605de4c5e33 Mon Sep 17 00:00:00 2001 From: Lars Wendler Date: Sun, 17 Dec 2017 16:41:40 +0100 Subject: sys-apps/util-linux: Fixed too generic symbols with USE="static". Bug: https://bugs.gentoo.org/641226 Package-Manager: Portage-2.3.19, Repoman-2.3.6 --- .../util-linux-2.31-too_generic_symbols_pt1.patch | 207 ++++++++++++ .../util-linux-2.31-too_generic_symbols_pt2.patch | 355 +++++++++++++++++++++ .../util-linux-2.31-too_generic_symbols_pt3.patch | 43 +++ sys-apps/util-linux/util-linux-2.31-r1.ebuild | 206 ++++++++++++ 4 files changed, 811 insertions(+) create mode 100644 sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt1.patch create mode 100644 sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt2.patch create mode 100644 sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt3.patch create mode 100644 sys-apps/util-linux/util-linux-2.31-r1.ebuild (limited to 'sys-apps/util-linux') diff --git a/sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt1.patch b/sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt1.patch new file mode 100644 index 000000000000..aa296d2bf2f3 --- /dev/null +++ b/sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt1.patch @@ -0,0 +1,207 @@ +From ff5feb96ec70e8a3fde41bd591b28c9855dab3fc Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 12 Dec 2017 11:29:02 +0100 +Subject: [PATCH] lib/sha1: use ul_/UL_prefix for symbols + +Unfortunately, the symbols are visible in statically compiled libuuid +and the names are too generic. + +Addresses: https://github.com/karelzak/util-linux/issues/548 +Signed-off-by: Karel Zak +--- + include/sha1.h | 49 +++++++++++++++---------------------------------- + lib/sha1.c | 34 +++++++++++++++++----------------- + libuuid/src/gen_uuid.c | 12 ++++++------ + 3 files changed, 38 insertions(+), 57 deletions(-) + +diff --git a/include/sha1.h b/include/sha1.h +index 5c28bce92..62af1da6f 100644 +--- a/include/sha1.h ++++ b/include/sha1.h +@@ -1,5 +1,5 @@ +-#ifndef SHA1_H +-#define SHA1_H ++#ifndef UTIL_LINUX_SHA1_H ++#define UTIL_LINUX_SHA1_H + + /* + SHA-1 in C +@@ -9,38 +9,19 @@ + + #include "stdint.h" + +-#define SHA1LENGTH 20 ++#define UL_SHA1LENGTH 20 + + typedef struct + { +- uint32_t state[5]; +- uint32_t count[2]; +- unsigned char buffer[64]; +-} SHA1_CTX; +- +-void SHA1Transform( +- uint32_t state[5], +- const unsigned char buffer[64] +- ); +- +-void SHA1Init( +- SHA1_CTX * context +- ); +- +-void SHA1Update( +- SHA1_CTX * context, +- const unsigned char *data, +- uint32_t len +- ); +- +-void SHA1Final( +- unsigned char digest[SHA1LENGTH], +- SHA1_CTX * context +- ); +- +-void SHA1( +- char *hash_out, +- const char *str, +- unsigned len); +- +-#endif /* SHA1_H */ ++ uint32_t state[5]; ++ uint32_t count[2]; ++ unsigned char buffer[64]; ++} UL_SHA1_CTX; ++ ++void ul_SHA1Transform(uint32_t state[5], const unsigned char buffer[64]); ++void ul_SHA1Init(UL_SHA1_CTX *context); ++void ul_SHA1Update(UL_SHA1_CTX *context, const unsigned char *data, uint32_t len); ++void ul_SHA1Final(unsigned char digest[UL_SHA1LENGTH], UL_SHA1_CTX *context); ++void ul_SHA1(char *hash_out, const char *str, unsigned len); ++ ++#endif /* UTIL_LINUX_SHA1_H */ +diff --git a/lib/sha1.c b/lib/sha1.c +index a2ac7f8ef..62c036774 100644 +--- a/lib/sha1.c ++++ b/lib/sha1.c +@@ -51,7 +51,7 @@ A million repetitions of "a" + + /* Hash a single 512-bit block. This is the core of the algorithm. */ + +-void SHA1Transform( ++void ul_SHA1Transform( + uint32_t state[5], + const unsigned char buffer[64] + ) +@@ -179,8 +179,8 @@ void SHA1Transform( + + /* SHA1Init - Initialize new context */ + +-void SHA1Init( +- SHA1_CTX * context ++void ul_SHA1Init( ++ UL_SHA1_CTX * context + ) + { + /* SHA1 initialization constants */ +@@ -195,8 +195,8 @@ void SHA1Init( + + /* Run your data through this. */ + +-void SHA1Update( +- SHA1_CTX * context, ++void ul_SHA1Update( ++ UL_SHA1_CTX * context, + const unsigned char *data, + uint32_t len + ) +@@ -213,10 +213,10 @@ void SHA1Update( + if ((j + len) > 63) + { + memcpy(&context->buffer[j], data, (i = 64 - j)); +- SHA1Transform(context->state, context->buffer); ++ ul_SHA1Transform(context->state, context->buffer); + for (; i + 63 < len; i += 64) + { +- SHA1Transform(context->state, &data[i]); ++ ul_SHA1Transform(context->state, &data[i]); + } + j = 0; + } +@@ -228,9 +228,9 @@ void SHA1Update( + + /* Add padding and return the message digest. */ + +-void SHA1Final( ++void ul_SHA1Final( + unsigned char digest[20], +- SHA1_CTX * context ++ UL_SHA1_CTX * context + ) + { + unsigned i; +@@ -262,13 +262,13 @@ void SHA1Final( + } + #endif + c = 0200; +- SHA1Update(context, &c, 1); ++ ul_SHA1Update(context, &c, 1); + while ((context->count[0] & 504) != 448) + { + c = 0000; +- SHA1Update(context, &c, 1); ++ ul_SHA1Update(context, &c, 1); + } +- SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ ++ ul_SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ + for (i = 0; i < 20; i++) + { + digest[i] = (unsigned char) +@@ -279,18 +279,18 @@ void SHA1Final( + memset(&finalcount, '\0', sizeof(finalcount)); + } + +-void SHA1( ++void ul_SHA1( + char *hash_out, + const char *str, + unsigned len) + { +- SHA1_CTX ctx; ++ UL_SHA1_CTX ctx; + unsigned int ii; + +- SHA1Init(&ctx); ++ ul_SHA1Init(&ctx); + for (ii=0; ii +Date: Tue, 12 Dec 2017 11:54:08 +0100 +Subject: [PATCH] lib/md5: use ul_/UL_ prefix + +The symbols names are too generic. + +Addresses: https://github.com/karelzak/util-linux/issues/548 +Signed-off-by: Karel Zak +--- + disk-utils/mkfs.cramfs.c | 13 +++++++------ + include/md5.h | 25 ++++++++++--------------- + lib/md5.c | 26 +++++++++++++------------- + libblkid/src/superblocks/hfs.c | 16 +++++++++------- + libuuid/src/gen_uuid.c | 12 ++++++------ + misc-utils/mcookie.c | 14 +++++++------- + tests/helpers/test_md5.c | 12 ++++++------ + 7 files changed, 58 insertions(+), 60 deletions(-) + +diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c +index a3e9aa48c..729765078 100644 +--- a/disk-utils/mkfs.cramfs.c ++++ b/disk-utils/mkfs.cramfs.c +@@ -98,7 +98,7 @@ struct entry { + /* stats */ + unsigned char *name; + unsigned int mode, size, uid, gid; +- unsigned char md5sum[MD5LENGTH]; ++ unsigned char md5sum[UL_MD5LENGTH]; + unsigned char flags; /* CRAMFS_EFLAG_* */ + + /* FS data */ +@@ -194,16 +194,17 @@ do_munmap(char *start, unsigned int size, unsigned int mode){ + /* compute md5sums, so that we do not have to compare every pair of files */ + static void + mdfile(struct entry *e) { +- MD5_CTX ctx; + char *start; + + start = do_mmap(e->path, e->size, e->mode); + if (start == NULL) { + e->flags |= CRAMFS_EFLAG_INVALID; + } else { +- MD5Init(&ctx); +- MD5Update(&ctx, (unsigned char *) start, e->size); +- MD5Final(e->md5sum, &ctx); ++ UL_MD5_CTX ctx; ++ ++ ul_MD5Init(&ctx); ++ ul_MD5Update(&ctx, (unsigned char *) start, e->size); ++ ul_MD5Final(e->md5sum, &ctx); + + do_munmap(start, e->size, e->mode); + +@@ -255,7 +256,7 @@ static int find_identical_file(struct entry *orig, struct entry *new, loff_t *fs + + if ((orig->flags & CRAMFS_EFLAG_MD5) && + (new->flags & CRAMFS_EFLAG_MD5) && +- !memcmp(orig->md5sum, new->md5sum, MD5LENGTH) && ++ !memcmp(orig->md5sum, new->md5sum, UL_MD5LENGTH) && + identical_file(orig, new)) { + new->same = orig; + *fslen_ub -= new->size; +diff --git a/include/md5.h b/include/md5.h +index d997e379d..d6991e1fd 100644 +--- a/include/md5.h ++++ b/include/md5.h +@@ -1,29 +1,24 @@ +-#ifndef MD5_H +-#define MD5_H ++#ifndef UTIL_LINUX_MD5_H ++#define UTIL_LINUX_MD5_H + +-#ifdef HAVE_STDINT_H + #include +-#else +-typedef unsigned int uint32_t; +-#endif + +-#define MD5LENGTH 16 ++#define UL_MD5LENGTH 16 + +-struct MD5Context { ++struct UL_MD5Context { + uint32_t buf[4]; + uint32_t bits[2]; + unsigned char in[64]; + }; + +-void MD5Init(struct MD5Context *context); +-void MD5Update(struct MD5Context *context, unsigned char const *buf, +- unsigned len); +-void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *context); +-void MD5Transform(uint32_t buf[4], uint32_t const in[16]); ++void ul_MD5Init(struct UL_MD5Context *context); ++void ul_MD5Update(struct UL_MD5Context *context, unsigned char const *buf, unsigned len); ++void ul_MD5Final(unsigned char digest[UL_MD5LENGTH], struct UL_MD5Context *context); ++void ul_MD5Transform(uint32_t buf[4], uint32_t const in[16]); + + /* + * This is needed to make RSAREF happy on some MS-DOS compilers. + */ +-typedef struct MD5Context MD5_CTX; ++typedef struct UL_MD5Context UL_MD5_CTX; + +-#endif /* !MD5_H */ ++#endif /* !UTIL_LINUX_MD5_H */ +diff --git a/lib/md5.c b/lib/md5.c +index 282e2d22a..3765ab93e 100644 +--- a/lib/md5.c ++++ b/lib/md5.c +@@ -19,7 +19,7 @@ + #include "md5.h" + + #if !defined(WORDS_BIGENDIAN) +-#define byteReverse(buf, len) /* Nothing */ ++# define byteReverse(buf, len) /* Nothing */ + #else + static void byteReverse(unsigned char *buf, unsigned longs); + +@@ -37,14 +37,14 @@ static void byteReverse(unsigned char *buf, unsigned longs) + buf += 4; + } while (--longs); + } +-#endif +-#endif ++#endif /* !ASM_MD5 */ ++#endif /* !WORDS_BIGENDIAN */ + + /* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +-void MD5Init(struct MD5Context *ctx) ++void ul_MD5Init(struct UL_MD5Context *ctx) + { + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; +@@ -59,7 +59,7 @@ void MD5Init(struct MD5Context *ctx) + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) ++void ul_MD5Update(struct UL_MD5Context *ctx, unsigned char const *buf, unsigned len) + { + uint32_t t; + +@@ -84,7 +84,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); +- MD5Transform(ctx->buf, (uint32_t *) ctx->in); ++ ul_MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += t; + len -= t; + } +@@ -93,7 +93,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); +- MD5Transform(ctx->buf, (uint32_t *) ctx->in); ++ ul_MD5Transform(ctx->buf, (uint32_t *) ctx->in); + buf += 64; + len -= 64; + } +@@ -104,10 +104,10 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) + } + + /* +- * Final wrapup - pad to 64-byte boundary with the bit pattern ++ * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +-void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *ctx) ++void ul_MD5Final(unsigned char digest[UL_MD5LENGTH], struct UL_MD5Context *ctx) + { + unsigned count; + unsigned char *p; +@@ -128,7 +128,7 @@ void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *ctx) + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); +- MD5Transform(ctx->buf, (uint32_t *) ctx->in); ++ ul_MD5Transform(ctx->buf, (uint32_t *) ctx->in); + + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); +@@ -145,9 +145,9 @@ void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *ctx) + memcpy(&ctx->in[14 * sizeof(uint32_t)], &ctx->bits[0], 4); + memcpy(&ctx->in[15 * sizeof(uint32_t)], &ctx->bits[1], 4); + +- MD5Transform(ctx->buf, (uint32_t *) ctx->in); ++ ul_MD5Transform(ctx->buf, (uint32_t *) ctx->in); + byteReverse((unsigned char *) ctx->buf, 4); +- memcpy(digest, ctx->buf, MD5LENGTH); ++ memcpy(digest, ctx->buf, UL_MD5LENGTH); + memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ + } + +@@ -170,7 +170,7 @@ void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *ctx) + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +-void MD5Transform(uint32_t buf[4], uint32_t const in[16]) ++void ul_MD5Transform(uint32_t buf[4], uint32_t const in[16]) + { + register uint32_t a, b, c, d; + +diff --git a/libblkid/src/superblocks/hfs.c b/libblkid/src/superblocks/hfs.c +index c2344114a..19f14ed0d 100644 +--- a/libblkid/src/superblocks/hfs.c ++++ b/libblkid/src/superblocks/hfs.c +@@ -130,19 +130,21 @@ struct hfsplus_vol_header { + + static int hfs_set_uuid(blkid_probe pr, unsigned char const *hfs_info, size_t len) + { +- static unsigned char const hash_init[MD5LENGTH] = { ++ static unsigned char const hash_init[UL_MD5LENGTH] = { + 0xb3, 0xe2, 0x0f, 0x39, 0xf2, 0x92, 0x11, 0xd6, + 0x97, 0xa4, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac + }; +- unsigned char uuid[MD5LENGTH]; +- struct MD5Context md5c; ++ unsigned char uuid[UL_MD5LENGTH]; ++ struct UL_MD5Context md5c; + + if (memcmp(hfs_info, "\0\0\0\0\0\0\0\0", len) == 0) + return -1; +- MD5Init(&md5c); +- MD5Update(&md5c, hash_init, MD5LENGTH); +- MD5Update(&md5c, hfs_info, len); +- MD5Final(uuid, &md5c); ++ ++ ul_MD5Init(&md5c); ++ ul_MD5Update(&md5c, hash_init, UL_MD5LENGTH); ++ ul_MD5Update(&md5c, hfs_info, len); ++ ul_MD5Final(uuid, &md5c); ++ + uuid[6] = 0x30 | (uuid[6] & 0x0f); + uuid[8] = 0x80 | (uuid[8] & 0x3f); + return blkid_probe_set_uuid(pr, uuid); +diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c +index 431bf2064..a374e75c9 100644 +--- a/libuuid/src/gen_uuid.c ++++ b/libuuid/src/gen_uuid.c +@@ -564,15 +564,15 @@ void uuid_generate(uuid_t out) + */ + void uuid_generate_md5(uuid_t out, const uuid_t ns, const char *name, size_t len) + { +- MD5_CTX ctx; +- char hash[MD5LENGTH]; ++ UL_MD5_CTX ctx; ++ char hash[UL_MD5LENGTH]; + +- MD5Init(&ctx); ++ ul_MD5Init(&ctx); + /* hash concatenation of well-known UUID with name */ +- MD5Update(&ctx, ns, sizeof(uuid_t)); +- MD5Update(&ctx, (const unsigned char *)name, len); ++ ul_MD5Update(&ctx, ns, sizeof(uuid_t)); ++ ul_MD5Update(&ctx, (const unsigned char *)name, len); + +- MD5Final((unsigned char *)hash, &ctx); ++ ul_MD5Final((unsigned char *)hash, &ctx); + + memcpy(out, hash, sizeof(uuid_t)); + +diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c +index e6c799d24..fd4227a09 100644 +--- a/misc-utils/mcookie.c ++++ b/misc-utils/mcookie.c +@@ -41,7 +41,7 @@ enum { + }; + + struct mcookie_control { +- struct MD5Context ctx; ++ struct UL_MD5Context ctx; + char **files; + size_t nfiles; + uint64_t maxsz; +@@ -67,12 +67,12 @@ static uint64_t hash_file(struct mcookie_control *ctl, int fd) + r = read_all(fd, (char *) buf, rdsz); + if (r < 0) + break; +- MD5Update(&ctl->ctx, buf, r); ++ ul_MD5Update(&ctl->ctx, buf, r); + count += r; + } + /* Separate files with a null byte */ + buf[0] = '\0'; +- MD5Update(&ctl->ctx, buf, 1); ++ ul_MD5Update(&ctl->ctx, buf, 1); + return count; + } + +@@ -131,7 +131,7 @@ int main(int argc, char **argv) + { + struct mcookie_control ctl = { .verbose = 0 }; + size_t i; +- unsigned char digest[MD5LENGTH]; ++ unsigned char digest[UL_MD5LENGTH]; + unsigned char buf[RAND_BYTES]; + int c; + +@@ -180,14 +180,14 @@ int main(int argc, char **argv) + free(ctl.files); + + random_get_bytes(&buf, RAND_BYTES); +- MD5Update(&ctl.ctx, buf, RAND_BYTES); ++ ul_MD5Update(&ctl.ctx, buf, RAND_BYTES); + if (ctl.verbose) + fprintf(stderr, P_("Got %d byte from %s\n", + "Got %d bytes from %s\n", RAND_BYTES), + RAND_BYTES, random_tell_source()); + +- MD5Final(digest, &ctl.ctx); +- for (i = 0; i < MD5LENGTH; i++) ++ ul_MD5Final(digest, &ctl.ctx); ++ for (i = 0; i < UL_MD5LENGTH; i++) + printf("%02x", digest[i]); + putchar('\n'); + +diff --git a/tests/helpers/test_md5.c b/tests/helpers/test_md5.c +index 471580e12..6f8dec4aa 100644 +--- a/tests/helpers/test_md5.c ++++ b/tests/helpers/test_md5.c +@@ -7,22 +7,22 @@ + int main(void) + { + int i, ret; +- struct MD5Context ctx; +- unsigned char digest[MD5LENGTH]; ++ struct UL_MD5Context ctx; ++ unsigned char digest[UL_MD5LENGTH]; + unsigned char buf[BUFSIZ]; + +- MD5Init( &ctx ); ++ ul_MD5Init( &ctx ); + + while(!feof(stdin) && !ferror(stdin)) { + ret = fread(buf, 1, sizeof(buf), stdin); + if (ret) +- MD5Update( &ctx, buf, ret ); ++ ul_MD5Update( &ctx, buf, ret ); + } + + fclose(stdin); +- MD5Final( digest, &ctx ); ++ ul_MD5Final( digest, &ctx ); + +- for (i = 0; i < MD5LENGTH; i++) ++ for (i = 0; i < UL_MD5LENGTH; i++) + printf( "%02x", digest[i] ); + printf("\n"); + return 0; diff --git a/sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt3.patch b/sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt3.patch new file mode 100644 index 000000000000..2306a210e0be --- /dev/null +++ b/sys-apps/util-linux/files/util-linux-2.31-too_generic_symbols_pt3.patch @@ -0,0 +1,43 @@ +From b4db227582f1d0a14c7b63de8d57e6052b753d57 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 12 Dec 2017 11:38:17 +0100 +Subject: [PATCH] test_sha1: update helper + +Signed-off-by: Karel Zak +--- + tests/helpers/test_sha1.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/helpers/test_sha1.c b/tests/helpers/test_sha1.c +index 5a1972935..ad96da4f0 100644 +--- a/tests/helpers/test_sha1.c ++++ b/tests/helpers/test_sha1.c +@@ -7,22 +7,22 @@ + int main(void) + { + int i, ret; +- SHA1_CTX ctx; +- unsigned char digest[SHA1LENGTH]; ++ UL_SHA1_CTX ctx; ++ unsigned char digest[UL_SHA1LENGTH]; + unsigned char buf[BUFSIZ]; + +- SHA1Init( &ctx ); ++ ul_SHA1Init( &ctx ); + + while(!feof(stdin) && !ferror(stdin)) { + ret = fread(buf, 1, sizeof(buf), stdin); + if (ret) +- SHA1Update( &ctx, buf, ret ); ++ ul_SHA1Update( &ctx, buf, ret ); + } + + fclose(stdin); +- SHA1Final( digest, &ctx ); ++ ul_SHA1Final( digest, &ctx ); + +- for (i = 0; i < SHA1LENGTH; i++) ++ for (i = 0; i < UL_SHA1LENGTH; i++) + printf( "%02x", digest[i] ); + printf("\n"); + return 0; diff --git a/sys-apps/util-linux/util-linux-2.31-r1.ebuild b/sys-apps/util-linux/util-linux-2.31-r1.ebuild new file mode 100644 index 000000000000..8b029289f46e --- /dev/null +++ b/sys-apps/util-linux/util-linux-2.31-r1.ebuild @@ -0,0 +1,206 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) + +inherit toolchain-funcs libtool flag-o-matic bash-completion-r1 \ + pam python-single-r1 multilib-minimal systemd + +MY_PV="${PV/_/-}" +MY_P="${PN}-${MY_PV}" + +if [[ ${PV} == 9999 ]] ; then + inherit git-r3 autotools + EGIT_REPO_URI="git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git" +else + [[ "${PV}" = *_rc* ]] || \ + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux" + SRC_URI="mirror://kernel/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz" +fi + +DESCRIPTION="Various useful Linux utilities" +HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/" + +LICENSE="GPL-2 LGPL-2.1 BSD-4 MIT public-domain" +SLOT="0" +IUSE="build caps +cramfs fdformat kill ncurses nls pam python +readline selinux slang static-libs +suid systemd test tty-helpers udev unicode" + +# Most lib deps here are related to programs rather than our libs, +# so we rarely need to specify ${MULTILIB_USEDEP}. +RDEPEND="caps? ( sys-libs/libcap-ng ) + cramfs? ( sys-libs/zlib ) + ncurses? ( >=sys-libs/ncurses-5.2-r2:0=[unicode?] ) + pam? ( sys-libs/pam ) + python? ( ${PYTHON_DEPS} ) + readline? ( sys-libs/readline:0= ) + selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] ) + slang? ( sys-libs/slang ) + !build? ( systemd? ( sys-apps/systemd ) ) + udev? ( virtual/libudev:= )" +DEPEND="${RDEPEND} + virtual/pkgconfig + nls? ( sys-devel/gettext ) + test? ( sys-devel/bc ) + virtual/os-headers" +RDEPEND+=" + kill? ( + !sys-apps/coreutils[kill] + !sys-process/procps[kill] + ) + !net-wireless/rfkill + !sys-process/schedutils + !sys-apps/setarch + ! "${T}"/fallocate.${ABI}.c + #define _GNU_SOURCE + #include + main() { return fallocate(0, 0, 0, 0); } + EOF + append-lfs-flags + $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.${ABI}.c -o /dev/null >/dev/null 2>&1 \ + || export ac_cv_func_fallocate=no + rm -f "${T}"/fallocate.${ABI}.c +} + +multilib_src_configure() { + lfs_fallocate_test + # The scanf test in a run-time test which fails while cross-compiling. + # Blindly assume a POSIX setup since we require libmount, and libmount + # itself fails when the scanf test fails. #531856 + tc-is-cross-compiler && export scanf_cv_alloc_modifier=ms + export ac_cv_header_security_pam_misc_h=$(multilib_native_usex pam) #485486 + export ac_cv_header_security_pam_appl_h=$(multilib_native_usex pam) #545042 + + local myeconfargs=( + --disable-chfn-chsh + --disable-login + --disable-nologin + --disable-su + --docdir='${datarootdir}'/doc/${PF} + --enable-agetty + --enable-bash-completion + --enable-fs-paths-extra="${EPREFIX}/usr/sbin:${EPREFIX}/bin:${EPREFIX}/usr/bin" + --enable-line + --enable-partx + --enable-raw + --enable-rename + --enable-rfkill + --enable-schedutils + --with-bashcompletiondir="$(get_bashcompdir)" + --with-systemdsystemunitdir=$(multilib_native_usex systemd "$(systemd_get_systemunitdir)" "no") + $(multilib_native_use_enable caps setpriv) + $(multilib_native_use_enable cramfs) + $(multilib_native_use_enable fdformat) + $(multilib_native_use_enable nls) + $(multilib_native_use_enable suid makeinstall-chown) + $(multilib_native_use_enable suid makeinstall-setuid) + $(multilib_native_use_enable tty-helpers mesg) + $(multilib_native_use_enable tty-helpers wall) + $(multilib_native_use_enable tty-helpers write) + $(multilib_native_use_with python) + $(multilib_native_use_with readline) + $(multilib_native_use_with slang) + $(multilib_native_use_with systemd) + $(multilib_native_use_with udev) + $(multilib_native_usex ncurses "$(use_with unicode ncursesw)" '--without-ncursesw') + $(multilib_native_usex ncurses "$(use_with !unicode ncurses)" '--without-ncurses') + $(tc-has-tls || echo --disable-tls) + $(use_enable unicode widechar) + $(use_enable kill) + $(use_enable static-libs static) + $(use_with selinux) + $(usex ncurses '' '--without-tinfo') + ) + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" +} + +multilib_src_compile() { + if multilib_is_native_abi; then + default + else + # build libraries only + emake -f Makefile -f - mylibs \ + <<< 'mylibs: $(usrlib_exec_LTLIBRARIES) $(pkgconfig_DATA)' + fi +} + +multilib_src_test() { + multilib_is_native_abi && emake check +} + +multilib_src_install() { + if multilib_is_native_abi; then + default + else + emake DESTDIR="${D}" install-usrlib_execLTLIBRARIES \ + install-pkgconfigDATA install-uuidincHEADERS \ + install-nodist_blkidincHEADERS install-nodist_mountincHEADERS \ + install-nodist_smartcolsincHEADERS install-nodist_fdiskincHEADERS + fi + + if multilib_is_native_abi; then + # need the libs in / + gen_usr_ldscript -a blkid mount smartcols uuid + + use python && python_optimize + fi +} + +multilib_src_install_all() { + dodoc AUTHORS NEWS README* Documentation/{TODO,*.txt,releases/*} + + # e2fsprogs-libs didnt install .la files, and .pc work fine + find "${ED}" -name "*.la" -delete || die + + if use pam; then + newpamd "${FILESDIR}/runuser.pamd" runuser + newpamd "${FILESDIR}/runuser-l.pamd" runuser-l + fi +} + +pkg_postinst() { + if ! use tty-helpers; then + elog "The mesg/wall/write tools have been disabled due to USE=-tty-helpers." + fi + + if [[ -z ${REPLACING_VERSIONS} ]]; then + elog "The agetty util now clears the terminal by default. You" + elog "might want to add --noclear to your /etc/inittab lines." + fi +} -- cgit v1.2.3-65-gdbad