public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/grace] epel10: Port to C99 (#2155764)
@ 2026-10-17 16:18 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2026-10-17 16:18 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/grace
            Branch : epel10
            Commit : eea9a8ff650a7a5534fe93fe1d4cc46963915c32
            Author : Florian Weimer <fweimer@redhat.com>
            Date   : 2022-12-22T10:46:58+01:00
            Stats  : +361/-1 in 4 file(s)
            URL    : https://src.fedoraproject.org/rpms/grace/c/eea9a8ff650a7a5534fe93fe1d4cc46963915c32?branch=epel10

            Log:
            Port to C99 (#2155764)

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>

---
diff --git a/grace-c99.patch b/grace-c99.patch
new file mode 100644
index 0000000..fb87e39
--- /dev/null
+++ b/grace-c99.patch
@@ -0,0 +1,12 @@
+diff -ur grace-5.1.25.orig/src/utils.c grace-5.1.25/src/utils.c
+--- grace-5.1.25.orig/src/utils.c	2022-12-22 10:40:39.391625263 +0100
++++ grace-5.1.25/src/utils.c	2022-12-22 10:41:24.732188992 +0100
+@@ -1391,7 +1391,7 @@
+     update_app_title();
+ }
+ 
+-void lock_dirtystate(flag)
++void lock_dirtystate(int flag)
+ {
+     dirtystate_lock = flag;
+ }

diff --git a/grace-configure-c99-1.patch b/grace-configure-c99-1.patch
new file mode 100644
index 0000000..243a76a
--- /dev/null
+++ b/grace-configure-c99-1.patch
@@ -0,0 +1,27 @@
+Do not call the XmRegisterConverters function because current Motif
+does not declare it (but still exports it).  With this call, the
+result of this configure check depends on whether the compiler
+supports implicit function declarations or not.
+
+diff -ur grace-5.1.25.orig/ac-tools/aclocal.m4 grace-5.1.25/ac-tools/aclocal.m4
+--- grace-5.1.25.orig/ac-tools/aclocal.m4	2014-08-16 23:54:51.000000000 +0200
++++ grace-5.1.25/ac-tools/aclocal.m4	2022-12-22 10:22:57.579378019 +0100
+@@ -280,7 +280,6 @@
+       int main(void) {
+         int vlibn, vincn;
+         vincn = XmVersion;
+-        XmRegisterConverters();
+         vlibn = xmUseVersion;
+         if (vincn < [$1]) {
+           exit(1);
+diff -ur grace-5.1.25.orig/configure grace-5.1.25/configure
+--- grace-5.1.25.orig/configure	2022-12-22 10:24:10.869603703 +0100
++++ grace-5.1.25/configure	2022-12-22 10:23:12.843216734 +0100
+@@ -9556,7 +9556,6 @@
+       int main(void) {
+         int vlibn, vincn;
+         vincn = XmVersion;
+-        XmRegisterConverters();
+         vlibn = xmUseVersion;
+         if (vincn < 1002) {
+           exit(1);

diff --git a/grace-configure-c99-2.patch b/grace-configure-c99-2.patch
new file mode 100644
index 0000000..99c726c
--- /dev/null
+++ b/grace-configure-c99-2.patch
@@ -0,0 +1,312 @@
+Avoid implicit declaration of the exit and strcmp functions.  Improves
+compatibility with C99 compilers.
+
+diff -ur grace-5.1.25.orig/ac-tools/aclocal.m4 grace-5.1.25/ac-tools/aclocal.m4
+--- grace-5.1.25.orig/ac-tools/aclocal.m4	2022-12-22 10:27:28.504523927 +0100
++++ grace-5.1.25/ac-tools/aclocal.m4	2022-12-22 10:30:25.072665840 +0100
+@@ -51,7 +51,7 @@
+       unsigned int B = 3;
+       int i;
+       for(i=0; i<B; i++) Array[[i]] = i - 3;
+-      exit( Array[[1]] != -2 );
++      return Array[[1]] != -2;
+     }
+     ],
+ 
+@@ -105,7 +105,7 @@
+       	}
+     }
+  
+-    exit(i);
++    return i;
+ }],
+     ac_cv_c_fpu_arithmetics_type="Unknown",
+     [case "$?" in
+@@ -282,12 +282,12 @@
+         vincn = XmVersion;
+         vlibn = xmUseVersion;
+         if (vincn < [$1]) {
+-          exit(1);
++          return 1;
+         }
+         if (vincn != vlibn) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -373,9 +373,9 @@
+         char *vlib;
+         vlib = T1_GetLibIdent();
+         if (strcmp(vlib, "[$1]") < 0) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -419,12 +419,12 @@
+         vlib = zlibVersion();
+         vinc = ZLIB_VERSION;
+         if (strcmp(vinc, "[$1]") < 0) {
+-          exit(1);
++          return 1;
+         }
+         if (strcmp(vinc, vlib) != 0) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -469,9 +469,9 @@
+         jpeg_create_compress(&cinfo);
+         vinc = JPEG_LIB_VERSION;
+         if (vinc < [$1]) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -515,12 +515,12 @@
+         vlib = png_libpng_ver;
+         vinc = PNG_LIBPNG_VER_STRING;
+         if (strcmp(vinc, "[$1]") < 0) {
+-          exit(1);
++          return 1;
+         }
+         if (strcmp(vinc, vlib) != 0) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -565,12 +565,12 @@
+         vincn = 100*PDFLIB_MAJORVERSION + PDFLIB_MINORVERSION;
+         vinc = PDFLIB_VERSIONSTRING;
+         if (strcmp(vinc, "[$1]") < 0) {
+-          exit(1);
++          return 1;
+         }
+         if (vincn != vlibn) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -611,13 +611,14 @@
+     AC_TRY_RUN([
+ #include <stdio.h>
+ #include <netcdf.h>
++#include <string.h>
+       int main(void) {
+         char *vlib;
+         vlib = nc_inq_libvers();
+         if (strcmp(vlib, "[$1]") < 0) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -659,9 +660,9 @@
+       int main(void) {
+         char *vlib = (char *) fftw_version;
+         if (strcmp(vlib, "[$1]") < 0) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+@@ -706,12 +707,12 @@
+         vlib = XmHTMLGetVersion();
+         vinc = XmHTMLVersion;
+         if (vinc < [$1]) {
+-          exit(1);
++          return 1;
+         }
+         if (vinc != vlib) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+       ],
+ 
+diff -ur grace-5.1.25.orig/configure grace-5.1.25/configure
+--- grace-5.1.25.orig/configure	2022-12-22 10:27:28.505523916 +0100
++++ grace-5.1.25/configure	2022-12-22 10:32:18.581471350 +0100
+@@ -4242,7 +4242,7 @@
+       unsigned int B = 3;
+       int i;
+       for(i=0; i<B; i++) Array[i] = i - 3;
+-      exit( Array[1] != -2 );
++      return Array[1] != -2;
+     }
+ 
+ _ACEOF
+@@ -4964,7 +4964,7 @@
+       	}
+     }
+ 
+-    exit(i);
++    return i;
+ }
+ _ACEOF
+ if ac_fn_c_try_run "$LINENO"; then :
+@@ -7808,9 +7808,9 @@
+         char *vlib;
+         vlib = T1_GetLibIdent();
+         if (strcmp(vlib, "1.3.1") < 0) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -8181,13 +8181,14 @@
+ 
+ #include <stdio.h>
+ #include <netcdf.h>
++#include <string.h>
+       int main(void) {
+         char *vlib;
+         vlib = nc_inq_libvers();
+-        if (((vlib[0] == '"') && (strcmp(vlib, "\"3.0") < 0)) || ((vlib[0] != '"') && (strcmp(vlib, "3.0") < 0))){
+-          exit(1);
++        if (strcmp(vlib, "3.0") < 0) {
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -8267,9 +8268,9 @@
+       int main(void) {
+         char *vlib = (char *) fftw_version;
+         if (strcmp(vlib, "2.1.3") < 0) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -8352,12 +8353,12 @@
+         vlib = zlibVersion();
+         vinc = ZLIB_VERSION;
+         if (strcmp(vinc, "1.0.3") < 0) {
+-          exit(1);
++          return 1;
+         }
+         if (strcmp(vinc, vlib) != 0) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -8438,9 +8439,9 @@
+         jpeg_create_compress(&cinfo);
+         vinc = JPEG_LIB_VERSION;
+         if (vinc < 61) {
+-          exit(1);
++          return 1;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -8522,12 +8523,12 @@
+         vlib = png_libpng_ver;
+         vinc = PNG_LIBPNG_VER_STRING;
+         if (strcmp(vinc, "0.9.6") < 0) {
+-          exit(1);
++          return 1;
+         }
+         if (strcmp(vinc, vlib) != 0) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -8610,12 +8611,12 @@
+         vincn = 100*PDFLIB_MAJORVERSION + PDFLIB_MINORVERSION;
+         vinc = PDFLIB_VERSIONSTRING;
+         if (strcmp(vinc, "5.0.0") < 0) {
+-          exit(1);
++          return 1;
+         }
+         if (vincn != vlibn) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -9558,12 +9559,12 @@
+         vincn = XmVersion;
+         vlibn = xmUseVersion;
+         if (vincn < 1002) {
+-          exit(1);
++          return 1;
+         }
+         if (vincn != vlibn) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF
+@@ -9830,12 +9831,12 @@
+         vlib = XmHTMLGetVersion();
+         vinc = XmHTMLVersion;
+         if (vinc < 1105) {
+-          exit(1);
++          return 1;
+         }
+         if (vinc != vlib) {
+-          exit(2);
++          return 2;
+         }
+-        exit(0);
++        return 0;
+       }
+ 
+ _ACEOF

diff --git a/grace.spec b/grace.spec
index d8b9118..51ff2f7 100644
--- a/grace.spec
+++ b/grace.spec
@@ -8,7 +8,7 @@
 
 Name:           grace
 Version:        5.1.25
-Release:        32%{?dist}
+Release:        33%{?dist}
 Summary:        Numerical Data Processing and Visualization Tool
 License:        GPLv2+
 # cephes is LGPL, see also Source3 and Source4
@@ -20,6 +20,9 @@ Source4:        LICENSE.cephes
 Source5:        http://ftp.de.debian.org/debian/pool/main/g/grace/grace_5.1.25-6.debian.tar.xz
 Source6:        FontDataBase
 Patch0:         grace-detect-netcdf.diff
+Patch1:         grace-configure-c99-1.patch
+Patch2:         grace-configure-c99-2.patch
+Patch3:         grace-c99.patch
 BuildRequires:  desktop-file-utils
 BuildRequires:  fftw2-devel
 BuildRequires:  gcc-gfortran
@@ -55,6 +58,9 @@ Install these files if you need to compile software that requires grace.
 %setup -q -D -a 5
 
 %patch0
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
 # avoid duplicating debian patch
 patch -p1 < debian/patches/binary_nostrip.diff
 patch -p1 < debian/patches/gracerc.diff
@@ -188,6 +194,9 @@ rm __dist_doc/doc/Makefile __dist_doc/doc/*.sgml
 %{_datadir}/%{name}/lib
 
 %changelog
+* Thu Dec 22 2022 Florian Weimer <fweimer@redhat.com> - 5.1.25-33
+- Port to C99 (#2155764)
+
 * Fri Sep 02 2022 Terje Rosten <terje.rosten@ntnu.no> - 5.1.25-32
 - No need for xterm on epel
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-17 16:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 16:18 [rpms/grace] epel10: Port to C99 (#2155764) Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox