File ocaml-labltk.spec of Package ocaml-labltk

#
# spec file for package ocaml-labltk
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


Name:           ocaml-labltk
Version:        8.06.15
Release:        0
%{?ocaml_preserve_bytecode}
Summary:        Tcl/Tk framework for ocaml
License:        SUSE-LGPL-2.0-with-linking-exception
URL:            https://github.com/garrigue/labltk
Source0:        https://github.com/garrigue/labltk/archive/%version.tar.gz#/labltk-%version.tar.gz
BuildRequires:  ocaml-findlib
BuildRequires:  ocaml-rpm-macros >= 20210409
BuildRequires:  pkgconfig(tcl)
BuildRequires:  pkgconfig(tk)
BuildRequires:  ocaml(ocaml_base_version) >= 4.10

%description
LablTk is an interface to the Tcl/Tk GUI framework. It allows to
develop GUI applications in a speedy and type safe way. A legacy
Camltk interface is included. The OCamlBrowser library viewer is
also part of this project.

%package devel
Summary:        Development files for labltk
Requires:       %name = %version-%release
Requires:       pkgconfig(tcl)
Requires:       pkgconfig(tk)

%description devel
Labltk is a library for interfacing Objective Caml with the scripting
language Tcl/Tk.

This package contains the development files.  It includes the ocaml
browser for code editing and library browsing.
%prep
%autosetup -p1 -n labltk-%version

%build
# this is not supported from our compiler liibrary
sed -i 's|~auto_include:Load_path.no_auto_include||' browser/setpath.ml browser/main.ml
env \
ocamlopt=$(type -P ocamlc) \
bash -ex \
./configure \
	--tklibs '-L%_libdir' \
	--use-findlib
make library
make libraryopt

%install
ld_conf=$PWD/ld.conf
> $ld_conf
d="$RPM_BUILD_ROOT`ocamlfind printconf destdir`"
mkdir -vp $d/labltk
mkdir -vp $d/stublibs
env \
OCAMLFIND_LDCONF=$ld_conf \
OCAMLFIND_DESTDIR=$d \
make \
	BINDIR="$RPM_BUILD_ROOT%_bindir" \
	INSTALLDIR=$d/labltk \
	STUBLIBDIR=$d/stublibs \
	install

find examples* -type f -exec chmod -v 644 {} \;
cat $ld_conf
#
%ocaml_create_file_list

%files -f %name.files
%_bindir/*

%files devel -f %name.files.devel
%_libdir/ocaml/*/labltktop
%_libdir/ocaml/*/pp
%_libdir/ocaml/*/tkcompiler

%changelog
openSUSE Build Service is sponsored by