Mon Apr 4 15:38:47 2022 UTC ()
mk: Fix malformed conditional.

There's no guarantee that POSSIBLE_GFORTRAN_VERSION is a numeric value,
so cannot be compared as such.  For example on my macOS it is set to
"clang-12 (clang-1205.0.22.9)".

This really needs to be normalised correctly at some point.


(jperkin)
diff -r1.19 -r1.20 pkgsrc/mk/compiler/gfortran.mk

cvs diff -r1.19 -r1.20 pkgsrc/mk/compiler/gfortran.mk (expand / switch to unified diff)

--- pkgsrc/mk/compiler/gfortran.mk 2022/04/02 08:01:48 1.19
+++ pkgsrc/mk/compiler/gfortran.mk 2022/04/04 15:38:47 1.20
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: gfortran.mk,v 1.19 2022/04/02 08:01:48 nia Exp $ 1# $NetBSD: gfortran.mk,v 1.20 2022/04/04 15:38:47 jperkin Exp $
2# 2#
3# Copyright (c) 2005 The NetBSD Foundation, Inc. 3# Copyright (c) 2005 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# This code is derived from software contributed to The NetBSD Foundation 6# This code is derived from software contributed to The NetBSD Foundation
7# by Johnny C. Lam. 7# by Johnny C. Lam.
8# 8#
9# Redistribution and use in source and binary forms, with or without 9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions 10# modification, are permitted provided that the following conditions
11# are met: 11# are met:
12# 1. Redistributions of source code must retain the above copyright 12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer. 13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright 14# 2. Redistributions in binary form must reproduce the above copyright
@@ -37,27 +37,27 @@ COMPILER_GFORTRAN_MK= defined @@ -37,27 +37,27 @@ COMPILER_GFORTRAN_MK= defined
37# possible. Otherwise, default to a mainstream version and hope for the best. 37# possible. Otherwise, default to a mainstream version and hope for the best.
38# If base compiler is clang, we really should use flang rather than gfortran. 38# If base compiler is clang, we really should use flang rather than gfortran.
39# \todo Perhaps adjust this so that gcc-4.8.3 maps to 48, or document that 4.8 39# \todo Perhaps adjust this so that gcc-4.8.3 maps to 48, or document that 4.8
40# is so old that we intend what seems like a bug to choose the modern version 40# is so old that we intend what seems like a bug to choose the modern version
41# in that case. 41# in that case.
42POSSIBLE_GFORTRAN_VERSION?= ${CC_VERSION:S/gcc-//:C/.[0-9].[0-9]$//} 42POSSIBLE_GFORTRAN_VERSION?= ${CC_VERSION:S/gcc-//:C/.[0-9].[0-9]$//}
43 43
44# gcc9 doesn't work on NetBSD/arm, but gcc10 does. 44# gcc9 doesn't work on NetBSD/arm, but gcc10 does.
45.if !empty(POSSIBLE_GFORTRAN_VERSION:M9) && \ 45.if !empty(POSSIBLE_GFORTRAN_VERSION:M9) && \
46 !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64*) 46 !empty(MACHINE_PLATFORM:MNetBSD-*-aarch64*)
47POSSIBLE_GFORTRAN_VERSION= 10 47POSSIBLE_GFORTRAN_VERSION= 10
48.endif 48.endif
49 49
50.if ${POSSIBLE_GFORTRAN_VERSION} <= 9 && \ 50.if !empty(POSSIBLE_GFORTRAN_VERSION:M[0-9]) && \
51 !empty(MACHINE_PLATFORM:MNetBSD-*-earm*) 51 !empty(MACHINE_PLATFORM:MNetBSD-*-earm*)
52POSSIBLE_GFORTRAN_VERSION= 10 52POSSIBLE_GFORTRAN_VERSION= 10
53.endif 53.endif
54 54
55.if !empty(PKGSRC_COMPILER:Mgcc) && \ 55.if !empty(PKGSRC_COMPILER:Mgcc) && \
56 exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk) 56 exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk)
57GFORTRAN_VERSION?= ${POSSIBLE_GFORTRAN_VERSION} 57GFORTRAN_VERSION?= ${POSSIBLE_GFORTRAN_VERSION}
58.else 58.else
59GFORTRAN_VERSION?= 7 59GFORTRAN_VERSION?= 7
60.endif 60.endif
61 61
62.if !empty(PKGPATH:Mlang/gcc${GFORTRAN_VERSION}) || !empty(PKGPATH:Mdevel/patch) || \ 62.if !empty(PKGPATH:Mlang/gcc${GFORTRAN_VERSION}) || !empty(PKGPATH:Mdevel/patch) || \
63 !empty(PKGPATH:Mdevel/libtool-base) 63 !empty(PKGPATH:Mdevel/libtool-base)