From 5d7a22114a538feb905195a5d35e2ebf3fe36fdc7cf39ea6fd4989d8a44d530f Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Tue, 1 Mar 2011 08:00:04 +0000 Subject: [PATCH] Accepting request 63072 from home:vuntz:branches:GNOME:Factory Forwarding to openSUSE:Factory OBS-URL: https://build.opensuse.org/request/show/63072 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/pango?expand=0&rev=61 --- baselibs.conf | 38 ++++-- macros.pango | 35 ++++++ pango-1.28.1.tar.bz2 | 3 - pango-1.28.3.tar.bz2 | 3 + pango-CVE-2011-0020.patch | 50 ++++++++ pango-CVE-2011-0064.patch | 186 +++++++++++++++++++++++++++++ pango.changes | 52 ++++++++ pango.spec | 242 ++++++++++++++++++++++---------------- 8 files changed, 492 insertions(+), 117 deletions(-) create mode 100644 macros.pango delete mode 100644 pango-1.28.1.tar.bz2 create mode 100644 pango-1.28.3.tar.bz2 create mode 100644 pango-CVE-2011-0020.patch create mode 100644 pango-CVE-2011-0064.patch diff --git a/baselibs.conf b/baselibs.conf index 12fe0b1..e565e1c 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,15 +1,31 @@ -pango +libpango-1_0-0 +/etc/pango/pango(64)?.modules + requires "pango-tools-" + provides "pango- = " + obsoletes "pango- <= " + post "%if "%_lib" == "lib64"" + post "if test -f %{_bindir}/pango-querymodules-64; then %{_bindir}/pango-querymodules-64 > %{_sysconfdir}/pango/pango64.modules; fi" + post "%else" + post "if test -f %{_bindir}/pango-querymodules; then %{_bindir}/pango-querymodules > %{_sysconfdir}/pango/pango.modules; fi" + post "%endif" +pango-tools +/usr/bin/pango-querymodules(-64)? - prereq "filesystem glib2 xorg-x11-libs xorg-x11-libXrender xorg-x11-libX11" - postun "/sbin/ldconfig" - targettype 64bit postun "if [ -x usr/bin/pango-querymodules-64 ] ; then" - targettype 64bit postun "LD_LIBRARY_PATH=usr/lib64 usr/bin/pango-querymodules-64 > etc/pango/pango64.modules || echo pango-querymodules-64 did not run properly in postun." - targettype 64bit postun "fi" - targettype 32bit postun "if [ -x usr/bin/pango-querymodules ] ; then" - targettype 32bit postun "LD_LIBRARY_PATH=usr/lib usr/bin/pango-querymodules > etc/pango/pango.modules" - targettype 32bit postun "fi" - targettype 64bit post "LD_LIBRARY_PATH=usr/lib64 usr/bin/pango-querymodules-64 > etc/pango/pango64.modules || echo pango-querymodules-64 did not run properly in postin." - targettype 32bit post "LD_LIBRARY_PATH=usr/lib usr/bin/pango-querymodules > etc/pango/pango.modules" + post "%if "%_lib" == "lib64"" + post "if [ $1 == 1 ]; then test -d %{_libdir}/pango/1.6.0; if test $? -eq 0; then %{_bindir}/pango-querymodules-64 > %{_sysconfdir}/pango/pango64.modules; fi; fi" + post "%else" + post "if [ $1 == 1 ]; then test -d %{_libdir}/pango/1.6.0; if test $? -eq 0; then %{_bindir}/pango-querymodules > %{_sysconfdir}/pango/pango.modules; fi; fi" + post "%endif" +pango-module-thai-lang + requires "pango-" + post "%if "%_lib" == "lib64"" + post "%{_bindir}/pango-querymodules-64 > %{_sysconfdir}/pango/pango64.modules" + post "%else" + post "%{_bindir}/pango-querymodules > %{_sysconfdir}/pango/pango.modules" + post "%endif" + postun "%if "%_lib" == "lib64"" + postun "%{_bindir}/pango-querymodules-64 > %{_sysconfdir}/pango/pango64.modules" + postun "%else" + postun "%{_bindir}/pango-querymodules > %{_sysconfdir}/pango/pango.modules" + postun "%endif" arch ppc package pango-devel arch sparcv9 package pango-devel diff --git a/macros.pango b/macros.pango new file mode 100644 index 0000000..1d7c313 --- /dev/null +++ b/macros.pango @@ -0,0 +1,35 @@ +# RPM macros for packages installing a Pango module +# +### +# +# When a package installs a Pango module, it should use all +# three macros: +# +# - %pango_module_requires in the preamble +# - %pango_module_post in %post +# - %pango_module_postun in %postun +# +### + +%pango_module_requires \ +Requires(post): pango-tools \ +Requires(postun): pango-tools + +# On install, update the cache +%pango_module_post \ +%if "%_lib" == "lib64" \ + %{_bindir}/pango-querymodules-64 > %{_sysconfdir}/pango/pango64.immodules \ +%else \ + %{_bindir}/pango-querymodules > %{_sysconfdir}/pango/pango.immodules \ +%endif + +# On uninstall, update the cache. Note: we ignore upgrades (already +# handled in %post of the new package). +%pango_module_postun \ +if [ $1 -eq 0 ]; then \ + %if "%_lib" == "lib64" \ + %{_bindir}/pango-querymodules-64 > %{_sysconfdir}/pango/pango64.immodules \ + %else \ + %{_bindir}/pango-querymodules > %{_sysconfdir}/pango/pango.immodules \ + %endif \ +fi diff --git a/pango-1.28.1.tar.bz2 b/pango-1.28.1.tar.bz2 deleted file mode 100644 index 600dc22..0000000 --- a/pango-1.28.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8f3eaab506f613dd25bb1fa65ea87a145d523d066d90c227bdb3016523451bc2 -size 1483961 diff --git a/pango-1.28.3.tar.bz2 b/pango-1.28.3.tar.bz2 new file mode 100644 index 0000000..ec74891 --- /dev/null +++ b/pango-1.28.3.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e278bc9430cc7bb00270f183360d262c5006b51248e8b537ea904573f200632 +size 1509501 diff --git a/pango-CVE-2011-0020.patch b/pango-CVE-2011-0020.patch new file mode 100644 index 0000000..960e4b1 --- /dev/null +++ b/pango-CVE-2011-0020.patch @@ -0,0 +1,50 @@ +From 4e6248d76f55c6184f28afe614d7d76b6fa3d455 Mon Sep 17 00:00:00 2001 +From: Behdad Esfahbod +Date: Thu, 17 Feb 2011 16:19:48 +0000 +Subject: Bug 639882 - Heap corruption in font parsing with FreeType2 backend + +--- +diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c +index bd3b7d4..42923f4 100644 +--- a/pango/pangoft2-render.c ++++ b/pango/pangoft2-render.c +@@ -121,9 +121,14 @@ pango_ft2_font_render_box_glyph (int width, + + box->bitmap.width = width; + box->bitmap.rows = height; +- box->bitmap.pitch = height; ++ box->bitmap.pitch = width; + +- box->bitmap.buffer = g_malloc0 (box->bitmap.rows * box->bitmap.pitch); ++ box->bitmap.buffer = g_malloc0_n (box->bitmap.rows, box->bitmap.pitch); ++ ++ if (G_UNLIKELY (!box->bitmap.buffer)) { ++ g_slice_free (PangoFT2RenderedGlyph, box); ++ return NULL; ++ } + + /* draw the box */ + for (j = 0; j < line_width; j++) +@@ -226,6 +231,11 @@ pango_ft2_font_render_glyph (PangoFont *font, + rendered->bitmap_left = face->glyph->bitmap_left; + rendered->bitmap_top = face->glyph->bitmap_top; + ++ if (G_UNLIKELY (!rendered->bitmap.buffer)) { ++ g_slice_free (PangoFT2RenderedGlyph, rendered); ++ return NULL; ++ } ++ + return rendered; + } + else +@@ -276,6 +286,8 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer, + if (rendered_glyph == NULL) + { + rendered_glyph = pango_ft2_font_render_glyph (font, glyph); ++ if (rendered_glyph == NULL) ++ return; + add_glyph_to_cache = TRUE; + } + +-- +cgit v0.8.3.4 diff --git a/pango-CVE-2011-0064.patch b/pango-CVE-2011-0064.patch new file mode 100644 index 0000000..1802352 --- /dev/null +++ b/pango-CVE-2011-0064.patch @@ -0,0 +1,186 @@ +From 3104961bc0ffaf847d2a1e116e6de4fdc1cd8ada Mon Sep 17 00:00:00 2001 +From: Behdad Esfahbod +Date: Thu, 2 Dec 2010 16:00:46 +1300 +Subject: [PATCH] Handle realloc failure in the buffer + +Ported from http://cgit.freedesktop.org/harfbuzz/commit/?id=a6a79df5fe2e +by Karl Tomlinson +--- + pango/opentype/hb-buffer-private.h | 1 + + pango/opentype/hb-buffer.c | 70 +++++++++++++++++++++--------------- + pango/opentype/hb-buffer.h | 2 +- + 3 files changed, 43 insertions(+), 30 deletions(-) + +diff --git a/pango/opentype/hb-buffer-private.h b/pango/opentype/hb-buffer-private.h +index 45cdc4d..f194786 100644 +--- a/pango/opentype/hb-buffer-private.h ++++ b/pango/opentype/hb-buffer-private.h +@@ -72,6 +72,7 @@ struct _hb_buffer_t { + unsigned int allocated; + + hb_bool_t have_output; /* weather we have an output buffer going on */ ++ hb_bool_t in_error; /* Allocation failed */ + unsigned int in_length; + unsigned int out_length; + unsigned int in_pos; +diff --git a/pango/opentype/hb-buffer.c b/pango/opentype/hb-buffer.c +index 93b51e5..e9788ad 100644 +--- a/pango/opentype/hb-buffer.c ++++ b/pango/opentype/hb-buffer.c +@@ -52,23 +52,21 @@ static hb_buffer_t _hb_buffer_nil = { + * in_string and out_string. + */ + +-/* XXX err handling */ +- + /* Internal API */ + +-static void ++static hb_bool_t + hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size) + { +- hb_buffer_ensure (buffer, size); ++ if (HB_UNLIKELY (!hb_buffer_ensure (buffer, size))) return FALSE; + if (buffer->out_string == buffer->in_string) + { + assert (buffer->have_output); +- if (!buffer->positions) +- buffer->positions = calloc (buffer->allocated, sizeof (buffer->positions[0])); + + buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions; + memcpy (buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0])); + } ++ ++ return TRUE; + } + + /* Public API */ +@@ -114,6 +112,7 @@ void + hb_buffer_clear (hb_buffer_t *buffer) + { + buffer->have_output = FALSE; ++ buffer->in_error = FALSE; + buffer->in_length = 0; + buffer->out_length = 0; + buffer->in_pos = 0; +@@ -122,32 +121,42 @@ hb_buffer_clear (hb_buffer_t *buffer) + buffer->max_lig_id = 0; + } + +-void ++hb_bool_t + hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size) + { +- unsigned int new_allocated = buffer->allocated; +- +- if (size > new_allocated) ++ if (HB_UNLIKELY (size > buffer->allocated)) + { ++ unsigned int new_allocated = buffer->allocated; ++ hb_internal_glyph_position_t *new_pos; ++ hb_internal_glyph_info_t *new_info; ++ hb_bool_t separate_out; ++ ++ if (HB_UNLIKELY (buffer->in_error)) ++ return FALSE; ++ ++ separate_out = buffer->out_string != buffer->in_string; ++ + while (size > new_allocated) + new_allocated += (new_allocated >> 1) + 8; + +- if (buffer->positions) +- buffer->positions = realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0])); ++ new_pos = (hb_internal_glyph_position_t *) realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0])); ++ new_info = (hb_internal_glyph_info_t *) realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); + +- if (buffer->out_string != buffer->in_string) +- { +- buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); +- buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions; +- } +- else +- { +- buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); +- buffer->out_string = buffer->in_string; +- } ++ if (HB_UNLIKELY (!new_pos || !new_info)) ++ buffer->in_error = TRUE; ++ ++ if (HB_LIKELY (new_pos)) ++ buffer->positions = new_pos; + +- buffer->allocated = new_allocated; ++ if (HB_LIKELY (new_info)) ++ buffer->in_string = new_info; ++ ++ buffer->out_string = separate_out ? (hb_internal_glyph_info_t *) buffer->positions : buffer->in_string; ++ if (HB_LIKELY (!buffer->in_error)) ++ buffer->allocated = new_allocated; + } ++ ++ return HB_LIKELY (!buffer->in_error); + } + + void +@@ -158,7 +167,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer, + { + hb_internal_glyph_info_t *glyph; + +- hb_buffer_ensure (buffer, buffer->in_length + 1); ++ if (HB_UNLIKELY (!hb_buffer_ensure (buffer, buffer->in_length + 1))) return; + + glyph = &buffer->in_string[buffer->in_length]; + glyph->codepoint = codepoint; +@@ -213,6 +222,8 @@ _hb_buffer_swap (hb_buffer_t *buffer) + + assert (buffer->have_output); + ++ if (HB_UNLIKELY (buffer->in_error)) return; ++ + if (buffer->out_string != buffer->in_string) + { + hb_internal_glyph_info_t *tmp_string; +@@ -265,7 +276,8 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer, + if (buffer->out_string != buffer->in_string || + buffer->out_pos + num_out > buffer->in_pos + num_in) + { +- hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out); ++ if (HB_UNLIKELY (!hb_buffer_ensure_separate (buffer, buffer->out_pos + num_out))) ++ return; + } + + mask = buffer->in_string[buffer->in_pos].mask; +@@ -302,7 +314,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer, + + if (buffer->out_string != buffer->in_string) + { +- hb_buffer_ensure (buffer, buffer->out_pos + 1); ++ if (HB_UNLIKELY (!hb_buffer_ensure (buffer, buffer->out_pos + 1))) return; + buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos]; + } + else if (buffer->out_pos != buffer->in_pos) +@@ -332,7 +344,7 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer) + + if (buffer->out_string != buffer->in_string) + { +- hb_buffer_ensure (buffer, buffer->out_pos + 1); ++ if (HB_UNLIKELY (!hb_buffer_ensure (buffer, buffer->out_pos + 1))) return; + buffer->out_string[buffer->out_pos] = buffer->in_string[buffer->in_pos]; + } + else if (buffer->out_pos != buffer->in_pos) +diff --git a/pango/opentype/hb-buffer.h b/pango/opentype/hb-buffer.h +index b030ba9..aaf6694 100644 +--- a/pango/opentype/hb-buffer.h ++++ b/pango/opentype/hb-buffer.h +@@ -94,7 +94,7 @@ hb_buffer_clear (hb_buffer_t *buffer); + void + hb_buffer_clear_positions (hb_buffer_t *buffer); + +-void ++hb_bool_t + hb_buffer_ensure (hb_buffer_t *buffer, + unsigned int size); + +-- +1.7.2.2 diff --git a/pango.changes b/pango.changes index 4fb1430..281ca32 100644 --- a/pango.changes +++ b/pango.changes @@ -1,3 +1,55 @@ +------------------------------------------------------------------- +Mon Feb 28 09:32:26 CET 2011 - vuntz@opensuse.org + +- Add pango-CVE-2011-0020.patch: fixes heap corruption in font + parsing with FreeType2 backend. Fix bnc#666101, CVE-2011-0020. +- Add pango-CVE-2011-0064.patch: handle realloc failure in the + buffer to fix potential crashes. Fix bnc#672502, CVE-2011-0064. + +------------------------------------------------------------------- +Wed Oct 13 20:26:17 CEST 2010 - vuntz@opensuse.org + +- Do not call pango-querymodules twice in the %post of + libpango-1_0-0. Especially since the first call might fail since + it's not in the if test. +- Put comments that are in the scriptlets area of the spec file in + "%if 0" statement: if we don't do that, they actually end up in + the scriplets and can even make them fail if the scriptlets were + just "-p /sbin/ldconfig". + +------------------------------------------------------------------- +Mon Oct 11 16:39:05 CEST 2010 - vuntz@opensuse.org + +- Update packaging to use the shared library packaging policy: + + Create libpango-1_0-0 and pango-tools subpackages. + + Add pango-tools Requires to libpango-1_0-0 for the call to + pango-querymodules in %post. + + Make libpango-1_0-0 Provides/Obsoletes pango. + + We need %post/%postun scriptlets for libpango-1_0-0 and + pango-tools that call pango-querymodules when possible. + + Update baselibs.conf accordingly, and simplify it a bit. +- Add RPM macros (macros.pango) to make it easier to handle + installation of a Pango module. +- Add pango-tools Requires to pango-module-thai-lang for the call + to pango-querymodules in %post/%postun. +- Add pango-module-thai-lang to baselibs.conf, since people want + the 32-bit module if they have the 32-bit library. +- Update summaries and descriptions. +- Use a find to remove .la files. +- Use in baselibs.conf since we use full paths there, and + this is needed for x86 packages that put files in + /emul/ia32-linux. + +------------------------------------------------------------------- +Wed Sep 29 13:18:13 CEST 2010 - vuntz@opensuse.org + +- Update to version 1.28.3: + + bgo#630857: introspection: Use --include-uninstalled +- Changes from version 1.28.2: + + Reduce DLL hijack risk and simplify code in basic-win32 module + + Improve performance on Windows especially for non-Latin scripts + + Bugs fixed: bgo#628497, bgo#626966, bgo#629632, bgo#625807 + ------------------------------------------------------------------- Sun Sep 19 00:56:17 CEST 2010 - vuntz@opensuse.org diff --git a/pango.spec b/pango.spec index 2e788fa..fbd1e55 100644 --- a/pango.spec +++ b/pango.spec @@ -1,5 +1,5 @@ # -# spec file for package pango (Version 1.28.1) +# spec file for package pango (Version 1.28.3) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -15,10 +15,27 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild +# When updating the binary version, do not forget to also update baselibs.conf +%define pango_binary_version 1.6.0 Name: pango +License: LGPLv2.1+ +Group: System/Libraries +Version: 1.28.3 +Release: 1 +# NOTE: on upgrade to a new upstream version, change the Obsoletes from <= to < (here and in baselibs.conf) +Summary: Library for Layout and Rendering of Text +Source: ftp://ftp.gnome.org/pub/GNOME/sources/pango/1.18/%{name}-%{version}.tar.bz2 +Source1: README.SuSE +Source2: macros.pango +Source99: baselibs.conf +# PATCH-FIX-UPSTREAM pango64.patch bgo129534 -- needed for biarch. Unfortunately, this is not good enough for usptream. +Patch0: pango64.patch +# PATCH-FIX-UPSTREAM pango-CVE-2011-0020.patch bnc#666101 CVE-2011-0020 vuntz@opensuse.org -- heap corruption in font parsing with FreeType2 backend +Patch1: pango-CVE-2011-0020.patch +# PATCH-FIX-UPSTREAM pango-CVE-2011-0064.patch bnc#672502 CVE-2011-0064. vuntz@opensuse.org -- handle realloc failure in the buffer +Patch2: pango-CVE-2011-0064.patch BuildRequires: gcc-c++ BuildRequires: gtk-doc BuildRequires: pkg-config @@ -30,60 +47,67 @@ BuildRequires: pkgconfig(gobject-introspection-1.0) BuildRequires: pkgconfig(libthai) BuildRequires: pkgconfig(xft) BuildRequires: pkgconfig(xrender) +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Pango is a library for layout and rendering of text, with an emphasis +on internationalization. It can be used anywhere that text layout +is needed. + +Pango forms the core of text and font handling for GTK+. + +%package -n libpango-1_0-0 License: LGPLv2.1+ +Summary: Library for Layout and Rendering of Text Group: System/Libraries +Requires(post): %{name}-tools +Provides: %{name} = %{version} +# Note: we keep <= (and a rpmlint warning...) until we get a version higher than 1.28.3 (when this provides/obsoletes was introduced) +Obsoletes: %{name} <= %{version} # bug437293 %ifarch ppc64 Obsoletes: pango-64bit %endif # -Version: 1.28.1 -Release: 2 -Summary: System for Layout and Rendering of Internationalised Text -Source: ftp://ftp.gnome.org/pub/GNOME/sources/pango/1.18/%{name}-%{version}.tar.bz2 -Source1: README.SuSE -Source99: baselibs.conf -# PATCH-FIX-UPSTREAM pango64.patch bgo129534 -- needed for biarch. Unfortunately, this is not good enough for usptream. -Patch0: pango64.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-build -PreReq: xorg-x11-libXrender xorg-x11-libX11 xorg-x11-libXdmcp -%description +%description -n libpango-1_0-0 Pango is a library for layout and rendering of text, with an emphasis -on internationalisation. It forms the core of text and font handling in -GTK+ 2.0. +on internationalization. It can be used anywhere that text layout +is needed. +Pango forms the core of text and font handling for GTK+. +%package tools +License: LGPLv2.1+ +Summary: Library for Layout and Rendering of Text -- Tools +Group: System/Libraries -Authors: --------- - Owen Taylor - Changwoo Ryu - Sivaraj Doddannan +%description tools +Pango is a library for layout and rendering of text, with an emphasis +on internationalization. It can be used anywhere that text layout +is needed. + +Pango forms the core of text and font handling for GTK+. %package module-thai-lang License: LGPLv2.1+ -Summary: System for Layout and Rendering of Internationalised Text +Summary: Library for Layout and Rendering of Text -- Module for the Thai Language Group: System/Libraries +Requires(post): %{name}-tools +Requires(postun): %{name}-tools Provides: locale(pango:th_TH) %description module-thai-lang Pango is a library for layout and rendering of text, with an emphasis -on internationalisation. It forms the core of text and font handling in -GTK+ 2.0. +on internationalization. It can be used anywhere that text layout +is needed. - - -Authors: --------- - Owen Taylor - Changwoo Ryu - Sivaraj Doddannan +Pango forms the core of text and font handling for GTK+. %package devel License: LGPLv2.1+ -Requires: %{name} = %{version} cairo-devel fontconfig-devel freetype2-devel glib2-devel %(rpm -q --whatprovides XFree86-devel --queryformat '%{NAME}') -Summary: Include files and libraries mandatory for development +Requires: libpango-1_0-0 = %{version} +Summary: Library for Layout and Rendering of Text -- Development Files Group: Development/Libraries/GNOME # bug437293 %ifarch ppc64 @@ -93,23 +117,23 @@ Obsoletes: pango-doc <= %{version} Provides: pango-doc = %{version} %description devel +Pango is a library for layout and rendering of text, with an emphasis +on internationalization. It can be used anywhere that text layout +is needed. + +Pango forms the core of text and font handling for GTK+. + This package contains all necessary include files and libraries needed to develop applications that require these. - - -Authors: --------- - Owen Taylor - Changwoo Ryu - Sivaraj Doddannan - %prep %setup -q %if "%_lib" == "lib64" cp -a %{S:1} . %patch0 -p0 %endif +%patch1 -p1 +%patch2 -p1 %build %configure --disable-static --with-pic @@ -117,96 +141,98 @@ make %{?jobs:-j%jobs} %install %makeinstall -touch $RPM_BUILD_ROOT%{_sysconfdir}/pango/pango.modules +find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print +touch %{buildroot}%{_sysconfdir}/pango/pango.modules %if "%_lib" == "lib64" -mv $RPM_BUILD_ROOT%{_bindir}/pango-querymodules\ - $RPM_BUILD_ROOT%{_bindir}/pango-querymodules-64 -mv $RPM_BUILD_ROOT%{_sysconfdir}/pango/pango.modules\ - $RPM_BUILD_ROOT%{_sysconfdir}/pango/pango64.modules +mv %{buildroot}%{_bindir}/pango-querymodules %{buildroot}%{_bindir}/pango-querymodules-64 +mv %{buildroot}%{_sysconfdir}/pango/pango.modules %{buildroot}%{_sysconfdir}/pango/pango64.modules %endif -rm $RPM_BUILD_ROOT%{_libdir}/*/*/*/*.*a -rm $RPM_BUILD_ROOT%{_libdir}/*.la +# Install rpm macros +mkdir -p %{buildroot}%{_sysconfdir}/rpm +cp %{S:2} %{buildroot}%{_sysconfdir}/rpm %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} -%post -/sbin/ldconfig +########################################################################### +# Note: when updating scriptlets, don't forget to also update baselibs.conf +########################################################################### + +# Convenient %define for the scriplets %if "%_lib" == "lib64" - # it is not fatal if execution fails on 32bit systems -LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules-64\ - > etc/pango/pango64.modules || echo "pango-querymodules-64 did not run properly in postin." +%define _pango_querymodules %{_bindir}/pango-querymodules-64 +%define _pango_querymodules_update_cache %{_pango_querymodules} > %{_sysconfdir}/pango/pango64.modules %else -LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules\ - > etc/pango/pango.modules +%define _pango_querymodules %{_bindir}/pango-querymodules +%define _pango_querymodules_update_cache %{_pango_querymodules} > %{_sysconfdir}/pango/pango.modules %endif -%postun +%post -n libpango-1_0-0 /sbin/ldconfig -%if "%_lib" == "lib64" -if [ -x usr/bin/pango-querymodules-64 ] ; then - # it is not fatal if execution fails on 32bit systems - LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules-64\ - > etc/pango/pango64.modules || echo "pango-querymodules-64 did not run properly in postun." -fi -%else -if [ -x usr/bin/pango-querymodules ] ; then - LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules\ - > etc/pango/pango.modules -fi +%if 0 +# In case libpango-1_0-0 gets installed before pango-tools, we don't want to +# fail. So we make the call to pango-querymodules dependent on the existence of +# the binary. This is why we also have a %post for pango-tools. %endif +if test -f %{_pango_querymodules}; then + %{_pango_querymodules_update_cache} +fi + +%if 0 +# No need to call pango-querymodules in postun: +# - if it's an upgrade, it will have been called in post +# - if it's an uninstall, we don't care about this anymore +%endif + +%postun -n libpango-1_0-0 -p /sbin/ldconfig %post module-thai-lang -%if "%_lib" == "lib64" - # it is not fatal if execution fails on 32bit systems -LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules-64\ - > etc/pango/pango64.modules || echo "pango-querymodules-64 did not run properly in postin." -%else -LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules\ - > etc/pango/pango.modules -%endif +%{_pango_querymodules_update_cache} %postun module-thai-lang -%if "%_lib" == "lib64" -if [ -x usr/bin/pango-querymodules-64 ] ; then - # it is not fatal if execution fails on 32bit systems - LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules-64\ - > etc/pango/pango64.modules || echo "pango-querymodules-64 did not run properly in postun." -fi -%else -if [ -x usr/bin/pango-querymodules ] ; then - LD_LIBRARY_PATH=usr/%{_lib}\ - usr/bin/pango-querymodules\ - > etc/pango/pango.modules -fi -%endif +%{_pango_querymodules_update_cache} -%files +%post tools +%if 0 +# If we install pango-tools for the first time, then we should run it in case +# libpango-1_0-0 was installed first (ie, if +# %{_libdir}/pango/%{pango_binary_version} already exists) which means +# pango-querymodules couldn't run there. +%endif +if [ $1 == 1 ]; then + test -d %{_libdir}/pango/%{pango_binary_version} + if test $? -eq 0; then + %{_pango_querymodules_update_cache} + fi +fi + +%files -n libpango-1_0-0 %defattr(-,root,root) %if "%_lib" == "lib64" %doc README AUTHORS COPYING ChangeLog README.SuSE %else %doc README AUTHORS COPYING ChangeLog %endif -%{_bindir}/pango-* %dir %{_libdir}/pango -%dir %{_libdir}/pango/1.6.0 -%dir %{_libdir}/pango/1.6.0/modules -%{_libdir}/pango/1.6.0/modules/*.so -%exclude %{_libdir}/pango/1.6.0/modules/pango-thai-lang.so +%dir %{_libdir}/pango/%{pango_binary_version} +%dir %{_libdir}/pango/%{pango_binary_version}/modules +%{_libdir}/pango/%{pango_binary_version}/modules/pango-arabic-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-arabic-lang.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-basic-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-basic-x.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-hangul-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-hebrew-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-indic-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-indic-lang.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-khmer-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-syriac-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-thai-fc.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-tibetan-fc.so %{_libdir}/lib*.so.* %{_libdir}/girepository-1.0/Pango-1.0.typelib %{_libdir}/girepository-1.0/PangoCairo-1.0.typelib %{_libdir}/girepository-1.0/PangoFT2-1.0.typelib %{_libdir}/girepository-1.0/PangoXft-1.0.typelib -%doc %{_mandir}/man?/*.* %dir %{_sysconfdir}/pango %{_sysconfdir}/pango/pangox.aliases %if "%_lib" == "lib64" @@ -215,9 +241,18 @@ fi %ghost %{_sysconfdir}/pango/pango.modules %endif +%files tools +%defattr(-, root, root) +%{_bindir}/pango-querymodules* +%{_bindir}/pango-view +%doc %{_mandir}/man1/pango-querymodules.1* +%doc %{_mandir}/man1/pango-view.1* + +# We have this module in a subpackage because it requires additional libraries. + %files module-thai-lang %defattr(-, root, root) -%{_libdir}/pango/1.6.0/modules/pango-thai-lang.so +%{_libdir}/pango/%{pango_binary_version}/modules/pango-thai-lang.so %files devel %defattr(-, root, root) @@ -226,5 +261,6 @@ fi %{_includedir}/pango-1.0/ %{_datadir}/gir-1.0/*.gir %doc %{_datadir}/gtk-doc/html/pango/ +%{_sysconfdir}/rpm/macros.pango %changelog