File:  [NetBSD Developer Wiki] / wikisrc / pkgsrc / how_to_use_pkgsrc_on_solaris.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Sun Feb 5 07:14:36 2012 UTC (2 years, 2 months ago) by schmonz
Branches: MAIN
CVS tags: HEAD
dos2unix

Document status: **DRAFT**

In this article I will document how to transform a Solaris 10 x86 core installation into a pkgsrc-powered desktop system. The Solaris core installation does not include any X11, GNOME or GNU utilites. We will use modular X.org from pkgsrc. The guide assumes that the reader has some prior experience using Solaris and pkgsrc.

**Contents**

[[!toc]]

#Installation

Begin by installing a Solaris core system. When done, mount the Solaris CD/DVD and install the following extra packages:

* SUNWarc Lint Libraries (usr)
* SUNWbtool CCS tools bundled with SunOS (Solaris 9)
* SUNWbzip The bzip compression utility
* SUNWdoc Documentation Tools
* SUNWhea SunOS Header Files
* SUNWlibm Math & Microtasking Library Headers & Lint Files (Usr)
* SUNWlibmr Math Library Lint Files (Root) (Solaris 10)
* SUNWman On-Line Manual Pages
* SUNWscpr Source Compatibility, (Root)
* SUNWscpu Source Compatibility, (Usr)
* SUNWsprot Solaris Bundled tools
* SUNWtoo SUNWtoo Programming Tools
* SUNWxcu4 XCU4 Utilities 

These packages are required if you intend to use modular-xorg-server from pkgsrc:

* SUNWdfbh Dumb Frame Buffer Header Files
* SUNWaudh Audio Header Files (don't ask why!) 
<pre><code>
# mount -F hsfs /dev/dsk/c1t1d0p0 /mnt
# cd /mnt/Solaris10/Product
# cp -r SUNW... /var/spool/pkg
# pkgadd
</code></pre>
To see which SUNW packages are already installed, use the /usr/bin/pkginfo command. 

#Compiler setup

Now you need a compiler. You have a couple of options:

* Use my prebuilt compiler kit, available from <http://notyet>
* Install SUNWgcc from the Solaris DVD
* Install Sun Studio 10
* Install gcc from Sunfreeware.com
* [advanced] Bootstrap your own gcc, using one of the above. If you get an error about a library not being found, remember to use *crle -u -l libpath* to add it to the link path. Make sure any /usr/pkg/* library paths are included early in this string so that pkgsrc binaries will only have dependencies on pkgsrc libraries as much as possible. 

#pkgsrc

Got a compiler? Good! Let's download and bootstrap pkgsrc.

Grab pkgsrc.tar.gz from <ftp://ftp.NetBSD.org/pub/pkgsrc/current/> and untar to /usr, or get it from CVS.

    # cd /usr/pkgsrc/bootstrap
    # env CFLAGS=-O2 CC=/usr/local/gcc4/bin/gcc ./bootstrap

[coffee break]

Now we can tune /usr/pkg/etc/mk.conf. I use the following additional settings:
<pre><code>
CFLAGS+=-O2
CXXFLAGS+=-O2
CC=/usr/local/gcc4/bin/gcc
CXX=/usr/local/gcc4/bin/g++
X11_TYPE=modular
PKG_DEVELOPER=yes
PKG_DEFAULT_OPTIONS+=freetype truetype mmx subpixel official-mozilla-branding
</code></pre>
At this point you're free to install whatever packages you like.

On Solaris 9 (at least), Python 2.4 is the latest version that will build. You may want to set PYTHON_VERSION_DEFAULT= 24 in mk.conf in order to build python packages. (As of 13feb2010.) 

#Installing modular X.org from pkgsrc

It is mentioned above, but easy to miss... you really want to set **X11_TYPE=modular** in mk.conf, otherwise none of this will work. You will also want to set **MOTIF_TYPE=openmotif** or **MOTIF_TYPE=lesstif** to avoid having pkgsrc/mk/motif.buildlink3.mk choose /usr/dt/... which requires X11_TYPE=native instead of modular.

Packages needed for modular X.org are:

* meta-pkgs/modular-xorg-fonts
  * xxx: fonts/mkfontdir needs a hack that I have not yet committed 
* meta-pkgs/modular-xorg-apps
* x11/modular-xorg-server
  * xxx: needs some hacks that have not yet been committed (--disable-dri, libdrm, driproto KDSETMODE ioctl, vtname /dev/fb) 
* x11/xf86-input-keyboard
* x11/xf86-input-mouse
* x11/xf86-video-vesa (or pick a suitable driver for your card)
* x11/xterm 

Now run /usr/pkg/bin/Xorg -configure, which should work. Move the generated configuration file to /etc/X11/xorg.conf. Now you can attempt to start the server, by running Xorg with no arguments. If you get a picture, but the mouse isn't working, try to set your mouse device to "/dev/kdmouse" and the protocol to "PS/2" in xorg.conf.

TODO: write about installing firefox, desktop stuff, ... 

#Outstanding PR's with patches

There are some PR's with patches that solve Solaris build issues that are not yet committed. These may solve a problem you are having.

* [pkg/40153](http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40153) - Synopsis: pkgsrc/devel/binutils fails to build on solaris 10 sparc
* [pkg/40201](http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40201) - Synopsis: pkgsrc/sysutils/memconf update needed
* [pkg/39085](http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=39085) - Synopsis: firefox3 compile problem (just committed!)
* [pkg/40221](http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40221) - Synopsis: pkgsrc/mail/p5-Mail-Mbox-MessageParser requires GNU grep (needed by grepmail)
* [pkg/40222](http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=40222) - Synopsis: pkgsrc/databases/sqsh fix build w/sybase libs on Solaris 

#Other hints

These may not be the 'right' think to do, but are still a help to get past some issues until the right thing can be figured out:

* errors building libffi (required by python 2.5+) using Sun Studio compiler can be worked around by using gcc or setting: 

    PYTHON_VERSION_DEFAULT=24

* errors regarding a **missing gtk-rebase** can be worked around by installing the package **textproc/gtk-doc**
* using a native jdk (on anything except SunOS-5.11-i386, which already works) can be done by adding these to /usr/pkg/etc/mk.conf: 

    PKG_JVM_DEFAULT=                sun-jdk6
    _PKG_JVMS_ACCEPTED+=            sun-jdk6

* errors regarding wrong number of arguments to readdir_r() and some other xxx_r() functions can be fixed by adding to the package Makefile: 

    CFLAGS.SunOS+=                  -D_POSIX_PTHREAD_SEMANTICS

If you encounter issues with missing libraries, refer to [the pkgsrc guide](ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/doc/pkgsrc.html#undefined-reference) first.
#See also

* [[pkgsrc/The pkgsrc portability guide]]
* [[pkgsrc/How to use pkgsrc on Mac OS X]]

#External links

* [NPC on Solaris developer HOWTO](http://solarpack.sourceforge.net/howto-dev.html)
* [pkgsrc under Solaris](http://www.oe-files.de/oefiles/lab/solpkgsrc) at The -Files - recommends using gcc (the [GCC for Sun Systems package](http://cooltools.sunsource.net/gcc/) on Sparc (note that 4.2.0 is the last version supporting Solaris 9), bootstrapped lang/gcc34 on x86), 32-bit binaries, building everything from pkgsrc 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb