File ocaml-gettext.spec of Package ocaml-gettext.1126

#
# spec file for package ocaml-gettext
#
# Copyright (c) 2014 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


%global __ocaml_requires_opts -i Asttypes -i Parsetree
%global __ocaml_provides_opts -i Pr_gettext

Name:           ocaml-gettext
Version:        0.3.5
%{ocaml_preserve_bytecode}
Release:        0
Summary:        OCaml library for i18n
License:        SUSE-LGPL-2.0-with-linking-exception
Group:          Development/Libraries/Other
Url:            http://forge.ocamlcore.org/projects/ocaml-gettext
Source0:        http://forge.ocamlcore.org/frs/download.php/1433/ocaml-gettext-%{version}.tar.gz
ExcludeArch:    s390x
Patch1:         ocaml-gettext-0.3.5-use-ocamlopt-g.patch
BuildRequires:  autoconf
BuildRequires:  chrpath
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  libxml2
BuildRequires:  libxslt
BuildRequires:  ocaml >= 4.00.1
BuildRequires:  ocaml-rpm-macros >= 4.02.1
BuildRequires:  ocaml-camlp4-devel
BuildRequires:  ocaml-fileutils-devel >= 0.4.4-4
BuildRequires:  ocaml-findlib-devel >= 1.3.3-3
BuildRequires:  ocaml-ocamldoc
BuildRequires:  ocaml-camomile-data
BuildRequires:  ocaml-camomile-devel >= 0.8.1
BuildRequires:  ocaml-ounit-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# ocaml-gettext program needs camomile data files
Requires:       ocaml-camomile-data

%description
Ocaml-gettext provides support for internationalization of Ocaml
programs.

Constraints :

* provides a pure Ocaml implementation,
* the API should be as close as possible to GNU gettext,
* provides a way to automatically extract translatable
  strings from Ocaml source code.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}-%{release}
# BZ 446919.
Requires:       ocaml-fileutils-devel >= 0.4.0

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

%package        camomile
Summary:        Parts of %{name} which depend on Camomile
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}-%{release}

%description    camomile
The %{name}-camomile package contains the parts of %{name} which
depend on Camomile.

%package        camomile-devel
Summary:        Development files for %{name}-camomile
Group:          Development/Libraries/Other
Requires:       %{name}-devel = %{version}-%{release}

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


%prep
%setup -q
%patch1 -p1

%define _stylesheet_path "%{_datadir}/xml/docbook/stylesheet/nwalsh/current"

%build
# Parallel builds don't work.
unset MAKEFLAGS
CFLAGS="%{optflags}" \
./configure \
  --libdir=%{_libdir} \
  --enable-test \
  --with-docbook-stylesheet=%{_stylesheet_path}
make all


%check
pushd test
../_build/bin/test
popd


%install
# make install in the package is screwed up completely.  Install
# by hand instead.
export DESTDIR=%{buildroot}
export OCAMLFIND_DESTDIR=%{buildroot}%{_libdir}/ocaml
mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs
mkdir -p %{buildroot}%{_bindir}

# Remove *.o files - these shouldn't be distributed.
find _build -name '*.o' -exec rm {} \;

ocamlfind install gettext _build/lib/gettext/*
ocamlfind install gettext-stub _build/lib/gettext-stub/*
ocamlfind install gettext-camomile _build/lib/gettext-camomile/*
install -m 0755 _build/bin/ocaml-gettext %{buildroot}%{_bindir}/
install -m 0755 _build/bin/ocaml-xgettext %{buildroot}%{_bindir}/

chrpath --delete $OCAMLFIND_DESTDIR/stublibs/dll*.so



%files
%defattr(-,root,root,-)
%doc COPYING
%{_libdir}/ocaml/gettext
%{_libdir}/ocaml/gettext-stub
%if %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/gettext/*.a
%exclude %{_libdir}/ocaml/gettext/*.cmxa
%exclude %{_libdir}/ocaml/gettext/*.cmx
%exclude %{_libdir}/ocaml/gettext-stub/*.a
%exclude %{_libdir}/ocaml/gettext-stub/*.cmxa
%exclude %{_libdir}/ocaml/gettext-stub/*.cmx
%endif
%exclude %{_libdir}/ocaml/gettext/*.ml
%exclude %{_libdir}/ocaml/gettext/*.mli
%exclude %{_libdir}/ocaml/gettext-stub/*.ml
%{_libdir}/ocaml/stublibs/*.so
%{_libdir}/ocaml/stublibs/*.so.owner

%files devel
%defattr(-,root,root,-)
%doc README CHANGELOG TODO
# %doc build/share/doc/html/*
%if %{ocaml_native_compiler}
%{_libdir}/ocaml/gettext/*.a
%{_libdir}/ocaml/gettext/*.cmxa
%{_libdir}/ocaml/gettext/*.cmx
%{_libdir}/ocaml/gettext-stub/*.a
%{_libdir}/ocaml/gettext-stub/*.cmxa
%{_libdir}/ocaml/gettext-stub/*.cmx
%endif
%{_libdir}/ocaml/gettext/*.ml
%{_libdir}/ocaml/gettext/*.mli
%{_libdir}/ocaml/gettext-stub/*.ml
%{_bindir}/ocaml-gettext
%{_bindir}/ocaml-xgettext

%files camomile
%defattr(-,root,root,-)
%doc COPYING
%{_libdir}/ocaml/gettext-camomile
%if %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/gettext-camomile/*.a
%exclude %{_libdir}/ocaml/gettext-camomile/*.cmxa
%exclude %{_libdir}/ocaml/gettext-camomile/*.cmx
%endif
%exclude %{_libdir}/ocaml/gettext-camomile/*.mli

%files camomile-devel
%defattr(-,root,root,-)
%doc README
%if %{ocaml_native_compiler}
%{_libdir}/ocaml/gettext-camomile/*.a
%{_libdir}/ocaml/gettext-camomile/*.cmxa
%{_libdir}/ocaml/gettext-camomile/*.cmx
%endif
%{_libdir}/ocaml/gettext-camomile/*.mli


%changelog
openSUSE Build Service is sponsored by