- fix version in gdlib.pc

- fix license handling
This commit is contained in:
Remi Collet 2015-03-23 18:30:43 +01:00
parent ff3f68b87a
commit b2eefd98f3
2 changed files with 63 additions and 9 deletions

30
gd.spec
View File

@ -5,7 +5,7 @@
Summary: A graphics library for quick creation of PNG or JPEG images
Name: gd
Version: 2.1.1
Release: 1%{?prever}%{?short}%{?dist}
Release: 2%{?prever}%{?short}%{?dist}
Group: System Environment/Libraries
License: MIT
URL: http://libgd.bitbucket.org/
@ -16,6 +16,9 @@ Source0: libgd-%{version}-%{commit}.tgz
%else
Source0: https://bitbucket.org/libgd/gd-libgd/downloads/libgd-%{version}%{?prever:-%{prever}}.tar.xz
%endif
# Missing in official archive, need for autoreconf
Source2: getver.pl
Patch1: gd-2.1.0-multilib.patch
BuildRequires: freetype-devel
@ -30,6 +33,7 @@ BuildRequires: libXpm-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig
BuildRequires: libtool
BuildRequires: perl
%description
@ -48,7 +52,7 @@ Group: Applications/Multimedia
%description progs
The gd-progs package includes utility programs supplied with gd, a
graphics library for creating PNG and JPEG images.
graphics library for creating PNG and JPEG images.
%package devel
@ -74,11 +78,10 @@ files for gd, a graphics library for creating PNG and JPEG graphics.
%setup -q -n libgd-%{version}%{?prever:-%{prever}}
%patch1 -p1 -b .mlib
# https://bitbucket.org/libgd/gd-libgd/issue/77
sed -e '/GD_VERSION_STRING/s/-alpha//' \
-e '/GD_EXTRA_VERSION/s/alpha//' \
-i src/gd.h
grep VERSION src/gd.h
# Workaround for missing file
cp %{SOURCE2} config/getver.pl
: $(perl config/getver.pl)
: regenerate autotool stuff
if [ -f configure ]; then
@ -106,14 +109,18 @@ make %{?_smp_mflags}
%install
make install INSTALL='install -p' DESTDIR=$RPM_BUILD_ROOT
make install INSTALL='install -p' DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.la
rm -f $RPM_BUILD_ROOT/%{_libdir}/libgd.a
%check
: Upstream test suite
make check
: Check content of pkgconfig
grep %{version} $RPM_BUILD_ROOT%{_libdir}/pkgconfig/gdlib.pc
%post -p /sbin/ldconfig
@ -121,7 +128,8 @@ make check
%files
%doc COPYING
%{!?_licensedir:%global license %%doc}
%license COPYING
%{_libdir}/*.so.*
%files progs
@ -137,6 +145,10 @@ make check
%changelog
* Mon Mar 23 2015 Remi Collet <remi@fedoraproject.org> - 2.1.1-2
- fix version in gdlib.pc
- fix license handling
* Wed Jan 14 2015 Jozef Mlich <jmlich@redhat.com> - 2.1.1-1
- Update to 2.1.1 final
Resolves: #1181972

42
getver.pl Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env perl
# Simple script to extract the version number parts from src/gd.h. If
# called with the middle word of the version macro, it prints the
# value of that macro. If called with no argument, it outputs a
# human-readable version string. This must be run in the project
# root. It is used by configure.ac and docs/naturaldocs/run_docs.sh.
use strict;
my $key = shift;
my @version_parts = ();
open FH, "<src/gd.h" # old-style filehandle for max. portability
or die "Unable to open 'version.h' for reading.\n";
while(<FH>) {
next unless m{version605b5d1778};
next unless /^#define\s+GD_([A-Z0-9]+)_VERSION+\s+(\S+)/;
my ($lk, $lv) = ($1, $2);
if ($lk eq $key) {
chomp $lv;
$lv =~ s/"//g;
print $lv; # no newline
exit(0); # success!
}
push @version_parts, $lv if (!$key);
}
close(FH);
if (scalar @version_parts == 4) {
my $result = join(".", @version_parts[0..2]);
$result .= $version_parts[3];
$result =~ s/"//g;
print $result;
exit(0);
}
exit(1); # failure