@ -1,6 +1,10 @@
#global llvm_version 14
%global soversion 100
%ifarch ppc64le
%define debug_package %{nil}
%endif
# bootstrapping is used for updating LDC to a newer version: it relies on an
# older, working LDC compiler in the buildroot, which is then used to build a
# new intermediate LDC version, and finally this in turn is used to build the
@ -13,7 +17,7 @@
Name: ldc
Epoch: 1
Version: 1.30.0%{?pre:~%{pre}}
Release: 1%{?dist}
Release: 2%{?dist}~bootstrap~ppc64le
Summary: LLVM D Compiler
# The DMD frontend in dmd/* GPL version 1 or artistic license
@ -21,21 +25,27 @@ Summary: LLVM D Compiler
License: BSD
URL: https://github.com/ldc-developers/ldc
Source0: https://github.com/ldc-developers/ldc/releases/download/v%{version}%{?pre:-%{pre}}/%{name}-%{version}%{?pre:-%{pre}}-src.tar.gz
Source1: ldc-1.8.0-1.fc29.ppc64le.tar.xz
Source2: llvm4.0-libs-4.0.1-6.fc29.ppc64le.tar.xz
Source3: macros.%{name}
Source4: libffi-3.1-18.fc29.ppc64le.tar.xz
# Make sure /usr/include/d is in the include search path
Patch0: ldc-include-path.patch
# Don't add rpath to standard libdir
Patch1: ldc-no-default-rpath.patch
ExclusiveArch: %{ldc_arches}
ExclusiveArch: %{ldc_arches} ppc64le
BuildRequires: bash-completion
BuildRequires: cmake
BuildRequires: gc
BuildRequires: gcc
BuildRequires: gcc-c++
%ifarch ppc64le
%else
BuildRequires: ldc
%endif
BuildRequires: libconfig-devel
BuildRequires: libcurl-devel
BuildRequires: libedit-devel
@ -91,6 +101,11 @@ Enable autocompletion for phobos library in geany (IDE)
mkdir geany_config
%build
%ifarch ppc64le
tar xvf %{SOURCE1}
tar xvf %{SOURCE2}
tar xvf %{SOURCE4}
%else
# This package appears to be failing because links to the LLVM plugins
# are not installed which results in the tools not being able to
# interpret the .o/.a files. Disable LTO for now
@ -118,12 +133,23 @@ popd
%{nil}
%cmake_build
%endif
# generate geany tags
geany -c geany_config -g phobos.d.tags $(find runtime/phobos/std -name "*.d")
%install
%ifarch ppc64le
cp -a ldc-1.8.0-1.fc29.ppc64le/* %{buildroot}
cp -a llvm4.0-libs-4.0.1-6.fc29.ppc64le/* %{buildroot}
cp -a libffi-3.1-18.fc29.ppc64le/* %{buildroot}
mv %{buildroot}%{_datadir}/licenses/libffi/ \
%{buildroot}%{_datadir}/licenses/libffi-3.1/
mv %{buildroot}%{_datadir}/doc/libffi/ \
%{buildroot}%{_datadir}/doc/libffi-3.1/
%else
%cmake_install
%endif
# macros for D package
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
@ -143,11 +169,15 @@ install -m0644 phobos.d.tags %{buildroot}/%{_datadir}/geany/tags/
%{_bindir}/ldc-profdata
%{_bindir}/ldc-prune-cache
%{_rpmconfigdir}/macros.d/macros.ldc
%ifarch ppc64le
%{_includedir}/d/
%else
%dir %{_prefix}/lib/ldc
%dir %{_prefix}/lib/ldc/%{_target_platform}
%dir %{_prefix}/lib/ldc/%{_target_platform}/include
%{_prefix}/lib/ldc/%{_target_platform}/include/d/
%{_libdir}/ldc_rt.dso.o
%endif
%{_libdir}/libdruntime-ldc-debug-shared.so
%{_libdir}/libdruntime-ldc-shared.so
%{_libdir}/libphobos2-ldc-debug-shared.so
@ -159,15 +189,35 @@ install -m0644 phobos.d.tags %{buildroot}/%{_datadir}/geany/tags/
%files libs
%license runtime/druntime/LICENSE.txt
%license runtime/phobos/LICENSE_1_0.txt
%ifarch ppc64le
%doc %{_datadir}/doc/ldc-druntime/README
%doc %{_datadir}/doc/ldc-druntime/README.md
%doc %{_datadir}/doc/libffi-3.1/README
%license %{_datadir}/licenses/ldc-druntime/LICENSE
%license %{_datadir}/licenses/ldc-phobos/LICENSE_1_0.txt
%license %{_datadir}/licenses/libffi-3.1/LICENSE
%license %{_datadir}/licenses/llvm4.0-libs/LICENSE.TXT
%{_sysconfdir}/ld.so.conf.d/llvm4.0-ppc64le.conf
%{_libdir}/llvm4.0/
%{_libdir}/libffi.so.6*
%{_libdir}/libdruntime-ldc-debug-shared.so.*
%{_libdir}/libdruntime-ldc-shared.so.*
%{_libdir}/libphobos2-ldc-debug-shared.so.*
%{_libdir}/libphobos2-ldc-shared.so.*
%else
%{_libdir}/libdruntime-ldc-debug-shared.so.%{soversion}*
%{_libdir}/libdruntime-ldc-shared.so.%{soversion}*
%{_libdir}/libphobos2-ldc-debug-shared.so.%{soversion}*
%{_libdir}/libphobos2-ldc-shared.so.%{soversion}*
%endif
%files phobos-geany-tags
%{_datadir}/geany/tags/phobos.d.tags
%changelog
* Mon Sep 12 2022 Kalev Lember <klember@redhat.com> - 1:1.30.0-2
- Bootstrap on ppc64le
* Tue Jul 26 2022 Kalev Lember <klember@redhat.com> - 1:1.30.0-1
- Update to 1.30.0
- Build with llvm 14