From cf94c9b4492424714a34cf015a9c693a0baaef9664ec1773a92220e7e7da7193 Mon Sep 17 00:00:00 2001 From: Fred Fu Date: Thu, 25 Jul 2024 14:41:56 +0000 Subject: [PATCH] - Switch over to pb (Platform without native-code Backend) for architectures which do not build - Add patch racket-fortify.patch to make it build with latest gcc OBS-URL: https://build.opensuse.org/package/show/devel:languages:misc/racket?expand=0&rev=87 --- _constraints | 18 +++++++++++++++ racket-fortify.patch | 53 +++++++++++++++++++++++++++++++++++++++++++ racket.changes | 7 ++++++ racket.spec | 54 ++++++++++++++++++++++++++++---------------- 4 files changed, 113 insertions(+), 19 deletions(-) create mode 100644 racket-fortify.patch diff --git a/_constraints b/_constraints index 4b58efc..b360d26 100644 --- a/_constraints +++ b/_constraints @@ -28,4 +28,22 @@ + + + ppc64le + s390x + + + + 8 + + + 12 + + 8 + + 4 + + + diff --git a/racket-fortify.patch b/racket-fortify.patch new file mode 100644 index 0000000..5c57638 --- /dev/null +++ b/racket-fortify.patch @@ -0,0 +1,53 @@ +--- + src/rktio/rktio_fs.c | 4 +++- + src/start/ustart.c | 5 +++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- src/rktio/rktio_fs.c ++++ src/rktio/rktio_fs.c 2024-06-18 12:25:03.035413375 +0000 +@@ -1,6 +1,7 @@ + #include "rktio.h" + #include "rktio_private.h" + #include ++#include + #include + #include + #include +@@ -1092,7 +1093,8 @@ char *rktio_readlink(rktio_t *rktio, con + return NULL; + } + #else +- int len, buf_len = 256; ++ ssize_t len; ++ size_t buf_len = PATH_MAX; + char *buffer = malloc(buf_len); + + while (1) { +--- src/start/ustart.c ++++ src/start/ustart.c 2024-06-18 12:25:13.635224103 +0000 +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + #include + + #if defined(__GNUC__) +@@ -266,7 +267,7 @@ int main(int argc, char **argv) + char *exe_path, *lib_path, *dll_path; + int start, decl_end, prog_end, end, count, fd, v, en, x11; + int argpos, inpos, collcount = 1, fix_argv; +- int bufsize = 127; ++ size_t bufsize = PATH_MAX; + + if (config[7] == '[') { + write_str(2, argv[0]); +@@ -280,7 +281,7 @@ int main(int argc, char **argv) + + /* resolve soft links */ + while (1) { +- int len; ++ ssize_t len; + char *buf; + buf = (char *)malloc(bufsize + 1); + len = readlink(me, buf, bufsize); diff --git a/racket.changes b/racket.changes index 97efd39..1f081b3 100644 --- a/racket.changes +++ b/racket.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Jun 21 07:17:41 UTC 2024 - Dr. Werner Fink + +- Switch over to pb (Platform without native-code Backend) for + architectures which do not build +- Add patch racket-fortify.patch to make it build with latest gcc + ------------------------------------------------------------------- Fri May 24 13:46:41 UTC 2024 - Martin Schreiner diff --git a/racket.spec b/racket.spec index bf9886d..9e7123b 100644 --- a/racket.spec +++ b/racket.spec @@ -17,6 +17,7 @@ # +%global _configure ../configure Name: racket Version: 8.13 Release: 0 @@ -28,6 +29,7 @@ Source0: http://download.racket-lang.org/installers/%{version}/%{name}-%{ Source2: racket-completion.bash Source3: racket-rpmlintrc Patch0: racket-doc.patch +Patch1: racket-fortify.patch BuildRequires: ImageMagick BuildRequires: ca-certificates BuildRequires: chrpath @@ -126,16 +128,32 @@ cp -p %{SOURCE2} src/ %build cd src/ - +mkdir build +pushd build %add_optflags -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=500 -fno-gcse -Wno-stringop-overread +# +# Overwrite stack size limit (hopefully a soft limit only) +# +for flag in s l m +do + ulimit -H$flag unlimited || true + ulimit -S$flag unlimited || true +done +echo "int main () { return !(sizeof(void*) >= 8); }" | gcc -x c -o test64 - +echo "int main () { return !(((union {unsigned int x; unsigned char c; }){1}).c); }" | gcc -x c -o testendianess - +./test64 && wide=64 || wide=32 +./testendianess && endianess=l || endianess=b +rm -f test64 testendianess +mach=tpb${wide}${endianess} +unset wide endianess %configure \ --prefix="%{_prefix}" \ --exec-prefix="%{_prefix}" \ --libdir=%{_libdir} \ --docdir="%{_defaultdocdir}/%{name}" \ --enable-shared \ -%ifarch ppc64 ppc64le s390x - --enable-bcdefault \ +%ifarch ppc64le s390x + --enable-pb --enable-mach=$mach \ %endif --disable-static \ --disable-strip \ @@ -145,9 +163,12 @@ cd src/ --enable-liblz4 \ --enable-pthread %make_build +popd %install +topdir=$(pwd) cd src/ +pushd build # use the following if setting extra plt_setup options # export LD_LIBRARY_PATH=%%{buildroot}%%{_libdir} @@ -157,6 +178,8 @@ install -d %{buildroot}/%{_datadir}/doc/%{name}/ %make_install +popd + # we do not need *.la and *.a files find %{buildroot}%{_libdir} -name "*.la" -delete find %{buildroot}%{_libdir} -name "*.a" -delete @@ -224,6 +247,14 @@ install -m 0644 ../README %{buildroot}%{_docdir}/%{name}/README %fdupes %{buildroot}%{_prefix} +# +# Dynamically determine which files gets installed +# bc, cs, and pb builds +# +pushd %{buildroot}%{_libdir} + find \( -name '*.boot' -o -name '*.so*' -o -name '*.lo' -o -name '*.o' -o -name bootinfo \) -printf '%{_libdir}/%%P\n' > ${topdir}/file.list +popd + %post /sbin/ldconfig %desktop_database_post @@ -232,7 +263,7 @@ install -m 0644 ../README %{buildroot}%{_docdir}/%{name}/README /sbin/ldconfig %desktop_database_postun -%files +%files -f file.list %doc %dir %{_docdir}/%{name} %doc %{_docdir}/%{name}/README %{_bindir}/drracket @@ -263,21 +294,6 @@ install -m 0644 ../README %{buildroot}%{_docdir}/%{name}/README %verify(not md5 size mtime) %{_libdir}/%{name}/*.rktd %dir %{_libdir}/%{name}/compiled/ %{_libdir}/%{name}/compiled/* -%ifnarch ppc64 ppc64le s390x -%{_libdir}/%{name}/petite.boot -%{_libdir}/%{name}/racket.boot -%{_libdir}/%{name}/scheme.boot -%endif -%ifarch ppc64 ppc64le s390x -%{_libdir}/libracket3m* -%{_libdir}/%{name}/buildinfo -%endif -%ifarch s390x -%{_libdir}/%{name}/mzdyn3m.o -%endif -%ifarch ppc64 ppc64le -%{_libdir}/%{name}/mzdyn3m.lo -%endif %{_mandir}/man1/mz* %{_mandir}/man1/racket* %{_mandir}/man1/raco*