File ldc.spec of Package ldc

# spec file for package ldc
# 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:           ldc
Version:        0.16.1
Release:        0
Summary:        The LLVM D Compiler
License:        BSD-3-Clause and Artistic-1.0
Group:          Development/Languages/Other
Source0:        ldc-%{version}-src.tar.gz
Source1:        %{name}-rpmlintrc
# PATCH-FIX-OPENSUSE workaround-buggy-llvm-config.patch bnc#856691
Patch1:         workaround-buggy-llvm-config.patch
BuildRequires:  cmake
BuildRequires:  help2man
BuildRequires:  libconfig++-devel
BuildRequires:  llvm-clang
BuildRequires:  llvm-devel >= 3.0
BuildRequires:  ncurses-devel
BuildRequires:  zlib-devel
# Should be installed, at least runtime
Recommends:     ldc-phobos-devel = %{version}
Recommends:     ldc-runtime-devel = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define so_ver        67
%define lname_runtime libdruntime-%{name}
%define lname_phobos  libphobos2-%{name}

LDC is an LLVM based compiler for the D programming language. It uses the
frontend of the reference compiler (DMD), thereby supporting the same language
features, but profits from LLVM's superior optimizing and code generation

%package -n %{lname_runtime}%{so_ver}
Summary:        Minimal D runtime library

%description -n %{lname_runtime}%{so_ver}
The minimal runtime library required to support the D programming language.

%package runtime-devel
Summary:        Development files for the D runtime library
Requires:       %{lname_runtime}%{so_ver} = %{version}
Recommends:     ldc-phobos-devel          = %{version}

%description runtime-devel
This package contains the druntime development files necessary for developing
with LDC.

%package -n %{lname_phobos}%{so_ver}
Summary:        The D standard library

%description -n %{lname_phobos}%{so_ver}
This package includes ldc's phobos library - The D standard library.

%package phobos-devel
Summary:        Development files for the D standard library
Requires:       %{lname_phobos}%{so_ver} = %{version}
Requires:       %{name}-runtime-devel    = %{version}

%description phobos-devel
This package contains the Phobos development files necessary for developing
with LDC.

%setup -q -n ldc-%{version}-src
%patch1 -p1

#Needs to be compiled with clang, but opensuse_rules.cmake forces gcc so disable rule
touch no-suse-rules
%cmake \
    -DCMAKE_C_COMPILER="%{_bindir}/clang" \
    -DCMKAE_CXX_COMPILER="%{_bindir}/clang++" \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/d \
make %{?_smp_mflags}

# Build man pages
help2man %{buildroot}%{_bindir}/ldc2  > ldc2.1  && gzip ldc2.1
help2man %{buildroot}%{_bindir}/ldmd2 > ldmd2.1 && gzip ldmd2.1
install -d %{buildroot}%{_mandir}/man1
install -m 644 -t %{buildroot}%{_mandir}/man1/ ldmd2.1.gz ldc2.1.gz

%post -n %{lname_runtime}%{so_ver} -p /sbin/ldconfig

%post -n %{lname_phobos}%{so_ver}  -p /sbin/ldconfig

%postun -n %{lname_runtime}%{so_ver} -p /sbin/ldconfig

%postun -n %{lname_phobos}%{so_ver}  -p /sbin/ldconfig

%doc %{_mandir}/man1/*.1.gz
%config %{_sysconfdir}/bash_completion.d/ldc2
%config %{_sysconfdir}/ldc2.conf

%files -n %{lname_runtime}%{so_ver}

%files runtime-devel
%dir %{_includedir}/d

%files -n %{lname_phobos}%{so_ver}

%files phobos-devel