##
##  pango.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package version
%define       V_glib_major   2.52
%define       V_pango_major  1.51
%define       V_pango_minor  2

#   package information
Name:         pango
Summary:      Layout And Rendering Of Internationalized Text
URL:          http://www.pango.org/
Vendor:       The Gtk Project
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        PLUS
Group:        XWindow
License:      GPL
Version:      %{V_pango_major}.%{V_pango_minor}
Release:      20240213

#   list of sources
Source0:      http://ftp.gnome.org/pub/GNOME/sources/pango/%{V_pango_major}/pango-%{version}.tar.xz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, make, gcc, pkgconfig, meson, ninja, help2man
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  glib >= %{V_glib_major}
PreReq:       glib >= %{V_glib_major}
BuildPreReq:  gettext, libiconv, freetype, fontconfig, cairo, harfbuzz, fribidi
PreReq:       gettext, libiconv, freetype, fontconfig, cairo, harfbuzz, fribidi

%description
    Pango is a library for layout and rendering of text, with an
    emphasis on internationalization. Pango can be used anywhere that
    text layout is needed; however, most of the work on Pango was done
    using the Gtk+ widget toolkit as a test platform. Pango forms the
    core of text and font handling for Gtk+.

%track
    prog pango = {
        version   = %{version}
        url       = http://ftp.gnome.org/pub/GNOME/sources/pango/%{V_pango_major}/
        regex     = pango-(__VER__)\.tar\.(gz|bz2|xz)
    }

%prep
    %setup -q

%build
    #   configure package
    CC="%{l_cc}" \
    CFLAGS="%{l_cflags -O} -Wno-deprecated-declarations" \
    CPPFLAGS="%{l_cppflags}" \
    LDFLAGS="%{l_ldflags}" \
    meson build \
        --prefix %{l_prefix} \
        --buildtype release \
        --default-library static \
        --backend ninja

    #   build package
    ninja -C build

%install
    DESTDIR=$RPM_BUILD_ROOT ninja -C build install
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    mv  $RPM_BUILD_ROOT%{l_prefix}/share/man \
        $RPM_BUILD_ROOT%{l_prefix}/man
    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share
    mv  $RPM_BUILD_ROOT%{l_prefix}/libdata/pkgconfig \
        $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

