From owner-freebsd-questions@FreeBSD.ORG Wed Aug 22 13:32:38 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF8F16A417 for ; Wed, 22 Aug 2007 13:32:38 +0000 (UTC) (envelope-from mkhitrov@gmail.com) Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.180]) by mx1.freebsd.org (Postfix) with ESMTP id 8319E13C459 for ; Wed, 22 Aug 2007 13:32:37 +0000 (UTC) (envelope-from mkhitrov@gmail.com) Received: by ik-out-1112.google.com with SMTP id c21so31083ika for ; Wed, 22 Aug 2007 06:32:36 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Z0PkXt2D7YzJ4Z7Cf7WHjVC5AUa7VUgWF6cuVXvbgMqQpCpEYQX7Rc97j4/TKmPZw3IQdMrT3KCvIRDkHL6x3f+bveZR/9fAn339PX9LfyEzIHF/CtZnYj5YC/+kJI/Ngm/d//M8YgoAbJhpyxFcuD9XBayqJ6RnbNADGZCwe6s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ScCEo7C7Fd1YWahjQSF3rqxymwN7EpDWADUnEmgaztwfO53MfxoX6Uc9A/TR1WJk815MOJayLymvQCHBrVPsw1XzT9aRPBZMRIHyW4CYhBZYTMoHmBG+jEWidY+BB9ey37VU+In3jVE0vFtu4C03YDr8EskSBivg/sHXfHpG9bU= Received: by 10.142.179.12 with SMTP id b12mr27675wff.1187789554686; Wed, 22 Aug 2007 06:32:34 -0700 (PDT) Received: by 10.143.10.17 with HTTP; Wed, 22 Aug 2007 06:32:34 -0700 (PDT) Message-ID: <26ddd1750708220632u48ed0773i80f9dc77ffddf980@mail.gmail.com> Date: Wed, 22 Aug 2007 09:32:34 -0400 From: "Maxim Khitrov" To: "Gabriel Linder" In-Reply-To: <20070822095408.61c11ab2@oblivion.jeuxvideo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070822095408.61c11ab2@oblivion.jeuxvideo.com> Cc: freebsd-questions@freebsd.org Subject: Re: Ports build parameters (knobs) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2007 13:32:38 -0000 On 8/22/07, Gabriel Linder wrote: > Hello, > > During the build of the graphical portion of my new FreeBSD-powered > laptop I noticed that some knobs are not listed in /usr/ports/KNOBS and > so, I can't add them to make.conf before building the packages. > > When I run "make fetch-recursive" for fluxbox, I get : > > WITH_DEBUG=yes Build with debugging symbols > WITH_DOCHTML=yes Install the HTML documentation > WITH_DOCPDF=yes Install the PDF documentation > WITH_GNOME=yes Enable GNOME support > WITH_IMLIB2=yes Enable Imlib2 (pixmap themes) support > [snip] > > and for libiconv : > > WITHOUT_EXTRA_ENCODINGS=yes Disable extra character sets > WITH_EXTRA_PATCHES=yes Apply extra patches (fixes cp932, adds > EUCJP-MS) > > GNOME and DEBUG are listed in /usr/ports/KNOBS, but IMLIB2 and > EXTRA_PATCHES are not... Is there a way to have the full list of > supported build options ? Or maybe I am wrong and these settings are not > supposed to be in make.conf but in /var/db/ports//options, if > so please let me know :) My experience has shown that it's always best to look at the Makefile of any port you are about to install. That's the most reliable way to learn about the port and the knobs it supports. However, this can be rather tedious when installing something with a few hundred dependencies (like gnome), so I actually came up with a solution to speed things up. First of all, you should install portconf from ports-mgmt and use it to specify port-specific options. It's a much cleaner way of doing things than using if statements in make.conf. You can also easily transfer the configuration to other systems. In addition to port-specific options, you can use * to set global knobs. Here's the start of my ports.conf file just to give you an idea: *: WITHOUT_BDB |\ WITHOUT_DEBUG |\ WITHOUT_DEBUGGING |\ WITHOUT_IPV6 |\ WITHOUT_NLS |\ WITHOUT_PROFILE |\ WITH_OPTIMIZED_CFLAGS |\ WITH_TTF_BYTECODE_ENABLED converters/libiconv: WITHOUT_EXTRA_ENCODINGS lang/php5: WITHOUT_CGI |\ WITH_MULTIBYTE And so on... Now as far as actually discovering what knobs are available, I wrote a simple script to do this. The contents are below, save them as /usr/local/sbin/getknobs or something similar. The idea is this; when you are about to install a port, run getknobs from the port's directory. The script uses 'make missing' to determine all the other ports that are about to be installed, then goes through their port directories and searches all the files for WITH/WITHOUT_* patterns. You then get a nice print out of all the knobs that you can configure before running make install for the current port. Since this script is using make missing you will not get the knobs for ports that are already installed. The script was meant to be used from the very beginning (i.e. starting from a clean system), so that on each step you are only shown knobs for ports that aren't already configured. You can easily modify this behavior if you want. You may also need to adjust the regular expression used to find the knobs. - Max #!/bin/sh cmd='make missing' regex='WITH(OUT)?_[^[:space:]=)}\?]+' dir=`pwd` dir=`dirname $dir` dir=`dirname $dir` if [ "/usr/ports" != "$dir" ]; then echo 1>&2 "This script must be run for a port's directory." exit 1 fi ports="`$cmd` `pwd | sed 's/\/usr\/ports\///'`" for port in $ports; do knobs=`grep -Eho $regex /usr/ports/$port/* | sort | uniq` if [ -z "$knobs" ]; then continue fi echo "--- ${port}:" for knob in $knobs; do echo " $knob" done echo done