X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f4db5740c56f3b29b11a796147086ec8848a7e90..91c707ef9229d7ba5e17b885416761feb2fdfc46:/src/scripts/drivers-Makefile diff --git a/src/scripts/drivers-Makefile b/src/scripts/drivers-Makefile index 0c3da19cb..4b2bf245b 100755 --- a/src/scripts/drivers-Makefile +++ b/src/scripts/drivers-Makefile @@ -3,10 +3,10 @@ # Copyright (c) The Exim Maintainers 1995 - 2024 # SPDX-License-Identifier: GPL-2.0-or-later -set -e class=${CLASS:?} classdef=${CLASSDEF:?} drnames="${DRNAMES:?}" +egrep="${EGREP:?}" # We turn the configure-built build-$foo/$class/Makefile.predynamic into Makefile. # This is used for router and transport drivers, called from scripts/Configure-Makefile. @@ -96,19 +96,30 @@ fi # command-line, not just check the Makefile. want_dynamic() { - local dyn_name="$1" + local dyn_name="${1#_}" local re="(${classdef}|EXPERIMENTAL)_${dyn_name}[ $tab]*=[ $tab]*2" - env | grep -E -q "^$re" + env | ${egrep} -q "^$re" if [ $? -eq 0 ]; then return 0; fi - grep -E -q "^[ $tab]*$re" "$defs_source" + ${egrep} -q "^[ $tab]*$re" "$defs_source" +} + +want_not_disabled() { + local want_name="${1#_}" + [ "$want_name" = "$1" ] && return 1; + local re="DISABLED_${want_name}[ $tab]*=[ $tab]*." + env | ${egrep} -q "^$re" + [ $? -ne 0 ] && return 0 + ${egrep} -q "^[ $tab]*$re" "$defs_source" + [ $? -ne 0 ] && return 0 + return 1 } want_at_all() { local want_name="$1" local re="(${classdef}|EXPERIMENTAL)_${want_name}[ $tab]*=[ $tab]*." - env | grep -E -q "^$re" + env | ${egrep} -q "^$re" if [ $? -eq 0 ]; then return 0; fi - grep -E -q "^[ $tab]*$re" "$defs_source" + ${egrep} -q "^[ $tab]*$re" "$defs_source" } # The values of these variables will be emitted into the Makefile. @@ -136,19 +147,21 @@ emit_module_rule() { echo >&2 "Missing CFLAGS_DYNAMIC prevents building dynamic $name" exit 1 fi - MODS="${MODS} ${mod_name}.so" -# pkgconf=$(grep "^${classdef}_${name}_PC" "$defs_source") -# if [ $? -eq 0 ]; then -# pkgconf=$(echo $pkgconf | sed 's/^.*= *//') -# echo "${classdef}_${mod_name}_INCLUDE = $(pkg-config --cflags $pkgconf)" -# echo "${classdef}_${mod_name}_LIBS = $(pkg-config --libs $pkgconf)" -# else -# grep "^${classdef}_${name}_" "$defs_source" -# echo "${classdef}_${mod_name}_INCLUDE = \$(${classdef}_${name}_INCLUDE)" -# echo "${classdef}_${mod_name}_LIBS = \$(${classdef}_${name}_LIBS)" -# fi - elif want_at_all "$name" - then + MODS="${MODS} ${mod_name#_}.so" + grep "^${classdef}_${name}_PC" "$defs_source" 1>&2 + pkgconf=$(grep "^${classdef}_${name}_PC" "$defs_source") + if [ $? -eq 0 ]; then + pkgconf=$(echo $pkgconf | sed 's/^.*= *//') + echo "${classdef}_${mod_name#_}_INCLUDE = $(pkg-config --cflags $pkgconf)" + echo "${classdef}_${mod_name#_}_LIBS = $(pkg-config --libs $pkgconf)" + else + grep "^${classdef}_${name}_" "$defs_source" + echo "${classdef}_${mod_name#_}_INCLUDE = \$(${classdef}_${name}_INCLUDE)" + echo "${classdef}_${mod_name#_}_LIBS = \$(${classdef}_${name}_LIBS)" + fi + elif want_not_disabled "$name"; then + OBJ="${OBJ} ${mod_name#_}.o" + elif want_at_all "$name"; then OBJ="${OBJ} ${mod_name}.o" fi }