Subject: Re: How to create packages with several -march?
To: None <sigsegv@rambler.ru>
From: Nuno Teixeira <nu@nunotex.freeshell.org>
List: netbsd-users
Date: 03/20/2005 14:43:29
Hello,

Thanks for your great and complete info.

I will try this when pkgsrc freeze is complete because I need to compile
meta kde3 and I'm waiting for xine-arts fix to be applied since
kdemultimedia needs it.

Just one more question: Do I see good performance results creating
packages optimized with "-march=pentium-mmx" for a pentium 200 MMX based
PC? For a long time that I see a lot of discussion about this and some
people says that you get good results other people says that it doesn't
matter using -march at all.

What is your opinion about this?

Yours,

	Nuno Teixeira


On Fri, Mar 18, 2005 at 11:55:28PM +0000, sigsegv@rambler.ru wrote:
> 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.

-- 
SDF Public Access UNIX System - http://sdf.lonestar.org