# building options in poudriere - best practice



## blazingice (May 10, 2013)

I have recently been playing with ports-mgmt/poudriere. I am trying to set some build options and there seem to be different ways how to do this. For example, if I want to build net/samba36 without CUPS I can

A. Edit make.conf (whether global or per jail)
   1. 
	
	



```
WITHOUT_CUPS=yes
```
   or
   2. 
	
	



```
samba_UNSET=CUPS
```

B. `#poudriere options -c JAILNAME net/samba36` And untick CUPS.

Is there a preferable way? What is the point of `poudriere options` if you can set all the options in make.conf? What is the difference between A.1 and A.2?


----------



## zeissoctopus (May 10, 2013)

ports-mgmt/poudriere will read specify make.conf in /usr/local/etc/poudriere.d/[YOUR Jail Name]-make.conf if it exists. For example, if you jail names COWBOY, ports-mgmt/poudriere will read /usr/local/etc/poudriere.d/COWBOY-make.conf. I put all global and individual port's options together into one specify make.conf. The first part is for global options apply to all ports, the latter part is for individual ports' options. According to characteristics of OptionsNg, individual options can override global options so that I put them in latter part of my make.conf.

The following is one of my make.conf for ports-mgmt/poudriere

```
###############################################################################
## enable PKGNG
## build for Intel KMS with New Xorg ports
## diable Vulnerabilities check
## set default version for Java, PostgreSQL, MySQL and Perl
WITH_PKGNG=YES
WITH_NEW_XORG=YES
DISABLE_VULNERABILITIES=YES
WITH_GECKO=libxul libxul19
JAVA_VENDOR=openjdk
JAVA_VERSION=1.6
DEFAULT_PGSQL_VER=92
DEFAULT_MYSQL_VER=55
PERL_VERSION=5.14.2
###############################################################################
## Global options for building desktop via optionsNG framework
## build desktop base on PGSQL, QT4 & KDE4
## avoid to build MySQL, GTK & GNOME 
OPTIONS_SET+=ALSA ARCHIVE ASPELL AUDIOFILE AVAHI
OPTIONS_SET+=BZIP2
OPTIONS_SET+=CAIRO CDDB CDPARANOIA COMPOSITE CUE CUPS CURL
OPTIONS_SET+=DATA DBM DBUS DEVD DOCS DOXYGEN
OPTIONS_SET+=EXIV2 EXPAT
OPTIONS_SET+=FFMPEG FLAC FONTCONFIG FREETYPE FTP FTPS FUSE
OPTIONS_SET+=GD GHOSTSCRIPT GIF GLX GMP GNUPG GPHOTO GRAPHVIZ GSSAPI GSTREAMER
OPTIONS_SET+=GUI
OPTIONS_SET+=HAL HTTPD HTTPS
OPTIONS_SET+=ICONS ICONV ICU ID3 ID3TAG IDN IMAGEMAGICK IPV4 IPV6
OPTIONS_SET+=JAVA JPEG
OPTIONS_SET+=KDE4 KWALLET
OPTIONS_SET+=LAME LANG_CN LANG_US LANG_TW LATEX LFS LIBEDIT LIBEV LIBEXIF 
OPTIONS_SET+=LIBMNG LIBPAPER LIBRSVG2 LIBVISUAL LIBWRAP LUA LZMA
OPTIONS_SET+=MAGICK MANPAGES MIXER MMKEYS MMX MODPERL MOTIF MOUSE MP3 MP4
OPTIONS_SET+=MAD MPEG2 MPLAYER MTP MULTIBYTE
OPTIONS_SET+=NLS NMAP NNTP NOTIFY
OPTIONS_SET+=OBJC OPENGL OPENJPEG OPENRAW OPENSSL OSS
OPTIONS_SET+=PAM PANGO PCRE PDF PERL PGSQL PGSQL_JDBC PHP PLUGINS PNG POPPLER
OPTIONS_SET+=PRINT PROXY PYMALLOC PYTHON
OPTIONS_SET+=QT4 QUOTA
OPTIONS_SET+=RAW RUBY
OPTIONS_SET+=SANE SASL SEM SIMD SMB SNDFILE SOCKS SOUND SQL SQLITE3 SSH SSL
OPTIONS_SET+=STRIP SVG SVN SYSLOG
OPTIONS_SET+=TCL TCLTK THEORA THREADS TIDY TIFF TK TLS
OPTIONS_SET+=UCS4 UNICODE UNIXODBC UNZIP UPNP UTF8 UTF16
OPTIONS_SET+=V4L VAAPI VDPAU VIDEO VORBIS
OPTIONS_SET+=WAV WAVEPACK WEBKIT WEBP WEBSERVER WMA WMF
OPTIONS_SET+=X11 X264 XCURSOR XFT XPM XRANDR XVID XVIDEO XVMC
OPTIONS_SET+=YAML
OPTIONS_SET+=ZLIB
###############################################################################
OPTIONS_UNSET+=A52 AAC ASCPLUS AALIB AMR AMR_NB AMR_WB AO APACHE APE ARTS ASM
OPTIONS_UNSET+=ASSERT
OPTIONS_UNSET+=BASH BDB BDB1 BITTORRENT BOOST
OPTIONS_UNSET+=CACA CARES CDDA2WAV CDIO CELT CFITSIO CXX
OPTIONS_UNSET+=DAGRAB DCA DCRAW DEBUG DIRAC DV DVDCSS
OPTIONS_UNSET+=ECW ESOUND EXAMPLES
OPTIONS_UNSET+=FAAC FAAD FAM FASTCGI FFTW FINGER FIREBIRD FLICKR FORTRAN
OPTIONS_UNSET+=FPECTL FPX FREETDS FREI0R FRIBIDI
OPTIONS_UNSET+=GCONF GCRYPT GDBM GDM GEOIP GEOS GEOTIFF GGI GIO GLADE GLUT
OPTIONS_UNSET+=GNOME GNOMEKEYRING GNOMEVFS2 GNUPLOT GNUTLS GOPHER GPERFTOOLS
OPTIONS_UNSET+=GRAPHMAGICK GRASS GSM GTK1 GTK2 GTK3 GUILE GVFS
OPTIONS_UNSET+=H323 HDF5
OPTIONS_UNSET+=IMLIB IMLIB2 INI IODBC ISPELL
OPTIONS_UNSET+=JABBER JACK JASPER JBIG JHEAD JSON
OPTIONS_UNSET+=KDE3 KERBEROS KERBEROS4 KERBEROS5 KML
OPTIONS_UNSET+=LADSPA LANG_AF LANG_AK LANG_AM LANG_AR LANG_AST LANG_BB
OPTIONS_UNSET+=LANG_BE LANG_BG LANG_BN LANG_BR LANG_BS LANG_CA LANG_CS
OPTIONS_UNSET+=LANG_CY LANG_DA LANG_DE LANG_EL LANG_EO LANG_ES LANG_ET
OPTIONS_UNSET+=LANG_EU LANG_FA LANG_FI LANG_FR LANG_FY LANG_GA LANG_GB
OPTIONS_UNSET+=LANG_GD LANG_GL LANG_GU LANG_HE LANG_HI LANG_HR LANG_HU
OPTIONS_UNSET+=LANG_ID LANG_IS LANG_IT LANG_JA LANG_JP LANG_KK LANG_KN
OPTIONS_UNSET+=LANG_KO LANG_KU LANG_LG LANG_LK LANG_LT LANG_LV LANG_MAI
OPTIONS_UNSET+=LANG_MK LANG_ML LANG_MN LANG_MR LANG_NB LANG_NL LANG_NN
OPTIONS_UNSET+=LANG_NSO LANG_OR LANG_PA LANG_PBR LANG_PL LANG_PT LANG_RM
OPTIONS_UNSET+=LANG_RO LANG_RU LANG_SA LANG_SC LANG_SE LANG_SI LANG_SK
OPTIONS_UNSET+=LANG_SL LANG_SM LANG_SON LANG_SQ LANG_SR LANG_SV LANG_TA
OPTIONS_UNSET+=LANG_TE LANG_TH LANG_TR LANG_UA LANG_UK LANG_VI LANG_ZA
OPTIONS_UNSET+=LANG_ZU LASH LASTFM LCMS2 LDAP LDAPS LENSFUN LIBBLURAY
OPTIONS_UNSET+=LIBEXTRACTOR LIBVIRT LIBWMF LIBXINE LIGHTTPD LIRC LITE
OPTIONS_UNSET+=LIVEMEDIA LQR LSOF
OPTIONS_UNSET+=MAPSERVER MATROSKA MDNSRESPONDER MIKMOD MJPEGTOOLS MMS
OPTIONS_UNSET+=MODPLUG MONO MPG123 MPLS MPP MSQL MSSQL MUSEPACK MYSQL
OPTIONS_UNSET+=MYSQL_JDBC
OPTIONS_UNSET+=NAS NETCDF NETPBM NFS NIS NTLM NUMPY
OPTIONS_UNSET+=ODBC ODF OGG OPENAL OPENCV OPENEXR OPENMP OPTIMIZED_CFLAGS
OPTIONS_UNSET+=ORACLE ORACLE_JDBC OSD
OPTIONS_UNSET+=PGO PIXBUF PORTAUDIO POSTGIS PROFILE PROJ PTH PULSEAUDIO 
OPTIONS_UNSET+=QUICKTIME
OPTIONS_UNSET+=RADIUS READLINE RESIN3 RTMP
OPTIONS_UNSET+=SAMPLERATE SCHROEDINGER SCIPY SDL SHOUTCAST SNAPPY SNMP SPEEX
OPTIONS_UNSET+=SQLITE SSE STATIC STROKE SVGALIB SWFDEC SZIP
OPTIONS_UNSET+=TEST TINYXML TOMCAT5 TOMACT6 TOMCAT7 TREMOR TWOLAME
OPTIONS_UNSET+=UCS2
OPTIONS_UNSET+=VO_AACENC VO_AMRWBENC VPX
OPTIONS_UNSET+=WXGTK
OPTIONS_UNSET+=XALAN XERCES
OPTIONS_UNSET+=ZSH

###############################################################################
## enable libdrm for FreeBSD Intel KMS support
libdrm_SET+=KMS

###############################################################################
## KDE4 global options
QT4_OPTIONS=CUPS QGTKSTYLE
KDE4_PREFIX=/usr/local
kde4_SET+=KDEADMIN KDEARTWORK KDEBINDINGS KDEGRAPHICS KDEMULTIMEDIA
kde4_SET+=KDENETWORK KDEPLASMA KDESDK KDETOYS KDEUTILS KDEWEBDEV
kde4_UNSET+=KDEACCESSIBILITY KDEEDU KDEGAMES KDEPIM KDEPIM44
kde-workspace_SET+=GSTREAMER UPOWER WALLPAPERS
kde-workspace_UNSET+=GPS PYTHON RUBY VLC
kdeplasma-addons_UNSET+=IBUS MARBLE SCIM
libkcompactdisc_UNSET+=ALSA

###############################################################################
## avoid to build aspell with PTHREADS
aspell_UNSET+=PTHREADS

###############################################################################
## cups settings
cups-base_SET+=LIBPAPER XDG_OPEN
cups-base_UNSET+=LDAP LIBUSB XPDF AVAHI MDNSRESPONDER

###############################################################################
## emacs own settings
emacs_SET+=DBUS GCONF GTK2 JPEG MAGICK M17N OTF PNG SCROLLBARS SVG SYNC_INPUT
emacs_SET+=TIFF XFT XIM XML XPM
emacs_UNSET+=CANNA GNUTLS GSETTINGS GTK3 MOTIF SOUND SOURCES XAW XAW3D

###############################################################################
## enchant settings
enchant_SET+=ASPELL
enchant_UNSET+=HSPELL HUNSPELL ISPELL ZEMBEREK

###############################################################################
# firefox own settings
firefox_i18n_UNSET+=LANG_ALL
firefox_SET+=GCONF GIO GTK2 LOGGING
firefox_UNSET+=GNOMEUI GNOMEVFS2 OSS QT4
libxul_SET+=GCONF GIO GTK2 LOGGING 
libxul_UNSET+=GNOMEUI GNOMEVFS2 OSS QT4
libxul19_SET+=GCONF GIO GTK2 LOGGING
libxul19_UNSET+=GNOMEUI GNOMEVFS2 OSS QT4

###############################################################################
## gimp setting
gimp_SET+=PRINT PYTHON
gimp_UNSET+=HELP
gimp-app_SET+=AA DBUS LIBEXIF HELPBROWSER LIBMING POPPLER LIBSVG2 WMF
gimp-app_UNSET+=GVFS

###############################################################################
## perl5.14
perl_SET+=PERL_64BITINT PTHREAD USE_PERL
perl_UNSET+=DEBUG GDBM PERL_MALLOC PERL_64BITINT THREADS MULTIPLICITY
perl_UNSET+=SITECUSTOMIZE VENDOR_PREFIX
perl5.14_SET+=PERL_64BITINT PTHREAD USE_PERL
perl5.14_UNSET+=DEBUG GDBM PERL_MALLOC PERL_64BITINT THREADS MULTIPLICITY
perl5.14_UNSET+=SITECUSTOMIZE VENDOR_PREFIX

################################################################################
## postgresql92-server 
## postgresql92-client 
postgresql92-server_SET+=ICU INTDATE NLS PAM SSL TZDATA XML
postgresql92-server_UNSET+=DTRACE LDAP MIT_KRB5 HEIMDAL_KRB5 GSSAPI
postgresql92-server_UNSET+=OPTIMIZED_CFLAGS DEBUG
postgresql92-client_SET+=ICU INTDATE NLS PAM SSL TZDATA XML
postgresql92-client_UNSET+=DTRACE LDAP MIT_KRB5 HEIMDAL_KRB5 GSSAPI
postgresql92-client_UNSET+=OPTIMIZED_CFLAGS DEBUG

################################################################################
## python
python_SET+=IPV6 NLS PYMALLOC THREADS UCS4
python_UNSET+=EXAMPLES FPECTL PTH SEM
python27_SET+=IPV6 NLS PYMALLOC THREADS UCS4
python27_UNSET+=EXAMPLES FPECTL PTH SEM

###############################################################################
## sqlite3
sqlite3_SET+=FTS3 ICU URI METADATA SECURE_DELETE UNLOCK_NOTIFY THREADSAFE

###############################################################################
## subversion
subversion_SET+=P4_STYLE_MARKERS ENHANCED_KEYWORD FREEBSD_TEMPLATE 
subervsion_SET+=KDE_KWALLET NEON BDB
subversion_UNSET+=GNOME_KEYRING
subversion_UNSET+=MOD_DAV_SVN MOD_DONTDOTHAT SERF SASL MAINTAINER_DEBUG
subversion_UNSET+=SVNSERVE_WRAPPER SVNAUTHZ_VALIDATE STATIC BOOK
subversion_UNSET+=TEST

###############################################################################
## Thunderbird
thunderbird_i18n_UNSET+=LANG_ALL
thunderbird_SET+=ALSA DBUS ENIGMAIL GCONF GIO GSTREAMER GTK2 LIBPROXY LIGHTNING
thunderbird_SET+=LOGGING
thunderbird_UNSET+=DEBUG GNOMEUI GNOMEVFS2 OPTIMIZED_CFLAGS OSS PULSEAUDIO QT4

###############################################################################
## xterm
xterm_SET+=WCHAR LUIT PCRE
```


----------



## Beeblebrox (May 10, 2013)

The design principle behind `poudriere` was to have a package builder which allows:
A. Package building for all versions (8-9-10) - and hence the build environments witch are fetched from source
B. Package building for the same version but with different flavors - so as example gnome style, kde style or stripped.
As a result, `poudriere` can have a matrix of [versions x flavours] of build environments, and can builk-build for all of them.

Because of this design, it can be a bit difficult to incorporate the principles and understand how to manipulate `poudriere` if you are just trying to build packages for your host environment or for a set of PC/servers with same version + pkg options.  Here is what you can do to simplify things:

1. place in /etc/fstab of the build machine:

```
/var/db/ports   /usr/local/etc/poudriere.d/options  nullfs  rw  0  0
```
That way all existing port options will get passed to `poudriere`, and any changes you make on host with `# make config` will be preserved into `poudriere` builds.

2. Before building for a previously uninstalled port (new install) you need to run `# make config-recursive` or `# poudriere options -c JAILNAME` so that you can set preferences.

3. None of the "native host" environment settings will be passed to `poudriere`, so any build options you want to use must be placed in /usr/local/etc/poudriere.d/make.conf, which will be copied to the `poudriere` build environment when the build-jail is started.

4, If you want to pass any settings to `poudriere` build environment/jail, you can place those variables in /usr/local/etc/poudriere.conf by using "export". so for example, suppose your `ccache` partition is on ufs instead of zfs and you would like to use `ccache` compression in the poudriere build-jail? Place this in poudriere.conf:

```
export CCACHE_COMPRESS=yes
```

Good Luck


----------



## blazingice (May 10, 2013)

Thank you for your answers, I learned few things from you examples. However I really wanted to understand when would you use /usr/local/etc/poudriere.d/make.conf or jailname-make.conf and when would you use `#poudriere options -c jailname` It seems to me, they both give you the same end result.

Secondly it seems to me there is an overlap in information in make.conf (whether it's for poudriere or for the host's ports) between what the handbook call "knobs" (WITHOUT_*) and "options" (OPTIONS_*). I don't really understand the difference between them.


----------



## zeissoctopus (May 10, 2013)

blazingice said:
			
		

> Thank you for your answers, I learned few things from you examples. However I really wanted to understand when would you use /usr/local/etc/poudriere.d/make.conf or jailname-make.conf and when would you use `#poudriere options -c jailname` It seems to me, they both give you the same end result.
> 
> Secondly it seems to me there is an overlap in information in make.conf (whether it's for poudriere or for the host's ports) between what the handbook call "knobs" (WITHOUT_*) and "options" (OPTIONS_*). I don't really understand the difference between them.



I make three jails for different target system, one for server, one for KMS desktop KDE PC and one for i386 virtualbox GTK2 guests. They cannot share the same make.conf. 

If I save different make.confs with file name [JAIL NAME]-make.conf in /usr/local/etc/poudriere.d. ports-mgmt/poudriere will take the specify make.conf automatically.

Usually, I make a alias for ports-mgmt/poudriere and run it in background.
`alias build91i386vbox-bg (nohup poudriere bulk -f /root/poudriere_pkg_i386vbox.list -j RELENG_9_1i386vbox -p defaultports) >&! /root/vbox.log &`
then ports-mgmt/poudriere will take /usr/local/etc/poudriere.d/RELENG_9_1i386vbox-make.conf automatically.

The infrastructure of ports is being change. Some old style KNOB do not disappear at this time. Please following ports mailing list or ports SVN logs for updating you information.


----------



## Beeblebrox (May 10, 2013)

As zeissoctopus stated, make.conf will be applied to all build-environments as default, while jailname-make.conf will be applied to that specific jail name only. If jailname-make.conf exists, it overrides the generic make.conf.



> Secondly it seems to me there is an overlap in information in make.conf (whether it's for poudriere or for the host's ports) between what the handbook call "knobs"


Knobs are more general and can cause some unexpected problems if you are not careful and if you do not keep good track of what you are doing. As an example, say you chose to place the WITHOUT_X11 (or whatever the equivalent knob for xorg is) in make.conf. That means no xorg dependent ports will ever be built - it makes sense if you are building packages for a headless server, but it will cause problems if you try to use any those packages in a desktop environment if the packages in question have an X11 knob in their config setting.  Think of this as "global setting" vs "per-port-knobs".


----------



## blazingice (May 11, 2013)

Sorry for not making clear my question.



			
				Beeblebrox said:
			
		

> As zeissoctopus stated, make.conf will be applied to all build-environments as default, while jailname-make.conf will be applied to that specific jail name only. If jailname-make.conf exists, it overrides the generic make.conf.



I understand perfectly the difference between global (make.conf) and specific (jailname-make.conf) in /usr/local/etc/poudriere.d/ and how they work together. I am building ports only for one system so I am not concerned about using different make.conf files. I am trying to understand whether I should enter the build options in e.g. jailname-make.conf or use `#poudriere options -j jailname port/location` which creates /usr/local/etc/poudriere.d/jailname-options/portname/options. It seems that the same build options that I can enter in jailname-make.conf can be generated by runing `poudriere -j jailname` and ticking or removing the right options. Is there a difference between these two ways of entering build options? 

I guess the question is not that specific to ports-mgmt/poudriere as it applies to the host too, whether you set the option through make.conf or through /var/db/ports/portname/options. I happen to face this dilema as I was experimenting with ports-mgmt/poudriere



			
				Beeblebrox said:
			
		

> Think of this as "global setting" vs "per-port-knobs".



Are you saying that knobs are global and options are specific to particular ports?


----------



## Beeblebrox (May 11, 2013)

> Are you saying that knobs are global and options are specific to particular ports?


Yes, and knobs will override any preference you set in options. That is why I stated that you should use knobs sparingly, since you might want to have more flexibility with port options and you can end up with knob settings being too strict = undesired functionality constraints on your resulting packages.



> the question is not that specific to ports-mgmt/poudriere as it applies to the host too


The build jail is a clone of an independent FreeBSD environment and works in the chroot environment just as Host would.



> I am trying to understand whether I should enter the build options in e.g. jailname-make.conf or use #poudriere options -j jailname ... Is there a difference between these two ways of entering build options?


There are several differences. If you go the jailname-make.conf method (which you seem to think will be less of a hassle), you will have these problems:

If a port offers a new option, you will have to read documentation for all ports to learn of the new option, instead of getting a config screen for that one port before the build.
If poudriere is unable to build a port and you want to try building one or two ports from the native host side with `# make package`, you will either have to copy the jailname-make.conf into /etc or run `# make config-recursive` for the port you want to build. Either way it's a waste of time and you could potentially have teo different option sets (who remembers every detail?). The solution is to null-mount /var/db/ports to /usr/local/etc/poudriere.d/options. This results in shared options between the jail(s) and host - now any change you make on one side remains consistent on the other side. Of course you now have to run config before starting the port-build.
Any knob changes (and it does happen) will require review of the knobs list, while any options changes will be smoothly handled by the Makefiles.
FreeBSD makes it less of a PIA to set port options compared to the Gentoo approach.


----------

