##
##  mico.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
##
##  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 [EVAL]
Group:        System
License:      LGPL/GPL
Version:      2.3.7
Release:      20030107

#   package options
%option       with_ssl      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
Patch0:       mico.patch

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20030103, gcc
PreReq:       OpenPKG, openpkg >= 20030103
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"
%if "%{with_qt}" == "yes"
    CXXFLAGS="$CXXFLAGS -I%{l_prefix}/include/qt"
%endif
    CPPFLAGS="%{l_cppflags}"
    LDFLAGS="%{l_ldflags}"
    export CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
    ./configure \
        --prefix=%{l_prefix} \
%if "%{with_ssl}" == "yes"
        --with-ssl=%{l_prefix} \
%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}/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}

    #   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.*
    ( cd $RPM_BUILD_ROOT%{l_prefix}/lib
      for name in mico micoaux micocoss micoir micox; do
          mv lib${name}%{version}.a lib${name}.a
      done
%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
    )

    #   generate files listing
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean
    rm -rf $RPM_BUILD_ROOT

