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:
Juan RP 2014-06-30 11:32:07 +02:00
parent 31866db69f
commit 9d34c36e0a
8 changed files with 117 additions and 68 deletions

View file

@ -0,0 +1,60 @@
desc_option_aalib="Enable support for aalib video output"
desc_option_acl="Enable support for ACLs and Extended Attributes"
desc_option_backtrace="Enable support for backtraces via libunwind"
desc_option_bluetooth="Enable support for bluetooth"
desc_option_broadway="Enable support for the HTML5 Broadway backend"
desc_option_cdparanoia="Enable support for CD audio (cdparanoia)"
desc_option_colord="Enable support for colord"
desc_option_cups="Enable support for CUPS"
desc_option_dbus="Enable support for D-BUS"
desc_option_dri2="Enable support for the DRI2 extension"
desc_option_dri="Enable support for the DRI extension"
desc_option_efi="Enable support for EFI"
desc_option_expat="Enable support for XML via expat"
desc_option_framebuffer="Enable support for the Framebuffer"
desc_option_gdk_pixbuf="Enable support to use transparency via gdk-pixbuf"
desc_option_gif="Enable support for GIF images"
desc_option_gir="Enable support for gobject introspection data"
desc_option_gles2="Enable support for GLES (v2)"
desc_option_gles="Enable support for GLES (v1)"
desc_option_gnome="Enable support for GNOME"
desc_option_gnutls="Enable support for SSL with gnutls"
desc_option_gstreamer="Enable support for GStreamer"
desc_option_harfbuzz="enable support for Harfbuzz"
desc_option_idn="Enable support for IDN"
desc_option_imagemagick="Enable support for ImageMagick"
desc_option_jack="Enable support for the JACK sound server"
desc_option_jpeg="Enable support for JPEG images"
desc_option_lame="Enable support for the LAME encoder"
desc_option_lua="Enable support for Lua"
desc_option_lzo="Enable support for LZO compression format"
desc_option_microhttpd="Enable support for microhttpd"
desc_option_mpcdec="Enable support for the Musepack decoder"
desc_option_notify="Enable support for desktop notifications (libnotify)"
desc_option_opengl="Enable support for OpenGL"
desc_option_openssl="Enable support for SSL with OpenSSL"
desc_option_pam="Enable support for PAM"
desc_option_pdf="Enable support to preview PDF files"
desc_option_perl="Enable support for Perl"
desc_option_png="Enable support for PNG images"
desc_option_ps="Enable support to preview PS files"
desc_option_pulseaudio="Enable support for the PulseAudio sound server"
desc_option_python="Enable support for Python"
desc_option_qrencode="Enable support for qrencode"
desc_option_qt="Enable support for building the QT UI"
desc_option_raw="Enable support for RAW image files"
desc_option_sasl="Enable support for SASL"
desc_option_ssl="Enable support for SSL"
desc_option_startup_notification="Enable support for desktop notification"
desc_option_svg="Enable support for SVG images"
desc_option_systemd="Enable support for systemd"
desc_option_tcpwrappers="Enable support for tcpwrappers"
desc_option_tiff="Enable support for TIFF images"
desc_option_usb="Enable support for USB"
desc_option_v4l2="Enable support for V4L2 (Video 4 Linux 2)"
desc_option_vaapi="Enable support for VA-API H.264 recording"
desc_option_wavpack="Enable support for the Wavpack audio format"
desc_option_wayland="Enable support for the Wayland backend"
desc_option_x11="Enable support for X11"
desc_option_xml="Enable support for XML"
desc_option_xscreensaver="Enable support for libXScrnSaver to determine idle time"

View file

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

View file

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

View file

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

View file

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