git: 7f4c2cbbb186 - main - devel/gmake43: GNU version of 'make' utility (version 4.3 before slowdown occurred in 4.4.1)

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 29 Mar 2024 19:36:28 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7f4c2cbbb1862ddda967d9486e6a016eb8b067fb

commit 7f4c2cbbb1862ddda967d9486e6a016eb8b067fb
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-03-29 19:32:27 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-03-29 19:36:23 +0000

    devel/gmake43: GNU version of 'make' utility (version 4.3 before slowdown occurred in 4.4.1)
---
 devel/Makefile                          |   1 +
 devel/gmake43/Makefile                  |  35 +++++++++
 devel/gmake43/distinfo                  |   3 +
 devel/gmake43/files/patch-10-6e6abd0c   | 127 ++++++++++++++++++++++++++++++++
 devel/gmake43/files/patch-lib-glob.c    |  10 +++
 devel/gmake43/files/patch-src-default.c |  11 +++
 devel/gmake43/files/patch-src-makeint.h |  10 +++
 devel/gmake43/pkg-descr                 |   3 +
 devel/gmake43/pkg-plist                 |  32 ++++++++
 9 files changed, 232 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index d7e485d6c5d5..1355369aeca0 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -845,6 +845,7 @@
     SUBDIR += glrparser
     SUBDIR += glui
     SUBDIR += gmake
+    SUBDIR += gmake43
     SUBDIR += gn
     SUBDIR += gnome-builder
     SUBDIR += gnome-common
diff --git a/devel/gmake43/Makefile b/devel/gmake43/Makefile
new file mode 100644
index 000000000000..f012ce4c0cec
--- /dev/null
+++ b/devel/gmake43/Makefile
@@ -0,0 +1,35 @@
+PORTNAME=	gmake
+PORTVERSION=	4.3 # pre-slowdown caused by the issues described here: https://savannah.gnu.org/bugs/?65533
+CATEGORIES=	devel
+MASTER_SITES=	GNU/make
+DISTNAME=	make-${PORTVERSION}
+PKGNAMESUFFIX=	43
+
+# note: before committing to this port, contact portmgr to arrange for an
+# experimental ports run.  Untested commits may be backed out at portmgr's
+# discretion.
+MAINTAINER=	tijl@FreeBSD.org
+COMMENT=	GNU version of 'make' utility
+WWW=		https://www.gnu.org/software/make/
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+GNU_CONFIGURE=	yes
+GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
+CONFIGURE_ARGS=	--program-prefix=g \
+		--without-guile
+
+USES=		cpe tar:lz
+CPE_VENDOR=	gnu
+CPE_PRODUCT=	make
+
+OPTIONS_DEFINE=	NLS
+OPTIONS_SUB=	yes
+
+NLS_USES=	gettext-runtime
+NLS_CONFIGURE_ENABLE=	nls
+
+INFO=		make
+
+.include <bsd.port.mk>
diff --git a/devel/gmake43/distinfo b/devel/gmake43/distinfo
new file mode 100644
index 000000000000..b8f83469ce24
--- /dev/null
+++ b/devel/gmake43/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1587222848
+SHA256 (make-4.3.tar.lz) = de1a441c4edf952521db30bfca80baae86a0ff1acd0a00402999344f04c45e82
+SIZE (make-4.3.tar.lz) = 1266180
diff --git a/devel/gmake43/files/patch-10-6e6abd0c b/devel/gmake43/files/patch-10-6e6abd0c
new file mode 100644
index 000000000000..9e0f1e22caa8
--- /dev/null
+++ b/devel/gmake43/files/patch-10-6e6abd0c
@@ -0,0 +1,127 @@
+From: Bruno Haible <bruno@clisp.org>
+Date: Sat, 23 May 2020 10:19:34 +0000 (+0200)
+Subject: findprog-in: Ignore directories.
+X-Git-Url: https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff_plain;h=6e6abd0cdfe4bb96f6412aebc511f10bf254a820
+
+findprog-in: Ignore directories.
+
+Reported by Frederick Eaton via Dmitry Goncharov in
+<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00003.html>.
+
+* lib/findprog-in.c (find_in_given_path): When the file found is a
+directory, set errno to EACCES and, during a PATH search, continue
+searching.
+* modules/findprog-in (Depends-on): Add sys_stat, stat.
+---
+
+diff --git a/lib/findprog-in.c b/lib/findprog-in.c
+index c254f2f..0f76e36 100644
+--- lib/findprog-in.c
++++ lib/findprog-in.c
+@@ -26,6 +26,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <sys/stat.h>
+ 
+ #include "filename.h"
+ #include "concat-filename.h"
+@@ -58,8 +59,8 @@ static const char * const suffixes[] =
+     /* Note: The cmd.exe program does a different lookup: It searches according
+        to the PATHEXT environment variable.
+        See <https://stackoverflow.com/questions/7839150/>.
+-       Also, it executes files ending .bat and .cmd directly without letting the
+-       kernel interpret the program file.  */
++       Also, it executes files ending in .bat and .cmd directly without letting
++       the kernel interpret the program file.  */
+     #elif defined __CYGWIN__
+     "", ".exe", ".com"
+     #elif defined __EMX__
+@@ -136,14 +137,26 @@ find_in_given_path (const char *progname, const char *path,
+                        call access() despite its design flaw.  */
+                     if (eaccess (progpathname, X_OK) == 0)
+                       {
+-                        /* Found!  */
+-                        if (strcmp (progpathname, progname) == 0)
++                        /* Check that the progpathname does not point to a
++                           directory.  */
++                        struct stat statbuf;
++
++                        if (stat (progpathname, &statbuf) >= 0)
+                           {
+-                            free (progpathname);
+-                            return progname;
++                            if (! S_ISDIR (statbuf.st_mode))
++                              {
++                                /* Found!  */
++                                if (strcmp (progpathname, progname) == 0)
++                                  {
++                                    free (progpathname);
++                                    return progname;
++                                  }
++                                else
++                                  return progpathname;
++                              }
++
++                            errno = EACCES;
+                           }
+-                        else
+-                          return progpathname;
+                       }
+ 
+                     if (errno != ENOENT)
+@@ -210,25 +223,37 @@ find_in_given_path (const char *progname, const char *path,
+                    call access() despite its design flaw.  */
+                 if (eaccess (progpathname, X_OK) == 0)
+                   {
+-                    /* Found!  */
+-                    if (strcmp (progpathname, progname) == 0)
++                    /* Check that the progpathname does not point to a
++                       directory.  */
++                    struct stat statbuf;
++
++                    if (stat (progpathname, &statbuf) >= 0)
+                       {
+-                        free (progpathname);
+-
+-                        /* Add the "./" prefix for real, that
+-                           xconcatenated_filename() optimized away.  This
+-                           avoids a second PATH search when the caller uses
+-                           execl/execv/execlp/execvp.  */
+-                        progpathname =
+-                          XNMALLOC (2 + strlen (progname) + 1, char);
+-                        progpathname[0] = '.';
+-                        progpathname[1] = NATIVE_SLASH;
+-                        memcpy (progpathname + 2, progname,
+-                                strlen (progname) + 1);
+-                      }
++                        if (! S_ISDIR (statbuf.st_mode))
++                          {
++                            /* Found!  */
++                            if (strcmp (progpathname, progname) == 0)
++                              {
++                                free (progpathname);
++
++                                /* Add the "./" prefix for real, that
++                                   xconcatenated_filename() optimized away.
++                                   This avoids a second PATH search when the
++                                   caller uses execl/execv/execlp/execvp.  */
++                                progpathname =
++                                  XNMALLOC (2 + strlen (progname) + 1, char);
++                                progpathname[0] = '.';
++                                progpathname[1] = NATIVE_SLASH;
++                                memcpy (progpathname + 2, progname,
++                                        strlen (progname) + 1);
++                              }
++
++                            free (path_copy);
++                            return progpathname;
++                          }
+ 
+-                    free (path_copy);
+-                    return progpathname;
++                        errno = EACCES;
++                      }
+                   }
+ 
+                 if (errno != ENOENT)
diff --git a/devel/gmake43/files/patch-lib-glob.c b/devel/gmake43/files/patch-lib-glob.c
new file mode 100644
index 000000000000..a51d38144d88
--- /dev/null
+++ b/devel/gmake43/files/patch-lib-glob.c
@@ -0,0 +1,10 @@
+--- lib/glob.c.orig	2020-01-03 07:11:27 UTC
++++ lib/glob.c
+@@ -203,7 +203,6 @@ my_realloc (p, n)
+     return (char *) malloc (n);
+   return (char *) realloc (p, n);
+ }
+-# define	realloc	my_realloc
+ # endif /* __SASC */
+ #endif /* __GNU_LIBRARY__ || __DJGPP__ */
+ 
diff --git a/devel/gmake43/files/patch-src-default.c b/devel/gmake43/files/patch-src-default.c
new file mode 100644
index 000000000000..df78eb415b2e
--- /dev/null
+++ b/devel/gmake43/files/patch-src-default.c
@@ -0,0 +1,11 @@
+--- src/default.c.orig	2020-01-03 07:11:27 UTC
++++ src/default.c
+@@ -530,7 +530,7 @@ static const char *default_variables[] =
+     "OBJC", "gcc",
+ #else
+     "CC", "cc",
+-    "CXX", "g++",
++    "CXX", "c++",
+     "OBJC", "cc",
+ #endif
+ 
diff --git a/devel/gmake43/files/patch-src-makeint.h b/devel/gmake43/files/patch-src-makeint.h
new file mode 100644
index 000000000000..0bf6dad2f146
--- /dev/null
+++ b/devel/gmake43/files/patch-src-makeint.h
@@ -0,0 +1,10 @@
+--- src/makeint.h.orig	2020-01-19 20:32:59 UTC
++++ src/makeint.h
+@@ -116,7 +116,6 @@ extern int errno;
+ 
+ /* Some systems define _POSIX_VERSION but are not really POSIX.1.  */
+ #if (defined (butterfly) || defined (__arm) || (defined (__mips) && defined (_SYSTYPE_SVR3)) || (defined (sequent) && defined (i386)))
+-# undef POSIX
+ #endif
+ 
+ #if !defined (POSIX) && defined (_AIX) && defined (_POSIX_SOURCE)
diff --git a/devel/gmake43/pkg-descr b/devel/gmake43/pkg-descr
new file mode 100644
index 000000000000..9e064d213a00
--- /dev/null
+++ b/devel/gmake43/pkg-descr
@@ -0,0 +1,3 @@
+GNU make is a tool that controls the generation of executables and other
+non-source files from source files.  Its purpose is the same as that
+of the utility make(1).
diff --git a/devel/gmake43/pkg-plist b/devel/gmake43/pkg-plist
new file mode 100644
index 000000000000..7979f4a46ae9
--- /dev/null
+++ b/devel/gmake43/pkg-plist
@@ -0,0 +1,32 @@
+bin/gmake
+include/gnumake.h
+%%NLS%%share/locale/be/LC_MESSAGES/make.mo
+%%NLS%%share/locale/bg/LC_MESSAGES/make.mo
+%%NLS%%share/locale/cs/LC_MESSAGES/make.mo
+%%NLS%%share/locale/da/LC_MESSAGES/make.mo
+%%NLS%%share/locale/de/LC_MESSAGES/make.mo
+%%NLS%%share/locale/es/LC_MESSAGES/make.mo
+%%NLS%%share/locale/fi/LC_MESSAGES/make.mo
+%%NLS%%share/locale/fr/LC_MESSAGES/make.mo
+%%NLS%%share/locale/ga/LC_MESSAGES/make.mo
+%%NLS%%share/locale/gl/LC_MESSAGES/make.mo
+%%NLS%%share/locale/he/LC_MESSAGES/make.mo
+%%NLS%%share/locale/hr/LC_MESSAGES/make.mo
+%%NLS%%share/locale/id/LC_MESSAGES/make.mo
+%%NLS%%share/locale/it/LC_MESSAGES/make.mo
+%%NLS%%share/locale/ja/LC_MESSAGES/make.mo
+%%NLS%%share/locale/ko/LC_MESSAGES/make.mo
+%%NLS%%share/locale/lt/LC_MESSAGES/make.mo
+%%NLS%%share/locale/nl/LC_MESSAGES/make.mo
+%%NLS%%share/locale/pl/LC_MESSAGES/make.mo
+%%NLS%%share/locale/pt/LC_MESSAGES/make.mo
+%%NLS%%share/locale/pt_BR/LC_MESSAGES/make.mo
+%%NLS%%share/locale/ru/LC_MESSAGES/make.mo
+%%NLS%%share/locale/sr/LC_MESSAGES/make.mo
+%%NLS%%share/locale/sv/LC_MESSAGES/make.mo
+%%NLS%%share/locale/tr/LC_MESSAGES/make.mo
+%%NLS%%share/locale/uk/LC_MESSAGES/make.mo
+%%NLS%%share/locale/vi/LC_MESSAGES/make.mo
+%%NLS%%share/locale/zh_CN/LC_MESSAGES/make.mo
+%%NLS%%share/locale/zh_TW/LC_MESSAGES/make.mo
+share/man/man1/gmake.1.gz