File cling.spec of Package cling

#
# spec file for package cling
#
# Copyright (c) 2024,2025 Boian Berberov
#
# 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/
#

# Don't LTO on x86, OOM
%ifarch %ix86
%{expand:%%global optflags $(echo "%optflags" | sed -e s/-flto=[[:alnum:]]*//) }
%endif



%global         root_llvm_tag  cling-llvm18-20250110-01

# macros.cmake overrides
%global         __sourcedir  llvm-project-%{root_llvm_tag}/llvm



Name:           cling
Version:        1.2
Release:        1%{?dist}
Group:          Development/Languages/C and C++
Summary:        The Interactive C++ Interpreter
License:        LGPL-2.1+
URL:            https://github.com/root-project/%{name}

Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz
Source1:        https://github.com/root-project/llvm-project/archive/refs/tags/%{root_llvm_tag}.tar.gz
Source999:      %{name}.rpmlintrc

BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libxml2-devel
BuildRequires:  zlib-devel
# BuildRequires:  clang

%description
Cling is an interactive C++ interpreter, built on top of Clang and LLVM compiler infrastructure. Cling realizes the read-eval-print loop (REPL) concept, in order to leverage rapid application development. Implemented as a small extension to LLVM and Clang, the interpreter reuses their strengths such as the praised concise and expressive compiler diagnostics.



%prep
%setup -q -c -a 1



%build
# NOTE: -DLLVM_TARGETS_TO_BUILD="host;NVPTX" is required
%cmake \
	-DBUILD_SHARED_LIBS:BOOL=OFF \
	-DBUILD_STATIC_LIBS:BOOL=OFF \
	\
	-DLLVM_ENABLE_PROJECTS=clang \
	\
	-DLLVM_EXTERNAL_CLING_SOURCE_DIR=../%{name}-%{version} \
	-DLLVM_EXTERNAL_PROJECTS=%{name} \
	\
	-DLLVM_TARGETS_TO_BUILD="host;NVPTX"

make help
make list_install_components
%__cmake --build . --target %{name}



%install
# NOTE: __builddir not _builddir
%__mkdir_p           %{buildroot}%{_datadir}
cp -R %{__builddir}  %{buildroot}%{_datadir}/%{name}
export NO_BRP_STRIP_DEBUG="true"



%files
%license  %{name}-%{version}/LICENSE.TXT
%{_datadir}/%{name}/



%changelog
openSUSE Build Service is sponsored by