Summary: Digital Mars D Compiler
Name: dmd
Version: 2.058
Release: 1%{?dist}
License: Proprietary
Group: Applications/Programming
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
URL: http://www.digitalmars.com/
Source0: dmd-%{version}.src.tar.gz
Source1: dmd.conf
Source2: dmd.conf.x86_64
Source3: dmd
Source4: make_src.sh
BuildRequires: make
BuildRequires: gcc-c++
%description
Compiler for the D Programming language
%define src_dmd $RPM_BUILD_DIR/%{name}-%{version}/dmd
%define src_phobos $RPM_BUILD_DIR/%{name}-%{version}/phobos
%define src_druntime $RPM_BUILD_DIR/%{name}-%{version}/druntime
%ifarch %{ix86}
%define path_libphobos %{src_phobos}/generated/linux/release/32/libphobos2.a
%define conf_source %{SOURCE1}
%define model 32
%endif
%ifarch ia64 amd64 x86_64 ia32e
%define path_libphobos %{src_phobos}/generated/linux/release/64/libphobos2.a
%define conf_source %{SOURCE2}
%define model 64
%endif
%define include_dmd /usr/include/d/dmd
%define include_druntime $RPM_BUILD_ROOT%{include_dmd}/druntime
%define include_phobos $RPM_BUILD_ROOT%{include_dmd}/phobos
%prep
%setup -q
%build
cd %{src_dmd}
make -f posix.mak MODEL=%{model}
export PATH=$PATH:%{src_dmd}
cd %{src_phobos}
make -f posix.mak MODEL=%{model} DRUNTIME_PATH=%{src_druntime}
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
cp %{src_dmd}/dmd $RPM_BUILD_ROOT%{_bindir}/
cp %{src_dmd}/idgen $RPM_BUILD_ROOT%{_bindir}/
cp %{src_dmd}/impcnvgen $RPM_BUILD_ROOT%{_bindir}/
cp %{src_dmd}/optabgen $RPM_BUILD_ROOT%{_bindir}/
mkdir -p $RPM_BUILD_ROOT%{_libdir}
cp %{path_libphobos} $RPM_BUILD_ROOT%{_libdir}/
mkdir -p %{include_druntime}
cp -r %{src_druntime}/import %{include_druntime}/
mkdir -p %{include_phobos}
cp -r %{src_phobos}/etc %{include_phobos}/
cp -r %{src_phobos}/std %{include_phobos}/
cp %{src_phobos}/*.d %{include_phobos}/
cp %{src_phobos}/*.ddoc %{include_phobos}/
cp %{src_phobos}/phoboslicense.txt %{include_phobos}/
mkdir -p $RPM_BUILD_ROOT/etc
cp %{conf_source} $RPM_BUILD_ROOT/etc/dmd.conf
mkdir -p $RPM_BUILD_ROOT/etc/bash_completion.d
cp %{SOURCE3} $RPM_BUILD_ROOT/etc/bash_completion.d/dmd
%files
%defattr(755,root,root,-)
%{_bindir}/dmd
%{_bindir}/idgen
%{_bindir}/impcnvgen
%{_bindir}/optabgen
%defattr(-,root,root,-)
%{_libdir}/libphobos2.a
/usr/include/d
/etc/dmd.conf
/etc/bash_completion.d/dmd
%clean
rm -rf $RPM_BUILD_ROOT
%changelog
* Thu Apr 5 2012 - <->
- new package