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
|
@ -438,7 +438,8 @@ The following variables may be set to allow package build options:
|
|||
- `build_options_default` Sets the default build options to be used by the source package.
|
||||
|
||||
- `desc_option_<option>` Sets the description for the build option `option`. This must match the
|
||||
keyword set in *build_options*.
|
||||
keyword set in *build_options*. Note that if the build option is generic enough, its description
|
||||
should be added to `common/options.description` instead.
|
||||
|
||||
After defining those required variables, you can check for the
|
||||
`build_option_<option>` variable to know if it has been set and adapt the source
|
||||
|
@ -494,6 +495,10 @@ The build options can also be shown for binary packages via `xbps-query(8)`:
|
|||
|
||||
$ xbps-query -R --property=build-options foo
|
||||
|
||||
Permanent global package build options can be set via `XBPS_PKG_OPTIONS` variable in the
|
||||
`etc/conf` configuration file. Per package build options can be set via
|
||||
`XBPS_PKG_OPTIONS_<pkgname>`.
|
||||
|
||||
### Runtime dependencies
|
||||
|
||||
Dependencies for ELF objects are detected automatically by `xbps-src`, hence runtime
|
||||
|
|
|
@ -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"
|
|
@ -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,24 +56,25 @@ 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
|
||||
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
|
||||
done
|
||||
state="OFF"
|
||||
if [ -n "$enabled" ]; then
|
||||
state="ON"
|
||||
unset enabled
|
||||
fi
|
||||
eval desc="\$desc_option_$f"
|
||||
printf "$f: $desc [$state]\n"
|
||||
done
|
||||
}
|
||||
|
||||
show_pkg_shlib_provides() {
|
||||
|
|
|
@ -96,3 +96,18 @@ XBPS_SUCMD="sudo /bin/sh -c"
|
|||
# RAM to build properly some packages.
|
||||
#
|
||||
#XBPS_DEBUG_PKGS=yes
|
||||
|
||||
# [OPTIONAL]
|
||||
# Enable or disable global package build options, these options apply
|
||||
# to all packages that support the maching options.
|
||||
#
|
||||
# To enable an option just define its option name; to disable an option
|
||||
# prefix it with ~. Options must be delimited by commas, i.e 'opt,~opt2,opt3,~opt4'
|
||||
#
|
||||
#XBPS_PKG_OPTIONS=opt,~opt2,opt3,~opt4
|
||||
|
||||
# [OPTIONAL]
|
||||
# Enable or disable package build options. Note that per package build options
|
||||
# override the global options defined above for the matching package.
|
||||
#
|
||||
#XBPS_PKG_OPTIONS_foo=opt,~opt2,opt3,~opt4
|
||||
|
|
10
xbps-src
10
xbps-src
|
@ -143,7 +143,9 @@ Options:
|
|||
-N Disable use of remote repositories to resolve dependencies.
|
||||
|
||||
-o <opt,~opt2,...>
|
||||
Enable or disable (prefixed with ~) package build options.
|
||||
Enable or disable (prefixed with ~) package build options. Note this overrides
|
||||
options set via XBPS_PKG_OPTIONS from 'etc/conf'. This effectively has the same
|
||||
effect than setting 'XBPS_PKG_OPTIONS_<pkgname>' in 'etc/conf'.
|
||||
Supported options can be shown with the 'show-options' target.
|
||||
|
||||
-r <repo>
|
||||
|
@ -325,7 +327,7 @@ while getopts "a:CfghH:Ij:Lm:No:r:V" opt; do
|
|||
L) export NOCOLORS=1; XBPS_OPTIONS+="-L ";;
|
||||
m) readonly XBPS_MASTERDIR=$(readlink -m $OPTARG 2>/dev/null); XBPS_OPTIONS+="-m $XBPS_MASTERDIR ";;
|
||||
N) readonly XBPS_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+="-N ";;
|
||||
o) readonly XBPS_BUILD_OPTS="$OPTARG"; XBPS_OPTIONS+="-o $OPTARG ";;
|
||||
o) readonly XBPS_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+="-o $OPTARG ";;
|
||||
r) readonly XBPS_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+="-r $OPTARG ";;
|
||||
V) echo $XBPS_SRC_VERSION && exit 0;;
|
||||
--) shift; break;;
|
||||
|
@ -457,7 +459,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
|
|||
XBPS_BUILDSTYLEDIR XBPS_CFLAGS XBPS_CXXFLAGS XBPS_LDFLAGS \
|
||||
XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
|
||||
XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
|
||||
XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_BUILD_OPTS \
|
||||
XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_PKG_OPTIONS \
|
||||
XBPS_CONFIG_FILE XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR \
|
||||
XBPS_SRC_VERSION XBPS_DESTDIR FAKEROOT_CMD CHROOT_CMD XBPS_MACHINE
|
||||
|
||||
|
@ -618,7 +620,7 @@ case "$XBPS_TARGET" in
|
|||
;;
|
||||
show-options)
|
||||
read_pkg
|
||||
show_pkg_options
|
||||
show_pkg_build_options
|
||||
;;
|
||||
show-shlib-provides)
|
||||
read_pkg
|
||||
|
|
Loading…
Reference in New Issue