Subject: Re: How to create packages with several -march?
To: Nuno Teixeira <nu@nunotex.freeshell.org>
From: None <sigsegv@rambler.ru>
List: netbsd-users
Date: 03/18/2005 23:55:28
Nuno Teixeira wrote:
> Hello to all,
>
> I came to this question when I use my i386 Athlon XP PC to create
> packages to old PCs based on I486 and I586 cpus.
>
> Generally I don't use any -march or -mcpu gcc options to avoid problems.
>
> I'm working and upgrading a Pentium 200 MMX and I like to optimize the
> packages with -march=pentium-mmx using my Athlon build system.
>
> Is there any way to create packages with several optimizations like:
>
> /usr/packages/2.0/i386_pentium-mmx/
> /usr/packages/2.0/i386_athlon-xp/
> /usr/packages/2.0/i386_pentiumpro
> etc...
>
> Using only one build PC?
>
> Thanks,
>
> Nuno Teixeira
I think you can, say you're using Pentium 4 and want to build optimized
packages for AMD Athlon, save the following file as
'/etc/mk.athlon-tbird.conf' and before you build packages run:
MAKECONF=/etc/mk.athlon-tbird.conf
export MAKECONF
Here is mk.athlon-tbird.conf:
MACH_ARCH=athlon-tbird
LOCALBASE=/usr/pkg.${MACH_ARCH}
PKG_DBDIR=/usr/pkg.${MACH_ARCH}/db/pkg
WRKOBJDIR=/usr/obj.${MACH_ARCH}/pkg
PACKAGES=/usr/packages.${MACH_ARCH}
DEPENDS_TARGET=package
OPTIM_CPUFLAGS=-march=i486 -mcpu=athlon-tbird
OPTIM_CPUFLAGS2=-march=athlon-tbird -mmmx -m3dnow
OPTIM_CFLAGS=-O2 -pipe
.ifdef BSD_PKG_MK
COPTS+=${OPTIM_CFLAGS} ${OPTIM_CPUFLAGS2}
CFLAGS+=${OPTIM_CFLAGS} ${OPTIM_CPUFLAGS2}
CXXFLAGS+=${OPTIM_CFLAGS} ${OPTIM_CPUFLAGS2}
.else
COPTS?=${OPTIM_CFLAGS}
CPUFLAGS+=${OPTIM_CPUFLAGS}
.endif
- packages will be installed into /usr/pkg.athlon-tbird
- packages database will be in /usr/pkg.athlon-tbird/db/pkg
- gzipped packages will be saved into /usr/packages.athlon-tbird
- object files during build will be kept in /usr/obj.athlon-tbird/pkg
See 'man packages' for options to go into your mk.conf file
Before you install packages on the target machine you would need to
setup symbolic link:
mkdir /usr/pkg.athlon-tbird
ln -s /usr/pkg.athlon-tbird /usr/pkg
The packages you built have hardcoded library paths to
/usr/pkg.athlon-tbird package directory, but you can still reference all
the executbles via /usr/pkg/bin/* as long as there is a symbolic link.
Other option is to build everything inside a chroot jail.