%define ARCH armv7l
%define ABI eabi
%endif
+%ifarch armv7hl
+%define ARCH armv7hl
+%define ABI eabihf
+%endif
%ifarch %ix86
%define ARCH i586
%endif
%ifarch aarch64
%define ARCH aarch64
%endif
+%ifarch riscv64
+%define ARCH riscv64
+%endif
%define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
%define target_cpu %{?cross}%{!?cross:%{ARCH}}
-%define target_abi %{?cross:%{?armv7l:eabi}}%{!?cross:%{?ABI}}
+%define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
%define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
+%if 0%{?run_tests}
+%{!?cross:
+%define binutils_run_tests 1
+}
+%endif
+
+%if 0%{?dump_configure}
+%define binutils_dump_configure 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all
+# binutils again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
Name: binutils%{?cross:-%{cross}}
+BuildRequires: binutils-libs
BuildRequires: makeinfo
BuildRequires: bison
BuildRequires: flex
BuildRequires: ncurses-devel
BuildRequires: zlib-devel
BuildRequires: gcc-c++
-Version: 2.25
+%if 0%{?binutils_run_tests}
+BuildRequires: dejagnu
+BuildRequires: glibc-devel-static
+%endif
+%if 0%{?binutils_dump_configure}
+BuildRequires: configure-dumper
+%endif
+Version: 2.42
Release: 0
Url: http://www.gnu.org/software/binutils/
Summary: GNU Binutils
size, strings, and strip. These utilities are needed whenever you want
to compile a program or kernel.
+%package libs
+Summary: Shared library files for binutils
+License: GPL-2.0+
+
+%description libs
+It contains the binutils shared libraries that applications can link
+to at runtime.
+%ifnarch riscv64
%package gold
Summary: The gold linker
License: GPL-3.0+
gold is an ELF linker. It is intended to have complete support for ELF
and to run as fast as possible on modern systems. For normal use it is
a drop-in replacement for the older GNU linker.
-
+%endif
%package devel
Summary: GNU binutils (BFD development files)
build programs which use the GNU BFD library, which is part of
binutils.
+%{?binutils_run_tests:
+%package testresults
+Summary: Testsuite results
+License: Public Domain
+Group: Development/Building
+%description testresults
+Results from running the binutils tests.
+}
+
+%{?binutils_dump_configure:
+%package configure-dump
+Summary: GNU Binutils configure dump
+License: GPL-3.0+
+Group: Development/Languages
+%description configure-dump
+This package contains dump of configure variables of Binutils
+}
%prep
%setup -q -n binutils-%{version}
export CFLAGS="${RPM_OPT_FLAGS}"
export CXXFLAGS="${RPM_OPT_FLAGS}"
-mkdir build-dir
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
+# Remove gdb and sim since they have separate gdb package
+rm -rf gdb gdbserver gdbsupport sim
+
+mkdir -p build-dir
cd build-dir
+%{!?binutils_skip_configure:
+%{?binutils_dump_configure:patch_configure.pl ..} # Add debug prints into configure
../configure \
--prefix=%{_prefix} --libdir=%{_libdir} \
--infodir=%{_infodir} --mandir=%{_mandir} \
--with-bugurl=http://bugs.tizen.org/ \
--with-sysroot=/ \
+%ifarch riscv64
+ --with-lib-path="=%{_libdir}" \
+%endif
--disable-nls \
--with-separate-debug-dir=%{_prefix}/lib/debug \
--with-pic \
--enable-64-bit-bfd \
} \
%{!?cross: \
- --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
+ --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux,riscv64-tizen-linux \
} \
--enable-plugins \
+%ifnarch riscv64
--enable-gold \
+%endif
--enable-shared \
- --enable-new-dtags
+ --enable-new-dtags \
+ --enable-relro=no \
+ --disable-gprofng \
+%ifarch %ix86
+ --disable-separate-code
+%endif
+
+}
+%{!?binutils_skip_make:
make %{?_smp_mflags}
+%{?binutils_dump_configure:
+ dump_configure.pl .. . \
+ --project binutils \
+ --project-version %{version} \
+ --out_db binutils-%{version}-%{release}-%_project-%_repository.db
+ }
+}
+
+%{?binutils_exit_on_make_finish:
+exit 1
+}
+
+%{?binutils_run_tests:
+echo "Run testsuite"
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ../testresults
+for tool in $(find -name '*.sum' -exec basename {} \; | sort -u | sed -e 's/.sum//'); do
+../contrib/dg-extract-results.sh -t $tool $(find -name '*.sum') | tee -a ../testresults/test_summary.txt
+done
+}
%install
cd build-dir
make DESTDIR=$RPM_BUILD_ROOT install
+export LINKERS="ld ld.bfd"
+%ifnarch riscv64
+# There's neither native gold nor cross-gold for riscv64 yet
+%{!?riscv64:export LINKERS="ld ld.bfd ld.gold"}
+%else
+%endif
+
# Copy instead of hardlinks
-for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
+for binary in ar as ${LINKERS} nm obj{dump,copy} ranlib strip
do
rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
%{!?cross:
install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
+%{?binutils_run_tests:
+ find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+ mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
+ find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
# Remove unwanted files to shut up rpm
%{remove_docs}
rm -rf %{buildroot}%{_bindir}/gcore
-rm -rf %{buildroot}%{_bindir}/gdb*
-rm -rf %{buildroot}%{_datadir}/gdb
-rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
+rm -rf %{buildroot}%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes,inproctrace,sframe}.la
%{?cross:
rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
rm -rf %{buildroot}%{_prefix}/%{host_arch}
rm -rf %{buildroot}%{_datadir}
}
+%{?binutils_dump_configure:
+ install -D -m 0644 binutils-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
%files
%manifest binutils.manifest
%defattr(-,root,root)
%{!?cross:
%exclude %{_bindir}/ld.gold
%exclude %{_prefix}/%{target_arch}/bin/ld.gold
-%{_libdir}/*.so
%{_prefix}/%{host_arch}/lib/ldscripts
+%files libs
+%{_libdir}/*.so*
+%{_libdir}/bfd-plugins/*.so
+
%files devel
%manifest binutils.manifest
%defattr(-,root,root)
%{_includedir}/*.h
-%{_includedir}/gdb/*.h
%{_libdir}/*.a
+%ifnarch riscv64
%files gold
%manifest binutils.manifest
%defattr(-,root,root)
%{_bindir}/ld.gold
%{_prefix}/%{target_arch}/bin/ld.gold
+%endif
+}
+
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
+%{?binutils_dump_configure:
+%files configure-dump
+%manifest binutils.manifest
+%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
}
%changelog
--- /dev/null
+%define cross armv7hl
+%define armv7hl 1
+
+%ifarch armv7l
+%define ARCH armv7l
+%define ABI eabi
+%endif
+%ifarch armv7hl
+%define ARCH armv7hl
+%define ABI eabihf
+%endif
+%ifarch %ix86
+%define ARCH i586
+%endif
+%ifarch x86_64
+%define ARCH x86_64
+%endif
+%ifarch aarch64
+%define ARCH aarch64
+%endif
+%ifarch riscv64
+%define ARCH riscv64
+%endif
+
+%define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
+
+%define target_cpu %{?cross}%{!?cross:%{ARCH}}
+%define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
+
+%define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
+
+%if 0%{?run_tests}
+%{!?cross:
+%define binutils_run_tests 1
+}
+%endif
+
+%if 0%{?dump_configure}
+%define binutils_dump_configure 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all
+# binutils again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
+Name: binutils%{?cross:-%{cross}}
+BuildRequires: binutils-libs
+BuildRequires: makeinfo
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: ncurses-devel
+BuildRequires: zlib-devel
+BuildRequires: gcc-c++
+%if 0%{?binutils_run_tests}
+BuildRequires: dejagnu
+BuildRequires: glibc-devel-static
+%endif
+%if 0%{?binutils_dump_configure}
+BuildRequires: configure-dumper
+%endif
+Version: 2.42
+Release: 0
+Url: http://www.gnu.org/software/binutils/
+Summary: GNU Binutils
+License: GFDL-1.3 and GPL-3.0+
+Group: Development/Building
+%{?cross:ExcludeArch: %{cross}}
+Source: binutils-%{version}.tar.bz2
+Source1001: binutils.manifest
+
+%description
+C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
+size, strings, and strip. These utilities are needed whenever you want
+to compile a program or kernel.
+
+%package libs
+Summary: Shared library files for binutils
+License: GPL-2.0+
+
+%description libs
+It contains the binutils shared libraries that applications can link
+to at runtime.
+
+%ifnarch riscv64
+%package gold
+Summary: The gold linker
+License: GPL-3.0+
+Group: Development/Building
+
+%description gold
+gold is an ELF linker. It is intended to have complete support for ELF
+and to run as fast as possible on modern systems. For normal use it is
+a drop-in replacement for the older GNU linker.
+%endif
+
+%package devel
+Summary: GNU binutils (BFD development files)
+License: GPL-3.0+
+Group: Development/Building
+Requires: zlib-devel
+
+%description devel
+This package includes header files and static libraries necessary to
+build programs which use the GNU BFD library, which is part of
+binutils.
+
+%{?binutils_run_tests:
+%package testresults
+Summary: Testsuite results
+License: Public Domain
+Group: Development/Building
+%description testresults
+Results from running the binutils tests.
+}
+
+%{?binutils_dump_configure:
+%package configure-dump
+Summary: GNU Binutils configure dump
+License: GPL-3.0+
+Group: Development/Languages
+%description configure-dump
+This package contains dump of configure variables of Binutils
+}
+
+%prep
+%setup -q -n binutils-%{version}
+cp %{SOURCE1001} .
+
+
+%build
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
+export CFLAGS="${RPM_OPT_FLAGS}"
+export CXXFLAGS="${RPM_OPT_FLAGS}"
+
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
+# Remove gdb and sim since they have separate gdb package
+rm -rf gdb gdbserver gdbsupport sim
+
+mkdir -p build-dir
+cd build-dir
+
+%{!?binutils_skip_configure:
+%{?binutils_dump_configure:patch_configure.pl ..} # Add debug prints into configure
+../configure \
+ --prefix=%{_prefix} --libdir=%{_libdir} \
+ --infodir=%{_infodir} --mandir=%{_mandir} \
+ --with-bugurl=http://bugs.tizen.org/ \
+ --with-sysroot=/ \
+%ifarch riscv64
+ --with-lib-path="=%{_libdir}" \
+%endif
+ --disable-nls \
+ --with-separate-debug-dir=%{_prefix}/lib/debug \
+ --with-pic \
+ --build=%{host_arch} --target=%{target_arch} \
+ --host=%{host_arch} \
+%{?cross: \
+ --enable-targets=%{target_arch} \
+ --enable-64-bit-bfd \
+} \
+%{!?cross: \
+ --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux,riscv64-tizen-linux \
+} \
+ --enable-plugins \
+%ifnarch riscv64
+ --enable-gold \
+%endif
+ --enable-shared \
+ --enable-new-dtags \
+ --enable-relro=no \
+ --disable-gprofng \
+%ifarch %ix86
+ --disable-separate-code
+%endif
+
+}
+
+%{!?binutils_skip_make:
+make %{?_smp_mflags}
+%{?binutils_dump_configure:
+ dump_configure.pl .. . \
+ --project binutils \
+ --project-version %{version} \
+ --out_db binutils-%{version}-%{release}-%_project-%_repository.db
+ }
+}
+
+%{?binutils_exit_on_make_finish:
+exit 1
+}
+
+%{?binutils_run_tests:
+echo "Run testsuite"
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ../testresults
+for tool in $(find -name '*.sum' -exec basename {} \; | sort -u | sed -e 's/.sum//'); do
+../contrib/dg-extract-results.sh -t $tool $(find -name '*.sum') | tee -a ../testresults/test_summary.txt
+done
+}
+
+%install
+cd build-dir
+make DESTDIR=$RPM_BUILD_ROOT install
+
+export LINKERS="ld ld.bfd"
+%ifnarch riscv64
+# There's neither native gold nor cross-gold for riscv64 yet
+%{!?riscv64:export LINKERS="ld ld.bfd ld.gold"}
+%else
+%endif
+
+# Copy instead of hardlinks
+for binary in ar as ${LINKERS} nm obj{dump,copy} ranlib strip
+do
+ rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
+%{!?cross:
+ cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
+}
+%{?cross:
+ cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
+}
+done
+
+install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
+install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
+
+%{?binutils_run_tests:
+ find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+ mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
+ find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
+# Remove unwanted files to shut up rpm
+%{remove_docs}
+rm -rf %{buildroot}%{_bindir}/gcore
+rm -rf %{buildroot}%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes,inproctrace,sframe}.la
+%{?cross:
+rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
+rm -rf %{buildroot}%{_prefix}/%{host_arch}
+rm -rf %{buildroot}%{_includedir}
+rm -rf %{buildroot}%{_prefix}/lib*
+rm -rf %{buildroot}%{_datadir}
+}
+
+%{?binutils_dump_configure:
+ install -D -m 0644 binutils-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
+%files
+%manifest binutils.manifest
+%defattr(-,root,root)
+%{_bindir}/*
+%{_prefix}/%{target_arch}/bin/*
+%{!?cross:
+%exclude %{_bindir}/ld.gold
+%exclude %{_prefix}/%{target_arch}/bin/ld.gold
+%{_prefix}/%{host_arch}/lib/ldscripts
+
+%files libs
+%{_libdir}/*.so*
+%{_libdir}/bfd-plugins/*.so
+
+%files devel
+%manifest binutils.manifest
+%defattr(-,root,root)
+%{_includedir}/*.h
+%{_libdir}/*.a
+
+%ifnarch riscv64
+%files gold
+%manifest binutils.manifest
+%defattr(-,root,root)
+%{_bindir}/ld.gold
+%{_prefix}/%{target_arch}/bin/ld.gold
+%endif
+}
+
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
+%{?binutils_dump_configure:
+%files configure-dump
+%manifest binutils.manifest
+%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
+%changelog
%define ARCH armv7l
%define ABI eabi
%endif
+%ifarch armv7hl
+%define ARCH armv7hl
+%define ABI eabihf
+%endif
%ifarch %ix86
%define ARCH i586
%endif
%ifarch aarch64
%define ARCH aarch64
%endif
+%ifarch riscv64
+%define ARCH riscv64
+%endif
%define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
%define target_cpu %{?cross}%{!?cross:%{ARCH}}
-%define target_abi %{?cross:%{?armv7l:eabi}}%{!?cross:%{?ABI}}
+%define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
%define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
+%if 0%{?run_tests}
+%{!?cross:
+%define binutils_run_tests 1
+}
+%endif
+
+%if 0%{?dump_configure}
+%define binutils_dump_configure 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all
+# binutils again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
Name: binutils%{?cross:-%{cross}}
+BuildRequires: binutils-libs
BuildRequires: makeinfo
BuildRequires: bison
BuildRequires: flex
BuildRequires: ncurses-devel
BuildRequires: zlib-devel
BuildRequires: gcc-c++
-Version: 2.25
+%if 0%{?binutils_run_tests}
+BuildRequires: dejagnu
+BuildRequires: glibc-devel-static
+%endif
+%if 0%{?binutils_dump_configure}
+BuildRequires: configure-dumper
+%endif
+Version: 2.42
Release: 0
Url: http://www.gnu.org/software/binutils/
Summary: GNU Binutils
size, strings, and strip. These utilities are needed whenever you want
to compile a program or kernel.
+%package libs
+Summary: Shared library files for binutils
+License: GPL-2.0+
+
+%description libs
+It contains the binutils shared libraries that applications can link
+to at runtime.
+%ifnarch riscv64
%package gold
Summary: The gold linker
License: GPL-3.0+
gold is an ELF linker. It is intended to have complete support for ELF
and to run as fast as possible on modern systems. For normal use it is
a drop-in replacement for the older GNU linker.
-
+%endif
%package devel
Summary: GNU binutils (BFD development files)
build programs which use the GNU BFD library, which is part of
binutils.
+%{?binutils_run_tests:
+%package testresults
+Summary: Testsuite results
+License: Public Domain
+Group: Development/Building
+%description testresults
+Results from running the binutils tests.
+}
+
+%{?binutils_dump_configure:
+%package configure-dump
+Summary: GNU Binutils configure dump
+License: GPL-3.0+
+Group: Development/Languages
+%description configure-dump
+This package contains dump of configure variables of Binutils
+}
%prep
%setup -q -n binutils-%{version}
export CFLAGS="${RPM_OPT_FLAGS}"
export CXXFLAGS="${RPM_OPT_FLAGS}"
-mkdir build-dir
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
+# Remove gdb and sim since they have separate gdb package
+rm -rf gdb gdbserver gdbsupport sim
+
+mkdir -p build-dir
cd build-dir
+%{!?binutils_skip_configure:
+%{?binutils_dump_configure:patch_configure.pl ..} # Add debug prints into configure
../configure \
--prefix=%{_prefix} --libdir=%{_libdir} \
--infodir=%{_infodir} --mandir=%{_mandir} \
--with-bugurl=http://bugs.tizen.org/ \
--with-sysroot=/ \
+%ifarch riscv64
+ --with-lib-path="=%{_libdir}" \
+%endif
--disable-nls \
--with-separate-debug-dir=%{_prefix}/lib/debug \
--with-pic \
--enable-64-bit-bfd \
} \
%{!?cross: \
- --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
+ --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux,riscv64-tizen-linux \
} \
--enable-plugins \
+%ifnarch riscv64
--enable-gold \
+%endif
--enable-shared \
- --enable-new-dtags
+ --enable-new-dtags \
+ --enable-relro=no \
+ --disable-gprofng \
+%ifarch %ix86
+ --disable-separate-code
+%endif
+
+}
+%{!?binutils_skip_make:
make %{?_smp_mflags}
+%{?binutils_dump_configure:
+ dump_configure.pl .. . \
+ --project binutils \
+ --project-version %{version} \
+ --out_db binutils-%{version}-%{release}-%_project-%_repository.db
+ }
+}
+
+%{?binutils_exit_on_make_finish:
+exit 1
+}
+
+%{?binutils_run_tests:
+echo "Run testsuite"
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ../testresults
+for tool in $(find -name '*.sum' -exec basename {} \; | sort -u | sed -e 's/.sum//'); do
+../contrib/dg-extract-results.sh -t $tool $(find -name '*.sum') | tee -a ../testresults/test_summary.txt
+done
+}
%install
cd build-dir
make DESTDIR=$RPM_BUILD_ROOT install
+export LINKERS="ld ld.bfd"
+%ifnarch riscv64
+# There's neither native gold nor cross-gold for riscv64 yet
+%{!?riscv64:export LINKERS="ld ld.bfd ld.gold"}
+%else
+%endif
+
# Copy instead of hardlinks
-for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
+for binary in ar as ${LINKERS} nm obj{dump,copy} ranlib strip
do
rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
%{!?cross:
install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
+%{?binutils_run_tests:
+ find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+ mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
+ find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
# Remove unwanted files to shut up rpm
%{remove_docs}
rm -rf %{buildroot}%{_bindir}/gcore
-rm -rf %{buildroot}%{_bindir}/gdb*
-rm -rf %{buildroot}%{_datadir}/gdb
-rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
+rm -rf %{buildroot}%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes,inproctrace,sframe}.la
%{?cross:
rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
rm -rf %{buildroot}%{_prefix}/%{host_arch}
rm -rf %{buildroot}%{_datadir}
}
+%{?binutils_dump_configure:
+ install -D -m 0644 binutils-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
%files
%manifest binutils.manifest
%defattr(-,root,root)
%{!?cross:
%exclude %{_bindir}/ld.gold
%exclude %{_prefix}/%{target_arch}/bin/ld.gold
-%{_libdir}/*.so
%{_prefix}/%{host_arch}/lib/ldscripts
+%files libs
+%{_libdir}/*.so*
+%{_libdir}/bfd-plugins/*.so
+
%files devel
%manifest binutils.manifest
%defattr(-,root,root)
%{_includedir}/*.h
-%{_includedir}/gdb/*.h
%{_libdir}/*.a
+%ifnarch riscv64
%files gold
%manifest binutils.manifest
%defattr(-,root,root)
%{_bindir}/ld.gold
%{_prefix}/%{target_arch}/bin/ld.gold
+%endif
+}
+
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
+%{?binutils_dump_configure:
+%files configure-dump
+%manifest binutils.manifest
+%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
}
%changelog
--- /dev/null
+%define cross riscv64
+%define riscv64 1
+
+%ifarch armv7l
+%define ARCH armv7l
+%define ABI eabi
+%endif
+%ifarch armv7hl
+%define ARCH armv7hl
+%define ABI eabihf
+%endif
+%ifarch %ix86
+%define ARCH i586
+%endif
+%ifarch x86_64
+%define ARCH x86_64
+%endif
+%ifarch aarch64
+%define ARCH aarch64
+%endif
+%ifarch riscv64
+%define ARCH riscv64
+%endif
+
+%define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
+
+%define target_cpu %{?cross}%{!?cross:%{ARCH}}
+%define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
+
+%define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
+
+%if 0%{?run_tests}
+%{!?cross:
+%define binutils_run_tests 1
+}
+%endif
+
+%if 0%{?dump_configure}
+%define binutils_dump_configure 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all
+# binutils again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
+Name: binutils%{?cross:-%{cross}}
+BuildRequires: binutils-libs
+BuildRequires: makeinfo
+BuildRequires: bison
+BuildRequires: flex
+BuildRequires: ncurses-devel
+BuildRequires: zlib-devel
+BuildRequires: gcc-c++
+%if 0%{?binutils_run_tests}
+BuildRequires: dejagnu
+BuildRequires: glibc-devel-static
+%endif
+%if 0%{?binutils_dump_configure}
+BuildRequires: configure-dumper
+%endif
+Version: 2.42
+Release: 0
+Url: http://www.gnu.org/software/binutils/
+Summary: GNU Binutils
+License: GFDL-1.3 and GPL-3.0+
+Group: Development/Building
+%{?cross:ExcludeArch: %{cross}}
+Source: binutils-%{version}.tar.bz2
+Source1001: binutils.manifest
+
+%description
+C compiler utilities: ar, as, gprof, ld, nm, objcopy, objdump, ranlib,
+size, strings, and strip. These utilities are needed whenever you want
+to compile a program or kernel.
+
+%package libs
+Summary: Shared library files for binutils
+License: GPL-2.0+
+
+%description libs
+It contains the binutils shared libraries that applications can link
+to at runtime.
+
+%ifnarch riscv64
+%package gold
+Summary: The gold linker
+License: GPL-3.0+
+Group: Development/Building
+
+%description gold
+gold is an ELF linker. It is intended to have complete support for ELF
+and to run as fast as possible on modern systems. For normal use it is
+a drop-in replacement for the older GNU linker.
+%endif
+
+%package devel
+Summary: GNU binutils (BFD development files)
+License: GPL-3.0+
+Group: Development/Building
+Requires: zlib-devel
+
+%description devel
+This package includes header files and static libraries necessary to
+build programs which use the GNU BFD library, which is part of
+binutils.
+
+%{?binutils_run_tests:
+%package testresults
+Summary: Testsuite results
+License: Public Domain
+Group: Development/Building
+%description testresults
+Results from running the binutils tests.
+}
+
+%{?binutils_dump_configure:
+%package configure-dump
+Summary: GNU Binutils configure dump
+License: GPL-3.0+
+Group: Development/Languages
+%description configure-dump
+This package contains dump of configure variables of Binutils
+}
+
+%prep
+%setup -q -n binutils-%{version}
+cp %{SOURCE1001} .
+
+
+%build
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Wno-error %{?cross:-DIGNORE_BROKEN_PLUGINS}"
+export CFLAGS="${RPM_OPT_FLAGS}"
+export CXXFLAGS="${RPM_OPT_FLAGS}"
+
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
+# Remove gdb and sim since they have separate gdb package
+rm -rf gdb gdbserver gdbsupport sim
+
+mkdir -p build-dir
+cd build-dir
+
+%{!?binutils_skip_configure:
+%{?binutils_dump_configure:patch_configure.pl ..} # Add debug prints into configure
+../configure \
+ --prefix=%{_prefix} --libdir=%{_libdir} \
+ --infodir=%{_infodir} --mandir=%{_mandir} \
+ --with-bugurl=http://bugs.tizen.org/ \
+ --with-sysroot=/ \
+%ifarch riscv64
+ --with-lib-path="=%{_libdir}" \
+%endif
+ --disable-nls \
+ --with-separate-debug-dir=%{_prefix}/lib/debug \
+ --with-pic \
+ --build=%{host_arch} --target=%{target_arch} \
+ --host=%{host_arch} \
+%{?cross: \
+ --enable-targets=%{target_arch} \
+ --enable-64-bit-bfd \
+} \
+%{!?cross: \
+ --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux,riscv64-tizen-linux \
+} \
+ --enable-plugins \
+%ifnarch riscv64
+ --enable-gold \
+%endif
+ --enable-shared \
+ --enable-new-dtags \
+ --enable-relro=no \
+ --disable-gprofng \
+%ifarch %ix86
+ --disable-separate-code
+%endif
+
+}
+
+%{!?binutils_skip_make:
+make %{?_smp_mflags}
+%{?binutils_dump_configure:
+ dump_configure.pl .. . \
+ --project binutils \
+ --project-version %{version} \
+ --out_db binutils-%{version}-%{release}-%_project-%_repository.db
+ }
+}
+
+%{?binutils_exit_on_make_finish:
+exit 1
+}
+
+%{?binutils_run_tests:
+echo "Run testsuite"
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ../testresults
+for tool in $(find -name '*.sum' -exec basename {} \; | sort -u | sed -e 's/.sum//'); do
+../contrib/dg-extract-results.sh -t $tool $(find -name '*.sum') | tee -a ../testresults/test_summary.txt
+done
+}
+
+%install
+cd build-dir
+make DESTDIR=$RPM_BUILD_ROOT install
+
+export LINKERS="ld ld.bfd"
+%ifnarch riscv64
+# There's neither native gold nor cross-gold for riscv64 yet
+%{!?riscv64:export LINKERS="ld ld.bfd ld.gold"}
+%else
+%endif
+
+# Copy instead of hardlinks
+for binary in ar as ${LINKERS} nm obj{dump,copy} ranlib strip
+do
+ rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
+%{!?cross:
+ cp %{buildroot}%{_bindir}/$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
+}
+%{?cross:
+ cp %{buildroot}%{_bindir}/%{target_arch}-$binary %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
+}
+done
+
+install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
+install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
+
+%{?binutils_run_tests:
+ find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+ mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
+ find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
+# Remove unwanted files to shut up rpm
+%{remove_docs}
+rm -rf %{buildroot}%{_bindir}/gcore
+rm -rf %{buildroot}%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes,inproctrace,sframe}.la
+%{?cross:
+rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
+rm -rf %{buildroot}%{_prefix}/%{host_arch}
+rm -rf %{buildroot}%{_includedir}
+rm -rf %{buildroot}%{_prefix}/lib*
+rm -rf %{buildroot}%{_datadir}
+}
+
+%{?binutils_dump_configure:
+ install -D -m 0644 binutils-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
+%files
+%manifest binutils.manifest
+%defattr(-,root,root)
+%{_bindir}/*
+%{_prefix}/%{target_arch}/bin/*
+%{!?cross:
+%exclude %{_bindir}/ld.gold
+%exclude %{_prefix}/%{target_arch}/bin/ld.gold
+%{_prefix}/%{host_arch}/lib/ldscripts
+
+%files libs
+%{_libdir}/*.so*
+%{_libdir}/bfd-plugins/*.so
+
+%files devel
+%manifest binutils.manifest
+%defattr(-,root,root)
+%{_includedir}/*.h
+%{_libdir}/*.a
+
+%ifnarch riscv64
+%files gold
+%manifest binutils.manifest
+%defattr(-,root,root)
+%{_bindir}/ld.gold
+%{_prefix}/%{target_arch}/bin/ld.gold
+%endif
+}
+
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
+%{?binutils_dump_configure:
+%files configure-dump
+%manifest binutils.manifest
+%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
+%changelog
%define ARCH armv7l
%define ABI eabi
%endif
+%ifarch armv7hl
+%define ARCH armv7hl
+%define ABI eabihf
+%endif
%ifarch %ix86
%define ARCH i586
%endif
%ifarch aarch64
%define ARCH aarch64
%endif
+%ifarch riscv64
+%define ARCH riscv64
+%endif
%define host_arch %{ARCH}-tizen-linux-gnu%{?ABI}
%define target_cpu %{?cross}%{!?cross:%{ARCH}}
-%define target_abi %{?cross:%{?armv7l:eabi}}%{!?cross:%{?ABI}}
+%define target_abi %{?cross:%{?armv7l:eabi}%{?armv7hl:eabihf}}%{!?cross:%{?ABI}}
%define target_arch %{target_cpu}-tizen-linux-gnu%{?target_abi}
+%if 0%{?run_tests}
+%{!?cross:
+%define binutils_run_tests 1
+}
+%endif
+
+%if 0%{?dump_configure}
+%define binutils_dump_configure 1
+%endif
+
+# Enable this when testing on device to:
+# 1. Enable macro to turn on testsuite building ('binutils_run_tests 1')
+# 2. Keep 'build-dir/' folder in build stage as we do not want to rebuild all
+# binutils again on device after invoking rpmbuild --short-circuit -bc ...
+# 3. Skip configure and make commands and go directly to 'make check'
+%if 0%{?run_tests_on_device}
+%define binutils_run_tests 1
+%define binutils_keep_build_dir 1
+%define binutils_skip_configure 1
+%define binutils_skip_make 1
+%endif
+
+# Exit right after 'make ..' step to keep all object files produced by binutils build
+%if 0%{?exit_on_make_finish}
+%define binutils_exit_on_make_finish 1
+%endif
+
Name: binutils%{?cross:-%{cross}}
+BuildRequires: binutils-libs
BuildRequires: makeinfo
BuildRequires: bison
BuildRequires: flex
BuildRequires: ncurses-devel
BuildRequires: zlib-devel
BuildRequires: gcc-c++
-Version: 2.25
+%if 0%{?binutils_run_tests}
+BuildRequires: dejagnu
+BuildRequires: glibc-devel-static
+%endif
+%if 0%{?binutils_dump_configure}
+BuildRequires: configure-dumper
+%endif
+Version: 2.42
Release: 0
Url: http://www.gnu.org/software/binutils/
Summary: GNU Binutils
size, strings, and strip. These utilities are needed whenever you want
to compile a program or kernel.
+%package libs
+Summary: Shared library files for binutils
+License: GPL-2.0+
+
+%description libs
+It contains the binutils shared libraries that applications can link
+to at runtime.
+%ifnarch riscv64
%package gold
Summary: The gold linker
License: GPL-3.0+
gold is an ELF linker. It is intended to have complete support for ELF
and to run as fast as possible on modern systems. For normal use it is
a drop-in replacement for the older GNU linker.
-
+%endif
%package devel
Summary: GNU binutils (BFD development files)
build programs which use the GNU BFD library, which is part of
binutils.
+%{?binutils_run_tests:
+%package testresults
+Summary: Testsuite results
+License: Public Domain
+Group: Development/Building
+%description testresults
+Results from running the binutils tests.
+}
+
+%{?binutils_dump_configure:
+%package configure-dump
+Summary: GNU Binutils configure dump
+License: GPL-3.0+
+Group: Development/Languages
+%description configure-dump
+This package contains dump of configure variables of Binutils
+}
%prep
%setup -q -n binutils-%{version}
export CFLAGS="${RPM_OPT_FLAGS}"
export CXXFLAGS="${RPM_OPT_FLAGS}"
-mkdir build-dir
+%{!?binutils_keep_build_dir:
+rm -rf build-dir
+}
+# Remove gdb and sim since they have separate gdb package
+rm -rf gdb gdbserver gdbsupport sim
+
+mkdir -p build-dir
cd build-dir
+%{!?binutils_skip_configure:
+%{?binutils_dump_configure:patch_configure.pl ..} # Add debug prints into configure
../configure \
--prefix=%{_prefix} --libdir=%{_libdir} \
--infodir=%{_infodir} --mandir=%{_mandir} \
--with-bugurl=http://bugs.tizen.org/ \
--with-sysroot=/ \
+%ifarch riscv64
+ --with-lib-path="=%{_libdir}" \
+%endif
--disable-nls \
--with-separate-debug-dir=%{_prefix}/lib/debug \
--with-pic \
--enable-64-bit-bfd \
} \
%{!?cross: \
- --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux \
+ --enable-targets=aarch64-tizen-linux,armv7l-tizen-linux,armv7hl-tizen-linux,armv8l-tizen-linux,i686-tizen-linux,x86_64-tizen-linux,riscv64-tizen-linux \
} \
--enable-plugins \
+%ifnarch riscv64
--enable-gold \
+%endif
--enable-shared \
- --enable-new-dtags
+ --enable-new-dtags \
+ --enable-relro=no \
+ --disable-gprofng \
+%ifarch %ix86
+ --disable-separate-code
+%endif
+
+}
+%{!?binutils_skip_make:
make %{?_smp_mflags}
+%{?binutils_dump_configure:
+ dump_configure.pl .. . \
+ --project binutils \
+ --project-version %{version} \
+ --out_db binutils-%{version}-%{release}-%_project-%_repository.db
+ }
+}
+
+%{?binutils_exit_on_make_finish:
+exit 1
+}
+
+%{?binutils_run_tests:
+echo "Run testsuite"
+# asan needs a whole shadow address space
+ulimit -v unlimited || true
+make -k check %{?_smp_mflags} || true
+mkdir ../testresults
+for tool in $(find -name '*.sum' -exec basename {} \; | sort -u | sed -e 's/.sum//'); do
+../contrib/dg-extract-results.sh -t $tool $(find -name '*.sum') | tee -a ../testresults/test_summary.txt
+done
+}
%install
cd build-dir
make DESTDIR=$RPM_BUILD_ROOT install
+export LINKERS="ld ld.bfd"
+%ifnarch riscv64
+# There's neither native gold nor cross-gold for riscv64 yet
+%{!?riscv64:export LINKERS="ld ld.bfd ld.gold"}
+%else
+%endif
+
# Copy instead of hardlinks
-for binary in ar as ld{,.bfd,.gold} nm obj{dump,copy} ranlib strip
+for binary in ar as ${LINKERS} nm obj{dump,copy} ranlib strip
do
rm %{buildroot}%{_prefix}/%{target_arch}/bin/$binary
%{!?cross:
install -m 644 libiberty/pic/libiberty.a %{buildroot}%{_prefix}/%{_lib}
install -m 644 ../include/libiberty.h %{buildroot}%{_prefix}/include
+%{?binutils_run_tests:
+ find . \( -name "*.sum" -o -name "*.log" -a \! -name "config.log" \) -exec tar -rf testresults.tar {} \;
+ mkdir -p ../testresults && tar -xf testresults.tar -C ../testresults
+ find ../testresults/ -type f -exec chmod 644 {} \;
+}
+
# Remove unwanted files to shut up rpm
%{remove_docs}
rm -rf %{buildroot}%{_bindir}/gcore
-rm -rf %{buildroot}%{_bindir}/gdb*
-rm -rf %{buildroot}%{_datadir}/gdb
-rm -rf %{buildroot}%{_libdir}/lib{bfd,opcodes,inproctrace}.{so,la}
+rm -rf %{buildroot}%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes,inproctrace,sframe}.la
%{?cross:
rm -rf %{buildroot}%{_prefix}/%{target_arch}/lib/ldscripts
rm -rf %{buildroot}%{_prefix}/%{host_arch}
rm -rf %{buildroot}%{_datadir}
}
+%{?binutils_dump_configure:
+ install -D -m 0644 binutils-%{version}-%{release}-%_project-%_repository.db %{buildroot}%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
+}
+
%files
%manifest binutils.manifest
%defattr(-,root,root)
%{!?cross:
%exclude %{_bindir}/ld.gold
%exclude %{_prefix}/%{target_arch}/bin/ld.gold
-%{_libdir}/*.so
%{_prefix}/%{host_arch}/lib/ldscripts
+%files libs
+%{_libdir}/*.so*
+%{_libdir}/bfd-plugins/*.so
+
%files devel
%manifest binutils.manifest
%defattr(-,root,root)
%{_includedir}/*.h
-%{_includedir}/gdb/*.h
%{_libdir}/*.a
+%ifnarch riscv64
%files gold
%manifest binutils.manifest
%defattr(-,root,root)
%{_bindir}/ld.gold
%{_prefix}/%{target_arch}/bin/ld.gold
+%endif
+}
+
+%{?binutils_run_tests:
+%files testresults
+%defattr(-,root,root)
+%doc testresults/test_summary.txt
+%doc testresults/*
+}
+
+%{?binutils_dump_configure:
+%files configure-dump
+%manifest binutils.manifest
+%{_datadir}/binutils-%{version}-%{release}-%_project-%_repository.db
}
%changelog
# the script takes binutils* and creates the cross-* packages
# sh4 is stuck in the testsuite
-for arch in armv7l aarch64; do
+for arch in armv7l armv7hl aarch64 riscv64; do
echo -n "Building package for $arch --> binutils-$arch ..."