Subject: [reinoud@netbsd.org: RFC: crosscompiling (src and pkgsrc) with distcc]
To: None <jesseoff@yahoo.com>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-pkg
Date: 01/03/2005 01:14:50
--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hiya folks,
Allthough a bit late, here is my RFC again on crosscompiling pkgsrc; it is 
known to work to crosscompile for my Sparc on my Alpha.

Cheers,
Reinoud


----- Forwarded message from Reinoud Zandijk <reinoud@netbsd.org> -----
Crosscompiling with distcc HOWTO
================================

Purpose:
--------
croscompiling of sourcecode in general including NetBSD's source 
tree and NetBSD's pkgsrc packages using `pkgsrc/devel/distcc'


Target machine setup:
---------------------
1) install `pkgsrc/devel/distcc' package.

2) install helper script "use-distcc" in f.e. /usr/local/bin/:
	---------
	#!/usr/pkg/bin/tcsh

	setenv PATH "/usr/distcc/bin:$PATH"
	setenv CC gcc
	---------

3) create directory "/usr/distcc/bin" contents with softlinks :
	lrwxr-xr-x  1 root  wheel   20 Sep 16 02:58 c++@ -> ../../pkg/bin/distcc
	lrwxr-xr-x  1 root  wheel   20 Sep 16 02:57 cc@ -> ../../pkg/bin/distcc
	lrwxr-xr-x  1 root  wheel   20 Sep 16 02:58 g++@ -> ../../pkg/bin/distcc
	lrwxr-xr-x  1 root  wheel   20 Sep 16 02:57 gcc@ -> ../../pkg/bin/distcc


Helper machine setup:
---------------------
1) install `pkgsrc/devel/distcc' package.

2) create a crosscompiler to compile from any architecture to NetBSD/sparc, 
go to the NetBSD src dir and run :
	./build.sh -a sparc -m sparc -T /usr/gcc-cross-sparc/ tools

this will create a directory called /usr/gcc-cross-sparc/ with the 
crosscompilation tools.

3) install helper script "START-distcc' 
	------------
	#!/usr/pkg/bin/tcsh

	setenv PATH "/usr/gcc-cross-sparc/sparc--netbsdelf/bin/:$PATH"
	setenv DISTCC_VERBOSE 1

	distccd -a 192.168.0.137/24  --listen 192.168.0.137 -p 3632
	-----------
this will start the `distcc' daemon to listen on the 192.168.0/24 network 
and listen on 192.168.0.137 specificly and on port 3632 (why doesn't it do 
this on default?)


Compilation of sources (not pkgsrc):
------------------------------------
1) on each helper machine run the `START-distcc' script

2) on the target machine (replace helper1, helper2 etc. by the names/ip 
addresses of the helper machines):
	source /usr/local/bin/use-distcc
	setenv DISTCC_HOSTS "helper1 helper2 helper3"
	cd .../sourcedir
	make -j2 target


Compilation of pkgsrc packages:
-------------------------------
1) on each helper machine run the `START-distcc' script

2) on the target machine go to the package dir and set :

set the helpers (,lzo addition sets compression of the data transport):
	setenv DISTCC_HOSTS "helper1 helper2 helper3,lzo"

instruct pkgsrc to use distcc:
	setenv PKGSRC_COMPILER "distcc gcc"

set the concurrency level (not all packages allow this)
	setenv BUILD_MAKE_FLAGS "-j2"

compile/update package
	make update

thats all :)



!DSPAM:416d3a534511616694490!

----- End forwarded message -----

--/04w6evG8XlLl3ft
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQdiOcoKcNwBDyKpoAQJwmQf+Lwt3LpZU2+YP2I+zunhWjhPQbQCt/3ym
jaKKoBkxoir6CtRScPXHohDnP5vmSQJph3p8sx9hj+7yCy6vhMyzI6TWpQQASTUp
quiphlQ0V0BQZmILJ8IN4jIBILHEllQaer9osQMdvlHafr2xPMBca8GfBIVjwSZP
sVKNPDjIchzVf3kAxtbC4G2XHeITLUejYZkBO84tpunhnO9NgCa4onSqOqtYXw7d
lL1wRZKES4L/cODRvhllF/muJCdXAol1dh4pwrCse83yPygAhfcPPa3TJAloWoEb
cnno6OMpRyiSttrkLoGwLgG/JAUOR3/b+lDN70BG4pRDa8n04ykW1w==
=lf0i
-----END PGP SIGNATURE-----

--/04w6evG8XlLl3ft--