ee6be14
Name:           e00compr
ee6be14
Version:        1.0.1
d74e530
# Unless upstream accepts Source1, we will need to maintain an soversion
82f6809
# downstream.
82f6809
%global downstream_soversion 0.1
82f6809
%global soversion %{downstream_soversion}
2d02d97
Release:        %autorelease
ee6be14
Summary:        Library to compress and uncompress E00 files
ee6be14
ee6be14
License:        MIT
ee6be14
URL:            http://avce00.maptools.org/e00compr
82f6809
Source0:        http://avce00.maptools.org/dl/e00compr-%{version}.tar.gz
82f6809
# Build a shared library instead of a static one, and version it with an
82f6809
# appropriate SONAME.
82f6809
#
82f6809
# New account creation is broken on upstream bug tracker
82f6809
# http://bugzilla.maptools.org/; Makefile.shared sent upstream by email
82f6809
# 2022-01-05.
82f6809
Source1:        Makefile.shared
82f6809
82f6809
# Fix possible buffer overflow due to strncpy() not null-terminating when it
82f6809
# truncates:
82f6809
#
82f6809
# New account creation is broken on upstream bug tracker
82f6809
# http://bugzilla.maptools.org/; patch sent upstream by email 2022-01-05.
82f6809
Patch0:         e00compr-1.0.1-strncpy-null-term.patch
82f6809
82f6809
# Unused variable
82f6809
#
82f6809
# New account creation is broken on upstream bug tracker
82f6809
# http://bugzilla.maptools.org/; patch sent upstream by email 2022-01-05.
82f6809
Patch1:         e00compr-1.0.1-nDigits-unused.patch
ee6be14
b391e2b
BuildRequires:  gcc
82f6809
BuildRequires:  make
82f6809
82f6809
BuildRequires:  dos2unix
82f6809
82f6809
Requires:       e00compr-libs%{?_isa} = %{version}-%{release}
82f6809
Requires:       e00compr-tools%{?_isa} = %{version}-%{release}
82f6809
c7c29cf
%global common_description %{expand:
82f6809
E00compr is an ANSI C library that reads and writes Arc/Info compressed E00
82f6809
files. Both “PARTIAL” and “FULL” compression levels are supported.
82f6809
82f6809
This package can be divided in three parts:
82f6809
82f6809
  • The ‘e00conv’ command-line program. This program takes a E00 file as input
82f6809
    (compressed or not) and copies it to a new file with the requested
82f6809
    compression level (NONE, PARTIAL or FULL).
82f6809
82f6809
  • A set of library functions to read compressed E00 files. These functions
82f6809
    read a E00 file (compressed or not) and return a stream of uncompressed
82f6809
    lines, making the E00 file appear as if it was not compressed.
82f6809
82f6809
  • A set of library functions to write compressed E00 files. These functions
82f6809
    take one line after another from what should be a uncompressed E00 file,
82f6809
    and write them to a file with the requested compression level, either NONE,
82f6809
    PARTIAL or FULL.}
ee6be14
c7c29cf
%description %{common_description}
82f6809
82f6809
This is a metapackage that installs both the command-line tools
82f6809
(e00compr-tools) and the libraries (e00compr-libs).
82f6809
82f6809
82f6809
%package libs
82f6809
Summary:        Libraries for e00compr
82f6809
c7c29cf
%description libs %{common_description}
82f6809
82f6809
The e00compr-libs package contains the e00compr libraries.
82f6809
ee6be14
ee6be14
%package devel
82f6809
Summary:        Development files for e00compr
82f6809
82f6809
Requires:       e00compr-libs%{?_isa} = %{version}-%{release}
ee6be14
c7c29cf
%description devel %{common_description}
82f6809
82f6809
The e00compr-devel package contains libraries and header files for developing
82f6809
applications that use e00compr.
82f6809
82f6809
82f6809
%package tools
82f6809
Summary:        Command-line tools associated with e00compr
82f6809
82f6809
Requires:       e00compr-libs%{?_isa} = %{version}-%{release}
82f6809
82f6809
%description tools
82f6809
This package provides the ‘e00conv’ command-line program, which takes a E00
82f6809
file as input (compressed or not) and copies it to a new file with the
82f6809
requested compression level (NONE, PARTIAL or FULL).
ee6be14
ee6be14
ee6be14
%prep
82f6809
%autosetup
82f6809
dos2unix *.TXT *.txt
82f6809
# Nothing in this package is a script; nothing should be executable.
82f6809
find . -type f -perm /0111 -exec chmod -v a-x '{}' '+'
82f6809
82f6809
# Header name conflict with cpl (cpl_error.h)
82f6809
# http://bugzilla.maptools.org/show_bug.cgi?id=2367
82f6809
# Use actual header file locations in examples.
82f6809
# Leave the upstream locations in the documentation since it assumes developers
82f6809
# will use a static library or possibly copy sources into a dependent project’s
82f6809
# source tree.
82f6809
sed -r -i 's@"(e00compr)\.h"@<\1/\1.h>@' ex_*.c
ee6be14
82f6809
# New account creation is broken on upstream bug tracker
82f6809
# http://bugzilla.maptools.org/; suggested creation of a separate file by email
82f6809
# to upstream on 2022-01-05.
82f6809
awk 'toupper($0) ~ /(COPYRIGHT|LICENSE)/ { o=1 }; /[-]{3,}/ { o=0 }; o' \
69eed9b
    README.TXT | tee LICENSE
82f6809
82f6809
# Unless upstream accepts Source1, we will need to maintain an soversion
82f6809
# downstream. Replace the suggested “1” with an “earlier” downstream version.
82f6809
cp -p '%{SOURCE1}' Makefile.shared
82f6809
sed -r -i 's/(SOVER=[[:blank:]]*)1/\1%{downstream_soversion}/' Makefile.shared
8162ce9
ee6be14
ee6be14
%build
82f6809
%set_build_flags
82f6809
%make_build \
82f6809
    CC="${CC-gcc}" \
82f6809
    CFLAGS="${CFLAGS}" \
82f6809
    LFLAGS="${LDFLAGS}" \
82f6809
    -f Makefile.shared
ee6be14
ee6be14
ee6be14
%install
82f6809
# Upstream Makefile lacks an “install” target.
8162ce9
# Header name conflict with cpl (cpl_error.h)
8162ce9
# http://bugzilla.maptools.org/show_bug.cgi?id=2367
7d4b0dc
install -d '%{buildroot}%{_includedir}/e00compr'
82f6809
install -t '%{buildroot}%{_includedir}/e00compr' -D -p -m 0644 *.h
7d4b0dc
install -d '%{buildroot}%{_mandir}/man1'
82f6809
install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 e00conv.1
82f6809
install -d '%{buildroot}%{_libdir}'
4956efd
# Use cp with an extra option, instead of install, to preserve symlinks
4956efd
cp -p --no-dereference *.so *.so.* '%{buildroot}%{_libdir}'
7d4b0dc
install -d '%{buildroot}%{_bindir}'
82f6809
install -t '%{buildroot}%{_bindir}' -D -p e00conv
ee6be14
ee6be14
ee6be14
%files
82f6809
# Metapackage
82f6809
82f6809
82f6809
%files libs
82f6809
%license LICENSE
82f6809
%doc README.TXT
82f6809
%doc HISTORY.TXT
82f6809
%{_libdir}/libe00compr.so.%{soversion}
82f6809
82f6809
82f6809
%files tools
82f6809
%doc e00compr.txt
82f6809
%doc e00compr.html
ee6be14
%{_bindir}/e00conv
ee6be14
%{_mandir}/man1/e00conv.1.*
ee6be14
ee6be14
%files devel
82f6809
# Examples:
82f6809
%doc ex_*.c
82f6809
%{_includedir}/e00compr
82f6809
%{_libdir}/libe00compr.so
ee6be14
ee6be14
ee6be14
%changelog
2d02d97
%autochangelog