All-

There was a thread back in August 2013 with a Subject of

        patches for OpenIndiana/Solaris 11

about building recent rpm on OpenIndiana and/or Solaris 11.  I've supplied
some patches to that effect via LaunchPad, but I've finally had a little
time to work on a devtool.conf entry and set up a VirtualBox VM for build
testing, so I thought I would describe the process and progress here.
I still haven't successfully built rpm from CVS or the 5.4.x series, but
here's what I have so far.

If you're not interested in RPM on OpenIndiana or Solaris, the rest of
this email won't be of any interest to you, so feel free to skip.  :-)

Virtual Environment
===================

I installed the OpenIndiana (OI) devel box onto a VirtualBox 4.2.18 VM.
VirtualBox is hosted on OpenIndiana on my new Dell Precision T3600
workstation.

Any recent version of VirtualBox or really any other VM environment should
be suitable.  VirtualBox has a predefined config for "Oracle Solaris 11
64 bit", so I used that option when creating the VM.  For VirtualBox,
the network config defaults to "NAT", but I switched that to "Bridged"
so that I could ssh into the VM from the outside world, once the OS was
installed.

OS Install
==========

I installed the Desktop version of OI 151a8 from the Live DVD ISO, from

        http://openindiana.org/download/#live

If you instead choose the USB version, be advised that the instructions
for concatenating the header and the USB Live image, available here:

        http://wiki.openindiana.org/oi/Installing+OpenIndiana

are apparently out of date.  With oi151a8 it's apparently necessary to use
the 2 Gig header, rather than the 1 Gig header the documentation
specifies.  The headers and various ISO and USB directories are all
available here:

        http://dlc.openindiana.org/isos/

After you've booted the Live image, installing is just a matter of
double-clicking on the "Install" icon on the Live desktop.  If you're
installing into a virtual environment (rather than onto native hardware),
there should be no issues with missing device drivers.

Note that in addition to setting the root password, the user account
that's created as part of the install process will automatically be added
to the Solaris "administrator" role (as part of the Role Based Access
Control, aka RBAC).  All this means is that the first account can
use either "sudo" or "pfexec" when needed for elevated privileges, without
needing to do any sudoers.conf or RBAC config.

Also, in the default configuration, "root" is actually a "role", so
with the exception of single user mode, you won't be able to log in
directly as root.

Post-Install Setup
==================

Assuming you installed the Desktop image, you'll have a graphical login
environment after the install completes.  This is the Java Desktop
System (JDS), but really it's just GNOME 2.x + Compiz with some Sun/Oracle
tweaks.

The OS will default to getting its IP address via DHCP.  This is controlled
through NWAM, NetWork AutoMagic.  sshd will also be running.

Bootup and most services are controlled via the Service Management Facility
(SMF), which is akin to systemd or upstart.  You can view services and
service status via "svcs", and you can disable and change service config
via "svcadm".

Development Tools
=================

The desktop install doesn't include a lot of the development-related
packages you'll need, so you'll want to install a few additional packages
from the OI repo.  I used the following script snippet to check for
and install the listed packages:

echo '####################################################################'
echo '#'
echo '# Installing any additional development packages we may need'
echo '#'
echo '####################################################################'

for p in        system/header \
                        system/header/header-audio \
                        system/library/math/header-math \
                        developer/library/lint \
                        developer/icu \
                        x11/header/x11-protocols \
                        compress/xz \
                        developer/java/jdk \
                        developer/java/jdk64 \
                        developer/build/gnu-make \
                        developer/build/make \
                        developer/linker \
                        developer/macro/cpp \
                        developer/macro/gnu-m4 \
                        developer/versioning/cvs \
                        developer/versioning/subversion
do
        has_pkg=`pkg list | egrep "^$p[    ]"`
        if test X"$has_pkg" = X"" ; then
                echo "Installing $p ..."
                sudo pkg install "$p"
        fi
done



I'm using Oracle Studio 12.3 as the compiler toolchain, not gcc, so I
didn't include the gcc package in the list.  If you want to test with
gcc, try "pkg search -r gcc" and install the versions of gcc you're
interested in.  "pkg list" shows you what's currently installed, and
"pkg contents <pkg FMRI>" shows you what's included in a particular
package.  Doing a web search for

        Oracle IPS one liners

will turn up a PDF cheat-sheet for working with IPS.

I also didn't install the OS packages for libtool, autoconf, or automake,
since RPM and many other packages typically require newer versions than
what OI is currently shipping (especially libtool).

Compiler
========

To install the Studio tool chain, download the tar bundle (not the IPS
packages) from

        
http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html

You will need to click the radio button to Accept the License Agreement
before the download links will appear.  I chose the Solaris 11 x86 tar
file, though it's exactly the same tar file as for Solaris 10.

Since the Studio suite (which has also been called the Workshop suite
and the Forte suite at various points in its history) has historically
been installed under /opt/SUNWspro and there are some "configure" scripts
that look for it there, I extracted the tar bundle into /opt and then
symlinked SUNWspro to the extracted directory:

        cd /opt
        bzcat /tmp/SolarisStudio12.3-solaris-x86-bin.tar.bz2 \
                | sudo tar -xvpf -
        sudo ln -s SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3 SUNWspro

When you're done with that, executing

        /opt/SUNWspro/bin/cc -V

should output something similar to "cc: Sun C 5.12 SunOS_i386 2011/11/16"


Build Environment
=================

My workplace's policy is that locally-installed software (even if it's
packaged, which all our local software is) is installed into /local if
it's not strictly GNU or GNOME (even if it uses the GPL), or /local/gnu
if it is part of GNU or GNOME.  We symlink /usr/local to /local, to ease
compatibility with packages that expect local software to be available
there.

I therefore created a directory (actually a ZFS mountpoint) for /local
and set up the symlink:

if test ! -d /local ; then
    echo "Creating /local"
    zfs create -o mountpoint=/local rpool/local
    zfs create -o mountpoint=/local/src rpool/local/src
else
    echo "/local already exists, no action taken"
fi

if test ! -L /usr/local ; then
    echo "symlinking /usr/local to /local"
    ln -s /local /usr/local
fi

I pre-created the bin, lib, sbin, et. al. under /local and /local/gnu.

Note that the library convention that OpenIndiana inherited from Solaris
is that 32 bit libraries go in <whatever>/lib, while 64 bit libraries go
in <whatever>/lib/64 (not the Linux convention of <whatever>/lib64).
OpenIndiana (and presumably Solaris 11) takes this one step further,
in that packages that provide both 32 bit and 64 bit binaries have the
32 bit binary in <whatever>/bin and the 64 bit binary in <whatever>/bin/64.
Not all packages provide 64 bit binaries, but when you're building
software and you want it to build 64 bit, you should

1) Make certain that <whatever>/bin/64 is in your PATH before
   <whatever>/bin.  This is especially important for pkg-config, since
   it will use the .pc files appropriate for 64 bit compilation if it's
   the pkg-config binary in the <whatever>/bin/64 directory.

2) Make certain that you specify --libdir=<whatever>/lib/64 when
   configuring a package.

3) Include the appropriate architecture (-m64) and library
   (-L<whatever1>/lib/64 -L<whatever2>/lib/64) flags when compiling
   software.


RPM Requirements
================

RPM (and other packages we'll build later) require a few things that
either aren't shipped with the OS or are shipped in versions that are
too old, so the first task is building a small list of pre-reqs.

My focus is on getting RPM bootstrapped with the basics, so right now
I'm only installing the very basics.  Since I don't yet have RPM available
to automate the build process, I used a set of simple shell scripts to
at least make the builds reproducible.  Packages and build order
amounted to

        10-pkgconfig.sh                 # 0.28
        11-autoconf.sh                  # 2.69
        12-gettext.sh                   # 0.18.3.1
        14-automake.sh                  # 1.11.1
        15-libtool.sh                   # 2.4.2
        17-xz.sh                                # 5.0.3
        20-beecrypt.sh                  # 4.1.2
        25-neon.sh                              # 0.30
        30-popt.sh                              # 1.16

If there's interest I can clean those scripts up and make them available
somewhere, but there's nothing special or innovative about them.  The
first one (pkgconfig) is probably the only interesting one, as the 32
bit build is configured to search all the following places for .pc files:

        
--with-pc-path="/local/lib/pkgconfig:/local/gnu/lib/pkgconfig:/local/share/pkgconfig:/local/gnu/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig"

while the 64 bit pkgconfig (that gets installed in /local/bin/64) is
configured with

        
--with-pc-path="/local/lib/64/pkgconfig:/local/gnu/lib/64/pkgconfig:/local/share/pkgconfig:/local/gnu/share/pkgconfig:/usr/lib/64/pkgconfig:/usr/share/pkgconfig"

Because I'm primarily interested in 64 bit builds but it's occasionally
useful to also have 32 bit libraries, the scripts I used build and install
the package twice, once with options for 32 bit and the second time with
options (and paths, like --bindir=<whatever>/bin/64
--libdir=<whatever>/lib/64) suitable for 64 bit compilation.

Devtool setup
=============

I started with the %indiana devtool.conf entry and created
%oi151a8_studio_64 from it, with settings suitable for using the Studio
compiler to build in 64 bit mode.  I also switched "neon" and "beecrypt"
to be "external", and enabled xz and libelf.

I just recently got that entry to the point where RPM will autogen and
run configure to completion, so consider it a work-in-progress.  In
particular, I haven't been able to correctly tailor which additional
modules are checked out for building internal to RPM, so I'm currently
using a horrible hack to do the normal %checkout, and then remove
the directories for beecrypt and neon.  I also used examples from
elsewhere in devtool.conf to check to make certain that necessary OS
packages are installed and automatically install them if not.

The devtool.conf patch (against current CVS) is after my signature.  With
it and the other steps I've describe above, I can get RPM's configure
to complete.  I'll be working on the remaining build issues as time permits.

Feedback welcomed!

Tim
--
Tim Mooney                                             tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164


Index: devtool.conf
===================================================================
RCS file: /v/rpm/cvs/rpm/devtool.conf,v
retrieving revision 2.382
diff -u -r2.382 devtool.conf
--- devtool.conf        6 Apr 2012 10:22:04 -0000       2.382
+++ devtool.conf        17 Oct 2013 21:21:44 -0000
@@ -1243,6 +1243,152 @@
         --enable-build-debug \
         --enable-maintainer-mode

+%oi151a8_pkg_prep
+       #
+       # Make certain we have the necessary OS distribution packages
+       # installed.
+       #
+       PKGS=""
+       if test ! -f /usr/include/pthread.h ; then
+               PKGS="$PKGS /system/header"
+       fi
+       if test ! -f /usr/include/math.h ; then
+               PKGS="$PKGS /system/library/math/header-math"
+       fi
+       if test ! -x /usr/bin/ld ; then
+               PKGS="$PKGS /developer/linker"
+       fi
+       if test ! -f /usr/lib/values-xpg6.o ; then
+               PKGS="$PKGS /developer/library/lint"
+       fi
+       if test ! -f /usr/lib/cpp ; then
+               PKGS="$PKGS /developer/macro/cpp"
+       fi
+       if test ! -x /usr/gnu/bin/make ; then
+               PKGS="$PKGS /developer/build/gnu-make"
+       fi
+       if test ! -x /usr/gnu/bin/m4; then
+               PKGS="$PKGS /developer/macros/gnu-m4"
+       fi
+       if test ! -x /usr/bin/cvs; then
+               PKGS="$PKGS /developer/versioning/cvs"
+       fi
+       # if PKGS isn't empty, loop and install
+       if test X"$PKGS" != X"" ; then
+               for p in $PKGS
+               do
+                       sudo pkg install $p
+               done
+       fi
+
+# OpenIndiana 151a8 on x86_64 with the Oracle Studio 12.x compiler
+%oi151a8_studio_64
+       %oi151a8_pkg_prep
+       %checkout
+       rm -rf neon popt
+       #
+       # set this to where local packages are installed, both RPM pre-reqs
+       # (autoconf, automake, libtool, gettext, neon, beecrypt) and where
+       # rpm will be installed.
+       #
+       LOCAL=/usr/local
+       #
+       # if GNU software is installed in a directory that's separate from other
+       # local software, specify the prefix here.  Otherwise, just set
+       # GNU=${LOCAL}
+       #
+       GNU=/usr/local/gnu
+       #
+       # where the Oracle Studio tar file is extracted.  You must install
+       # this manually.
+       #
+       STUDIO=/opt/SUNWspro
+       #
+       # environment setup for building RPM.
+       #
+       PATH=${STUDIO}/bin:${LOCAL}/bin/64:${LOCAL}/bin:${GNU}/bin/64:${GNU}/bin
+       PATH=$PATH:/usr/gnu/bin/64:/usr/gnu/bin:/usr/bin/64:/usr/bin:/usr/sbin
+       export PATH
+       CC='cc -m64'
+       CXX='CC -m64'
+       CPPFLAGS="-I${LOCAL}/include -I${GNU}/include"
+       LP64="-xtarget=generic -m64 -xarch=generic"
+       CFLAGS="$LP64 -Xa -xc99=all -KPIC $CPPFLAGS"
+       CXXFLAGS="$LP64 -library=Cstd -library=Crun -KPIC $CPPFLAGS"
+       LDFLAGS="-L${LOCAL}/lib/64 -L${GNU}/lib/64"
+       export CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
+       CONFIG_SHELL=/bin/bash
+       export CONFIG_SHELL
+    %autogen
+    %configure \
+        --verbose \
+        --prefix=${LOCAL} \
+        --bindir=${LOCAL}/bin/64 \
+        --libdir=${LOCAL}/lib/64 \
+        --enable-shared \
+        --with-db \
+        --with-dbsql \
+        --without-db-tools-integrated \
+        --with-zlib \
+        --with-bzip2 \
+        --with-xz \
+        --with-file \
+        --with-path-magic=/usr/share/mime/magic \
+        --without-lua \
+        --with-tcl \
+        --without-sqlite \
+        --without-syck \
+        --with-readline \
+        --without-augeas \
+        --with-beecrypt=external \
+        --without-java \
+        --with-openssl \
+        --without-nss \
+        --without-gcrypt \
+        --without-tomcrypt \
+        --without-tpm \
+        --without-libtasn1 \
+        --without-pakchois \
+        --without-gnutls \
+        --with-neon=external \
+        --with-libproxy \
+        --with-expat \
+        --with-pcre \
+        --enable-utf8 \
+        --without-uuid \
+        --without-attr \
+        --without-acl \
+        --without-xar \
+        --with-popt=external \
+        --without-keyutils \
+        --with-pthreads \
+        --with-libelf \
+        --without-cudf \
+        --without-ficl \
+        --without-aterm \
+        --without-nix \
+        --without-bash \
+        --without-rc \
+        --without-js \
+        --without-gpsee \
+        --without-python \
+        --without-pythonembed \
+        --without-perl \
+        --without-perlembed \
+        --without-ruby \
+        --without-selinux \
+        --without-sepol \
+        --without-semanage \
+        --without-squirrel \
+        --with-build-extlibdep \
+        --with-build-maxextlibdep \
+        --without-valgrind \
+        --enable-build-pic \
+        --disable-build-versionscript \
+        --enable-build-warnings \
+        --enable-build-debug \
+        --enable-maintainer-mode
+
 %opensuse
     %autogen
     %configure \
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to