File pygui.spec of Package pacemaker-pygui

#
# spec file for package Pacemaker (Version 0.7.0)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%define with_extra_warnings   	0
%define with_debugging  	0
%define without_fatal_warnings 	1

%define pkg_group Productivity/Clustering/HA

%if 0%{?fedora_version}
%define pkg_group System Environment/Daemons
%endif

%define gname haclient
%define uname hacluster

Name:           pacemaker-pygui
Summary:        A Python based GUI for the Pacemaker High-Availability cluster resource manager
Version:        1.4
Release:        1
License:        GPL2/LGPL2
URL:            http://www.clusterlabs.org
Group:          %{pkg_group}
Source:         pygui.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Autoreqprov:    on

Requires:      pyxml
BuildRequires: libpacemaker-devel heartbeat-devel e2fsprogs-devel glib2-devel gnutls-devel libxml2-devel pam-devel python-devel swig ncurses-devel
BuildRequires: net-snmp-devel

%if 0%{?suse_version}
%if 0%{?suse_version} == 930
BuildRequires: rpm-devel
%endif

%if 0%{?suse_version} == 1000
BuildRequires: lzo lzo-devel
%endif

%if 0%{?suse_version} < 1020
BuildRequires: tcpd-devel
%endif

%if 0%{?sles_version} == 9
BuildRequires: pkgconfig openssl-devel rpm-devel
%endif

%endif

%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version}
BuildRequires:  which openssl-devel lm_sensors-devel
%endif

%if 0%{?rhel_version} ==  406
BuildRequires: libselinux-devel
%endif

%if 0%{?rhel_version} == 406
BuildRequires: kernel gcc-c++
%endif

%if 0%{?fedora_version} == 8
BuildRequires: 	openssl-devel
%endif


%if 0%{?mandriva_version}
BuildRequires: libbzip2-devel openssl-devel
%endif

%description
pyGUI is a Python based GUI for configuring Pacemaker - an advanced, scalable
High-Availability cluster resource manager for Linux-HA (Heartbeat) and/or OpenAIS.

%package devel 
Summary:        Pacemaker Python GUI development package 
Group:          %{pkg_group}
Requires:       %{name} = %{version}-%{release}

%description devel
Header files and shared libraries needed for developing programs based on the 
Pacemaker Python GUI

%prep
###########################################################
%setup -n pygui
###########################################################

%build
# TODO: revisit -all

CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"

# Feature-dependent CFLAGS:
%if %with_extra_warnings
# CFLAGS="${CFLAGS} -Wshadow -Wfloat-equal -Waggregate-return -Wnested-externs -Wunreachable-code -Wendif-labels -Winline"
CFLAGS="${CFLAGS} -Wfloat-equal -Wendif-labels -Winline"
%endif
%if %with_debugging
CFLAGS="${CFLAGS} -O0"
%endif

# Distribution specific settings:
%if 0%{?suse_version} > 1001
CFLAGS="${CFLAGS} -fstack-protector-all"
%endif

%if 0%{?suse_version} < 1001
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/gnome/%{_lib}/pkgconfig:/opt/gnome/share/pkgconfig"
%endif

%if 0%{?suse_version} > 1020
CFLAGS="$CFLAGS -fgnu89-inline"
%endif

%if 0%{?fedora_version} > 6
CFLAGS="$CFLAGS -fgnu89-inline"
%endif


export CFLAGS

./ConfigureMe configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} \
	--localstatedir=%{_var} --infodir=%{_infodir} 		\
	--mandir=%{_mandir} --libdir=%{_libdir} 		\
	--libexecdir=%{_libdir} 				\
	--with-group-name=%{gname} --with-ccmuser-name=%{uname} \
	--with-hapkgversion=%{version} 				\
	--enable-glib-malloc 					\
	--enable-snmp-subagent					\
	--with-mibsdir=%{_datadir}/snmp/mibs			\
%if %without_fatal_warnings
	--enable-fatal-warnings=no 			        \
%endif
	--enable-pretty

export MAKE="make %{?jobs:-j%jobs}"
make %{?jobs:-j%jobs}
###########################################################

%install
###########################################################
#make DESTDIR=$RPM_BUILD_ROOT install-strip
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

# Cleanup
[ -d $RPM_BUILD_ROOT/usr/man ] && rm -rf $RPM_BUILD_ROOT/usr/man
[ -d $RPM_BUILD_ROOT/usr/share/libtool ] && rm -rf $RPM_BUILD_ROOT/usr/share/libtool
find $RPM_BUILD_ROOT -name '*.a' -type f -print0 | xargs -0 rm -f
find $RPM_BUILD_ROOT -name '*.la' -type f -print0 | xargs -0 rm -f

###########################################################

%clean
###########################################################
if
  [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ]
then
  rm -rf $RPM_BUILD_ROOT
fi
rm -rf $RPM_BUILD_DIR/pygui
###########################################################

%pre
%preun

# Use the following if more commands need to be executed
# %post
# /sbin/ldconfig
# [...]
# http://en.opensuse.org/SUSE_Package_Conventions/RPM_Macros

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files devel
%defattr(-,root,root)
%dir %{_includedir}/heartbeat/mgmt
%{_includedir}/heartbeat/mgmt/mgmt.h
%{_includedir}/heartbeat/mgmt/mgmt_client.h
%{_includedir}/heartbeat/mgmt/mgmt_common.h
%{_includedir}/heartbeat/mgmt/mgmt_tls.h
%{_includedir}/heartbeat/pygui_config.h

%files
###########################################################
%defattr(-,root,root)
%dir %{_libdir}/heartbeat
%dir %{_libdir}/heartbeat-gui
%dir %{_datadir}/heartbeat-gui

%{_sysconfdir}/pam.d/hbmgmtd
%{_bindir}/hb_gui

%{_libdir}/heartbeat-gui/haclient.py
%{_libdir}/heartbeat-gui/pymgmt.py
%{_libdir}/heartbeat/mgmtd
%{_libdir}/heartbeat/mgmtdtest
%{_libdir}/libhbmgmt.so*
%{_libdir}/libhbmgmtclient.so*
%{_libdir}/libhbmgmtcommon.so*
%{_libdir}/libhbmgmttls.so*
%{_libdir}/heartbeat-gui/_pymgmt.so*
%{_libdir}/heartbeat/hbagent
%{_datadir}/heartbeat-gui/*.png
%{_datadir}/heartbeat-gui/haclient.glade
%{_datadir}/heartbeat-gui/haclient.py
%{_datadir}/heartbeat-gui/mgmtcmd.py
%{_datadir}/locale/zh_CN/LC_MESSAGES/haclient.mo
%{_datadir}/snmp/mibs/LINUX-HA-MIB.mib
%{_datadir}/heartbeat/SNMPAgentSanityCheck


%changelog pygui