File ocaml-camlidl.spec of Package ocaml-camlidl

# spec file for package ocaml-camlidl
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           ocaml-camlidl
Version:        1.05
Release:        0
Summary:        Stub code generator and COM binding for Objective Caml
License:        QPL-1.0 and LGPL-2.0
Group:		Development/Languages/OCaml
# PATCH-FIX-UPSTREAM fix-include.patch - add missing include statement to prevent 64 bit compatibility issue
Patch2:         fix-include.patch
BuildRequires:  ocaml
BuildRequires:  ocaml-oasis
BuildRequires:  ocaml-ocamldoc
BuildRequires:  ocaml-rpm-macros >= 4.03
BuildRequires:  perl
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

CamlIDL is a stub code generator and COM binding for Objective Caml.

CamlIDL comprises two parts:

* A stub code generator that generates the C stub code required for
  the Caml/C interface, based on an MIDL specification. (MIDL stands
  for Microsoft's Interface Description Language; it looks like C
  header files with some extra annotations, plus a notion of object
  interfaces that look like C++ classes without inheritance.)

* A (currently small) library of functions and tools to import COM
  components in Caml applications, and export Caml code as COM

%package        devel
Summary:        Development files for %{name}
Group:          Development/Languages/OCaml
Requires:       %{name} = %{version}

%description    devel
The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.

%setup -q -n camlidl-%{version}
%patch2 -p1
cp %{SOURCE1} .
# compiler/ contains a module called 'Array' which conflicts with the
# OCaml stdlib module (although only when using ocamlopt for some
# reason).
mv compiler/ compiler/
mv compiler/array.mli compiler/idlarray.mli

perl -pi.bak -e 's/array/idlarray/g' \
  compiler/Makefile compiler/.depend
perl -pi.bak -e 's/Array(?!\d)/Idlarray/g' \

pushd compiler
sed -e 's|%%%%CPP%%%%|cpp|' config.mlp >
tee _oasis <<_EOF_
OASISFormat: 0.4
Name:        camlidl
Version:     %{version}
Synopsis:    Stub code generator for OCaml
Authors:     Xavier Leroy
LicenseFile: LICENSE
License:     %{license}
Plugins:     META(`oasis version`)
BuildTools:  ocamlbuild

Library com
 Path: lib
 Install: true
 Modules: Com

Library camlidl
 Path: runtime
 Install: true
 Datafiles: camlidlruntime.h (\$standard_library/caml)
 CSources: idlalloc.c
 CCOpt: -I$PWD/runtime %{optflags} -fPIC

Document "camlidl"
 Title:                API reference for camlidl
 Type:                 ocamlbuild
 BuildTools+:          ocamldoc
 InstallDir:           \$htmldir
 Install:              true
 XOCamlbuildPath:      .
 XOCamlbuildLibraries: com

Executable camlidl
 Install: true
 Path: compiler
 CompiledObject: best

%ocaml_oasis_configure --enable-docs

mkdir -vp %{buildroot}/etc/
tee %{buildroot}/etc/{name}.conf <<_EOF_

%post   -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%dir %{_libdir}/ocaml/*
%if 0%{?ocaml_native_compiler}

%files devel
%doc LICENSE README Changes camlidl-%{version}.doc.pdf tests
%dir %{_libdir}/ocaml/*
%if 0%{?ocaml_native_compiler}