File gdc.spec of Package gdc

# spec file for package gdc
# Copyright (c) 2015 SUSE LINUX Products 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

%define gdc_ver 2.066.1
%define gcc_ver 5.3.0
Name:           gdc
Version:        %{gdc_ver}gcc5
Release:        0
License:        GPL-2.0+
Summary:        GNU D Compiler
Group:          Development/Languages/Other
Source2:        GDMD-20150829.tar.xz
BuildRequires:  binutils-gold
BuildRequires:  zlib-devel
BuildRequires:  gcc-c++
BuildRequires:  gmp-devel >= 4.2
BuildRequires:  mpfr-devel >= 2.4.0
BuildRequires:  mpc-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%define gdc_dir 

%package phobos-devel
Group:          Development/Libraries/Other
Summary:        Development files

GNU D Compiler
GDC is a GPL implementation of the D compiler which integrates the open source D front end with GCC.

%description phobos-devel
Phobos library development files

%setup -q -n GDC-%{gdc_ver}_gcc5 -a 1 -a 2
./ gcc-%{gcc_ver}

mkdir build
cd build
LDFLAGS="-fuse-ld=gold" ../gcc-%{gcc_ver}/configure \
        --prefix=%{_prefix} --host=%{_host} --build=%{_build} \
        --libdir=%{_libdir} --libexecdir=%{_libexecdir} \
        --mandir=%{_mandir} --infodir=%{_infodir} \
        --with-bugurl="" \
        --enable-languages=d \
        --enable-shared --enable-threads=posix \
        --with-system-zlib --enable-__cxa_atexit \
        --disable-libunwind-exceptions --enable-clocale=gnu \
        --disable-libstdcxx-pch --disable-libssp \
        --enable-gnu-unique-object --enable-linker-build-id \
        --enable-cloog-backend=isl --disable-cloog-version-check \
        --enable-gold --enable-plugin --enable-ld=default \
        --enable-install-libiberty \
        --with-linker-hash-style=gnu \
        --disable-multilib --disable-libgomp --disable-libmudflap \
        --disable-libquadmath --enable-checking=release
make %{?_smp_mflags}

install -D -m755 build/gcc/gdc %{buildroot}%{_bindir}/gdc
install -D -m755 build/gcc/cc1d %{buildroot}%{_libdir}/gcc/%{_host}/%{gcc_ver}/cc1d
# tools
install -D -m755 GDMD/dmd-script %{buildroot}%{_bindir}/gdmd
gzip GDMD/dmd-script.1
install -D -m644 GDMD/dmd-script.1.gz %{buildroot}%{_mandir}/man1/gdmd.1.gz
# druntime
install -D libphobos/libdruntime/object.di %{buildroot}/%{_includedir}/d/gdc/object.di
install -D libphobos/libdruntime/__entrypoint.di  %{buildroot}/%{_includedir}/d/gdc/__entrypoint.di
cp -r libphobos/libdruntime/core %{buildroot}/%{_includedir}/d/gdc/core
cp -r libphobos/libdruntime/gcc %{buildroot}/%{_includedir}/d/gdc/gcc
# workaround for auto-generated libbacktrace issue
# script needs to be re-written to first call normal gcc instalaltion targets to
# avoid such problems in future
cp build/%{_host}/libphobos/libdruntime/gcc/libbacktrace.d %{buildroot}/%{_includedir}/d/gdc/gcc/
rm %{buildroot}/%{_includedir}/d/gdc/gcc/
# phobos
cp -r libphobos/src/std %{buildroot}/%{_includedir}/d/gdc/std
cp -r libphobos/src/etc %{buildroot}/%{_includedir}/d/gdc/etc
install -D -m644 build/%{_host}/libphobos/src/libgphobos2.a %{buildroot}/%{_libdir}/libgphobos2.a
%dir %{_libdir}/gcc/
%dir %{_libdir}/gcc/%{_host}/
%dir %{_libdir}/gcc/%{_host}/
%dir %{_libdir}/gcc/%{_host}/%{gcc_ver}/

%files phobos-devel