pw3270.spec.in 7.37 KB
%define _rel	@PACKAGE_RELEASE@

#---[ Check for OpenOffice ]------------------------------------------------------------------------------------------

%if 0%(if [ -x @OO_SDK_HOME@/bin/idlc ]; then echo 1; else echo 0; fi)
	%define _uno		1
	%define	ooo_home	@OO_HOME@
	%define ooo_ure_home	@OO_URE_HOME@
	%define	ooo_sdk_home	@OO_SDK_HOME@
%endif

%if 0%(if [ -x /opt/openoffice.org/basis3.1/sdk/bin/idlc ]; then echo 1; else echo 0; fi)
	%define _uno		1
	%define	ooo_home	/usr/lib/ooo3
	%define ooo_ure_home	/opt/openoffice.org/ure
	%define	ooo_sdk_home	/opt/openoffice.org/basis3.1/sdk
%endif

%if 0%(if [ -x /opt/openoffice.org/basis3.0/sdk/bin/idlc ]; then echo 1; else echo 0; fi)
	%define _uno			1
	%define ooo_home		/opt/openoffice.org
	%define ooo_ure_home	/opt/openoffice.org/ure
	%define ooo_sdk_home	/opt/openoffice.org/basis3.0/sdk
%endif

%define _uno 0

#---[ Check for Java ]------------------------------------------------------------------------------------------------

%if 0%(if [ -x @JDK_HOME@/bin/javah ]; then echo 1; else echo 0; fi)
	%define _java	1
%endif

#---[ Check for distro ]----------------------------------------------------------------------------------------------

%define _release	%{_rel}
%define _distro		Linux

%if 0%{?suse_version}
	%define _release %{_rel}.suse%{suse_version}
	%define _distro SuSE Linux %{suse_version}
%endif

%if 0%{?mdkversion}
	%define _release %{_rel}.mdv%{mandriva_release}
	%define _redhat 0
	%define _distro Mandriva Linux %{mandriva_release}
%endif

%if 0%{?fedora_version}
	%define _release %{_rel}.fc%{fedora_version}
	%define _redhat 0
	%define _distro Fedora %{fedora_version}
%endif

%if 0%{?_redhat}
	%define _redhat_prefix      %(grep -q "Red Hat Linux" /etc/redhat-release && echo rhl || echo el)
	%define _redhat_vernum      %(rpm -qf --queryformat %{VERSION} /etc/redhat-release|tr -d '.')
	%define _release          	%{_rel}.%{_redhat_prefix}%{_redhat_vernum}
	%define _distro %{_redhat_prefix} %{_redhat_vernum}
%endif

#---[ Check for extras ]----------------------------------------------------------------------------------------------

%define _rexx	%(which oorexx-config > /dev/null 2>&1; if [ "$?" = "0" ]; then echo 1; else echo 0; fi)

#---[ Packaging ]-----------------------------------------------------------------------------------------------------

Name:           @PACKAGE@
License:        LGPL
Group:          System/X11/Terminals
Version:        @PACKAGE_VERSION@
Release:        %_release
Summary:        IBM 3270 Terminal emulator for gtk.
Source:         %{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       openssl shared-mime-info libgnome libgnomeui %{name}-lib = @PACKAGE_VERSION@
Distribution:    %_distro
BuildRequires:  autoconf automake gcc-c++ sed pkgconfig gtk2-devel libgnome-devel gettext-devel

%description
IBM 3270 terminal emulator gtk. It can be used to communicate with
any IBM host that supports 3270-style connections over TELNET.

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@

%package lib
Provides:	%{name}-lib
Summary:	3270 Communication library for %{name}
Group:		Development/Libraries
Requires:       openssl %{name}-lib
BuildRequires:  autoconf openssl-devel sed pkgconfig

%description lib
tn3270 protocol library for %{name}

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@

%package devel
Provides:	%{name}-devel
Summary:	Devel for 3270 Communication library for %{name}
Group:		Development/Libraries
Requires:	%{name}-lib = @PACKAGE_VERSION@

%description devel
devel for tn3270 protocol library for %{name}

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@

%if 0%{?_rexx}
%package rexx
Summary:	Rexx scripts support for %{name}
Group:		Development/Libraries
Requires:	ooRexx >= 3.2.0 %{name}-lib = @PACKAGE_VERSION@ 
BuildRequires:	ooRexx >= 3.2.0

%description rexx
Rexx bindings for 3270 access using lib3270 (non-gui)

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@

%package plugin-rexx
Summary:	Rexx plugin for  %{name}
Group:		Development/Libraries
Requires:	%{name}-rexx = @PACKAGE_VERSION@
BuildRequires:	ooRexx >= 3.2.0

%description plugin-rexx
Plugin to add Rexx scripting suport in %{name}

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@
%endif

%if 0%{?_uno}
%package OpenOffice
Provides:	%{name}-OpenOffice
Group:		Productivity/Office/Suite
Summary:	3270 calls for OpenOffice/StarBasic.
Requires:	%{name}-lib = @PACKAGE_VERSION@
BuildRequires:	autoconf sed pkgconfig zip

%description OpenOffice
Uno/OpenOffice library allowing 3270 access from StarBasic

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@
%endif

%if 0%{?_java}
%package java
Group:		Development/Libraries
Summary:	Java bindings for %{name}
Requires:	%{name}-lib = @PACKAGE_VERSION@

%description java
Jni library allowing 3270 access from java programs (non-GUI)

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@

%package plugin-java
Group:		Development/Libraries
Summary:	Java plugin for %{name}
Requires:	%{name}-java = @PACKAGE_VERSION@

%description plugin-java
Plugin allowing use of java classes inside %{name}'s UI

SVN Revision:		@PACKAGE_REVISION@
SVN sources from:	@PACKAGE_SOURCE@
%endif

%prep

%setup -q -n %{name}-%{version}
aclocal
autoconf

%if 0%{?_uno}
	UNO_OPTIONS="--with-office-sdk-home=%{ooo_sdk_home} --with-office-home=%{ooo_home} --with-office-ure-home=%{ooo_ure_home}"
%else
	UNO_OPTIONS="--disable-office"
%endif

%if 0%{?_java}
	JAVA_OPTIONS="--with-jnidir=%{_jnidir} --with-jvmjardir=%{_jvmjardir}"
%else
	JAVA_OPTIONS=""
%endif

%configure --disable-trace $UNO_OPTIONS $JAVA_OPTIONS

%build
make clean
make Release

%install
rm -rf $RPM_BUILD_ROOT
cd %{_builddir}/%{name}-%{version}
make DESTDIR=$RPM_BUILD_ROOT docdir=%{_docdir} install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc ChangeLog AUTHORS LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/locale/*/LC_MESSAGES/*.mo
%{_datadir}/%{name}/pw3270.conf
%{_datadir}/%{name}/ui/default.xml
%{_datadir}/%{name}/ui/keypad.xml
%{_datadir}/%{name}/ui/functions.xml
%{_datadir}/%{name}/%{name}.svg
%{_datadir}/%{name}/colors.conf

%post
/sbin/ldconfig
/usr/bin/update-mime-database /usr/share/mime >/dev/null

%postun
/sbin/ldconfig
/usr/bin/update-mime-database /usr/share/mime >/dev/null

%if 0%{?_uno}
%post OpenOffice
if [ -x /opt/broffice.org3/program/unopkg ] then
	/opt/broffice.org3/program/unopkg add --shared %ooo_home/share/extension/install/%{name}.oxt
else
	@UNOPKG@ add --shared %ooo_home/share/extension/install/%{name}.oxt
fi

%preun OpenOffice
if [ -x /opt/broffice.org3/program/unopkg ] then
	/opt/broffice.org3/program/unopkg remove --shared %{name}.oxt
else
	@UNOPKG@ remove --shared %{name}.oxt
fi
%endif

%files lib
%defattr(-,root,root)
%{_docdir}
%{_libdir}/lib3270.so

%files devel
%defattr(-,root,root)
%{_includedir}/lib3270.h
%{_includedir}/lib3270
%{_libdir}/pkgconfig
%{_datadir}/%{name}/ui/debug.xml

%if 0%{?_rexx}
%files rexx
%defattr(-,root,root)
%{_libdir}/librx3270.so
%{_bindir}/rx3270.cls

%files plugin-rexx
%defattr(-,root,root)
%{_libdir}/%{name}/plugins/rx3270.so
%{_datadir}/%{name}/ui/rexx.xml
%endif

%if 0%{?_uno}
%files OpenOffice
%defattr(-,root,root)
%ooo_home/share/extension/install/*.oxt
%endif

%if 0%{?_java}
%files java
%defattr(-,root,root)
%{_jnidir}
%{_jvmjardir}

%files plugin-java
%defattr(-,root,root)
%{_libdir}/%{name}/plugins/j3270plugin.so
%endif