# Disabling a component of a package?



## finalturismo (Jan 23, 2022)

is there anyway i can disable a component of a package, this is coming from a Gentoo user that is use to the USE flag system. Where i can compile packages without specific components and features.

For example how can i remove Bluetooth from the Pulseaudio package. Or how can i remove emulated networking features from libvirt?


----------



## grahamperrin@ (Jan 24, 2022)

Welcome to FreeBSD Forums. I can't answer your first topic, sorry. 

Here, for starters: 

FreshPorts is our friend.
<https://www.freshports.org/faq.php#anchors> lists in-page anchors. 



finalturismo said:


> … remove Bluetooth from the Pulseaudio package. Or



<https://www.freshports.org/audio/pulseaudio/#config> (with the `#config` anchor) lists the available configuration options for audio/pulseaudio. No _Bluetooth_ there, or elsewhere on the page. 



finalturismo said:


> remove emulated networking features from libvirt?



<https://www.freshports.org/devel/libvirt/#config> you might prefer `BHYVE=off`. There's a commonplace hint: 

`===> Use 'make config' to modify these settings`

– which you _can_ do, but I might throw you in at the deep end with something that does not require you to run that particular command. In a separate post.

Incidentally, from your first topic: 



finalturismo said:


> … installed libvirtd, …




```
% pkg provides bin/libvirtd
Name    : libvirt-7.10.0
Desc    : Toolkit to interact with virtualization capabilities
Repo    : FreeBSD
Filename: usr/local/sbin/libvirtd
%
```

– that's ports-mgmt/pkg-provides.


----------



## grahamperrin@ (Jan 24, 2022)

<https://www.freshports.org/devel/libvirt/#options> (with the `#options` anchor) gives `devel_libvirt` as the _options name_ for devel/libvirt.

ports-mgmt/poudriere is our friend, ports-mgmt/poudriere-devel moreso because it can fetch packages for things that need not be built. A great time-saver.

tl;dr use poudriere to quickly get yourself a jail with what's required to build and package a port, then:

`poudriere ports -u`
`poudriere options -n devel/libvirt`
`poudriere bulk -j main -b latest -v devel/libvirt`
That's with my jail named _main_, because I use FreeBSD 14.0-CURRENT. YMMV.

`-v` for fun, not required, because you might enjoy the verbosity during a first run. It can help you to understand what goes on.

Running here, now, I might put the result in a spoiler. In the meantime:


```
root@mowa219-gjp4-8570p-freebsd:/usr/local/etc/poudriere.d/options # ls -hlrt
total 3
drwxr-xr-x  2 root  wheel     3B Nov 10 02:59 www_firefox
drwxr-xr-x  2 root  wheel     3B Nov 10 03:01 emulators_wine
drwxr-xr-x  2 root  wheel     3B Nov 28 10:48 deskutils_recoll
drwxr-xr-x  2 root  wheel     3B Dec 23 15:03 multimedia_webcamd
drwxr-xr-x  2 root  wheel     3B Dec 23 23:28 www_falkon
drwxr-xr-x  2 root  wheel     3B Jan 24 01:06 devel_libvirt
root@mowa219-gjp4-8570p-freebsd:/usr/local/etc/poudriere.d/options # ls -hlR devel_libvirt/
total 5
-rw-r--r--  1 root  wheel   464B Jan 24 01:06 options
root@mowa219-gjp4-8570p-freebsd:/usr/local/etc/poudriere.d/options # cat devel_libvirt/options
# This file is auto-generated by 'make config'.
# Options for libvirt-7.10.0
_OPTIONS_READ=libvirt-7.10.0
_FILE_COMPLETE_OPTIONS_LIST=BHYVE DOCS LIBSSH LIBSSH2 NLS NSS QEMU READLINE SASL XEN ZFS
OPTIONS_FILE_UNSET+=BHYVE
OPTIONS_FILE_SET+=DOCS
OPTIONS_FILE_SET+=LIBSSH
OPTIONS_FILE_SET+=LIBSSH2
OPTIONS_FILE_SET+=NLS
OPTIONS_FILE_UNSET+=NSS
OPTIONS_FILE_UNSET+=QEMU
OPTIONS_FILE_SET+=READLINE
OPTIONS_FILE_UNSET+=SASL
OPTIONS_FILE_UNSET+=XEN
OPTIONS_FILE_SET+=ZFS
root@mowa219-gjp4-8570p-freebsd:/usr/local/etc/poudriere.d/options #
```

– there it is, devel_libvirt as the name of the relevant directory. "`# This file is auto-generated by 'make config'.`", which _could_ be true, however on this occasion we did _not_ run the command.

<https://github.com/freebsd/poudriere/wiki/poudriere-options.8-devel>

<https://github.com/freebsd/poudriere/wiki/poudriere-bulk.8-devel>


----------



## grahamperrin@ (Jan 24, 2022)

grahamperrin said:


> `-v` for fun, not required, because you might enjoy the verbosity during a first run. It can help you to understand what goes on.
> 
> Running here, now, I might put the result in a spoiler.



Fun. Verbosity. Colours. Yes, colours (cue: a raft of responses about the virtues of suppressing colour.)






Control-T at any time:





Nearly finished.

Finished. 

Finally, _not_ installing the package that was produced by poudriere: 


```
root@mowa219-gjp4-8570p-freebsd:~ # pkg install -n -r poudriere devel/libvirt                           
Updating poudriere repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
Fetching packagesite.pkg: 100%   61 KiB  62.3kB/s    00:01   
Processing entries: 100%
The provides database is up-to-date.
poudriere repository update completed. 240 packages processed.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
dnsmasq: 2.86_2,1 [poudriere]
libvirt: 7.10.0 [poudriere]

Number of packages to be installed: 2

The process will require 37 MiB more space.
root@mowa219-gjp4-8570p-freebsd:~ #
```


----------



## mark_j (Jan 24, 2022)

finalturismo said:


> is there anyway i can disable a component of a package, this is coming from a Gentoo user that is use to the USE flag system. Where i can compile packages without specific components and features.
> 
> For example how can i remove Bluetooth from the Pulseaudio package. Or how can i remove emulated networking features from libvirt?


Perhaps you are mixing packages (binary) with ports (source) and Gentoo's nomenclature?

In FreeBSD, ports are the source code and you DIY. Packages are binary compilations of ports with the port maintainer's preferred set of options as default (or whatever determines the best defaults for a given port). I know nothing of Gentoo so I can't give you comparisons.

So, if you're building a port (for example, your libvirt), then:
`cd /usr/ports/devel/libvirt`
`make config`

Then select the options you want.

I am not sure what you mean by "emulated networking features" though?


----------



## jmos (Jan 24, 2022)

finalturismo said:


> For example how can i remove Bluetooth from the Pulseaudio package.


If you're using pre-build packages there might be different versions of a port available (f.e. there are packages "mc" and "mc-nox11" from the mc port); And some packages have extra module packages (f.e. "pulseaudio-module-xrdp"). But that's it on packages: You cannot add or remove more features from them.

If you're using ports to build your own packages you've got more control: Many packages offering a dialog to enable or disable options of a software. You will get this dialog the first time you're building a port as well if the available options changed (or running `make config` inside the ports directory).

But also here: You're limited to the option the package maintainer made available. In case of PulseAudio there's no config option for Bluetooth; I see that there's a module, but the docs of that project are really poor (most times they say "use the package of your distribution" without any word of compiling options - just one meson command for all, they are telling more about how to download the source from the internet… wow).

To go on from here: First you've got to find out if that module is build by default. If I'm compiling that package the directory work/pulseaudio-14.2/src/modules/bluetooth stays untouched, so AFAIK it isn't build, and so it cannot be removed 

But if it would be build: Then you can ask the ports maintainer to add a configure option. If that leads to nothing you can build your own modified port, or compile it by yourself. That means: Read the docs of the developers; They are the best people who can tell you how to add or remove features from their software. (But as said that part isn't a strength of PulseAudio…)


----------



## finalturismo (Jan 24, 2022)

jmos said:


> If you're using pre-build packages there might be different versions of a port available (f.e. there are packages "mc" and "mc-nox11" from the mc port); And some packages have extra module packages (f.e. "pulseaudio-module-xrdp"). But that's it on packages: You cannot add or remove more features from them.
> 
> If you're using ports to build your own packages you've got more control: Many packages offering a dialog to enable or disable options of a software. You will get this dialog the first time you're building a port as well if the available options changed (or running `make config` inside the ports directory).
> 
> ...



Hit the nail on the head, thanks!


----------

