File carp.spec of Package carp

#
# spec file for package carp
#
# Copyright (c) 2021 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/
#

%global pkg_name carp
Name:           %{pkg_name}
Version:        0.5.5
Release:        0
Summary:        Statically typed lisp, without a GC, for real-time applications
License:        Apache-2.0
Group:          Development/Languages/Other
URL:            https://github.com/carp-lang/Carp
Source0:        https://github.com/carp-lang/Carp/archive/v%{version}.tar.gz
Source1:        %{name}-rpmlintrc
BuildRequires:  chrpath
BuildRequires:  ghc-Cabal-devel
BuildRequires:  ghc-blaze-markup-devel
BuildRequires:  ghc-blaze-html-devel
BuildRequires:  ghc-split-devel
BuildRequires:  ghc-cmdargs-devel
BuildRequires:  ghc-ansi-terminal-devel
BuildRequires:  ghc-edit-distance-devel
BuildRequires:  ghc-rpm-macros
BuildRequires:  ghc-cmark-devel
BuildRequires:  ghc-hashable-devel
BuildRequires:  ghc-haskeline-devel
BuildRequires:  ghc-open-browser-devel
BuildRequires:  ghc-optparse-applicative-devel
%if %{with tests}
BuildRequires:  ghc-HUnit-devel
%endif
BuildRequires:  python3 python3-Markdown
BuildRequires:  fdupes
ExcludeArch:    %{ix86}
Recommends:     %{name}-doc = %{version}-%{release}

%description
Carp is a programming language designed to work well for interactive and performance sensitive use cases like games, sound synthesis and visualizations.

The key features of Carp are the following:
+ Automatic and deterministic memory management (no garbage collector or VM)
+ Inferred static types for great speed and reliability
+ Ownership tracking enables a functional programming style while still using mutation of cache-friendly data structures under the hood
+ No hidden performance penalties – allocation and copying are explicit
+ Straightforward integration with existing C code
+ Lisp macros, compile time scripting and a helpful REPL

%package doc
Summary:        Documentation for Carp
Group:          Documentation/Other
Recommends:     %{name} = %{version}-%{release}
BuildArch:      noarch

%description doc
This package contains the documentation of Carp.

%prep
%setup -q -n Carp-%{version}
# Force to use <_libdir>/carp/ if CARP_DIR variable is not set
sed -e 's!^import Control.Monad (!&mplus, !' \
    -e 's!lookup "CARP_DIR" sysEnv!& `mplus` Just "%{_libdir}/%{name}"!' \
    -i app/Main.hs
sed -E 's!(cmd = ")(carp -x ./docs/core/generate_core_docs.carp")!\1./dist/build/carp/\2!' \
    -i docs-html/zConvertMd2Html.py

%build
%ghc_bin_build
export CARP_DIR=${PWD}
cd docs-html/
python3 zConvertMd2Html.py 

%check
%cabal_test

%install
%ghc_bin_install
rm -Rf %{buildroot}/%{_libdir}/ghc*/
%ghc_fix_rpath ${pkg_name}-%{version}
mkdir -pv %{buildroot}/%{_libdir}/%{name}/
cp -R bench/ core/ %{buildroot}/%{_libdir}/%{name}/
mkdir -pv %{buildroot}/%{_docdir}/%{name}
# doc
rm docs-html/zConvertMd2Html.py
cp -R docs-html/ examples/ %{buildroot}/%{_docdir}/%{name}/
find %{buildroot}/%{_docdir}/%{name}/ -type f -exec chmod -x {} \;
%fdupes %{buildroot}/%{_docdir}

%files
%license LICENSE
%{_bindir}/carp
%{_bindir}/carp-header-parse
%{_libdir}/%{name}/

%files doc
%doc README.md CHANGELOG.md
%{_docdir}/%{name}/

%changelog
openSUSE Build Service is sponsored by