##
## mico.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2003 The OpenPKG Project
## Copyright (c) 2000-2003 Ralf S. Engelschall
## Copyright (c) 2000-2003 Cable & Wireless
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: mico
Summary: CORBA Toolkit
URL: http://www.mico.org/
Vendor: The MICO Project
Packager: The OpenPKG Project
Distribution: OpenPKG [PLUS]
Group: System
License: LGPL/GPL
Version: 2.3.10
Release: 20031007
# package options
%option with_ssl no
%option with_x11 no
%option with_qt no
%option with_gtk no
%option with_tcl no
# list of sources
Source0: http://www.mico.org/mico-%{version}.tar.gz
Source2: rc.mico
Patch0: mico.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20030718, gcc, make
PreReq: OpenPKG, openpkg >= 20030718
%if "%{with_ssl}" == "yes"
BuildPreReq: openssl
PreReq: openssl
%endif
%if "%{with_x11}" == "yes"
BuildPreReq: X11
PreReq: X11
%endif
%if "%{with_qt}" == "yes"
BuildPreReq: qt, pkgconfig
PreReq: qt
%endif
%if "%{with_gtk}" == "yes"
BuildPreReq: gtk
PreReq: gtk
%endif
%if "%{with_tcl}" == "yes"
BuildPreReq: tcl
PreReq: tcl
%endif
AutoReq: no
AutoReqProv: no
%description
The acronym MICO expands to MICO Is CORBA. The intention of this
project is to provide a freely available and fully compliant
implementation of the CORBA standard. The following design
principles guided the implementation of MICO:
- Start from scratch, and only use standard APIs (Posix/Win32)
- Don't rely on propietary or specialized libraries
- Use standard C++ for the implementation
- Only make use of widely available, free, non-proprietary tools
- Only implement what is required for a CORBA compliant implementation
- Provide a clear design even for implementation internals
%prep
%setup -q -n mico
%patch -p1
%build
CC="%{l_cc}"
CXX="%{l_cxx}"
CFLAGS="%{l_cflags -O}"
CXXFLAGS="%{l_cxxflags -O} -Wno-deprecated"
CPPFLAGS="%{l_cppflags}"
includedir=""
%if "%{with_qt}" == "yes"
CFLAGS="$CFLAGS `%{l_prefix}/bin/pkg-config --cflags-only-other qt`"
CXXFLAGS="$CXXFLAGS `%{l_prefix}/bin/pkg-config --cflags-only-other qt`"
CPPFLAGS="$CPPFLAGS `%{l_prefix}/bin/pkg-config --cflags-only-I qt`"
includedir="$includedir %{l_prefix}/include/qt"
LDFLAGS="$LDFLAGS `%{l_prefix}/bin/pkg-config --libs-only-L qt`"
%endif
%if "%{with_ssl}" == "yes"
includedir="$includedir %{l_prefix}/include/openssl"
%endif
%if "%{with_gtk}" == "yes"
includedir="$includedir %{l_prefix}/include/gtk"
%endif
%if "%{with_tcl}" == "yes"
includedir="$includedir %{l_prefix}/include/tcl"
%endif
for dir in $includedir; do
CPPFLAGS="$CPPFLAGS -I$dir"
done
LDFLAGS="%{l_ldflags}"
JAVAC=no
export CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS JAVAC
./configure \
--prefix=%{l_prefix} \
%if "%{with_ssl}" == "yes"
--with-ssl=%{l_prefix} \
%endif
%if "%{with_x11}" == "yes"
--with-x \
--x-includes=`%{l_prefix}/etc/rc --query x11_incdir` \
--x-libraries=`%{l_prefix}/etc/rc --query x11_libdir` \
%else
--without-x \
%endif
%if "%{with_qt}" == "yes"
--with-qt=%{l_prefix} \
%endif
%if "%{with_gtk}" == "yes"
--with-gtk=%{l_prefix} \
%endif
%if "%{with_tcl}" == "yes"
--with-tcl=%{l_prefix} \
%endif
--disable-mini-stl \
--disable-shared
%{l_make} %{l_mflags}
%install
rm -rf $RPM_BUILD_ROOT
# make directory structure
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/lib \
$RPM_BUILD_ROOT%{l_prefix}/include/mico \
$RPM_BUILD_ROOT%{l_prefix}/include/coss \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/var/mico \
$RPM_BUILD_ROOT%{l_prefix}/man/man1 \
$RPM_BUILD_ROOT%{l_prefix}/man/man5 \
$RPM_BUILD_ROOT%{l_prefix}/man/man8
# install binaries, libraries, headers
%{l_make} %{l_mflags} install \
INSTDIR=$RPM_BUILD_ROOT%{l_prefix} \
SHARED_INSTDIR=$RPM_BUILD_ROOT%{l_prefix}
# install our own things
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.mico} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# cleanup installation files
rm -rf $RPM_BUILD_ROOT%{l_prefix}/doc
rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/ministl
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/mico-setup.*
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/nsd.8 \
$RPM_BUILD_ROOT%{l_prefix}/man/man8/mico-nsd.8
( cd $RPM_BUILD_ROOT%{l_prefix}/lib
for name in mico micoaux micocoss micoir; do
mv lib${name}%{version}.a lib${name}.a
done
%if "%{with_x11}" == "yes"
mv libmicox%{version}.a libmicox.a
%endif
%if "%{with_qt}" == "yes"
mv libmicoqt%{version}.a libmicoqt.a
%endif
%if "%{with_gtk}" == "yes"
mv libmicogtk%{version}.a libmicogtk.a
%endif
%if "%{with_tcl}" == "yes"
mv libmicotcl%{version}.a libmicotcl.a
%endif
) || exit $?
# generate files listing
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
'%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/mico'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%pre
# before upgrade, save status and stop service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} mico status 2>/dev/null | tee %{l_tmpfile}`
%{l_rc} mico stop 2>/dev/null
exit 0
%post
if [ $1 -eq 2 ]; then
# after upgrade, restore status
eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
[ ".$mico_active" = .yes ] && %{l_rc} mico start
fi
exit 0
%preun
# before erase, stop service
[ $1 -eq 0 ] || exit 0
%{l_rc} mico stop 2>/dev/null
exit 0