libmakepkg: add framework for autodeps

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2021-12-12 14:41:01 +10:00
parent 354a300cd2
commit 060ab4a289
3 changed files with 43 additions and 2 deletions

View file

@ -76,7 +76,8 @@ BUILDENV=(!distcc color !ccache check !sign)
# These are default values for the options=() settings # 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. # A negated option will do the opposite of the comments below.
# #
#-- strip: Strip symbols from binaries/libraries #-- strip: Strip symbols from binaries/libraries
@ -88,8 +89,9 @@ BUILDENV=(!distcc color !ccache check !sign)
#-- purge: Remove files specified by PURGE_TARGETS #-- purge: Remove files specified by PURGE_TARGETS
#-- debug: Add debugging flags as specified in DEBUG_* variables #-- debug: Add debugging flags as specified in DEBUG_* variables
#-- lto: Add compile flags for building with link time optimization #-- 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 #-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(ck) INTEGRITY_CHECK=(ck)

View file

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

View file

@ -480,6 +480,7 @@ write_pkginfo() {
local size=$(dirsize) local size=$(dirsize)
merge_arch_attrs merge_arch_attrs
generate_autodeps
printf "# Generated by makepkg %s\n" "$makepkg_version" printf "# Generated by makepkg %s\n" "$makepkg_version"
printf "# using %s\n" "$(fakeroot -v)" printf "# using %s\n" "$(fakeroot -v)"