riscv-gnu-toolchain: Enable build of GCC linked against glibc.
[fedora-riscv.git] / stage2-riscv-gnu-toolchain / riscv-gnu-toolchain.spec.in
1 %global debug_package %{nil}
2
3 # Don't rm -rf $RPM_BUILD_ROOT at the top of install rule.
4 %global __spec_install_pre %{___build_pre}
5
6 # Strip breaks the libraries, don't do it.
7 %global __strip /bin/true
8
9 # Kill check-buildroot and check-rpaths.
10 %global __arch_install_post /bin/true
11
12 Name:           riscv-gnu-toolchain
13 Version:        0
14 Release:        0.5.git@SHORTCOMMIT@%{?dist}
15 Summary:        RISC-V GNU cross-toolchain, containing binutils and GCC
16 License:        GPLv2+ and LGPLv2+ and BSD
17
18 URL:            https://github.com/riscv/riscv-qemu
19 Source0:        https://github.com/riscv/%{name}/archive/@COMMIT@/%{name}-@SHORTCOMMIT@.tar.gz
20
21 Source1:        http://mirrors.kernel.org/gnu/binutils/binutils-@BINUTILS_VERSION@.tar.gz
22 Source2:        http://mirrors.kernel.org/gnu/glibc/glibc-@GLIBC_VERSION@.tar.gz
23 Source3:        http://mirrors.kernel.org/gnu/gcc/gcc-@GCC_VERSION@/gcc-@GCC_VERSION@.tar.gz
24 Source4:        ftp://sourceware.org/pub/newlib/newlib-@NEWLIB_VERSION@.tar.gz
25
26 # XXX These BuildRequires are just culled from the GCC spec
27 # and probably overestimate the real requirements.
28 BuildRequires: binutils
29 BuildRequires: glibc-static
30 BuildRequires: zlib-devel, gettext, bison, flex
31 BuildRequires: texinfo, texinfo-tex, /usr/bin/pod2man
32 BuildRequires: systemtap-sdt-devel
33 BuildRequires: gmp-devel, mpfr-devel, libmpc-devel
34 BuildRequires: hostname, procps
35 BuildRequires: gdb
36 BuildRequires: glibc-devel
37 BuildRequires: elfutils-devel
38 BuildRequires: elfutils-libelf-devel
39 BuildRequires: glibc
40 BuildRequires: glibc-devel
41 BuildRequires: libunwind
42 BuildRequires: isl
43 BuildRequires: isl-devel
44 BuildRequires: doxygen
45 BuildRequires: graphviz, texlive-collection-latex
46
47
48 %description
49 This is the RISC-V fork of the GNU cross-compiler toolchain.  It
50 includes binutils and GCC.
51
52
53 %prep
54 %setup -q -n %{name}-@COMMIT@
55
56
57 %build
58 # This only works if you build in a build subdirectory.
59 mkdir build
60 pushd build
61 ../configure --prefix=%{_prefix} --libdir=%{_libdir}
62
63 # The ordinary Makefile downloads upstream GNU packages.  Instead we
64 # provide these as local files.  Note this is "DISTDIR" not "DESTDIR".
65 export DISTDIR=%{_sourcedir}
66
67 # Since the Makefile installs as it goes along, clean the buildroot
68 # now (instead of at the top of install).
69 rm -rf $RPM_BUILD_ROOT
70 mkdir -p $RPM_BUILD_ROOT
71 export DESTDIR=$RPM_BUILD_ROOT
72
73 # We need to use the tools we built as we go along.
74 export PATH=$RPM_BUILD_ROOT/usr/bin:$RPM_BUILD_ROOT/bin:$PATH
75
76 make
77
78 # The 'make linux' rule builds GCC linked against glibc (instead of
79 # newlib).
80 # Set RISCV=...?
81 make linux SYSROOT=$RPM_BUILD_ROOT%{_prefix}/sysroot
82
83 popd
84
85
86 %install
87 # Not needed since the make installs as it goes along.
88 #pushd build
89 #make install DESTDIR=$RPM_BUILD_ROOT
90 #popd
91
92 # Remove some documentation, language files
93 rm -r $RPM_BUILD_ROOT%{_datadir}/info
94 rm -r $RPM_BUILD_ROOT%{_mandir}
95 rm -r $RPM_BUILD_ROOT%{_datadir}/locale
96
97 # Remove this libtool linker file.
98 rm $RPM_BUILD_ROOT%{_libdir}/libcc1.la
99
100
101 %files
102 %doc README.md
103 %{_bindir}/riscv64-unknown-elf-*
104 %{_bindir}/riscv64-unknown-linux-gnu-*
105 %{_libdir}/libcc1.so
106 %{_libdir}/libcc1.so.0
107 %{_libdir}/libcc1.so.0.0.0
108 %{_libexecdir}/gcc/riscv64-unknown-elf
109 %{_libexecdir}/gcc/riscv64-unknown-linux-gnu
110 %{_prefix}/lib/gcc/riscv64-unknown-elf
111 %{_prefix}/lib/gcc/riscv64-unknown-linux-gnu
112 %{_prefix}/riscv64-unknown-elf
113 %{_prefix}/riscv64-unknown-linux-gnu
114 %{_datadir}/gcc-@GCC_VERSION@
115 %{_prefix}/sysroot
116
117
118 %changelog