Understanding make.conf - An Introduction

Anything that pertains to Portage

Moderator: Moderators

Posts: 9051
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Understanding make.conf - An Introduction

Post by wolfden » Wed Sep 26, 2007 11:19

Code: Select all

# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-O3 -march=native -funroll-all-loops -m3dnow -msse3 -funit-at-a-time -fpeel-loops -ftracer -funswitch-loops -fomit-frame-pointer -pipe"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -s"
USE="win32codecs mp3 quicktime type1 divx4linux dvb dvd dvdread live mpeg nvidia jpeg truetype v4l v4l2 xv xvid multilib gnutls arts cups ppds foomatic-db alsa gimpprint freetype gnome X gtk gtk2 unicode moznocompose moznoirc moznomail kde qt samba xinerama xine theora kdeenablefinal wifi hal ieee1394 oggvorbis lm_sensors logitech-mouse zeroconf artswrappersuid nptl nptlonly rdesktop dvdr css gphoto2 openexr speex jpeg2k povray scanner musicbrainz accessibility audiofile exif xscreensaver ffmpeg vcd sndfile musepack asterisk mbrola pam_chroot pam_timestamp pwdb pda sms irda kig-scripting speedo browserplugin nsplugin ldap kerberos firefox dga aac dts xvmc dbus hal dvi on-the-fly-crypt dri xprint acpi ada ruby perforce cjk fat hfs jfs ntfs reiser4 xfs reiserfs skins cdda real shout stream a52 wxwindows vlm lirc libcaca remote stats lcd unichrome 7zip commercial mozsvg canvas xml2 glut java glitz svg avahi ogg vorbis aalib flac gdbm mikmod timidity kdgraphics dlloader exscalibar ipod visualization mono cdr nntp cairo djvu nautilus evo ole pdf xml ladspa soundtouch bzip2 udev mad fuse rtsp tiff kdehiddenvisibility dvi usb kipi aiglx musicbrainz pulseaudio dv lame mp3rtp udev cdr dvi djvu libnotify bzip2 aalib startup-notification nsplugin jingle gsm dbox2 opengl sdl png gif qt3 qt4 qt3support apache2 mysql php ssl xml berkdb innobd pcre" 
MAKEOPTS="-s -j3"
CONFIG_PROTECT="/usr/kde/3.5/share/config/kdm/ /etc"
VIDEO_CARDS="vesa vga nvidia"
INPUT_DEVICES="evdev keyboard mouse"
LIRC_DEVICES="audio audio_alsa"
PORTAGE_ELOG_CLASSES="warn error log info"
# FEATURES="buildpkg"
source /usr/portage/local/layman/make.conf 
EMERGE_DEFAULT_OPTS="--with-bdeps y"
Above you will find a make.conf and is a vital component to your operating system. If you don't know this file you are defeating the purpose of this distro. One of the biggest things about gentoo based is being able to build the operating sytem to you. Using the default settings are going to work, but you are not taking full advantage of your potentials. You can ease our portage frustration also, like compiling issues.

Why do we need make.conf?
Portage uses this file to know how to build your entire system. All the settings you put here, portage reads and builds to them.

CFLAGS are C compiler flags, usually GCC (GNU Compiler Collection) options.
CFLAGS are commonly used to specify the architecture of your computer, as well as the CPU you are using and any other special options you would like to enable or disable. This information is important to GCC because it tells it exactly how to customize the assembly instructions it creates from the application's source code.

Deals with your hash tables and compiler See for more information:
Your not going to be touching these, so moving right along.

Variable declares the target build host for your system You don't want to change this value unless you know what you are doing. You simply can't change it to i686 and go about using your computer. There is situations that may cause you to have to change this. For instance, lets say you upgrade your cpu or need a certain package that won't work with your current architect. Gentoo has a guide for changing it. Follow it closely or you will have a hosed system.

CXXFLAGS is set to use all the options present in CFLAGS. This is what you'll want almost without fail. You shouldn't ever need to specify additional options in CXXFLAGS.

In Gentoo a USE flag is a representation of an option, a global setting for your final system. USE flags affect how many of the packages on your system will build. These depend on the software and your computer usage. It's important to know these and to thin the list down to your usage. You will see that I have a lot in mine, but that is because of testing I do for SL. All these USE settings are global, meaning they effect every package on your system. The more USE settings you have, the more conflicts you can encounter with portage when compiling software. There is a /etc/portage/package.use file that you can use to individually tell packages how you want them built.
http://www.gentoo.org/doc/en/handbook/h ... t=2&chap=2

This is for setting which branch of portage you want to use. Stable vs. Unstable "bleeding edge". You can see by the ~ we are not using the stable branch so we are bleeding edge.
http://www.gentoo.org/doc/en/handbook/h ... t=3&chap=3

I hope this is self explanatory, but if not - your language

You define how many parallel compilations should occur when you install a package. A good choice is the number of CPUs in your system plus one, but this guideline isn't always perfect.
http://www.gentoo.org/doc/en/handbook/h ... t=1&chap=5

If you keep using your computer while compiling packages you will notice that your box is less responsive than usual. This is caused by having two "groups" of processes with the same nice priority: your usual running processes, and emerge (and its child processes). Now, if you could renice emerge and its children to a higher nice value (i.e. lower priority), compiling would take somewhat longer, but your workstation will be as responsive as before.

Portage has several additional features that makes your Gentoo experience even better. Many of these features rely on certain software tools that improve performance, reliability, security, ...
Parallel fetch:
When you are emerging a series of packages, Portage can fetch the source files for the next package in the list even while it is compiling another package, thus shortening compile times..
http://www.gentoo.org/doc/en/handbook/h ... t=2&chap=3

This variable contains a space-delimited list of directories which should be protected by Portage during updates.
http://www.gentoo.org/doc/en/handbook/h ... t=2&chap=5

I see people's make.conf often and in the default make.conf there is like 20 video cards listed. Why compile more than you have too? Get rid of all the cards not in your computer.
http://www.gentoo.org/proj/en/desktop/x ... -howto.xml

The same goes here, get rid of any equipment you don't have. My desktop doesn't have touchpad - why compile it?
http://www.gentoo.org/proj/en/desktop/x ... -howto.xml

Linux Infrared Remote Control - this is where you are going to set your devices

source /usr/portage/local/layman/make.conf -- location for your layman, for managing your overlays such as sabayon, xeffects, etc....

Extras that I have added, just for my own use. You will not see these in a default make.conf

Ebuild Logging -
Portage can create per-ebuild logfiles, but only when the PORT_LOGDIR variable is set to a location that is writable by Portage (the portage user). By default this variable is unset. If you don't set PORT_LOGDIR, then you won't receive any build logs with the current logging system, though you may receive some logs from the new elog. If you do have PORT_LOGDIR defined and you use elog, you will receive build logs and any logs saved by elog, as explained below.

Portage offers fine-grained control over logging through the use of elog:

* PORTAGE_ELOG_CLASSES: This is where you set what kinds of messages to be logged. You can use any space-separated combination of info, warn, error, log, and qa.
o info: Logs "einfo" messages printed by an ebuild
o warn: Logs "ewarn" messages printed by an ebuild
o error: Logs "eerror" messages printed by an ebuild
o log: Logs the "elog" messages found in some ebuilds
o qa: Logs the "QA Notice" messages printed by an ebuild
PORTAGE_ELOG_SYSTEM: This selects the module(s) to process the log messages. If left empty, logging is disabled. You can use any space-separated combination of save, custom, syslog, mail, save_summary, and mail_summary. You must select at least one module in order to use elog.
* save: This saves one log per package in $PORT_LOGDIR/elog, or /var/log/portage/elog if $PORT_LOGDIR is not defined.
* custom: Passes all messages to a user-defined command in $PORTAGE_ELOG_COMMAND; this will be discussed later.
* syslog: Sends all messages to the installed system logger.
* mail: Passes all messages to a user-defined mailserver in $PORTAGE_ELOG_MAILURI; this will be discussed later. The mail features of elog require >=portage-2.1.1.
* save_summary: Similar to save, but it merges all messages in $PORT_LOGDIR/elog/summary.log, or /var/log/portage/elog/summary.log if $PORT_LOGDIR is not defined.
* mail_summary: Similar to mail, but it sends all messages in a single mail when emerge exits.
http://www.gentoo.org/doc/en/handbook/h ... t=3&chap=1
**portage-2.1.3: "echo" - this prints all logged messages again at the end of the emerge

FEATURES="buildpkg" for building your own binary packages and saving them
http://gentoo-wiki.com/HOWTO_setup_a_PO ... OST_server

source /usr/portage/local/layman/make.conf -- location for your layman, for managing your overlays such as sabayon, xeffects, etc....

EMERGE_DEFAULT_OPTS="--with-bdeps y" # considers also build-time deps at dependency calculations
http://www.gentoo.org/doc/en/handbook/h ... t=3&chap=2

Man Make.conf

Do you see now why it is important to know this file? This file can make your gentoo based distro a much better experience. The gentoo handbook can help you set it up properly. Remember to take full advantage of changes, you need to be using certain flags like emerge --newuse foo. Recompiling your entire sytem and world is what you need to do to take advantage of your changes. Like for me I simple run emerge -uDN --world - that will update and make sure all packages are following my settings. If I changed a USE flag it will rebuild the packages effected and update packages to latest in portage.

Recompiling your system is not going to be easy if you are new to all of this. I recommend getting to know portage and how to work with portage before attempting it. It's something you just don't jump into. Your going to run into all sorts of issues and gonna have to search and find your answers. As of 3.4 you are gonna run into a python update, which requires taking care of first as things will break and need to get updated to the new python. Pending on your system - it can take several days to complete the process.
Learn your world file and cleaning it out before starting, this will save many hours of recompiling packages you don't need. The world file is a record of packages which have been specifically installed by the user. More specifically it's a list of packages which the user wants to keep installed and updated on their system. It will not record the dependencies of those packages, but instead uses the dependencies of the currently installed packages to keep track of this information. http://gentoo-wiki.com/HOWTO_Use_Portage_Correctly

You will also want to get yourself familiar with the files in your /etc/portage/ you will need to use them to mask and unmask needed packages. Also use em for telling how certain packages should be built.

Read thru the unofficial guide for a world update
http://www.sabayonlinux.org/forum/viewt ... =54&t=5531

Best advice - Use the operating system till you know it, than start diving into the depths of the internal stuff. I know it is frustrating for people that are new, but if you give it time and stick with it, it will all come together. If all this information totally terrifies you, than stick with the default settings. Use the information for you knowledge. Topic is open for discussion.

Growing Hen
Posts: 181
Joined: Sun Mar 11, 2007 8:12
Location: Glasgow, UK.

Re: Understanding make.conf - An Introduction

Post by freeallbadgers » Wed Sep 26, 2007 11:24

Excellent post - great stuff!
“I just finished compiling glibc and now it says there is a new update available? Arrgh! It never ends!!”

Baby Hen
Posts: 17
Joined: Thu Aug 02, 2007 17:23

Re: Understanding make.conf - An Introduction

Post by Cohan » Wed Sep 26, 2007 13:51

Outstanding introduction! Complete with links and everything. Tnx a lot! Might give an extra donation to Sabayon for this. :D

User avatar
Advanced Hen
Posts: 242
Joined: Mon Apr 23, 2007 22:47
Location: Munich (Germany)

Re: Understanding make.conf - An Introduction

Post by Necoro » Wed Sep 26, 2007 15:40

Great post ... but you might want to add the PORTAGE_ELOG_SYTEM choice added with portage-2.1.3: "echo" - this prints all logged messages again at the end of the emerge. Thus you don't miss anything important and you don't have to look up several logs =)

Growing Hen
Posts: 140
Joined: Thu Mar 15, 2007 17:39
Location: Roma

Re: Understanding make.conf - An Introduction

Post by fenius » Wed Sep 26, 2007 16:00

Wolfden you are the man!!!
we should make a statue in your honor :wink:

Posts: 9051
Joined: Sat Jan 14, 2006 0:55
Location: Midwest USA

Re: Understanding make.conf - An Introduction

Post by wolfden » Wed Sep 26, 2007 20:20

Necoro wrote:Great post ... but you might want to add the PORTAGE_ELOG_SYTEM choice added with portage-2.1.3: "echo" - this prints all logged messages again at the end of the emerge. Thus you don't miss anything important and you don't have to look up several logs =)
Yes, that is great, but if one is doing several packages and end up doing --resume --skipfirst or emerge till done, you will miss those message. It is nice tho for your smaller size emerges.

Sagely Hen
Posts: 1989
Joined: Wed Jan 03, 2007 21:01
Location: 31.324270, -113.585511

Re: Understanding make.conf - An Introduction

Post by WarraWarra » Wed Sep 26, 2007 21:23

Great thanks makes live much easier. :D

Growing Hen
Posts: 195
Joined: Thu Jun 28, 2007 13:05

Re: Understanding make.conf - An Introduction

Post by koch » Thu Sep 27, 2007 0:04

WINDOWS: Buy it, use it, break it, fix it, trash it, melt - upgrade it, charge it, pawn it, zoom it, press it, snap it, write it, get it, paste it, save it, load it, check it, plug it, play it, burn it, rip it, drag and drop it - stop. format it.

Simple Hen
Posts: 94
Joined: Thu Sep 20, 2007 23:08
Location: Southern Brazil

Re: Understanding make.conf - An Introduction

Post by xt600 » Thu Sep 27, 2007 13:39

I finally edited my make.config and took out a bunch of junk like Nvidia drivers, Bluetooth, etc. Now my putter is compiling 3-4 times faster. I also just switched over to the 3.4 mini. So I am not sure if it is the make.config, the mini or a combiantion of both that is making my putter faster?

BTW, Thanks much for the Tutorial! A+

P4, 64bit Radeon 9600 Pro with 1 gig ram

Baby Hen
Posts: 2
Joined: Thu Oct 25, 2007 4:36
Location: Bristol, VA

Re: Understanding make.conf - An Introduction

Post by skipb » Thu Oct 25, 2007 4:48

Great tutorial Thanks a lot! :D

Post Reply