Implemented support for permanent pkg build options (globally or per-pkg).
Permanent global pkg build options can be defined via 'XBPS_PKG_OPTIONS' in etc/conf. Permament per-pkg build options can be defined via 'XBPS_PKG_OPTIONS_<pkgname>' in etc/conf. Close GH #452.
This commit is contained in:
parent
31866db69f
commit
9d34c36e0a
8 changed files with 117 additions and 68 deletions
|
@ -11,25 +11,7 @@ XBPS_CXXFLAGS="$XBPS_CXXFLAGS"
|
|||
XBPS_CPPFLAGS="$XBPS_CPPFLAGS"
|
||||
XBPS_LDFLAGS="$XBPS_LDFLAGS"
|
||||
_EOF
|
||||
if [ -n "$XBPS_MAKEJOBS" ]; then
|
||||
echo "XBPS_MAKEJOBS=$XBPS_MAKEJOBS" >> $XBPSSRC_CF
|
||||
fi
|
||||
if [ -n "$XBPS_HOSTDIR" ]; then
|
||||
echo "XBPS_HOSTDIR=/host" >> $XBPSSRC_CF
|
||||
fi
|
||||
if [ -n "$XBPS_CCACHE" ]; then
|
||||
echo "XBPS_CCACHE=$XBPS_CCACHE" >> $XBPSSRC_CF
|
||||
fi
|
||||
if [ -n "$XBPS_DISTCC" ]; then
|
||||
echo "XBPS_DISTCC=$XBPS_DISTCC" >> $XBPSSRC_CF
|
||||
echo "XBPS_DISTCC_HOSTS=\"${XBPS_DISTCC_HOSTS}\"" >> $XBPSSRC_CF
|
||||
fi
|
||||
if [ -n "$XBPS_USE_GIT_REVS" ]; then
|
||||
echo "XBPS_USE_GIT_REVS=yes" >> $XBPSSRC_CF
|
||||
fi
|
||||
if [ -n "$XBPS_DEBUG_PKGS" ]; then
|
||||
echo "XBPS_DEBUG_PKGS=yes" >> $XBPSSRC_CF
|
||||
fi
|
||||
grep -E '^XBPS_.*' $XBPS_CONFIG_FILE >> $XBPSSRC_CF
|
||||
|
||||
echo "# End of configuration file." >> $XBPSSRC_CF
|
||||
|
||||
|
@ -192,7 +174,6 @@ chroot_handler() {
|
|||
if [ "$action" = "chroot" ]; then
|
||||
$CHROOT_CMD ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell || rv=$?
|
||||
else
|
||||
[ -n "$XBPS_BUILD_OPTS" ] && arg="$arg -o $XBPS_BUILD_OPTS"
|
||||
[ -n "$XBPS_CROSS_BUILD" ] && arg="$arg -a $XBPS_CROSS_BUILD"
|
||||
[ -n "$XBPS_KEEP_ALL" ] && arg="$arg -C"
|
||||
[ -n "$NOCOLORS" ] && arg="$arg -L"
|
||||
|
|
|
@ -89,7 +89,7 @@ msg_normal_append() {
|
|||
}
|
||||
|
||||
set_build_options() {
|
||||
local f j opt optval _optsset
|
||||
local f j opt optval _optsset pkgopts
|
||||
local -A options
|
||||
|
||||
if [ -z "$build_options" ]; then
|
||||
|
@ -97,15 +97,19 @@ set_build_options() {
|
|||
fi
|
||||
|
||||
for f in ${build_options}; do
|
||||
eval pkgopts="\$XBPS_PKG_OPTIONS_${pkgname}"
|
||||
if [ -z "$pkgopts" -o "$pkgopts" = "" ]; then
|
||||
pkgopts=${XBPS_PKG_OPTIONS}
|
||||
fi
|
||||
OIFS="$IFS"; IFS=','
|
||||
for j in ${XBPS_BUILD_OPTS}; do
|
||||
for j in ${pkgopts}; do
|
||||
opt=${j#\~}
|
||||
opt_disabled=${j:0:1}
|
||||
if [ "$opt" = "$f" ]; then
|
||||
if [ "$opt_disabled" != "~" ]; then
|
||||
options[$opt]=1
|
||||
eval options[$opt]=1
|
||||
else
|
||||
options[$opt]=0
|
||||
eval options[$opt]=0
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -137,11 +141,11 @@ set_build_options() {
|
|||
fi
|
||||
|
||||
for f in ${build_options}; do
|
||||
optval=${options[$f]}
|
||||
eval optval=${options[$f]}
|
||||
if [[ $optval -eq 1 ]]; then
|
||||
_optsset="${_optsset} ${f}"
|
||||
_optsset+=" ${f}"
|
||||
else
|
||||
_optsset="${_optsset} ~${f}"
|
||||
_optsset+=" ~${f}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
@ -149,7 +153,7 @@ set_build_options() {
|
|||
if [ -z "$PKG_BUILD_OPTIONS" ]; then
|
||||
PKG_BUILD_OPTIONS="$f"
|
||||
else
|
||||
PKG_BUILD_OPTIONS="$PKG_BUILD_OPTIONS $f"
|
||||
PKG_BUILD_OPTIONS+=" $f"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
# vim: set ts=4 sw=4 et:
|
||||
|
||||
show_build_options() {
|
||||
local f opt desc
|
||||
|
||||
[ -z "$PKG_BUILD_OPTIONS" ] && return 0
|
||||
|
||||
msg_normal "$pkgver: the following build options are set:\n"
|
||||
for f in ${PKG_BUILD_OPTIONS}; do
|
||||
opt="${f#\~}"
|
||||
eval desc="\${desc_option_${opt}}"
|
||||
if [[ ${f:0:1} == '~' ]]; then
|
||||
echo " $opt: $desc (OFF)"
|
||||
else
|
||||
printf " "
|
||||
msg_normal_append "$opt: "
|
||||
printf "$desc (ON)\n"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_pkg_arch() {
|
||||
local cross="$1"
|
||||
|
||||
|
@ -48,7 +29,7 @@ install_pkg() {
|
|||
|
||||
[ -z "$pkgname" ] && return 1
|
||||
|
||||
show_build_options
|
||||
show_pkg_build_options
|
||||
check_pkg_arch $cross
|
||||
install_cross_pkg $cross
|
||||
|
||||
|
|
|
@ -56,23 +56,24 @@ show_pkg_build_deps() {
|
|||
done
|
||||
}
|
||||
|
||||
show_pkg_options() {
|
||||
local f= j= state= desc= enabled=
|
||||
|
||||
for f in ${build_options}; do
|
||||
for j in ${build_options_default}; do
|
||||
if [ "$f" = "$j" ]; then
|
||||
enabled=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
state="OFF"
|
||||
if [ -n "$enabled" ]; then
|
||||
state="ON"
|
||||
unset enabled
|
||||
show_pkg_build_options() {
|
||||
local f opt desc
|
||||
|
||||
[ -z "$PKG_BUILD_OPTIONS" ] && return 0
|
||||
|
||||
source $XBPS_COMMONDIR/options.description
|
||||
msg_normal "$pkgver: the following build options are set:\n"
|
||||
for f in ${PKG_BUILD_OPTIONS}; do
|
||||
opt="${f#\~}"
|
||||
eval desc="\${desc_option_${opt}}"
|
||||
if [[ ${f:0:1} == '~' ]]; then
|
||||
echo " $opt: $desc (OFF)"
|
||||
else
|
||||
printf " "
|
||||
msg_normal_append "$opt: "
|
||||
printf "$desc (ON)\n"
|
||||
fi
|
||||
eval desc="\$desc_option_$f"
|
||||
printf "$f: $desc [$state]\n"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue