From 14e2fb9b5aeb58bc2b520f086da63161dd6767b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=85=D9=87=D8=AF=D9=8A=20=D8=B4=D9=8A=D9=86=D9=88=D9=86?= =?UTF-8?q?=20=28Mehdi=20Chinoune=29?= Date: Fri, 21 Nov 2025 08:59:20 +0100 Subject: [PATCH] make: Fix default CXX compiler. --- mingw-w64-make/005-fix-default-cxx.patch | 11 +++++ .../006-fix-build-with-gcc-15.patch | 39 ++++++++++++++++ mingw-w64-make/PKGBUILD | 46 +++++++++++++------ mingw-w64-make/make-linebuf-mingw.patch | 7 ++- 4 files changed, 85 insertions(+), 18 deletions(-) create mode 100644 mingw-w64-make/005-fix-default-cxx.patch create mode 100644 mingw-w64-make/006-fix-build-with-gcc-15.patch diff --git a/mingw-w64-make/005-fix-default-cxx.patch b/mingw-w64-make/005-fix-default-cxx.patch new file mode 100644 index 0000000000..2202ca1976 --- /dev/null +++ b/mingw-w64-make/005-fix-default-cxx.patch @@ -0,0 +1,11 @@ +--- a/src/default.c ++++ b/src/default.c +@@ -542,7 +542,7 @@ + "CXX", "gcc", + # endif /* __MSDOS__ */ + # else +- "CXX", "g++", ++ "CXX", "c++", + # endif + #endif + /* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist, diff --git a/mingw-w64-make/006-fix-build-with-gcc-15.patch b/mingw-w64-make/006-fix-build-with-gcc-15.patch new file mode 100644 index 0000000000..8f7cdeaf03 --- /dev/null +++ b/mingw-w64-make/006-fix-build-with-gcc-15.patch @@ -0,0 +1,39 @@ +--- a/lib/fnmatch.c ++++ b/lib/fnmatch.c +@@ -121,7 +121,7 @@ USA. */ + whose names are inconsistent. */ + + # if !defined _LIBC && !defined getenv +-extern char *getenv (); ++extern char *getenv (const char*); + # endif + + # ifndef errno +--- a/src/getopt.c ++++ b/src/getopt.c +@@ -202,7 +202,7 @@ static char *posixly_correct; + whose names are inconsistent. */ + + #ifndef getenv +-extern char *getenv (); ++extern char *getenv (const char*); + #endif + + static char * +--- a/src/getopt.h ++++ b/src/getopt.h +@@ -96,14 +96,7 @@ struct option + #define optional_argument 2 + + #if defined (__STDC__) && __STDC__ +-#ifdef __GNU_LIBRARY__ +-/* Many other libraries have conflicting prototypes for getopt, with +- differences in the consts, in stdlib.h. To avoid compilation +- errors, only prototype getopt for the GNU C library. */ + extern int getopt (int argc, char *const *argv, const char *shortopts); +-#else /* not __GNU_LIBRARY__ */ +-extern int getopt (); +-#endif /* __GNU_LIBRARY__ */ + extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); + extern int getopt_long_only (int argc, char *const *argv, diff --git a/mingw-w64-make/PKGBUILD b/mingw-w64-make/PKGBUILD index 67ce63059c..76097b5223 100644 --- a/mingw-w64-make/PKGBUILD +++ b/mingw-w64-make/PKGBUILD @@ -7,12 +7,12 @@ _realname=make # name is part of the import library (libgnumake-1.dll.a) used to link # customized dll's. # General information at https://www.gnu.org/software/make/manual/html_node/Loading-Objects.html#Loading-Objects. -_autotools=no +_autotools=yes _prog_name=mingw32-make pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") pkgver=4.4.1 -pkgrel=3 +pkgrel=4 pkgdesc="GNU make utility to maintain groups of programs (mingw-w64)" arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64') @@ -20,25 +20,38 @@ url="https://www.gnu.org/software/make" msys2_references=( "cpe: cpe:/a:gnu:make" ) -license=('GPL3') +license=('spdx:GPL-3.0-or-later') groups=("${MINGW_PACKAGE_PREFIX}-toolchain") depends=("${MINGW_PACKAGE_PREFIX}-gettext-runtime") -makedepends=("${MINGW_PACKAGE_PREFIX}-autotools" "${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-gettext-tools") +makedepends=("${MINGW_PACKAGE_PREFIX}-autotools" + "${MINGW_PACKAGE_PREFIX}-gcc" + "${MINGW_PACKAGE_PREFIX}-gettext-tools") source=("https://ftp.gnu.org/gnu/${_realname}/${_realname}-${pkgver}.tar.gz" 'make-linebuf-mingw.patch' 'make-4.3_undef-HAVE_STRUCT_DIRENT_D_TYPE.patch' 'make-4.4-timestamps.patch' 'make-4.2.1-Makefile.am-gcc-only-link-libgnumake-1.dll.a.patch' + '005-fix-default-cxx.patch' + '006-fix-build-with-gcc-15.patch' 'make-check-load-feature.mak' 'mk_temp.c') sha256sums=('dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3' - 'cbb8c0a1bdd6e8174febce01946bd42da26dfcb73a7338c0a1df89ac6b8e157b' + '578860779efd8aedfd7362b2f6bb73bf1a5ca57ee1d9f4a7d26b83c570d92db1' '952b8decffb25b6083bbda262578f93f2b480789b9d0baaabb7b3a77d7b86fc1' 'd13abf8697abaca71634f7de302d14e65b9236b0181a3ac081663d33e647d303' 'f28d1596ac8f60bbe6042f3467627646ae7e7243e4f73652f9682255758ecdb9' + 'bd6a597d76b35a48020dc335040c96f562439970595a21014469b73b3b6c805a' + 'c5125d642ca6ae9b5788648aa51ecc7a44e829cf443b44768c9a66c85d85689d' '3d6ece384425ff1c3f691efeb7c97e89bb11825bb6648995552dfcb52afe661d' '61d4f57c311cf2e27ccf4d1da847216730f304cf17c5c386721182ffe2d4b1aa') +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying $_patch" + patch -Np1 -i "${srcdir}/$_patch" + done +} # helper function get_exe_dir() { @@ -53,15 +66,18 @@ get_exe_dir() { prepare() { cd "${srcdir}"/${_realname}-${pkgver} - pushd src - patch -p1 -i "${srcdir}"/make-linebuf-mingw.patch - patch -p2 -i "${srcdir}"/make-4.3_undef-HAVE_STRUCT_DIRENT_D_TYPE.patch - popd + apply_patch_with_msg \ + make-linebuf-mingw.patch \ + make-4.3_undef-HAVE_STRUCT_DIRENT_D_TYPE.patch \ + 005-fix-default-cxx.patch \ + 006-fix-build-with-gcc-15.patch # https://lists.gnu.org/archive/html/bug-make/2022-11/msg00017.html - patch -p1 -i "${srcdir}"/make-4.4-timestamps.patch + apply_patch_with_msg \ + make-4.4-timestamps.patch if test "${_autotools}" = "yes"; then - patch -p1 -i "${srcdir}"/make-4.2.1-Makefile.am-gcc-only-link-libgnumake-1.dll.a.patch + apply_patch_with_msg \ + make-4.2.1-Makefile.am-gcc-only-link-libgnumake-1.dll.a.patch # 1 - The import library libgnumake-1.dll.a contains the name of the program to be # installed. This requires autotools to be informed about the installed program # name in case it is different from the standard name 'make' hardcoded in the GNU @@ -94,16 +110,15 @@ prepare() { build() { if test "${_autotools}" = "yes"; then - mkdir -vp build-${MSYSTEM} - cd build-${MSYSTEM} + mkdir -vp build-${MSYSTEM} && cd build-${MSYSTEM} ../${_realname}-${pkgver}/configure \ -C \ --prefix=${MINGW_PREFIX} \ - --host=${MINGW_CHOST} \ --without-libintl-prefix \ --without-libiconv-prefix \ CPPFLAGS=-DMAKE_LOAD \ CFLAGS=-mthreads \ + MAKECXX=${CXX} \ ac_cv_dos_paths=yes make -j1 else @@ -136,4 +151,7 @@ package() { cp -fv "${_exe_dir}/${_prog_name}.exe" "${pkgdir}${MINGW_PREFIX}/bin/" cp -fv "${_exe_dir}/libgnumake-1.dll.a" "${pkgdir}${MINGW_PREFIX}/lib/" cp -fv "${srcdir}/${_realname}-${pkgver}/src/gnumake.h" "${pkgdir}${MINGW_PREFIX}/include/" + + install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING \ + "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/COPYING } diff --git a/mingw-w64-make/make-linebuf-mingw.patch b/mingw-w64-make/make-linebuf-mingw.patch index 85ded555c0..feb17dc503 100644 --- a/mingw-w64-make/make-linebuf-mingw.patch +++ b/mingw-w64-make/make-linebuf-mingw.patch @@ -1,7 +1,6 @@ -diff -Naur make-4.2.1/main.c make-4.2.1.new/main.c ---- make-4.2.1/main.c 2016-05-31 09:17:26.000000000 +0200 -+++ make-4.2.1.new/main.c 2017-02-20 22:55:09.051617838 +0100 -@@ -1126,8 +1126,11 @@ +--- a/src/main.c ++++ b/src/main.c +@@ -1241,8 +1241,11 @@ #endif