File libproxy-plugins.spec of Package libproxy.999

#
# spec file for package libproxy-plugins
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#


%define         build_core_not_modules 0
%if 0%{?suse_version}
%define         have_mono 1
%else
%define         have_mono 0
%endif

%if 0%{?suse_version} > 1130
%define xulrunner_ver 20
%else
%if 0%{?suse_version} > 1120
%define xulrunner_ver 192
%else
%if 0%{?suse_version} > 1110
%define xulrunner_ver 191
%else
%define xulrunner_ver 190
%endif
%endif
%endif
Url:            http://code.google.com/p/libproxy/
%define _name   libproxy

Name:           libproxy-plugins
Summary:        Libproxy provides consistent proxy configuration to applications
License:        GPL-2.0+ and LGPL-2.1+
Group:          System/Libraries
Version:        0.4.7
Release:        6.<RELEASE2>
%if 0%{?build_snapshot}
%define _sourcename %{_name}
%else
%define _sourcename %{_name}-%{version}
%endif
Source:         http://libproxy.googlecode.com/files/%{_sourcename}.tar.gz
# Script used for automatic snapshot updates
Source98:       update-from-svn.sh
Source99:       baselibs.conf
# PATCH-FIX-UPSTREAM libproxy-trim-ignores.patch bnc#679322 dimstar@opensuse.org -- Trim strings in ignore list.
Patch0:         libproxy-trim-ignores.patch
# PATCH-FIX-UPSTREAM libproxy-CVE-2012-4504.patch bnc#784523 CVE-2012-4504 dimstar@opensuse.org -- Fix buffer overflow downloading large pac file
Patch1:         libproxy-CVE-2012-4504.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libmodman-devel
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
%if !%{build_core_not_modules}
%if ! 0%{?windows}
BuildRequires:  dbus-1-devel
BuildRequires:  gconf2-devel
# For directory ownership, but also because we want to rebuild the modules if
# the library changed
BuildRequires:  libproxy1
BuildRequires:  libwebkit-devel
%if 0%{?suse_version}
BuildRequires:  mozilla-xulrunner%{xulrunner_ver}-devel
%else
BuildRequires:  xulrunner-devel
%endif
BuildRequires:  NetworkManager-devel
BuildRequires:  libkde4-devel
BuildRequires:  libqt4-devel
%endif
%else
%if 0%{?have_mono}
BuildRequires:  mono-devel
%endif
BuildRequires:  perl
BuildRequires:  python-devel
%endif

%{!?python_sitelib:  %global python_sitelib  %(%__python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%__python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?_assemblies_dir: %global _assemblies_dir %(pkg-config cecil --variable=assemblies_dir)}

%description
libproxy offers the following features: * extremely small core
   footprint (< 35K)

* no external dependencies within libproxy core (libproxy modules
   may have dependencies)
* only 3 functions in the stable external API
* dynamic adjustment to changing network topology
* a standard way of dealing with proxy settings across all scenarios


%if %build_core_not_modules

%package tools
Summary:        A simple application using libproxy
Group:          System/Libraries
Requires:       libproxy1 = %{version}

%description tools
A simple application that will use libproxy to give the results you can
expect from other applications. It can be used to debug what would
happen in various cases.


%package devel
Summary:        Libproxy provides consistent proxy configuration to applications - Development Files
Group:          Development/Libraries/C and C++
Requires:       libproxy1 = %{version}

%description devel
libproxy offers the following features: * extremely small core
   footprint (< 35K)

* no external dependencies within libproxy core (libproxy modules
   may have dependencies)
* only 3 functions in the stable external API
* dynamic adjustment to changing network topology
* a standard way of dealing with proxy settings across all scenarios


%package -n libproxy1
Summary:        Libproxy provides consistent proxy configuration to applications
Group:          System/Libraries

%description -n libproxy1
libproxy offers the following features: * extremely small core
   footprint (< 35K)

* no external dependencies within libproxy core (libproxy modules
   may have dependencies)
* only 3 functions in the stable external API
* dynamic adjustment to changing network topology
* a standard way of dealing with proxy settings across all scenarios

%package -n python-libproxy
Summary:        Python bindings for libproxy
Group:          System/Libraries
%if 0%{?suse_version} > 1110
BuildArch:      noarch
%py_requires
%endif
Requires:       libproxy1 = %{version}

%description -n python-libproxy
libproxy offers the following features: * extremely small core
   footprint (< 35K)

* no external dependencies within libproxy core (libproxy modules
   may have dependencies)
* only 3 functions in the stable external API
* dynamic adjustment to changing network topology
* a standard way of dealing with proxy settings across all scenarios


%package -n perl-Net-Libproxy
Summary:        Perl bindings for libproxy
Group:          Development/Libraries/Perl
Requires:       libproxy1 = %{version}
# For Fedora at least perl = perl_version does not work.
Requires:       perl >= %{perl_version}

%description -n perl-Net-Libproxy
libproxy offers the following features: * extremely small core
   footprint (< 35K)

* no external dependencies within libproxy core (libproxy modules
   may have dependencies)
* only 3 functions in the stable external API
* dynamic adjustment to changing network topology
* a standard way of dealing with proxy settings across all scenarios

%if 0%{?have_mono}

%package -n libproxy-sharp
Summary:        .Net bindings for libproxy
Group:          Development/Languages/Mono
Requires:       libproxy1 = %{version}

%description -n libproxy-sharp
libproxy offers the following features: * extremely small core
   footprint (< 35K)

* no external dependencies within libproxy core (libproxy modules
   may have dependencies)
* only 3 functions in the stable external API
* dynamic adjustment to changing network topology
* a standard way of dealing with proxy settings across all scenarios
%endif

%else

%package -n libproxy1-config-gnome

Summary:        Libproxy module for GNOME configuration
Group:          System/Libraries
Requires:       libproxy1 = %{version}
%if 0%{?suse_version}
Recommends:     libproxy1-pacrunner = %{version}
Supplements:    packageand(libproxy1:gconf2)
%else
Requires:       libproxy1-pacrunner = %{version}
%endif
Provides:       libproxy-gnome = %{version}
Obsoletes:      libproxy-gnome < %{version}

%description -n libproxy1-config-gnome
A module to extend libproxy with capabilities to query GNOME about
proxy settings.


%package -n libproxy1-config-kde4

Summary:        Libproxy module for KDE configuration
Group:          System/Libraries
Requires:       libproxy1 = %{version}
%if 0%{?suse_version}
Recommends:     libproxy1-pacrunner = %{version}
Supplements:    packageand(libproxy1:libkde4)
%else
Requires:       libproxy1-pacrunner = %{version}
%endif
Provides:       libproxy-kde = %{version}
Obsoletes:      libproxy-kde < %{version}

%description -n libproxy1-config-kde4
A module to extend libproxy with capabilities to query KDE4 about proxy
settings.


%package -n libproxy1-pacrunner-mozjs

Summary:        Libproxy module to support wpad/pac parsing via Mozilla JavaScript Engine
Group:          System/Libraries
Requires:       libproxy1 = %{version}
%if 0%{?suse_version}
Supplements:    packageand(libproxy1:mozilla-xulrunner%{xulrunner_ver})
%endif
# A virtual symbol to identify that this is a pacrunner.
Provides:       libproxy1-pacrunner = %{version}

%description -n libproxy1-pacrunner-mozjs
A module to extend libproxy with capabilities to pass addresses to a
WPAD/PAC script and have it find the correct proxy.


%package -n libproxy1-pacrunner-webkit

Summary:        Libproxy module to support WPAD/PAC parsing via WebKit JavaScript Engine
Group:          System/Libraries
Requires:       libproxy1 = %{version}
%if 0%{?suse_version}
Supplements:    packageand(libproxy1:libwebkitgtk-0)
%endif
# A virtual symbol to identify that this is a pacrunner.
Provides:       libproxy1-pacrunner = %{version}

%description -n libproxy1-pacrunner-webkit
A module to extend libproxy with capabilities to pass addresses to a
WPAD/PAC script and have it find the correct proxy.

%package -n libproxy1-networkmanager

Summary:        Libproxy module for NetworkManager configuration
Group:          System/Libraries
Requires:       libproxy1 = %{version}
%if 0%{?suse_version}
Supplements:    packageand(libproxy1:NetworkManager)
%endif

%description -n libproxy1-networkmanager
A module to extend libproxy with capabilities to query NetworkManager
about network configuration changes.

%endif

%prep
%setup -q -n %{_sourcename}
%patch0 -p0
%patch1 -p0
mkdir build

%build
cd build
export CXXFLAGS="%{optflags}"
export CFLAGS="%{optflags}"
%if 0%{?suse_version} < 1120 && 0%{?suse_version}
export CXXFLAGS="%{optflags} -DXP_UNIX"
%endif
%if 0%{?windows}
export CXXFLAGS="%{optflags} -fno-stack-protector -static-libgcc"
%endif
cmake \
%if 0%{?windows}
  -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw32.cmake \
  -DBUILD_TESTING=False \
  -DWITH_DOTNET=OFF \
%else
  -DWITH_VALA=yes \
  -DWITH_DOTNET=%{have_mono} \
  -DFORCE_SYSTEM_LIBMODMAN=ON \
  -DWITH_GNOME3=OFF \
  -DWITH_WEBKIGTK3=OFF \
%endif
  -DCMAKE_INSTALL_PREFIX=%{_prefix} \
  -DBIN_INSTALL_DIR=%{_bindir} \
  -DLIB_INSTALL_DIR=%{_libdir} \
  -DMODULE_INSTALL_DIR=%{_libdir}/libproxy-%{version}/modules \
  -DLIBEXEC_INSTALL_DIR=%{_libexecdir}/libproxy-%{version} \
  -DPYTHON_SITEPKG_DIR=%{python_sitelib} \
  -DSHARE_INSTALL_PREFIX=%{_datadir} \
  -DINCLUDE_INSTALL_DIR=%{_includedir} \
  -DPERL_VENDORINSTALL=yes \
%if ! %build_core_not_modules
  -DWITH_DOTNET=OFF \
%endif
%if 0%{?suse_version} && 0%{?suse_version} < 1120
  -DCMAKE_BUILD_TYPE=DebugFull \
  -DCMAKE_INSTALL_CONFIG_NAME=DebugFull \
%else
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_INSTALL_CONFIG_NAME=RelWithDebInfo \
%endif
..
%{__make} VERBOSE=1

%install
cd build
make DESTDIR=%{buildroot} install

# On Windows we also do not want to provide the static libraries.
%if 0%{?windows}
find %{buildroot}%{_libdir} -name '*.dll.a' -delete -print
rm %{buildroot}%{_libdir}/libmodman.dll
%endif

%if %build_core_not_modules
# Build the basic directory structure for the modules so we can
# own the directories in the main library package
install -d %{buildroot}%{_libexecdir}/libproxy-%{version}
install -d %{buildroot}%{_libdir}/%{name}-%{version}/modules
%else
# remove files that are part of the core
rm -f %{buildroot}%{_includedir}/*.h
# Delete all files that exist in the base libproxy package
rm -f %{buildroot}%{_bindir}/proxy%{?windows:.exe}
rm -f %{buildroot}%{_libdir}/libproxy.*
rm -f %{buildroot}%{python_sitelib}/*.py
rm -f %{buildroot}%{_libdir}/pkgconfig/libproxy-1.0.pc
rm -f %{buildroot}%{_datadir}/cmake/Modules/Findlibproxy.cmake
rm -f %{buildroot}%{_datadir}/vala/vapi/libproxy-1.0.vapi
rm -f %{buildroot}%{perl_vendorarch}/Net/Libproxy.pm
rm -f %{buildroot}%{perl_vendorarch}/auto/Net/Libproxy/Libproxy.so
%endif

%check
cd build
make test

%if %build_core_not_modules

%post -n libproxy1 -p /sbin/ldconfig

%postun -n libproxy1 -p /sbin/ldconfig

%files tools
%defattr(-, root, root)
%{_bindir}/proxy%{?windows:.exe}

%files -n libproxy1
%defattr(-, root, root)
%doc COPYING README AUTHORS
%if ! 0%{?windows}
%{_libdir}/libproxy.so.*
%else
%{_libdir}/libproxy.dll
%endif
%dir %{_libexecdir}/libproxy-%{version}
%dir %{_libdir}/libproxy-%{version}
%dir %{_libdir}/libproxy-%{version}/modules

%files devel
%defattr(-, root, root)
%{_includedir}/*.h
%if ! 0%{?windows}
%{_libdir}/*.so
%{_libdir}/pkgconfig/libproxy-1.0.pc
%if 0%{have_mono}
%{_libdir}/pkgconfig/libproxy-sharp-1.0.pc
%endif
%{_datadir}/cmake/Modules/Findlibproxy.cmake
%dir %{_datadir}/vala
%dir %{_datadir}/vala/vapi
%{_datadir}/vala/vapi/libproxy-1.0.vapi
%endif

%files -n python-libproxy
%defattr(-, root, root)
%{python_sitelib}/*.py

%if 0%{?have_mono}

%files -n libproxy-sharp
%defattr(-, root, root)
%{_assemblies_dir}/gac/libproxy-sharp
%{_assemblies_dir}/libproxy-sharp
%endif

%if ! 0%{?windows}

%files -n perl-Net-Libproxy
%defattr(-,root,root)
%dir %{perl_vendorarch}/Net
%dir %{perl_vendorarch}/auto/Net
%dir %{perl_vendorarch}/auto/Net/Libproxy
%{perl_vendorarch}/Net/Libproxy.pm
%{perl_vendorarch}/auto/Net/Libproxy/Libproxy.so
%endif
%else

%if ! 0%{?windows}

%files -n libproxy1-config-kde4
%defattr(-, root, root)
%{_libdir}/libproxy-%{version}/modules/config_kde4.so

%files -n libproxy1-config-gnome
%defattr(-, root, root)
%{_libdir}/libproxy-%{version}/modules/config_gnome.so
%{_libexecdir}/libproxy-%{version}/pxgconf

%files -n libproxy1-networkmanager
%defattr(-, root, root)
%{_libdir}/libproxy-%{version}/modules/network_networkmanager.so

%files -n libproxy1-pacrunner-webkit
%defattr(-, root, root)
%{_libdir}/libproxy-%{version}/modules/pacrunner_webkit.so

%files -n libproxy1-pacrunner-mozjs
%defattr(-, root, root)
%{_libdir}/libproxy-%{version}/modules/pacrunner_mozjs.so
%endif
%endif

%changelog
openSUSE Build Service is sponsored by