%define _prefix /opt/freeware
%define _defaultdocdir %{_prefix}/doc
%define linc_version 1.0.1
%define libidl_version 0.8.0
%define glib2_version 2.2.1

Summary: 	A high-performance CORBA Object Request Broker.
Name: 		ORBit2
Version: 	2.6.1
Release: 	1
Source: 	%{name}-%{version}.tar.bz2

Patch0:		ORBit2-2.6.1-aix.patch
Patch1:		ORBit2-2.6.1-autotools.patch

Group: 		System Environment/Daemons
License: 	LGPL/GPL
BuildRoot: 	%{_tmppath}/%{name}-%{version}-root
URL: 		http://www.labs.redhat.com/orbit/
BuildRequires: linc-devel >= %{linc_version}
BuildRequires: libIDL-devel >= %{libidl_version}
BuildRequires: glib2-devel >= %{glib2_version}

%description
ORBit is a high-performance CORBA (Common Object Request Broker 
Architecture) ORB (object request broker). It allows programs to 
send requests and receive replies from other programs, regardless 
of the locations of the two programs. CORBA is an architecture that 
enables communication between program objects, regardless of the 
programming language they're written in or the operating system they
run on.

You will need to install this package and ORBit-devel if you want to 
write programs that use CORBA technology.

%package devel
Summary: Development libraries, header files and utilities for ORBit.
Group: Development/Libraries
Requires: glib2-devel
Requires: linc-devel >= %{linc_version}
Requires: libIDL-devel >= %{libidl_version}
Requires: ORBit2 = %{version}
Requires: glib2-devel >= %{glib2_version}

%description devel
ORBit is a high-performance CORBA (Common Object Request Broker
Architecture) ORB (object request broker) with support for the 
C language.

This package contains the header files, libraries and utilities 
necessary to write programs that use CORBA technology. If you want to
write such programs, you'll also need to install the ORBIT package.

%prep
%setup -q

if test x$PATCH = x ; then
  PATCH=patch ;
fi
$PATCH -p2 -s < %{_sourcedir}/ORBit2-2.6.1-aix.patch
$PATCH -p2 -s < %{_sourcedir}/ORBit2-2.6.1-autotools.patch


%build
CPPFLAGS="-I%{_includedir}" LDFLAGS="-L%{_libdir}" \
PATH=%{_bindir}:$PATH ./configure --prefix=%{_prefix}
make

%install
if test "%{buildroot}" != "/"; then
	rm -rf %{buildroot}
fi
mkdir -p %{buildroot}
make DESTDIR=%{buildroot} install-strip

# make links
cd %{buildroot}
for dir in bin lib include
do
        mkdir -p usr/$dir
        cd usr/$dir
        ln -sf ../..%{_prefix}/$dir/* .
        cd -
done

%files

%defattr(-,root,system)
%doc AUTHORS COPYING ChangeLog NEWS README TODO
%{_libdir}/*.a
/usr/lib/*.a
%{_libdir}/orbit-2.0/*.a

%files devel

%defattr(-,root,system)

%{_libdir}/*.la
%{_libdir}/pkgconfig/*
%{_libdir}/orbit-2.0/*.la

%{_bindir}/*
/usr/bin/*
%{_includedir}/*
/usr/include/*
%{_datadir}/aclocal/*
%{_datadir}/idl/orbit-2.0/*

