Difference between revisions of "Makepkg.conf"

From ArchWiki
Jump to: navigation, search
m (capitalization, wording)
(CFLAGS by Architecture: remove incomplete, confusing, and outdated list of processor-specific CFLAGS; use -march=native instead)
Line 97: Line 97:
 
  MAKEFLAGS="-j3"
 
  MAKEFLAGS="-j3"
  
==CFLAGS by Architecture==
+
==CFLAGS==
Arch currently optimizes for i686 and x86-64 architectures. The default makepkg.conf CFLAGS are compatible with all machines within their respective architectures. The following CFLAGS are further isolated to CPU types. ''Further'' optimizing for CPU type can ''theoretically'' enhance performance for packages built with such optimizations, though such gains are most likely not human-perceivable.  
+
Arch currently optimizes for i686 and x86-64 architectures. The default makepkg.conf CFLAGS are compatible with all machines within their respective architectures. ''Further'' optimizing for CPU type can ''theoretically'' enhance performance for packages built with such optimizations, though such gains are most likely not human-perceivable.  
  
===Arch Linux i686 Default===
+
As of version 4.3.0, the gcc compiler offers the {{Codeline|-march-native}} switch that enables CPU auto-detection and automatically selects optimizations supported by the local machine at gcc runtime. To use it, just modify the Arch Linux default settings by changing the CFLAGS line as follows:
 +
CFLAGS="-march=native -O2 -pipe"
 +
 
 +
See the gcc man page for a complete list of available options. The Gentoo [http://www.gentoo.org/doc/en/gcc-optimization.xml Compilation Optimization Guide] and [http://en.gentoo-wiki.com/wiki/Safe_Cflags Safe Cflags] wiki article provide more in-depth information.
 +
 
 +
===i686 default===
 
  CARCH="i686"
 
  CARCH="i686"
 
  CHOST="i686-pc-linux-gnu"
 
  CHOST="i686-pc-linux-gnu"
Line 106: Line 111:
 
  CXXFLAGS="${CFLAGS}"
 
  CXXFLAGS="${CFLAGS}"
  
===Arch Linux x86_64 Default===
+
===x86_64 default===
 
  CARCH="x86_64"
 
  CARCH="x86_64"
 
  CHOST="x86_64-unknown-linux-gnu"
 
  CHOST="x86_64-unknown-linux-gnu"
 
  CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe"
 
  CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe"
CXXFLAGS="${CFLAGS}"
 
 
===Architecture Autodetection===
 
As of version 4.3.0, the gcc compiler allows to use -march-native switch that enables the CPU autodetection and automatically turns on all optimizations supported by the local machine at gcc runtime. To use it, just modify the Arch Linux default settings by changing the CFLAGS line as following:
 
CFLAGS="-march=native -O2 -pipe"
 
 
===*AMD*===
 
 
====Mobile Duron/Duron====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon-tbird -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Athlon====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Athlon XP/Thunderbird XP/Duron Palomino/Duron 1800/Sempron 2400+====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Athlon MP====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon-mp -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Athlon 64====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=k8 -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
 
====Athlon 64 X2====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=athlon64 -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
*add +1 per extra core to MAKEFLAGS, i.e.:
 
MAKEFLAGS="-j3"
 
for dual core CPUs.
 
 
====Turion64 / X2 / Ultra====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=athlon-xp -msse3 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=k8 -msse3 -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
 
====Opteron====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=opteron -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=opteron -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
* For multi-core chips, add +1 per core to MAKEFLAGS, i.e.:
 
MAKEFLAGS="-j3"
 
for dual core CPUs.
 
 
 
====Phenom X3 / X4====
 
*'''GCC < 4.3 users use "-march=k8", GCC 4.3+ users may use the "-march=amdfam10" option.'''
 
*i686
 
I'm not quite sure about this since my Arch is x86_64, can somebody verify this please?
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=k8 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=k8 -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
*add +1 per extra core to MAKEFLAGS, i.e.:
 
MAKEFLAGS="-j5"
 
for X4 quadcore CPUs.
 
 
===*Intel*===
 
====PII====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium2 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Celeron====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium2 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====PIII====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Coppermine series Celeron====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Williamette series Celeron====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Pentium M Dothan/Celeron M====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Pentium 4/Pentium 4 Mobile====
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Pentium 4/Prescott/Celeron 'D'/Pentium 'D'/Core Solo/Core Duo====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
====Core 2 Duo/Quad/Xeon====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
*x86-64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=core2 -O2 -pipe"
 
CXXFLAGS="${CFLAGS}"
 
* Add +1 per extra core to MAKEFLAGS, i.e.:
 
MAKEFLAGS="-j3"
 
for multi core CPUs
 
 
==== Atom ====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-march=core2 -mtune=generic -O2 -fomit-frame-pointer -pipe"
 
CXXFLAGS="${CFLAGS}"
 
 
==== Core i5/i7 ====
 
*i686
 
CHOST="i686-pc-linux-gnu"
 
CFLAGS="-O2 -pipe -march=core2 -msse4 -mcx16 -msahf -fomit-frame-pointer"
 
CXXFLAGS="${CFLAGS}"
 
 
*x86_64
 
CHOST="x86_64-unknown-linux-gnu"
 
CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
 
 
  CXXFLAGS="${CFLAGS}"
 
  CXXFLAGS="${CFLAGS}"
  

Revision as of 19:49, 19 March 2010

The file Template:Filename contains configuration options for make, makepkg and gcc. This file is sourced, so you can include any special compiler flags you wish to use (however, only the variables described below are exported to the build environment). These settings are helpful when building for different architectures and optimizations.

Do keep in mind that not all package Makefiles will use your exported variables. Some of them override them in the original Makefiles or the PKGBUILD.

The default file is fairly well commented, so it may be easiest to simply follow directions given there for customization.

OPTIONS

DLAGENTS=(protocol::/path/to/command [options] ...)

Sets the download agents used to fetch source files specified with a URL in the PKGBUILD file. Options can be specified for each command as well and the download URL is placed on the end of the command. This is more flexible than the former FTPAGENT variable, as any protocol can have a download agent. Several examples are provided in the default makepkg.conf.

CARCH=

Specifies your computer architecture. Possible values include "i686" or "x86_64", which should have been set automatically during installation.

CHOST=

A string such as "i686-pc-linux-gnu". Do not modify unless you know what you are doing. This can be commented out by most users if desired.

CFLAGS=

Flags used for the C compiler. This is a key part to the use of makepkg. Usually several options are specified, and the most common string resembles something like this: "-march=i686 -O2 -pipe". Another useful option may be -mcpu in place of -march.

CXXFLAGS=

Flags used for the C++ compiler.

MAKEFLAGS=

This is often used to set the number of jobs used, for example, -j2. Typically, this is modified for SMP systems.

BUILDENV=(fakeroot !distcc color !ccache)

These are the default values for the array that contains options which affect the build environment. All options should always be left in the array. To enable or disable an option, simply remove or place an exclamation symbol (!) at the front of the option. Each works as follows:

fakeroot

Allow building packages as a non-root user. This is highly recommended.

distcc

Use the distributed C/C++/ObjC compiler to spread compilation among multiple machines. If this is enabled, DISTCC_HOSTS must be specified as well.

color

Colorize output messages, making output easier to read.

ccache

Use ccache to cache compilation by default. This allows for faster compiles if you are continuously recompiling the same packages. It can be disabled for individual packages by placing !ccache in the PKGBUILD options array.

DISTCC_HOSTS="host1 ..."

If using DistCC, this is used to specify a space-delimited list of hosts running in the DistCC cluster. In addition, you will want to modify your MAKEFLAGS to accomodate the change.

OPTIONS=(strip !docs libtool emptydirs)

These are the default values for the array that contains options which affect the default packaging. All four are equivalent to options that can be placed in the PKGBUILD. All options should always be left in the array; to enable or disable an option simply remove or place an "!" at the front of the option. Each works as follows:

strip

Strip symbols from binaries and libraries. If you frequently use a debugger on programs or libraries, it may be helpful to disable this option.

docs

Save doc and info directories. If you wish to delete doc and info directories, specify !docs in the array.

libtool

Leave libtool (.la) files in packages. Specify !libtool to remove them

emptydirs

Leave empty directories in packages

zipman

Compress manual (man and info) pages in MAN_DIRS with gzip

purge

Remove files specified by PURGE_TARGETS

INTEGRITY_CHECK=(check1 ...)

File integrity checks to use. Multiple checks may be specified, and they affect both generation and checking. The current valid options are: md5, sha1, sha256, sha384, and sha512.

MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})

Manual (man and info) directories to compress (if zipman is specified)

DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})

If "!docs" is specified in the OPTIONS array, this variable will instruct makepkg where to look to remove docs. If you build packages that are located in opt/, you may need to add the directory to this array. Note: Do not add the leading slash to the directory name.

PKGDEST="/path/to/folder"

If this value is not set, packages will by default be placed in the current directory (location of the PKGBUILD. Many people like to keep all their packages in one place so this option allows this behavior. A common location is "/home/packages".

STRIP_DIRS=(bin lib sbin usr/{bin,lib,sbin,local/{bin,lib,sbin}} opt/*/{bin,lib,sbin})

Directories to be searched for the strip option (if strip is specified)

PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)

Files to be removed from all packages (if purge is specified)

SRCDEST="/path/to/folder"

If this value is not set, downloaded source files will only be stored in the current directory. Many people like to keep all source files in a central location for easy cleanup, so this path can be set here.

PACKAGER="John Doe <john@doe.com>"

This value is used when querying a package to see who was the builder. It is recommended you change this to your name and email address.

PKGEXT, SRCEXT

Do not touch these unless you know what you are doing.

MAKEFLAGS

Has an effect on how many jobs are passed for compilation. Generally -j2, plus 1 for each additional CPU/core is the adequate choice. Optimizing for multiple cores can sometimes increase compiling performance, shortening compile times. However, you should be warned that occasionally using anything but the default can cause compilation problems, though many have agreed that -j3 is fairly safe to use for the majority of packages. E.g., for a dual-core CPU:

MAKEFLAGS="-j3"

CFLAGS

Arch currently optimizes for i686 and x86-64 architectures. The default makepkg.conf CFLAGS are compatible with all machines within their respective architectures. Further optimizing for CPU type can theoretically enhance performance for packages built with such optimizations, though such gains are most likely not human-perceivable.

As of version 4.3.0, the gcc compiler offers the Template:Codeline switch that enables CPU auto-detection and automatically selects optimizations supported by the local machine at gcc runtime. To use it, just modify the Arch Linux default settings by changing the CFLAGS line as follows:

CFLAGS="-march=native -O2 -pipe"

See the gcc man page for a complete list of available options. The Gentoo Compilation Optimization Guide and Safe Cflags wiki article provide more in-depth information.

i686 default

CARCH="i686"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=i686 -mtune=generic -O2 -pipe"
CXXFLAGS="${CFLAGS}"

x86_64 default

CARCH="x86_64"
CHOST="x86_64-unknown-linux-gnu"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe"
CXXFLAGS="${CFLAGS}"

See also