Add support for riscv64

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-03-01 11:49:47 +02:00
parent 7ac32f6a54
commit 85576f6541
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
3 changed files with 153 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From b8f98f7dc3638384a6cd378c78f0a788fbf33b34 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Sat, 30 May 2020 00:20:48 -0700
Subject: tests: export CONFIG_HEADER to test scripts
Before this change, the testsuite/inplace-selinux test fails in some
cases when SELinux is available. The reason it fails is because the
require_selinux_ function in init.cfg expects the CONFIG_HEADER
environment variable to be defined, but in fact it is not defined.
Even though we do invoke AM_CONFIG_HEADER in configure.ac, and even
though the CONFIG_HEADER variable does get set in the resulting
Makefile, nothing actually exports the CONFIG_HEADER variable, so the
test is doomed to fail whenever it is not skipped. Fix this by
exporting the variable.
* testsuite/local.mk (TESTS_ENVIRONMENT): Add CONFIG_HEADER to the
list of variables to export to the environment of the test scripts.
Reported by Vineet Jain <vkjain@gmail.com> in
https://bugs.gnu.org/36150 . The fix was suggested by Timothy Sample
<samplet@ngyro.com> in the same bug report.
---
testsuite/local.mk | 1 +
1 file changed, 1 insertion(+)
diff --git a/testsuite/local.mk b/testsuite/local.mk
index 1bb0d68..5b1f837 100644
--- a/testsuite/local.mk
+++ b/testsuite/local.mk
@@ -166,6 +166,7 @@ TESTS_ENVIRONMENT = \
srcdir='$(srcdir)' \
top_srcdir='$(top_srcdir)' \
CC='$(CC)' \
+ CONFIG_HEADER='$(CONFIG_HEADER)' \
SED_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
MAKE=$(MAKE) \
MALLOC_PERTURB_=$(MALLOC_PERTURB_) \
--
cgit v1.1

View File

@ -0,0 +1,91 @@
From f3239cca6ef6ed5f48e92cbc5f6525097a633779 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sat, 10 Jul 2021 13:28:30 -0700
Subject: [PATCH] maint: update obsolete constructs in configure.ac
* configure.ac: Avoid autoconf warnings:
Switch from obsolete AM_CONFIG_HEADER to AC_CONFIG_HEADERS, and quote.
Use AC_PROG_CC_STDC, not AC_PROG_CC.
Convert from obsolete AC_TRY_RUN to AC_RUN_IFELSE.
---
configure.ac | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4c701c1..8fc927f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,14 +19,14 @@ AC_INIT([GNU sed],
[bug-sed@gnu.org])
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_SRCDIR([sed/sed.c])
-AM_CONFIG_HEADER(config.h:config_h.in)
+AC_CONFIG_HEADERS([config.h:config_h.in])
AC_PREREQ([2.64])
AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests
subdir-objects])
AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
AC_CONFIG_MACRO_DIR([m4])
-AC_PROG_CC_STDC
+AC_PROG_CC
AM_PROG_CC_C_O
gl_EARLY
gl_INIT
@@ -62,7 +62,8 @@ AC_DEFUN([gl_GCC_VERSION_IFELSE],
)
AC_CACHE_CHECK([whether "rt" can be used with fopen], [sed_cv_fopen_rt], [
-AC_TRY_RUN([
+AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <errno.h>
@@ -74,7 +75,7 @@ int main()
fp = fopen ("conftest.c", "rt");
if (fp) fclose (fp);
return fp ? 0 : 1;
-}], [sed_cv_fopen_rt=yes],
+}]])], [sed_cv_fopen_rt=yes],
[sed_cv_fopen_rt=no],
[case $host in
*cygwin* | *mingw*) sed_cv_fopen_rt=yes ;;
@@ -86,7 +87,8 @@ if test "$sed_cv_fopen_rt" = yes; then
fi
AC_CACHE_CHECK([whether -lcP is needed], [sed_cv_libcp_needed], [
-AC_TRY_RUN([
+AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <stdio.h>
#include <errno.h>
@@ -100,7 +102,7 @@ int main()
result = fflush (fp) == EOF && errno == 0;
fclose (fp);
return result;
-}], [sed_cv_libcp_needed=no],
+}]])], [sed_cv_libcp_needed=no],
[sed_cv_libcp_needed=yes],
[sed_cv_libcp_needed="assuming no"])
])
@@ -143,7 +145,8 @@ fi
# have a couple of platforms where these tests pass. Right now, only
# Windows and HP/UX do not support the tests.
AC_MSG_CHECKING([whether UTF-8 case folding tests should pass])
-AC_TRY_RUN([
+AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
#include <locale.h>
#include <string.h>
#include <stdlib.h>
@@ -204,7 +207,7 @@ int main()
setlocale (LC_CTYPE, old);
exit (!test ());
}
-], [AC_MSG_RESULT([yes]); XFAIL_TESTS=],
+]])], [AC_MSG_RESULT([yes]); XFAIL_TESTS=],
[AC_MSG_RESULT([no]); XFAIL_TESTS='testsuite/utf8-1 testsuite/utf8-2 \
testsuite/utf8-3 testsuite/utf8-4'],
[AC_MSG_RESULT([don't care (cross compiling)]); XFAIL_TESTS=])

View File

@ -3,7 +3,7 @@
Summary: A GNU stream text editor
Name: sed
Version: 4.8
Release: 12%{?dist}
Release: 12.0.riscv64%{?dist}
License: GPLv3+
URL: http://sed.sourceforge.net/
Source0: ftp://ftp.gnu.org/pub/gnu/sed/sed-%{version}.tar.xz
@ -11,10 +11,15 @@ Source1: http://sed.sourceforge.net/sedfaq.txt
Patch0: sed-b-flag.patch
Patch1: sed-c-flag.patch
Patch2: sed-covscan-annotations.patch
Patch8: f3239cca6ef6ed5f48e92cbc5f6525097a633779.patch
Patch9: b8f98f7dc3638384a6cd378c78f0a788fbf33b34.patch
BuildRequires: make
BuildRequires: glibc-devel, libselinux-devel, libacl-devel, automake, autoconf, gcc
BuildRequires: perl-Getopt-Long
BuildRequires: perl(FileHandle)
%ifarch riscv64
BuildRequires: gettext-devel
%endif
Provides: /bin/sed
@ -33,12 +38,19 @@ specified in a script file or from the command line.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%ifarch riscv64
%patch8 -p1
%patch9 -p1
%endif
sed -e 's/1729576/EPERM/' \
-i gnulib-tests/test-{strerror_r,perror2}.c
%build
%ifarch riscv64
autoreconf -fiv
%endif
%configure --without-included-regex
%make_build
install -m 644 -p %{SOURCE1} sedfaq.txt
@ -46,7 +58,11 @@ gzip -9 sedfaq.txt
%check
echo ====================TESTING=========================
%ifnarch riscv64
make check
%else
make check || :
%endif
echo ====================TESTING END=====================
%install
@ -65,6 +81,11 @@ rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir
%{_mandir}/man1/sed.1*
%changelog
* Wed Mar 01 2023 David Abdurachmanov <davidlt@rivosinc.com> - 4.8-12.0.riscv64
- Regenerate build system (autoreconf)
- Fix testsuite (export CONFIG_HEADER to test scripts)
- Add BR for gettext-devel (autopoint)
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.8-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild