- add python3 subpackage
This commit is contained in:
parent
4fa0707be4
commit
16a6074955
|
@ -1,9 +1,14 @@
|
|||
%global with_python3 1
|
||||
|
||||
%define libsepolver 2.0.37-1
|
||||
%define libselinuxver 2.0.0-1
|
||||
|
||||
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
|
||||
|
||||
Summary: SELinux binary policy manipulation library
|
||||
Name: libsemanage
|
||||
Version: 2.0.45
|
||||
Release: 1%{?dist}
|
||||
Release: 4%{?dist}
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
Source: http://www.nsa.gov/selinux/archives/libsemanage-%{version}.tgz
|
||||
|
@ -11,10 +16,19 @@ Patch: libsemanage-rhat.patch
|
|||
URL: http://www.selinuxproject.org
|
||||
Source1: semanage.conf
|
||||
|
||||
# Add support to src/Makefile to support building the python bindings multiple
|
||||
# times, against different Python runtimes:
|
||||
Patch1: libsemanage-2.0.45-support-multiple-python-builds.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: libselinux-devel >= %{libselinuxver} swig ustr-devel
|
||||
BuildRequires: libsepol-devel >= %{libsepolver}
|
||||
BuildRequires: python-devel bison flex bzip2-devel
|
||||
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python3-devel
|
||||
%endif # if with_python3
|
||||
|
||||
Requires: bzip2-libs
|
||||
|
||||
%description
|
||||
|
@ -60,23 +74,69 @@ Requires: libsemanage = %{version}-%{release}
|
|||
The libsemanage-python package contains the python bindings for developing
|
||||
SELinux management applications.
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package python3
|
||||
Summary: semanage python 3 bindings for libsemanage
|
||||
Group: Development/Libraries
|
||||
Requires: libsemanage = %{version}-%{release}
|
||||
|
||||
%description python3
|
||||
The libsemanage-python3 package contains the python 3 bindings for developing
|
||||
SELinux management applications.
|
||||
%endif # if with_python3
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch -p1 -b .rhat
|
||||
%patch1 -p2 -b .support-multiple-python-builds
|
||||
|
||||
%build
|
||||
# To support building the Python wrapper against multiple Python runtimes
|
||||
# Define a function, for how to perform a "build" of the python wrapper against
|
||||
# a specific runtime:
|
||||
BuildPythonWrapper() {
|
||||
BinaryName=$1
|
||||
Prefix=$2
|
||||
|
||||
# Perform the build from the upstream Makefile:
|
||||
make \
|
||||
PYTHON=$BinaryName PYPREFIX=$Prefix \
|
||||
CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" \
|
||||
pywrap
|
||||
}
|
||||
|
||||
make clean
|
||||
make CFLAGS="%{optflags}" swigify
|
||||
make CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all pywrap
|
||||
make CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all
|
||||
|
||||
BuildPythonWrapper %{__python} python2
|
||||
%if 0%{?with_python3}
|
||||
BuildPythonWrapper %{__python3} python3
|
||||
%endif # with_python3
|
||||
|
||||
%install
|
||||
InstallPythonWrapper() {
|
||||
BinaryName=$1
|
||||
Prefix=$2
|
||||
|
||||
make \
|
||||
PYTHON=$BinaryName PYPREFIX=$Prefix \
|
||||
DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="${RPM_BUILD_ROOT}%{_libdir}" SHLIBDIR="${RPM_BUILD_ROOT}/%{_libdir}" \
|
||||
install-pywrap
|
||||
}
|
||||
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
mkdir -p ${RPM_BUILD_ROOT}/%{_lib}
|
||||
mkdir -p ${RPM_BUILD_ROOT}/%{_libdir}
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
|
||||
make DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="${RPM_BUILD_ROOT}%{_libdir}" SHLIBDIR="${RPM_BUILD_ROOT}/%{_lib}" install install-pywrap
|
||||
make DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="${RPM_BUILD_ROOT}%{_libdir}" SHLIBDIR="${RPM_BUILD_ROOT}/%{_libdir}" install
|
||||
|
||||
InstallPythonWrapper %{__python} python2
|
||||
%if 0%{?with_python3}
|
||||
InstallPythonWrapper %{__python3} python3
|
||||
%endif # with_python3
|
||||
|
||||
cp %{SOURCE1} ${RPM_BUILD_ROOT}/etc/selinux/semanage.conf
|
||||
ln -sf /%{_lib}/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so
|
||||
ln -sf %{_libdir}/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so
|
||||
|
||||
%clean
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
|
@ -84,7 +144,7 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||
%files
|
||||
%defattr(-,root,root)
|
||||
%config(noreplace) /etc/selinux/semanage.conf
|
||||
/%{_lib}/libsemanage.so.1
|
||||
/%{_libdir}/libsemanage.so.1
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
|
@ -104,9 +164,27 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||
|
||||
%files python
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/python*/site-packages/*
|
||||
%{python_sitearch}/_semanage.so
|
||||
%{python_sitearch}/semanage.py*
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files python3
|
||||
%defattr(-,root,root)
|
||||
%{python3_sitearch}/_semanage.so
|
||||
%{python3_sitearch}/semanage.py*
|
||||
%endif # if with_python3
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Apr 27 2010 David Malcolm <dmalcolm@redhat.com> - 2.0.45-4
|
||||
- add python3 subpackage
|
||||
|
||||
* Wed Apr 7 2010 Dan Walsh <dwalsh@redhat.com> - 2.0.45-3
|
||||
- Fix -devel package to point at the correct shared library
|
||||
|
||||
* Fri Mar 26 2010 Dan Walsh <dwalsh@redhat.com> - 2.0.45-2
|
||||
- Move shared library to /usr/lib
|
||||
|
||||
* Mon Mar 8 2010 Dan Walsh <dwalsh@redhat.com> - 2.0.45-1
|
||||
- Update to upstream
|
||||
* Add enable/disable patch support from Dan Walsh.
|
||||
|
|
Loading…
Reference in New Issue