tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gfortran version code fix (jperkin@: freeze permission request)



In gfortran.mk, the calculation of POSSIBLE_GFORTRAN_VERSION seems not
quite right:

  # If pkgsrc base compiler is GCC, match the gfortran requirement as closely as
  # possible.  Otherwise, default to a mainstream version and hope for the best.
  # If base compiler is clang, we really should use flang rather than gfortran.
  POSSIBLE_GFORTRAN_VERSION?=     ${CC_VERSION:C/.[0-9].[0-9]//:S/gcc-//}

  .if (${PKGSRC_COMPILER} == gcc) && \
      exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk)
  GFORTRAN_VERSION?=              ${POSSIBLE_GFORTRAN_VERSION}
  .else
  GFORTRAN_VERSION?=              7
  .endif

There are three issues:

  POSSIBLE_GFORTRAN_VERSION doesn't anchor the .[0-9].[0-9] with $ (if
  that works) and the first . matches the -.

  For 5.5.0, this is ok, but for 4.8.x, I think it will lead to 4,
  instead of 48.  Perhaps this is intended to fail and we take the
  base version if >=5, else 7, but if that's the plan we need a comment.

  The PKGSRC_COMPILER cannot be tested with ==, because if it's "distcc
  gcc" the test fails.

$ /usr/pkgsrc/ham/gnuradio-fcd > make show-vars VARNAMES="CC_VERSION POSSIBLE_GFORTRAN_VERSION"
gcc-5.5.0
gcc.0


So I'd like to apply the following patch to fix issues 1 and 3 above, which results in

  $ /usr/pkgsrc/ham/gnuradio-fcd > make show-vars VARNAMES="CC_VERSION POSSIBLE_GFORTRAN_VERSION GFORTRAN_VERSION"
  gcc-5.5.0
  5
  5

Index: gfortran.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler/gfortran.mk,v
retrieving revision 1.13
diff -u -p -r1.13 gfortran.mk
--- gfortran.mk	7 Mar 2020 15:19:20 -0000	1.13
+++ gfortran.mk	26 Mar 2020 00:43:42 -0000
@@ -36,9 +36,9 @@ COMPILER_GFORTRAN_MK=	defined
 # If pkgsrc base compiler is GCC, match the gfortran requirement as closely as
 # possible.  Otherwise, default to a mainstream version and hope for the best.
 # If base compiler is clang, we really should use flang rather than gfortran.
-POSSIBLE_GFORTRAN_VERSION?=	${CC_VERSION:C/.[0-9].[0-9]//:S/gcc-//}
+POSSIBLE_GFORTRAN_VERSION?=	${CC_VERSION:S/gcc-//:C/.[0-9].[0-9]$//}
 
-.if (${PKGSRC_COMPILER} == gcc) && \
+.if !empty(PKGSRC_COMPILER:Mgcc) && \
     exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk)
 GFORTRAN_VERSION?=		${POSSIBLE_GFORTRAN_VERSION}
 .else



Home | Main Index | Thread Index | Old Index