makepkg.conf to build packages for Leopard regardless of being on 10.5 or 10.6

14 views
Skip to first unread message

Loic Nageleisen

unread,
Aug 15, 2009, 9:55:34 AM8/15/09
to arch-osx
We currently focus on building packages for i386 arch. This post
adresses how to do that reliably regardless of we're building on Leo
or SL. being a entirely distinct problem, x86_64/universal support
will come later.

Here is the makepkg.conf section, straight from my hard disk. Details
below.

#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="macx86"
CHOST="i386-apple-darwin9.6.0"

# We target Leopard at a minimum
export MACOSX_DEPLOYMENT_TARGET=10.5
SDK="/Developer/SDKs/MacOSX10.5.sdk"
SDK_CFLAGS="-isysroot ${SDK}"
SDK_LDFLAGS="-isysroot ${SDK} -Wl,-syslibroot,${SDK}"

# We target arch i386, not x86_64
ARCH="i386"

# Mac OS X will not run on anything less than an i686 with SSE and
SSE2
# Some packages require SSE or SSE2 to be built at all.
CFLAGS="-arch ${ARCH} -march=i686 -mtune=generic -msse -msse2 -O2 -
pipe -I/opt/arch/include ${SDK_CFLAGS}"
CXXFLAGS="${CFLAGS}"
export CPPFLAGS="-I/opt/arch/include"
export LDFLAGS="-arch ${ARCH} -L/opt/arch/lib ${SDK_LDFLAGS}"
export DSOFLAGS="${LDFLAGS}"

#########################################################################

-isysroot and -libsysroot tell gcc where to root the core libs path.
Without this gcc will use latest headers and libs.

MACOSX_DEPLOYMENT_TARGET tells gcc we target a given os level. This
tells him to output binaries compatible with the given os level, among
other funky magic triggers.

-arch is essential to be forced because it'll default to host gcc
value, which is x86_64-apple-darwin on SL. So on SL, gcc will try to
ouptut x86_64 binaries by default, even with -march=i686, which will
absolutely fail.

SDK_* vars are put last on corresponding *FLAGS so that they are
picked up in that order by compiler/linker.

Some packages have broken build systems, so they won't pick up CFLAGS
correctly, thus output x86_64 binaries on SL. Either sed/patch in the
relevant place or export CC="gcc -arch $ARCH" in the PKGBUILD. This is
also why ARCH is a var inside makepkg.conf, independent of CFLAGS.

SL defaults to gcc-4.2 while Leo defaults on gcc-4.0. TTBOMK this does
not cause any issue to mix binaries build with one or the other.

With SL just around the corner, the default makepkg.conf in our pacman
package should be updated ASAP with those values.

Loic Nageleisen

unread,
Aug 16, 2009, 12:08:18 PM8/16/09
to arch-osx
I have uploaded a pacman package that incorporates those changes.
Reply all
Reply to author
Forward
0 new messages