diff --git a/etc/makepkg.conf.d/fortran.conf.in b/etc/makepkg.conf.d/fortran.conf.in new file mode 100644 index 00000000..3654ffa7 --- /dev/null +++ b/etc/makepkg.conf.d/fortran.conf.in @@ -0,0 +1,18 @@ +#!/hint/bash +# +# @sysconfdir@/makepkg.conf.d/fortran.conf +# + +######################################################################### +# FORTRAN LANGUAGE SUPPORT +######################################################################### + +# Flags used for the Fortran compiler, similar in spirit to CFLAGS. Read +# linkman:gfortran[1] for more details on the available flags. +#FFLAGS="-O2 -pipe" +#FCFLAGS="$FFLAGS" + +# Additional compiler flags appended to `FFLAGS` and `FCFLAGS` for use in debugging. Usually +# this would include: ``-g''. Read linkman:gfortran[1] for more details on the wide +# variety of compiler flags available. +#DEBUG_FFLAGS="-g" diff --git a/meson.build b/meson.build index 494f5c67..84154bc2 100644 --- a/meson.build +++ b/meson.build @@ -420,6 +420,12 @@ configure_file( configuration : substs, install_dir : SYSCONFDIR) +configure_file( + input : 'etc/makepkg.conf.d/fortran.conf.in', + output : 'fortran.conf', + configuration : substs, + install_dir : join_paths(SYSCONFDIR, 'makepkg.conf.d/')) + configure_file( input : 'etc/makepkg.conf.d/rust.conf.in', output : 'rust.conf', diff --git a/scripts/libmakepkg/buildenv/fortran.sh.in b/scripts/libmakepkg/buildenv/fortran.sh.in new file mode 100644 index 00000000..3dc6f216 --- /dev/null +++ b/scripts/libmakepkg/buildenv/fortran.sh.in @@ -0,0 +1,38 @@ +#!/usr/bin/bash +# +# fortran.sh - Specify flags for building a package with Fortran +# +# Copyright (c) 2024 Pacman Development Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +[[ -n "$LIBMAKEPKG_BUILDENV_FORTRAN_SH" ]] && return +LIBMAKEPKG_BUILDENV_FORTRAN_SH=1 + +MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'} + +source "$MAKEPKG_LIBRARY/util/option.sh" +source "$MAKEPKG_LIBRARY/util/util.sh" + +buildenv_vars+=('FFLAGS' 'FCFLAGS' 'DEBUG_FFLAGS') +buildenv_functions+=('buildenv_fortran') + +buildenv_fortran() { + if check_option "debug" "y" && ! check_option "buildflags" "n"; then + append_once DEBUG_FFLAGS "-ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}" + append_once FFLAGS "$DEBUG_FFLAGS" + append_once FCFLAGS "$DEBUG_FFLAGS" + fi +}