Compare commits

..

1 commit

Author SHA1 Message Date
Pavel Zhukov
c7f91f915c Rebuild with new gnat 2017-07-07 17:57:58 +02:00
6 changed files with 39 additions and 341 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
/zlib-ada-20120830.tar.bz2
/zlib-ada-git-ca39312ba02e84eb15799300ef83607a83402868.zip

View file

@ -10,7 +10,7 @@
with "directories";
library project Build_Zlib_Ada is
Version := external("VERSION");
Version := external("RPM_PACKAGE_VERSION");
Destdir := external("DESTDIR");
for Library_Name use "zlib_ada";
@ -19,7 +19,11 @@ library project Build_Zlib_Ada is
for Library_Src_Dir use Destdir & Directories.Includedir & "/zlib-ada";
for Library_Dir use Destdir & Directories.Libdir;
for Library_ALI_Dir use Destdir & Directories.Libdir & "/zlib-ada";
for Library_Options use ("-lz");
for Library_Options use ("-lz") & external_as_list("LDFLAGS", " ");
-- Put the binder files for different architectures in subdirectories where
-- they won't conflict with each other.
for Object_Dir use Directories.Hardware_Platform;
for Source_Files use ("zlib.ads",
"zlib.adb",

View file

@ -1 +1 @@
SHA512 (zlib-ada-git-ca39312ba02e84eb15799300ef83607a83402868.zip) = 0304881e8808d107c2b3259ced3202857641ddfed5850e404602c952c97ab744986e031bac2fecb07dd101b74d57931b27afd18ed5fde144db658278d0dc55f1
8d24e104d1671dedc3714edb295794bd zlib-ada-20120830.tar.bz2

View file

@ -1,134 +0,0 @@
--- a/zlib-streams.adb
+++ b/zlib-streams.adb
@@ -83,6 +83,7 @@ package body ZLib.Streams is
Stream.Buffer := new Buffer_Subtype;
Stream.Rest_First := Stream.Buffer'Last + 1;
Stream.Rest_Last := Stream.Buffer'Last;
+ Stream.Ahead_Last := Stream.Buffer'First - 1;
end if;
end Create;
@@ -100,9 +101,9 @@ package body ZLib.Streams is
loop
Flush (Stream.Writer, Buffer, Last, Mode);
- Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
+ exit when Last < Buffer'First;
- exit when Last < Buffer'Last;
+ Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last));
end loop;
end Flush;
@@ -146,8 +147,71 @@ package body ZLib.Streams is
Rest_First => Stream.Rest_First,
Rest_Last => Stream.Rest_Last);
+ Ahead_First : Stream_Element_Offset;
+ Ahead_Last : Stream_Element_Offset;
+
begin
- Read (Stream.Reader, Item, Last);
+ if Stream.Ahead_Last > Stream.Rest_Last then
+ Last := Item'First - 1;
+ Ahead_First := Stream.Rest_Last + 1;
+
+ loop
+ if Last = Item'Last then
+ Ahead_Last :=
+ Stream.Rest_Last + Stream.Ahead_Last - Ahead_First + 1;
+ Stream.Buffer
+ (Stream.Rest_Last + 1 .. Ahead_Last) :=
+ Stream.Buffer (Ahead_First .. Stream.Ahead_Last);
+ Stream.Ahead_Last := Ahead_Last;
+ return;
+ end if;
+
+ Last := Last + 1;
+
+ Item (Last) := Stream.Buffer (Ahead_First);
+
+ if Ahead_First = Stream.Ahead_Last then
+ Stream.Ahead_Last := Stream.Buffer'First - 1;
+ exit;
+ end if;
+
+ Ahead_First := Ahead_First + 1;
+ end loop;
+
+ if Last < Item'Last then
+ Read (Stream.Reader, Item (Last + 1 .. Item'Last), Last);
+ end if;
+
+ else
+ Read (Stream.Reader, Item, Last);
+ end if;
+
+ if not Stream.Reader.Stream_End
+ and then Stream.Rest_First > Stream.Rest_Last
+ then
+ -- Try read ahead to detect end of stream early
+
+ Read (Stream.Buffer.all, Stream.Rest_Last);
+ Stream.Rest_First := Stream.Buffer'First;
+
+ if Stream.Rest_Last = Stream.Buffer'Last then
+ -- No space to read ahead
+ return;
+ end if;
+
+ Translate
+ (Stream.Reader,
+ Stream.Buffer (Stream.Rest_First .. Stream.Rest_Last),
+ In_Last => Stream.Rest_First,
+ Out_Data =>
+ Stream.Buffer (Stream.Rest_Last + 1 .. Stream.Buffer'Last),
+ Out_Last => Stream.Ahead_Last,
+ Flush => (if Stream.Rest_First > Stream.Rest_Last
+ then Finish
+ else No_Flush));
+
+ Stream.Rest_First := Stream.Rest_First + 1;
+ end if;
end Read;
-------------------
--- a/zlib-streams.ads
+++ b/zlib-streams.ads
@@ -91,6 +91,11 @@ private
-- We need to have this buffer in the record because not all read data
-- from back stream could be processed during the read operation.
+ Ahead_Last : Stream_Element_Offset;
+ -- Sometimes the decompressed data is over but the gzip footer still was
+ -- not read from back stream. We should try to read ahead in case we are
+ -- suspect this to detect end of stream proper.
+
Buffer_Size : Stream_Element_Offset;
-- Buffer size for write operation.
-- We do not need to have this buffer in the record because all data
@@ -102,6 +107,8 @@ private
end record;
function End_Of_Stream (Stream : in Stream_Type) return Boolean is
- (Stream_End (Stream.Reader));
+ (Stream_End (Stream.Reader)
+ and then Stream.Rest_First > Stream.Rest_Last
+ and then Stream.Rest_Last >= Stream.Ahead_Last);
end ZLib.Streams;
--- a/zlib.ads
+++ b/zlib.ads
@@ -263,8 +263,10 @@ package ZLib is
Rest_First, Rest_Last : in out Stream_Element_Offset;
-- Rest_First have to be initialized to Buffer'Last + 1
- -- Rest_Last have to be initialized to Buffer'Last
- -- before usage.
+ -- Rest_Last have to be initialized to Buffer'Last before usage.
+ -- When no more data provided with first generic parameter procedure
+ -- Read then the Read_First became Buffer'First and the Read_Last became
+ -- Buffer'First - 1.
Allow_Read_Some : in Boolean := False;
-- Is it allowed to return Last < Item'Last before end of data

View file

@ -1,11 +0,0 @@
--- a/zlib.adb
+++ b/zlib.adb
@@ -631,6 +631,8 @@ package body ZLib is
Flush => Flush);
CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last));
+ else
+ In_Last := In_Data'First - 1;
end if;
if Filter.Stream_End and then Out_Last <= Out_Data'Last then

View file

@ -1,61 +1,25 @@
# The test suite is normally run. It can be disabled with "--without=check".
%bcond_without check
# Upstream source information.
%global upstream_name zlib-ada
%global upstream_version 1.4
%global upstream_commit_date 20210811
%global upstream_commit ca39312ba02e84eb15799300ef83607a83402868
%global upstream_shortcommit %(c=%{upstream_commit}; echo ${c:0:7})
Name: zlib-ada
Version: %{upstream_version}
Release: 0.43.%{upstream_commit_date}git%{upstream_shortcommit}%{?dist}
Version: 1.4
Release: 0.16.20120830CVS%{?dist}
Summary: Zlib for Ada
Summary(sv): Zlib för ada
License: GPL-3.0-or-later WITH GCC-exception-3.1 AND GPL-3.0-or-later WITH GNAT-exception
# Based on the header of zlib.ads.
Group: System Environment/Libraries
License: GPLv3+ with exceptions
URL: http://zlib-ada.sourceforge.net/
# The tarball was made with these commands:
# cvs -z3 -d:pserver:anonymous@zlib-ada.cvs.sourceforge.net:/cvsroot/zlib-ada co -P zlib-ada
# tar --create --exclude-vcs --bzip2 --file=zlib-ada-20120830.tar.bz2 zlib-ada
Source: zlib-ada-20120830.tar.bz2
# This will be the source when there is a new release:
#Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source2: build_zlib_ada.gpr
Source3: zlib_ada.gpr
URL: https://zlib-ada.sourceforge.net/
Source0: https://sourceforge.net/code-snapshots/git/z/zl/%{upstream_name}/git.git/%{upstream_name}-git-%{upstream_commit}.zip
# NOTE: The above link points to a source package that is generated on
# demand by opening the source code page in a browser (see [Code] below),
# selecting the correct commit and then clicking "Download Snapshot". The
# generated Zip-file will remain available at the mentioned location for some
# time (at most 24h, as it seems).
#
# See also:
# [Code] https://sourceforge.net/p/zlib-ada/git/ci/master/tree/
# [Releases] https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: build_zlib_ada.gpr
Source2: zlib_ada.gpr
# The Ada Web Server bundles the Zlib-Ada library. The authors of the
# Ada Web Server found that a previous fix in the upstream source of
# Zlib-Ada did not solve all problems in the end-of-stream detection
# and therefore made additional improvements, but only in the bundled
# sources. The improvements have, for some reason, not been offered
# to/integrated into the upstream repository of Zlib-Ada on
# SourceForge. Tests have been added to the AWS test suite that
# explicitly test for the bug(s). As the Ada Web Server is packaged in
# Fedora (package "aws"), we apply these patches here as well.
# Adapted from: https://github.com/AdaCore/aws/commit/178767546df544388bb8a921d8314957b88a6ae0
Patch: %{name}-detect-end-of-zlib-stream-better.patch
# Adapted from: https://github.com/AdaCore/aws/commit/76ae4648ee0e8c38e92b0ee71ae60db259ff27ce
Patch: %{name}-properly-initialize-in_last.patch
BuildRequires: gcc-gnat
# A fedora-gnat-project-common that contains GPRbuild_flags is needed.
BuildRequires: fedora-gnat-project-common >= 3.17
BuildRequires: gprbuild
BuildRequires: zlib-devel
# Build only on architectures where GPRbuild is available:
ExclusiveArch: %{GPRbuild_arches}
BuildRequires: gcc-gnat >= 4.7 fedora-gnat-project-common zlib-devel chrpath
# Gnatmake learned about external_as_list sometime between 4.4 and 4.7.
# Build only on architectures where gcc-gnat is available:
ExclusiveArch: %{GNAT_arches}
%global common_description_en \
Zlib-Ada is a thick Ada binding to the popular compression/decompression \
@ -70,13 +34,10 @@ avkomprimeringsbiblioteket Zlib.
%description -l sv %{common_description_sv}
#################
## Subpackages ##
#################
%package devel
Summary: Development files for Zlib-Ada
Summary(sv): Filer för programmering med Zlib-Ada
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: fedora-gnat-project-common
@ -91,71 +52,39 @@ Paketet %{name}-devel innehåller källkod och länkningsinformation som behövs
för att utveckla program som använder Zlib-Ada.
#############
## Prepare ##
#############
%prep
%autosetup -n %{upstream_name}-git-%{upstream_commit}
%setup -q -n zlib-ada
chmod a-x * # Remove bogus executable bits.
cp %{SOURCE2} .
# Remove bogus executable bits.
chmod a-x *
# Copy the GPRbuild-file with which we will build the library.
cp %{SOURCE1} .
###########
## Build ##
###########
%build
gprbuild %{GPRbuild_flags} -XVERSION=%{upstream_commit_date} \
-XDESTDIR=build_target \
-P build_zlib_ada.gpr
gnatmake -P build_zlib_ada.gpr %{Gnatmake_optflags} -XDESTDIR=build_target -XLDFLAGS='%{__global_ldflags}'
# Remove the unnecessary runpath that Gnatmake added.
chrpath --delete build_target%{_libdir}/*.so.*
#############
## Install ##
#############
%install
mv build_target/* --target-directory=%{buildroot}
# Add the project file for projects that use this library.
mkdir --parents %{buildroot}%{_GNAT_project_dir}
cp --preserve=timestamps %{SOURCE2} %{buildroot}%{_GNAT_project_dir}/
cp --preserve=timestamps %{SOURCE3} %{buildroot}%{_GNAT_project_dir}/
###########
## Check ##
###########
%if %{with check}
%check
# Let the multithreading test run for a limited amount of time.
sed --in-place \
--expression="156 { s,Ada.Text_IO.Get_Immediate (Dummy),delay 2.0, ; t; q1 }" \
mtest.adb
# Build & run the tests.
gnatmake test.adb -largs -lz && ./test
gnatmake mtest.adb -largs -lz && ./mtest
%endif
%{_rpmconfigdir}/check-rpaths
###########
## Files ##
###########
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc readme.txt
%license COPYING3 COPYING.RUNTIME
%{_libdir}/*.so.*
%files devel
%doc test.adb mtest.adb read.adb buffer_demo.adb
%{_includedir}/*
@ -164,98 +93,9 @@ gnatmake mtest.adb -largs -lz && ./mtest
%{_GNAT_project_dir}/*
###############
## Changelog ##
###############
%changelog
* Wed Jan 07 2026 Björn Persson <Bjorn@Rombobjörn.se> - 1.4-0.43.20210811gitca39312
- Rebuilt with GCC 16 prerelease.
* Sun Aug 10 2025 Björn Persson <Bjorn@Rombobjörn.se> - 1.4-0.42.20210811gitca39312
- Rebuilt because the ALI of System.OS_Constants changed.
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.41.20210811gitca39312
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.40.20210811gitca39312
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Tue Jan 14 2025 Björn Persson <Bjorn@Rombobjörn.se> - 1.4-0.39.20210811gitca39312
- Rebuilt with GCC 15 prerelease.
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.38.20210811gitca39312
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Sun Jan 28 2024 Dennis van Raaij <dvraaij@fedoraproject.org> - 1.4-0.37.20210811gitca39312
- Updated to new prerelease of v1.4 (Git commit ca39312, 2021-08-11).
- License field now contains an SPDX license expression.
- Added an option to run some small tests (enabled by default).
- Added two additional fixes from AWS; a libray that bundles this library.
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.36.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Jan 16 2024 Björn Persson <Bjorn@Rombobjörn.se> - 1.4-0.35.20120830CVS
- Rebuilt with GCC 14 prerelease.
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.34.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.33.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Jan 17 2023 Björn Persson <Bjorn@Rombobjörn.se> - 1.4-0.32.20120830CVS
- Rebuilt with GCC 13.
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.31.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.30.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.29.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Thu Jan 28 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.28.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Dec 8 2020 Pavel Zhukov <pzhukov@redhat.com> - 1.4-0.27.20120830CVS
- Rebuild with new libgnat
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.26.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.25.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.24.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Tue Feb 12 2019 Pavel Zhukov <pzhukov@redhat.com> - 1.4-0.23.20120830CVS
- Rebuild for i686
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.22.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.21.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Feb 06 2018 Pavel Zhukov <landgraf@fedoraproject.org - 1.4-0.20.20120830CVS
- rebuilt
* Sun Feb 04 2018 Björn Persson <Bjorn@Rombobjörn.se> - 1.4-0.19.20120830CVS
- Switched to building with GPRbuild as project file support was removed from
Gnatmake in GCC 8.
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.18.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.17.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Jul 10 2017 Pavel Zhukov <pzhukov@redhat.com> - 1.4-0.16.20120830CVS
- rebuild with new gnat
* Fri Jul 7 2017 Pavel Zhukov <pzhukov@redhat.com> - 1.4-0.16.20120830CVS
- Rebuild with new gnat
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-0.15.20120830CVS
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild