Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 2B19A84F04 for ; Sun, 12 Nov 2023 01:15:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id lMBHNyYb76jX for ; Sun, 12 Nov 2023 01:15:52 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id 8542184CF7 for ; Sun, 12 Nov 2023 01:15:52 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 82666FA2F; Sun, 12 Nov 2023 01:15:52 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1699751752254300" MIME-Version: 1.0 Date: Sun, 12 Nov 2023 01:15:52 +0000 From: "Greg Troxel" Subject: CVS commit: pkgsrc/mk/compiler To: pkgsrc-changes@NetBSD.org Approved: commit_and_comment Reply-To: gdt@netbsd.org X-Mailer: log_accum Message-Id: <20231112011552.82666FA2F@cvs.NetBSD.org> This is a multi-part message in MIME format. --_----------=_1699751752254300 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: gdt Date: Sun Nov 12 01:15:52 UTC 2023 Modified Files: pkgsrc/mk/compiler: gfortran.mk Log Message: mk/compiler/gfortran.mk: Clean up version selection - Document hwat this file is supposed to do. Notably, it is not intended to select flang. The purpose is to find and set up for gfortran. - Only try to match the compiler version if the compiler is gcc. - Attempt to document the reasons behind the version choice on Darwin. - Try the POSSIBLE_GFORTRAN_VERSION regardless of whether gcc is in use - only check if it exists. Tested on older macOS x86, NetBSD 10 amd64, NetBSD 9 earmv7hf-el to build math/blas. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 pkgsrc/mk/compiler/gfortran.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1699751752254300 Content-Disposition: inline Content-Length: 2627 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/mk/compiler/gfortran.mk diff -u pkgsrc/mk/compiler/gfortran.mk:1.26 pkgsrc/mk/compiler/gfortran.mk:1.27 --- pkgsrc/mk/compiler/gfortran.mk:1.26 Sat Nov 4 12:50:06 2023 +++ pkgsrc/mk/compiler/gfortran.mk Sun Nov 12 01:15:52 2023 @@ -1,4 +1,4 @@ -# $NetBSD: gfortran.mk,v 1.26 2023/11/04 12:50:06 gdt Exp $ +# $NetBSD: gfortran.mk,v 1.27 2023/11/12 01:15:52 gdt Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -33,20 +33,30 @@ COMPILER_GFORTRAN_MK= defined .include "../../mk/bsd.prefs.mk" +# This file is gfortran.mk, which is defined to find, depend on, and +# set up for a gfortran version. Using gfortran is thus appropriate +# even if the base compiler is clang; if flang usage is desired then +# clang.mk or the user should set PKGSRC_FORTRAN to flang (and +# implement as necessary). + # If the pkgsrc base compiler is GCC, define POSSIBLE_GORTRAN_VERSION -# (meaning a candidate we would like) to match. If that version is -# known to be problematic on a platform, pick a better one. -# \todo If the base compiler is clang, we probably should use flang -# rather than gfortran, but this is gfortran.mk. +# (meaning a candidate we would like) to match. +.if !empty(PKGSRC_COMPILER:Mgcc) POSSIBLE_GFORTRAN_VERSION?= ${CC_VERSION:S/gcc-//:C/.[0-9].[0-9]$//} +.endif + +# On a variety of platforms various versions of gfortran are +# problematic. +# Choose gcc12 for Darwin/aarch64. \todo Explain why. +# gcc7 does not build on Darwin 12.6.x, so match aarch64. .if ${MACHINE_PLATFORM:MDarwin-*-*} -# \todo For parallel structure this should set POSSIBLE_GFORTRAN_VERSION instead. -GFORTRAN_VERSION?= 12 +POSSIBLE_GFORTRAN_VERSION= 12 .endif # pkgsrc gcc9 is missing NetBSD patches for aarch64, so if 9 is -# selected (historical current only?), advance to 10. +# selected (historical current, or elevated gcc for this package on +# NetBSD 9 or older), advance to 10. .if !empty(POSSIBLE_GFORTRAN_VERSION:M9) && \ !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64*) POSSIBLE_GFORTRAN_VERSION= 10 @@ -58,10 +68,9 @@ POSSIBLE_GFORTRAN_VERSION= 10 POSSIBLE_GFORTRAN_VERSION= 10 .endif -# If we are using gcc, and the POSSIBLE version exists in pkgsrc, use it. +# If the POSSIBLE version exists in pkgsrc, use it. # Otherwise, pick gcc 10 as a mainstream default. -.if !empty(PKGSRC_COMPILER:Mgcc) && \ - exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk) +.if exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk) GFORTRAN_VERSION?= ${POSSIBLE_GFORTRAN_VERSION} .else GFORTRAN_VERSION?= 10 --_----------=_1699751752254300--