makepkg: Add support for Fortran build flags

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
loqs 2024-02-24 20:10:23 +10:00 committed by Allan McRae
parent 2a0dd9ec09
commit dba383f092
3 changed files with 62 additions and 0 deletions

View file

@ -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"

View file

@ -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',

View file

@ -0,0 +1,38 @@
#!/usr/bin/bash
#
# fortran.sh - Specify flags for building a package with Fortran
#
# Copyright (c) 2024 Pacman Development Team <pacman-dev@lists.archlinux.org>
#
# 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 <http://www.gnu.org/licenses/>.
#
[[ -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
}