%define gdc_version 0.17 %define gdc_mirror http://home.earthlink.net/~dvdfrdmn/d %define dmd_version 0.140 %define gcc_version 4.0.2 %define gcc_mirror ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{gcc_version} %define needs_gcc3 0 Summary: GNU D Compiler Name: gdc Version: %{gdc_version} Release: 0 License: GPL Group: Development/Languages URL: http://home.earthlink.net/~dvdfrdmn/d/ Source0: %{gdc_mirror}/gdc-%{gdc_version}.tar.bz2 Source1: %{gcc_mirror}/gcc-core-%{gcc_version}.tar.bz2 Source2: %{gcc_mirror}/gcc-g++-%{gcc_version}.tar.bz2 Source3: %{gcc_mirror}/gcc-java-%{gcc_version}.tar.bz2 NoSource: 0 NoSource: 1 NoSource: 2 NoSource: 3 #Source4: dmd.1 #Source5: gdc.1 #Patch1: dmd-0.109-line-ending.patch #Patch2: gdc-0.10-clean.patch #Patch3: dmd-0.112-lexer.patch #Patch4: gdc-0.10-comments.patch # Spec file written by Anders F Bjorklund # Spec file adapted for gdc-0.14 on Mandrake 10.x by Peri Hankey # Spec file adapted for gdc-0.17-gcc-4.0.2 on Mandrake 10.x by Peri Hankey %define _prefix /opt/gdc %define _mandir %{_prefix}/share/man %define _infodir %{_prefix}/share/info Prefix: %{_prefix} %define _gnu %{nil} %define unittest %{?_with_unittest:1} %{!?_with_unittest:0} BuildRequires: gettext, zlib-devel %ifnos darwin Requires: zlib %endif %ifos linux BuildRequires: binutils, glibc-devel Requires: glibc-devel %define linux_needs_gcc !%{needs_gcc3} %define linux_needs_gcc3 %{needs_gcc3} %else # old RPM does not handled nested ifs: %define linux_needs_gcc 0 %define linux_needs_gcc3 0 %endif %if %{linux_needs_gcc3} BuildRequires: gcc3-c++ Requires: libgcc3 %endif %if %{linux_needs_gcc} BuildRequires: gcc-c++ >= 3 Requires: libgcc >= 3 %endif BuildRoot: %{_tmppath}/%{name}-%{version}-root %description D is a general purpose systems and applications programming language. It is a higher level language than C++, but retains the ability to write high performance code and interface directly with the operating system API's and with hardware. D is well suited to writing medium to large scale million line programs with teams of developers. D is easy to learn, provides many capabilities to aid the programmer, and is well suited to aggressive compiler optimization technology. This version of GDC (%{gdc_version}) was built using GCC version %{gcc_version}. See http://gcc.gnu.org/ for more info on the GNU Compiler Collection. %package c Summary: GDC - C support Group: Development/Languages Requires: %{name} = %{version} %description c This package adds C support for the bundled GCC compiler of GDC. It includes support for the C preprocessor, cpp. %package c++ Summary: GDC - C++ support Group: Development/Languages Requires: %{name} = %{version} %description c++ This package adds C++ support for the bundled GCC compiler of GDC. It includes support for most of the current C++ specification, including templates and exception handling. %define builddir gdc-%{gdc_version}-gcc-%{gcc_version} %prep # GCC_MAJOR=`echo %{gcc_version} | perl -pe 's/([0-9]\.[0-9]).*/$1/'` %setup -q -n %{builddir} -c -a 1 -a 2 -a 3 mv d gcc-%{gcc_version}/gcc pushd gcc-%{gcc_version} ./gcc/d/setup-gcc.sh popd #pushd gcc-%{gcc_version}/gcc # patch -p1 --forward -i d/patch-gcc-$GCC_MAJOR.x # change line endings from DOS (CR+LF) to UNIX (LF), for patch to work : #find . -type f -name '*.[cdh]' | xargs -n 1 -t perl -pe 's/\r\n/\n/s' -i #%patch1 -p3 -b .lineends #%patch2 -p3 -b .pedantic #%patch3 -p3 -b .lexer #popd #%patch4 -p1 -b .comments %build # avoid building in the srcdir: rm -rf obj-%{_target_platform} mkdir obj-%{_target_platform} pushd obj-%{_target_platform} %if %{needs_gcc3} CC=gcc3 CXX=g++3 %else CC=gcc CXX=g++ %endif %ifos darwin STATIC=--disable-shared %else STATIC= %endif #OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fno-rtti//g' -e 's/-fno-exceptions//g'` # -mcpu makes libiberty fail to build, in GCC 3.4 *grr!* #BOOT_FLAGS=`echo $OPT_FLAGS|sed -e 's/-mcpu=/-mtune=/g'` #OPT_FLAGS=`echo $OPT_FLAGS|perl -pe 's/ ?-mcpu=([^ ]+)//g'` #CC="$CC" CFLAGS="$OPT_FLAGS" CXX="$CXX" CXXFLAGS="$OPT_FLAGS" XCFLAGS="$OPT_FLAGS" TCFLAGS="$BOOT_FLAGS" \ # ../gcc-%{gcc_version}/configure --prefix=%{_prefix} --host=%{_target_platform} \ # --enable-shared --enable-threads=posix --disable-checking --with-system-zlib \ # --enable-languages=c,d,c++ $STATIC # if RPM_BUILD_NCPUS unset, set it if [ -z "$RPM_BUILD_NCPUS" ] ; then if [ -x /usr/bin/getconf ] ; then RPM_BUILD_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN) if [ $RPM_BUILD_NCPUS -eq 0 ]; then RPM_BUILD_NCPUS=1 fi else RPM_BUILD_NCPUS=1 fi fi ../gcc-%{gcc_version}/configure --prefix=%{_prefix} --with-dwarf2 --enable-languages=c,d,c++ $STATIC %{_target_platform} # --enable-generated-files-in-srcdir #make -j$RPM_BUILD_NCPUS bootstrap-lean #make -j$RPM_BUILD_NCPUS BOOT_CFLAGS="$BOOT_FLAGS" %make # do a temporary install, just to build phobos #rm -rf "$RPM_BUILD_DIR/%{builddir}/gdc-temp" #mkdir "$RPM_BUILD_DIR/%{builddir}/gdc-temp" #make DESTDIR="$RPM_BUILD_DIR/%{builddir}/gdc-temp" install #OLDPATH=$PATH #export PATH="$RPM_BUILD_DIR/%{builddir}/gdc-temp%{_bindir}:$PATH" # #popd #%if %{unittest} #rm -rf phobos-unittest #mkdir phobos-unittest #pushd phobos-unittest # can't pass options here, since GDC is using mixed versions of autoconf (for boehm-gc) :-( #../gcc-%{gcc_version}/gcc/d/phobos/configure --prefix=%{_prefix} --host=%{_target_platform} #make libphobos.a unittest \ #CC="gcc" CFLAGS="$OPT_FLAGS -DPHOBOS_USE_PTHREADS=1 -DHAVE_CONFIG_H -Ietc/c/stlsoft -I." \ #DMD="gdc" DFLAGS="$OPT_FLAGS -funittest -nostdinc" #./unittest || exit 1 #popd #%endif # #rm -rf phobos-release #mkdir phobos-release #pushd phobos-release ## Forget any make options or parallell makes, since the configure scripts are broken :-( #../gcc-%{gcc_version}/gcc/d/phobos/configure --prefix=%{_prefix} --host=%{_target_platform} #make \ #CC="gcc" CFLAGS="$OPT_FLAGS -DPHOBOS_USE_PTHREADS=1 -DHAVE_CONFIG_H -Ietc/c/stlsoft -I." \ #DMD="gdc" DFLAGS="$OPT_FLAGS -frelease -nostdinc" # #popd ## now we don't need the temp install anymore #rm -rf "$RPM_BUILD_DIR/%{builddir}/gdc-temp" #export PATH="$OLDPATH" %install rm -rf $RPM_BUILD_ROOT pushd obj-%{_target_platform} %makeinstall #install -d $RPM_BUILD_ROOT%{_mandir}/man1 #install -p %{SOURCE4} $RPM_BUILD_ROOT%{_mandir}/man1/dmd.1 #install -p %{SOURCE5} $RPM_BUILD_ROOT%{_mandir}/man1/gdc.1 #pop#d #pushd phobos-release #%makeinstall popd rm -f $RPM_BUILD_ROOT%{_bindir}/cc rm -f $RPM_BUILD_ROOT%{_bindir}/c++ rm -f $RPM_BUILD_ROOT%{_bindir}/%{_target_platform}-* %ifos darwin rm -f $RPM_BUILD_ROOT%{_libdir}/libstdc++.la rm -f $RPM_BUILD_ROOT%{_libdir}/libstdc++*.dylib rm -f $RPM_BUILD_ROOT%{_libdir}/libsupc++.la rm -f $RPM_BUILD_ROOT%{_libdir}/libsupc++*.dylib %endif rm -f $RPM_BUILD_ROOT%{_infodir}/dir gzip -9 $RPM_BUILD_ROOT%{_infodir}/*.info* %find_lang gcc # %find_lang libstdc++ || true %ifos darwin strip $RPM_BUILD_ROOT%{_libexecdir}/gcc/%{_target_platform}/%{gcc_version}/cc1* %endif %clean rm -rf $RPM_BUILD_ROOT %ifnos darwin # for the shared libraries: %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %post c++ -p /sbin/ldconfig %postun c++ -p /sbin/ldconfig %endif # -f gdc.lang %files %defattr(-,root,root) %{_bindir}/gdmd %{_bindir}/gdc %{_libdir}/gcc/%{_target_platform}/%{gcc_version}/*.o %{_libexecdir}/gcc/%{_target_platform}/%{gcc_version}/cc1d #%{_mandir}/man1/dmd.1* %{_mandir}/man1/gdmd.1* %{_mandir}/man1/gdc.1* # Phobos runtime library: %{_libdir}/libgphobos.a %{_libdir}/libgphobos.spec %{_includedir}/d/* %ifnos darwin # needed for exceptions: %{_libdir}/libgcc_s.* %endif # for good measure: %{_mandir}/man7/fsf-funding.7* %{_mandir}/man7/gfdl.7* %{_mandir}/man7/gpl.7* # -f gcc.lang %files c -f gcc.lang %defattr(-,root,root) %{_bindir}/cpp %{_bindir}/gcc %{_bindir}/gccbug %{_bindir}/gcov %{_libdir}/libiberty.a %{_libdir}/gcc/%{_target_platform}/%{gcc_version}/include #%{_libdir}/gcc/%{_target_platform}/%{gcc_version}/install-tools %{_libdir}/gcc/%{_target_platform}/%{gcc_version}/*.a #%{_libdir}/gcc/%{_target_platform}/%{gcc_version}/specs %{_libexecdir}/gcc/%{_target_platform}/%{gcc_version}/cc1 %{_libexecdir}/gcc/%{_target_platform}/%{gcc_version}/collect2 %{_libexecdir}/gcc/%{_target_platform}/%{gcc_version}/install-tools %{_mandir}/man1/cpp.1* %{_mandir}/man1/gcc.1* %{_mandir}/man1/gcov.1* %{_infodir}/*.info* # -f libstdc++.lang %files c++ %defattr(-,root,root) %{_bindir}/g++ %{_libdir}/libstdc++.* %{_libdir}/libsupc++.* %{_libdir}/libmudflap.* %{_libdir}/libmudflapth.* %{_includedir}/c++/* %{_includedir}/mf-runtime.h %{_libexecdir}/gcc/%{_target_platform}/%{gcc_version}/cc1plus %{_mandir}/man1/g++.1* %{_datadir}/locale/*/LC_MESSAGES/cpplib.*