[gd] - fix version in gdlib.pc - fix license handling

Remi Collet remi at fedoraproject.org
Mon Mar 23 17:30:48 UTC 2015


commit b2eefd98f3cf8b5449c1f2c41be59f4300b47148
Author: Remi Collet <remi at fedoraproject.org>
Date:   Mon Mar 23 18:30:43 2015 +0100

    - fix version in gdlib.pc
    - fix license handling

 gd.spec   | 30 +++++++++++++++++++++---------
 getver.pl | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 9 deletions(-)
---
diff --git a/gd.spec b/gd.spec
index 86843cc..45618e3 100644
--- a/gd.spec
+++ b/gd.spec
@@ -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 at fedoraproject.org> - 2.1.1-2
+- fix version in gdlib.pc
+- fix license handling
+
 * Wed Jan 14 2015 Jozef Mlich <jmlich at redhat.com> - 2.1.1-1
 - Update to 2.1.1 final
   Resolves: #1181972
diff --git a/getver.pl b/getver.pl
new file mode 100755
index 0000000..3838952
--- /dev/null
+++ b/getver.pl
@@ -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


More information about the scm-commits mailing list