Subject: Re: solaris pkgsrc, gcc, and bulk builds (fwd)
To: None <tech-pkg@NetBSD.org>
From: Eric Boutilier <Eric.Boutilier@Sun.COM>
List: tech-pkg
Date: 02/07/2005 15:58:12
I sent a message earlier today that got lost somewhere.  This makes
my message below -- which did get through -- a bit confusing because I
was replying to a message (my original one) that nobody saw except me.

I'll resend the one that didn't get through...

Eric

---------- Forwarded message ----------
Date: Mon, 07 Feb 2005 12:04:33 -0600 (CST)
From: Eric Boutilier <Eric.Boutilier@Sun.COM>
To: tech-pkg@NetBSD.org
Cc: Hal Snyder <hal@vailsys.com>, Gavan Fantom <Gavan.Fantom@Sun.COM>
Subject: Re: solaris pkgsrc, gcc, and bulk builds

Previously, I wrote:
>
> I'll provide all the details in a separate message. Stay tuned...

Here it is.

This write-up was done for the purpose of posting to my blog. So
for the tech-pkg audience, obviously the parts where I extoll
the virtues of source-based SW mgmt systems (like the entire 1st
paragrph!) is "preaching to choir". :-)

--Eric

--------------------------------------------------------------------

In the world of open-source software (OSS) there are just a few
"distros" that are source-based. The two major ones appear to be
Portage (gentoo.org) and Pkgsrc (netbsd.org). Unlike almost every
other OSS software distribution system, Portage and Pkgsrc provide
the option of getting and building software packages directly. That
is, for any package install or update, you always have the option
of bypassing the traditional binary repository and going directly
to the app's master site; fetching the source "tarball"; and doing
an installation based on that. (Talk about going directly to the
source!)

I've long been intrigued by the freedom and flexibility of this
approach, and have been wanting to "assemble" a UNIX platform (on
x86 HW) made up of the following layers:

   Bottom: Sun OS 5.1x kernel (what else!)
   Middle: Core SUNW* packages made up of the packages provide by
           installing a "Core System" and adding 23 more that are needed
           to bootstrap the top layer.
   Top:    Open-source, end-user apps built and maintained by either
           the Portage or Pkgsrc system.
  (Of course the ultimate goal is to use OpenSolaris for the bottom
  and middle layers.)

And I'm here to report... I have done it! It was a success! And
I'm psyched!  I took careful notes too, so I put together a "recipe"
and included it below.

The beauty of this kind of platform is it's low cost, very modular,
light-weight (less packages = less vulns), easy to manage, but best
of all: Suppose you used this approach to set up a dedicated server
of some sort (postgres, streaming audio, x10 HA server, whatever),
you are not tied to the people at your distro for updates. In other
words, anytime after the release of one of your production packages,
you can update -- either immediately or as soon as you're ready. Or you
can wait 'til it shows up in the binary repository, it's your choice.

These instructions will get you to the point where you can start
trying to build any non-GUI (e.g. server, sys-util, etc.)
applications you want. And I'm happy to report that for a distro
that so far has been focused primarily on NetBSD and Linux, it's
amazing how many packages build perfectly "out of the box" on
Solaris 10. I'm up to 290 and counting...

BTW, I'm using two "build servers" for this project: an ASUS/Duron
1.3 Ghz box (that I built from scratch a couple or 3 years ago),
and an old Toshiba Portege 266 Mhz laptop.

Also included below is a list of the SUNW packages that you
need to pkgadd (after doing a core system install as described
above). Unfortunately they're scattered among CDs 1, 2, and 4.

Please let me know if you try this out so we can share notes.

More details to follow.
Questions welcome.
I need some sleep.

--Eric

---------------------------------------------------------------------------

- Download the just-released Solaris 10 CD images

- During Solaris 10 install, choose "Core System Support"
  which is fully contained on CD1. (There's nothing wrong
  with installing one of the bigger sets, but using a minimal
  number of Sun packages was one of my "design principles".)

- Install 23 other packages. You'll need CD 1, 2, and 4 for this.
  The list of package names is included below.

- Download the pkgsrc system. You'll get:
  * The bootstrapping software
  * The pkgsrc repository of automated build scripts. This is the
    "magic" that enables you to transparently install and update
    applications directly from their master sites (or from the
    pkgsrc binary repository of course).
  * Tools and utilities that make up the pkgsrc software management
    system. (These get built and installed by the bootstrap program)

  You can put the tree anywhere, but be sure to give it plenty of
  room to grow.

- Now bootstrap pkgsrc (follow this sequence exactly):
  1. Go to ..pkgsrc/bootstrap and run ./bootstrap
  2. Add the following to /usr/pkg/etc/mk.conf:
       CC= /usr/sfw/bin/gcc
  3. Copy /usr/sfw/bin/{ggrep,gegrep} to /usr/pkgsrc/bin/{grep,egrep}
  4. Temporarily set: LD_LIBRARY_PATH=/opt/sfw/lib
  5. a. Go to pkgsrc/devel/libtool-base and do `bmake install'
     b. Go to pkgsrc/converters/libiconv and do `bmake install'
     c. Go to pkgsrc/devel/gettext-lib and do `bmake install'
     d. Go to pkgsrc/devel/gmake and do `bmake install'
     e. Go to pkgsrc/lang/gcc3-c and do `bmake install'

  6. Go back into /usr/pkg/etc/mk.conf and change CC like this:
       CC= /usr/pkg/gcc3/bin/gcc
     and add:
       GCC_REQD+= 3

---------------------------------------------------------------------------

These are the Sun packages required in addition to those included when
you do a "core system" installation. (I hope you appreciate this list --
arriving at it took a lot of trial and error!)

Come to think of it, you can probably omit the SSH packages. And I'm
quite sure SUNWbash isn't required either -- but that's my shell of
choice these days. And (much to my surprise) it's not part of the
core system install.


SUNWarc
SUNWbash
SUNWbtool
SUNWdoc
SUNWgcc
SUNWgccruntime
SUNWgcmn
SUNWggrp
SUNWgpch
SUNWgzip
SUNWhea
SUNWlibm
SUNWlibmr
SUNWscpr
SUNWscpu
SUNWsprot
SUNWsshcu
SUNWsshdr
SUNWsshdu
SUNWsshr
SUNWsshu
SUNWtoo
SUNWxcu4