File libplist.spec of Package libplist.4095

#
# spec file for package libplist
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           libplist
Version:        1.8
Release:        0
Summary:        Library for handling Apple Binary and XML Property Lists
License:        LGPL-2.1+
Group:          System/Libraries
Url:            http://cgit.sukimashita.com/libplist.git
Source:         http://cgit.sukimashita.com/libplist.git/snapshot/%{name}-%{version}.tar.bz2
#remove when pkgconfig is fixed to handle Requires.private correctly
Patch0:         libplist-1.8-pkgconfig.patch
Patch1:         A0001-fix-compiler-warnings.patch
Patch2:         A0002-fix-invalid-memory-access-in-copy_plist_data.patch
Patch3:         A0003-implemented-handling-of-UID-keyed-encoding-type.patch
Patch4:         A0004-use-__FLOAT_WORD_ORDER__-instead-of-__VFP_FP__-for-floating-point-endianness-detection.patch
Patch5:         A0005-prevent-segmentation-fault-in-plist_from_bin.patch
Patch6:         A0006-Fix-timezone-bound-date-time-conversion.patch
Patch7:         A0007-Fix-memory-leaking-caused-by-unused-nodes-in-plist_from_bin.patch
Patch8:         A0008-Silence-compiler-warnings-about-shadowing-global-declarations.patch
Patch9:         A0009-Fix-PLIST_DATE-parsing-in-xml_to_node.patch
Patch10:        A0010-Fix-PLIST_DATE-handling-to-respect-the-Mac-epoch.patch
Patch11:        A0011-Handle-signed-vs-unsigned-integer-values-correctly.patch
Patch12:        A0012-Silence-compiler-warning-about-always-true-comparison-due-to-type-mismatch.patch
Patch13:        A0013-Prevent-crash-in-plist_from_bin-when-parsing-unusually-structured-binary-plist.patch
Patch14:        A0014-Drop-src-common.h-and-use-byte-order-macros-from-config.h-directly.patch
Patch15:        A0015-Fix-plist_from_bin-changing-value-nodes-to-key-nodes-in-dictionaries.patch
Patch16:        drop-common.h.patch
Patch101:       0001-Fix-possible-crash-in-plist_from_bin-caused-by-access-to-already-freed-memory.patch
Patch102:       0002-Plug-memory-leaks-caused-by-unused-and-unfreed-buffer.patch
Patch103:       0003-Refactor-binary-plist-parsing-in-a-recursive-way.patch
Patch104:       0004-Make-sure-to-compare-the-node-sizes-for-integer-nodes.patch
Patch105:       0005-Change-internal-storage-of-PLIST_DATE-values-from-struct-timeval-to-double.patch
Patch106:       0006-Fix-possible-out-of-bounds-read-in-parse_dict_node-with-proper-bounds-checking.patch
Patch107:       0007-Fix-possible-out-of-bounds-reads-in-parse_bin_node.patch
Patch108:       0008-Make-sure-the-index-in-parse_bin_node_at_index-is-actually-within-the-offset-table.patch
Patch109:       0009-Prevent-out-of-bounds-read-in-plist_from_bin-when-parsing-offset_table.patch
Patch110:       0010-Make-sure-to-error-out-if-allocation-of-used_indexes-buffer-in-plist_from_bin-fails.patch
Patch111:       0011-Disallow-key-nodes-with-non-string-node-types.patch
Patch112:       0012-Prevent-OOB-heap-buffer-read-by-checking-input-size.patch
Patch113:       0013-Improve-UINT_TO_HOST-macro-remove-uint24_from_be-function.patch
Patch114:       0014-Check-for-invalid-offset_size-in-bplist-trailer.patch
Patch115:       0015-Use-proper-struct-for-binary-plist-trailer.patch
Patch116:       0016-Mass-rename-dict_size-and-param_dict_size-to-more-appropiate-ref_size.patch
Patch117:       0017-Fix-possible-out-of-bounds-read-in-parse_array_node-with-proper-bounds-checking.patch
Patch118:       0018-Avoid-heap-buffer-allocation-when-parsing-array-dict-string-data-node-sizes-14.patch
Patch119:       0019-Unify-size-node-parsing-for-data-string-array-dict-nodes.patch
Patch120:       0020-Prevent-OOB-read-when-parsing-data-string-array-dict-size-nodes.patch
Patch121:       0021-Fix-OOB-write-on-heap-buffer-and-improve-recursion-check.patch
Patch122:       0022-Make-sure-node-index-is-smaller-than-number-of-objects.patch
Patch123:       0023-Make-sure-the-offset-table-is-in-the-correct-range.patch
Patch124:       0024-Plug-memory-leak-in-case-parsing-a-dictionary-key-fails.patch
Patch125:       0025-Fixed-memory-leaks-in-new_xml_plist-and-parse_real_node.patch
Patch126:       0026-bplist-Improve-real-date-node-de-serialization.patch
Patch127:       0027-bplist-Improve-parsing-unicode-nodes.patch
Patch128:       0028-UTF-16-surrogate-pair-fix.patch
Patch129:       0029-bplist-Make-sure-to-bail-out-if-malloc-fails-in-pars.patch
Patch130:       0030-bplist-Make-sure-to-bail-out-if-malloc-fails-in-pars.patch
Patch131:       0031-bplist-Make-sure-to-bail-out-if-malloc-fails-in-pars.patch
Patch132:       0032-bplist-Properly-handle-some-more-malloc-failure-situ.patch
Patch133:       0033-plist-Fix-assert-to-allow-16-or-8-byte-integer-sizes.patch
Patch134:       C0001-Plug-memory-leak-when-converting-PLIST_UID-nodes-to-XML.patch
Patch135:       C0002-Improve-writing-of-array-and-dictionary-nodes.patch
Patch136:       C0003-Improve-writing-of-integer-nodes.patch
Patch137:       C0004-Fix-UID-node-parsing-to-match-Apples-parser.patch
Patch138:       C0005-Improve-writing-of-UID-nodes.patch
Patch139:       C0006-Improve-writing-of-data-string-and-unicode-nodes.patch
Patch140:       C0007-Improve-writing-of-offset-table.patch
Patch202:       B0002-base64-use-strtok_r-instead-of-strtok-to-make-sure-were-thread-safe.patch
Patch203:       B0003-base64-get-rid-of-strtok_r-and-use-strspn-strcspn-instead.patch
Patch204:       B0004-silence-compiler-warning-by-using-correct-type.patch
Patch205:       B0005-base64-Prevent-buffer-overflow-by-not-decoding-blocks-with-less-than-4-chrs.patch
Patch206:       B0006-Prevent-use-strlen-in-base64decode-when-input-buffer-size-is-known.patch
Patch207:       B0007-base64-Rework-base64decode-to-handle-split-encoded-data.patch
# PATCH-FIX-UPSTREAM libplist-boo1035312-overflow-fixes.patch boo#1035312 mgorse@suse.com -- add some overflow checks (boo#1035312 CVE-2017-7982).
Patch300:       libplist-boo1035312-overflow-fixes.patch
# PATCH-FIX-UPSTREAM libplist-boo1029631-32bit.patch boo#1029631 mgorse@suse.com -- make sure sanity checks work on 32-bit platforms (CVE-2017-6440).
Patch301:       libplist-boo1029631-32bit.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libxml2-devel
BuildRequires:  pkg-config
%if %{?suse_version} > 1140
BuildRequires:  python-cython
BuildRequires:  python-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libplist is a library for handling Apple Binary and XML Property Lists.

%package -n libplist1
Summary:        Library for handling Apple Binary and XML Property Lists
Group:          System/Libraries
Provides:       libplist = %{version}
Obsoletes:      libplist < %{version}

%description -n libplist1
libplist is a library for handling Apple Binary and XML Property Lists.

%package -n libplist++1
Summary:        Library for handling Apple Binary and XML Property Lists
Group:          System/Libraries
Provides:       libplist++ = %{version}
Obsoletes:      libplist++ < %{version}

%description -n libplist++1
libplist is a library for handling Apple Binary and XML Property Lists.

%package -n plutil
Summary:        Library for handling Apple Binary and XML Property Lists
Group:          System/Libraries
Requires:       libplist1 = %{version}

%description -n plutil
libplist is a library for handling Apple Binary and XML Property Lists.

This package contains an utility to convert PList files from binary to XML and
from XML to binary.

%package devel
Summary:        Library for handling Apple Binary and XML Property Lists -- Development Files
Group:          Development/Libraries/C and C++
Requires:       glibc-devel
Requires:       libplist1 = %{version}

%description devel
libplist is a library for handling Apple Binary and XML Property Lists.

This package contains the development files for C.

%package -n libplist++-devel
Summary:        Library for handling Apple Binary and XML Property Lists -- Development Files
Group:          Development/Libraries/C and C++
Requires:       libplist++1 = %{version}
Requires:       libplist-devel
Requires:       libstdc++-devel

%description -n libplist++-devel
libplist is a library for handling Apple Binary and XML Property Lists.

This package contains the development files for C++.

%if %{?suse_version} > 1140
%package -n python-plist
Summary:        Library for handling Apple Binary and XML Property Lists -- Python Bindings
Group:          Development/Languages/Python
Requires:       libplist1 = %{version}
Requires:       python-cython >= 0.13
%{py_requires}

%description -n python-plist
libplist is a library for handling Apple Binary and XML Property Lists.

This package contains the python bindings.
%endif

%prep
%setup -q
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
%patch125 -p1
%patch126 -p1
%patch127 -p1
%patch128 -p1
%patch129 -p1
%patch130 -p1
%patch131 -p1
%patch132 -p1
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
%patch139 -p1
%patch140 -p1
%patch202 -p1
%patch203 -p1
%patch204 -p1
%patch205 -p1
%patch206 -p1
%patch207 -p1
%patch300 -p1
%patch301 -p1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%configure || true
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DCMAKE_INSTALL_LIBDIR=%{_lib} \
      -DCMAKE_VERBOSE_MAKEFILE=TRUE \
      -DPYTHON_VERSION=%{py_ver} \
      -DPYTHON_SITEDIR=%{py_sitedir} \
      -DCMAKE_FIND_ROOT_PATH=/%{?_sysroot} \
      -DPYTHON_LIBRARY=%_libdir/python%{py_ver} \
      -DENABLE_SWIG=OFF \
      -DPYTHON_INCLUDE_DIR=%{?_sysroot}/usr/include/python \
      .
# Workaround in order to make parallel build pass
cd libcnary
make %{?_smp_mflags}
cd ..
make %{?_smp_mflags}

%install
%makeinstall
rm %{buildroot}%{_bindir}/plutil
mv %{buildroot}%{_bindir}/plutil-%{version} %{buildroot}%{_bindir}/plutil

%if 0%{?_crossbuild}
cp -a %{buildroot}%{?_sysroot}/* %{buildroot}/
rm -fr %{buildroot}%{?_sysroot}
%endif

%post -n libplist1 -p /sbin/ldconfig

%postun -n libplist1 -p /sbin/ldconfig

%post -n libplist++1 -p /sbin/ldconfig

%postun -n libplist++1 -p /sbin/ldconfig

%files -n libplist1
%defattr(-,root,root)
%doc AUTHORS COPYING.LESSER README NEWS
%{_libdir}/libplist.so.*

%files -n libplist++1
%defattr(-,root,root)
%doc AUTHORS COPYING.LESSER README NEWS
%{_libdir}/libplist++.so.*

%files -n plutil
%defattr(-,root,root)
%{_bindir}/plutil

%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/plist
%{_includedir}/plist/plist.h
%{_libdir}/libplist.so
%{_libdir}/pkgconfig/libplist.pc

%files -n libplist++-devel
%defattr(-,root,root,-)
%dir %{_includedir}/plist
%{_includedir}/plist/plist++.h
%{_includedir}/plist/Array.h
%{_includedir}/plist/Boolean.h
%{_includedir}/plist/Data.h
%{_includedir}/plist/Date.h
%{_includedir}/plist/Dictionary.h
%{_includedir}/plist/Integer.h
%{_includedir}/plist/Node.h
%{_includedir}/plist/Real.h
%{_includedir}/plist/String.h
%{_includedir}/plist/Structure.h
%{_libdir}/libplist++.so
%{_libdir}/pkgconfig/libplist++.pc

%if %{?suse_version} > 1140
%files -n python-plist
%defattr(-,root,root,-)
%{py_sitedir}/plist.so
%dir %{_includedir}/plist
%dir %{_includedir}/plist/cython
%{_includedir}/plist/cython/plist.pxd
%endif

%changelog
openSUSE Build Service is sponsored by