lbzip2: upgraded package to upstream

Upgraded app-arch/lbzip2 to version 2.5_p20181227-r1.

BUG=None
TEST=CQ passes

Change-Id: I3b1c160116c7c398ceeeda6517ddaee9300a2881
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/2923079
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Sergey Frolov <sfrolov@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/app-arch/lbzip2/Manifest b/app-arch/lbzip2/Manifest
index 98b292c..37602fe 100644
--- a/app-arch/lbzip2/Manifest
+++ b/app-arch/lbzip2/Manifest
@@ -1 +1 @@
-DIST lbzip2-2.5.tar.gz 651399 SHA256 46c75ee93cc95eedc6005625442b2b8e59a2bef3ba80987d0491f055185650e9 SHA512 76e96cfa75b3ed515b2f891349dffc1403daab2dd0a2a614fa0c811cec6ca25faa395da08ad68a9b6ba4069332c4571f70fb7424f06ef3d800c3082c08d7d3d7 WHIRLPOOL b64e70239d89782499cd59731130258d0432dbd69f84d1bed2adb7f573f706ab635a80bd2e2331231f4aad0c92b51151a0c45f192f4fcea9579fb1eef2fa8708
+DIST lbzip2-2.5_p20181227.tar.gz 704920 BLAKE2B e5da0091c0e4fb73724c5ea472d757d76356cffbf1fc679bf4ee05e25690b7712dceaf17f355383bfd4eb525c4aea04c2e5312592df5bb99159e000769bcee2e SHA512 53b29721a106d280927f2c18f33247645bb7fb3e67d835885d73e037910bf02e473f1210d848df41a387be30f829213d98ac9387b2a9201b94d12117809fbcf5
diff --git a/app-arch/lbzip2/files/lbzip2-2.5-glibc-2.28.patch b/app-arch/lbzip2/files/lbzip2-2.5-glibc-2.28.patch
deleted file mode 100644
index bc39549..0000000
--- a/app-arch/lbzip2/files/lbzip2-2.5-glibc-2.28.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-diff --git a/lib/fseterr.c b/lib/fseterr.c
-index 1e212e4..81f51ed 100644
---- a/lib/fseterr.c
-+++ b/lib/fseterr.c
-@@ -1,5 +1,5 @@
- /* Set the error indicator of a stream.
--   Copyright (C) 2007-2014 Free Software Foundation, Inc.
-+   Copyright (C) 2007-2018 Free Software Foundation, Inc.
- 
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-@@ -12,7 +12,7 @@
-    GNU General Public License for more details.
- 
-    You should have received a copy of the GNU General Public License
--   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
- 
- #include <config.h>
- 
-@@ -23,21 +23,26 @@
- 
- #include "stdio-impl.h"
- 
-+/* This file is not used on systems that have the __fseterr function,
-+   namely musl libc.  */
-+
- void
- fseterr (FILE *fp)
- {
-   /* Most systems provide FILE as a struct and the necessary bitmask in
-      <stdio.h>, because they need it for implementing getc() and putc() as
-      fast macros.  */
--#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
-+#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1
-+  /* GNU libc, BeOS, Haiku, Linux libc5 */
-   fp->_flags |= _IO_ERR_SEEN;
--#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
-+#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
-+  /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
-   fp_->_flags |= __SERR;
- #elif defined __EMX__               /* emx+gcc */
-   fp->_flags |= _IOERR;
- #elif defined __minix               /* Minix */
-   fp->_flags |= _IOERR;
--#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
-+#elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, MSVC, NonStop Kernel, OpenVMS */
-   fp_->_flag |= _IOERR;
- #elif defined __UCLIBC__            /* uClibc */
-   fp->__modeflags |= __FLAG_ERROR;
diff --git a/app-arch/lbzip2/files/lbzip2-2.5_p20181227-fix-unaligned.patch b/app-arch/lbzip2/files/lbzip2-2.5_p20181227-fix-unaligned.patch
new file mode 100644
index 0000000..c23d1af
--- /dev/null
+++ b/app-arch/lbzip2/files/lbzip2-2.5_p20181227-fix-unaligned.patch
@@ -0,0 +1,33 @@
+https://github.com/kjn/lbzip2/pull/25
+
+From d570020ade2add591b97e61927545a005a2d4a6f Mon Sep 17 00:00:00 2001
+From: Matt Turner <mattst88@gmail.com>
+Date: Wed, 7 Aug 2019 11:47:04 -0700
+Subject: [PATCH] Align zero-length array to avoid unaligned accesses
+
+When make_tree() creates the left-justified base table (uint64_t *B)
+it does so with 64-bit stores:
+
+    B[k] = sofar;
+
+But B points to memory in the zero-length array "uint32_t tt[0]" at the
+end of struct decoder_state. Since tt's type is uint32_t, it is only
+aligned to a four byte boundary, and so the 64-bit store in make_tree()
+causes an unaligned trap on strict platforms like sparc.
+---
+ src/decode.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/decode.h b/src/decode.h
+index c9a9086..7c0ca3f 100644
+--- a/src/decode.h
++++ b/src/decode.h
+@@ -62,7 +62,7 @@ struct decoder_state {
+   uint8_t rle_char;             /* current character */
+   uint8_t rle_prev;             /* prevoius character */
+ 
+-  uint32_t tt[0];
++  uint32_t tt[0] __attribute__((aligned (8)));
+ };
+ 
+ 
diff --git a/app-arch/lbzip2/lbzip2-2.5-r1.ebuild b/app-arch/lbzip2/lbzip2-2.5_p20181227-r1.ebuild
similarity index 71%
rename from app-arch/lbzip2/lbzip2-2.5-r1.ebuild
rename to app-arch/lbzip2/lbzip2-2.5_p20181227-r1.ebuild
index fc6514f..ab11143 100644
--- a/app-arch/lbzip2/lbzip2-2.5-r1.ebuild
+++ b/app-arch/lbzip2/lbzip2-2.5_p20181227-r1.ebuild
@@ -1,11 +1,13 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI="7"
+
+inherit autotools
 
 DESCRIPTION="Parallel bzip2 utility"
 HOMEPAGE="https://github.com/kjn/lbzip2/"
-SRC_URI="http://archive.lbzip2.org/${P}.tar.gz"
+SRC_URI="https://dev.gentoo.org/~whissi/dist/${PN}/${P}.tar.gz"
 
 LICENSE="GPL-3"
 SLOT="0"
@@ -17,13 +19,16 @@
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-2.3-s_isreg.patch
-	# bug 669594
-	"${FILESDIR}"/${PN}-2.5-glibc-2.28.patch
+	"${FILESDIR}"/${P}-fix-unaligned.patch
 )
 
+src_prepare() {
+	default
+	eautoreconf
+}
+
 src_configure() {
 	local myeconfargs=(
-		--disable-silent-rules
 		$(use_enable debug tracing)
 	)
 	econf "${myeconfargs[@]}"
diff --git a/app-arch/lbzip2/metadata.xml b/app-arch/lbzip2/metadata.xml
index b2cb179..f6621e0 100644
--- a/app-arch/lbzip2/metadata.xml
+++ b/app-arch/lbzip2/metadata.xml
@@ -1,16 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-  <maintainer type="person">
-    <email>mattst88@gentoo.org</email>
-    <name>Matt Turner</name>
-  </maintainer>
-  <longdescription lang="en">
-	A multi-threaded bzip2/bunzip2 utility that employs multiple threads and an 
-	input-bound splitter even when decompressing .bz2 files created by standard 
-	bzip2
+	<maintainer type="person">
+		<email>mattst88@gentoo.org</email>
+		<name>Matt Turner</name>
+	</maintainer>
+	<longdescription lang="en">
+		A multi-threaded bzip2/bunzip2 utility that employs multiple threads and an
+		input-bound splitter even when decompressing .bz2 files created by standard
+		bzip2
 	</longdescription>
-  <upstream>
-    <remote-id type="github">kjn/lbzip2</remote-id>
-  </upstream>
+	<use>
+		<flag name="symlink">Install symlinks which override <pkg>app-arch/bzip2</pkg> implementation</flag>
+	</use>
+	<upstream>
+		<remote-id type="github">kjn/lbzip2</remote-id>
+	</upstream>
 </pkgmetadata>