Signed-off-by: Allan McRae <allan@archlinux.org> --- etc/makepkg.conf.in | 6 +++-- scripts/libmakepkg/autodep.sh.in | 38 ++++++++++++++++++++++++++++++++ scripts/makepkg.sh.in | 1 + 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 scripts/libmakepkg/autodep.sh.in diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 5ad3d490..f69a7add 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -76,7 +76,8 @@ BUILDENV=(!distcc color !ccache check !sign) # These are default values for the options=() settings ######################################################################### # -# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto) +# Makepkg defaults: +# OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto !autodeps) # A negated option will do the opposite of the comments below. # #-- strip: Strip symbols from binaries/libraries @@ -88,8 +89,9 @@ BUILDENV=(!distcc color !ccache check !sign) #-- purge: Remove files specified by PURGE_TARGETS #-- debug: Add debugging flags as specified in DEBUG_* variables #-- lto: Add compile flags for building with link time optimization +#-- autodeps: Automatically add depends/provides # -OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto) +OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto !autodeps) #-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2 INTEGRITY_CHECK=(ck) diff --git a/scripts/libmakepkg/autodep.sh.in b/scripts/libmakepkg/autodep.sh.in new file mode 100644 index 00000000..80f66e70 --- /dev/null +++ b/scripts/libmakepkg/autodep.sh.in @@ -0,0 +1,38 @@ +#!/bin/bash +# +# autodep.sh - functions for automatically adding depends/provides +# +# Copyright (c) 2021 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_AUTODEP_SH" ]] && return +LIBMAKEPKG_AUTODEP_SH=1 + +LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + +declare -a autodep_functions + +for lib in "$LIBRARY/autodep/"*.sh; do + source "$lib" +done + +readonly -a autodep_functions + +generate_autodeps() { + for func in ${autodep_functions[@]}; do + $func + done +} diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 639ea84a..818eb471 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -480,6 +480,7 @@ write_pkginfo() { local size=$(dirsize) merge_arch_attrs + generate_autodeps printf "# Generated by makepkg %s\n" "$makepkg_version" printf "# using %s\n" "$(fakeroot -v)" -- 2.34.1