addd patches

This commit is contained in:
Alexander Stefanov 2020-03-06 10:30:44 +00:00
parent 7fe2bf684a
commit b91a1afb7a
4 changed files with 72 additions and 33 deletions

11
default-threading.patch Normal file
View file

@ -0,0 +1,11 @@
--- xz-5.2.0/src/xz/args.c~ 2014-12-21 13:49:36.000000000 -0500
+++ xz-5.2.0/src/xz/args.c 2015-01-08 19:00:14.122772405 -0500
@@ -211,6 +211,8 @@
};
int c;
+
+ hardware_threads_set(0);
while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL))
!= -1) {

11
io-size.patch Normal file
View file

@ -0,0 +1,11 @@
--- xz-5.1.2alpha/src/xz/file_io.h~ 2012-07-04 10:51:14.000000000 -0700
+++ xz-5.1.2alpha/src/xz/file_io.h 2013-01-28 07:40:20.356319426 -0800
@@ -15,7 +15,7 @@
#if BUFSIZ <= 1024
# define IO_BUFFER_SIZE 8192
#else
-# define IO_BUFFER_SIZE (BUFSIZ & ~7U)
+# define IO_BUFFER_SIZE ((BUFSIZ * 8) & ~7U)
#endif

43
speedup.patch Normal file
View file

@ -0,0 +1,43 @@
diff -Naru xz-5.2.3/src/liblzma/lz/lz_encoder_mf.c xz-5.2.3.tpg/src/liblzma/lz/lz_encoder_mf.c
--- xz-5.2.3/src/liblzma/lz/lz_encoder_mf.c 2016-12-30 11:08:20.000000000 +0000
+++ xz-5.2.3.tpg/src/liblzma/lz/lz_encoder_mf.c 2017-10-23 15:45:34.970539050 +0000
@@ -464,22 +464,22 @@
uint32_t len0 = 0;
uint32_t len1 = 0;
+ uint32_t len2 = 0;
while (true) {
const uint32_t delta = pos - cur_match;
+ uint32_t len = len2;
if (depth-- == 0 || delta >= cyclic_size) {
*ptr0 = EMPTY_HASH_VALUE;
*ptr1 = EMPTY_HASH_VALUE;
return matches;
}
+ const uint8_t *const pb = cur - delta;
uint32_t *const pair = son + ((cyclic_pos - delta
+ (delta > cyclic_pos ? cyclic_size : 0))
<< 1);
- const uint8_t *const pb = cur - delta;
- uint32_t len = my_min(len0, len1);
-
if (pb[len] == cur[len]) {
len = lzma_memcmplen(pb, cur, len + 1, len_limit);
@@ -502,11 +502,13 @@
ptr1 = pair + 1;
cur_match = *ptr1;
len1 = len;
+ len2 = my_min(len0, len1);
} else {
*ptr0 = cur_match;
ptr0 = pair;
cur_match = *ptr0;
len0 = len;
+ len2 = my_min(len0, len1);
}
}
}

40
xz.spec
View file

@ -3,8 +3,6 @@
%define libname %mklibname %{lname} %{major}
%define devname %mklibname %{lname} -d
%bcond_with dietlibc
%define gitdate 20140129
Summary: XZ utils
@ -18,11 +16,12 @@ Source0: http://tukaani.org/xz/%{name}-%{version}.tar.xz
Source1: xzme
Patch0: xz-5.2.0-text-tune.patch
Patch1: xz-5.1.3alpha-man-page-day.patch
# clearlinux
Patch2: speedup.patch
Patch3: default-threading.patch
Patch4: io-size.patch
# needed by check suite
BuildRequires: diffutils
%if %{with diet}
BuildRequires: dietlibc-devel
%endif
%rename lzma
%rename lzma-utils
@ -45,7 +44,7 @@ tools. Also provides:
- Very similar command line interface than what gzip and bzip2 have.
%files -f %{name}.lang
%doc README THANKS
%doc %{_docdir}/%{name}
%{_bindir}/*
%{_mandir}/man1/*
@ -79,43 +78,22 @@ Devel libraries & headers for liblzma.
%{_includedir}/%{lname}/*.h
%{_libdir}/*.so
%{_libdir}/*.a
%if %{with dietlibc}
%{_prefix}/lib/dietlibc/lib-%{_arch}/liblzma.a
%endif
%{_libdir}/pkgconfig/lib%{lname}.pc
#----------------------------------------------------------------------------
%prep
%setup -q
%patch0 -p1 -b .text~
%patch1 -p1 -b .day~
%autosetup -p1
%build
export CONFIGURE_TOP=`pwd`
mkdir objs
pushd objs
CFLAGS="%{optflags} -O3 -funroll-loops" \
%configure
%configure --enable-static
%make
popd
%if %{with dietlibc}
mkdir objsdietlibc
pushd objsdietlibc
CFLAGS="-Os" CC="diet gcc" \
%configure --disable-shared \
--enable-static \
--disable-xz \
--disable-xzdec \
--disable-lzmadec \
--disable-lzmainfo \
--disable-lzma-links \
--disable-scripts
%make
popd
%endif
%install
%makeinstall_std -C objs
@ -124,10 +102,6 @@ mv %{buildroot}%{_libdir}/*.so.* %{buildroot}/%{_lib}/
rm -f %{buildroot}%{_libdir}/liblzma.so
ln -sr %{buildroot}/%{_lib}/liblzma.so.%{major} %{buildroot}%{_libdir}/liblzma.so
%if %{with dietlibc}
install -D objsdietlibc/src/liblzma/.libs/liblzma.a -D %{buildroot}%{_prefix}/lib/dietlibc/lib-%{_arch}/liblzma.a
%endif
install -m755 %{SOURCE1} -D %{buildroot}%{_bindir}/xzme
%find_lang %{name}