|
|
Building JDS on OpenSolarisIntroduction
1. CompilersWe recommend to build JDS with Sun Studio 11 or Sun Studio 10. Building with gcc is also possible, but may require a little extra work during the build. We would much welcome patches to fix this so that both compilers can be used out of the box. The rest of this document assumes you are building the JDS sources with Sun Studio. 2. Package RequirementsSome of the JDS components require other packages to be available on your system in order for you to build.
You can find these packages on your Solaris install media. The cbe-install script will assist with installing them. 3. JDS Common Build EnvironmentThe JDS Common Build Environment (CBE) is a set of build tools required to build GNOME, Mozilla and Evolution on Solaris. It includes the following tools - *=optional Download the latest tarball from the JDS download center. The latest version of CBE builds packages by default in ~/packages, while installing the tools in /opt/jdsbld. Installing the CBE for your architecture gives you the opportunity of easily installing packages, rather than having to build the tools yourself. You don't need root access for installing the CBE or building GNOME, but the build user needs to have the 'Software Installation' profile for installing the packages that the JDS CBE creates. In a typical case, you need to add the following profile to /etc/user_attr -
Then run the cbe-install script as follows -
You may want to put the following in your profile, adjusting to your shell of preference -
Note: if you already have a previous version of the JDS CBE installed, the cbe-install script will upgrade it to the new version. The JDS CBE sets up the following default directory structure for you to build packages -
4. JDS Build Sources
Once you have installed the JDS CBE, you are now ready to fetch the build sources. You can get the latest set of JDS sources from the SVN repository with anonymous access -
As part of our policy for developing on JDS, we only apply and manage patches on top of a pre existing community released tarball. Not only does this allow us to separate out our work into atomic changes, it also maximizes the chances of getting these changes upstream in the original community. Along with the build sources that you just downloaded, you will also need to download the original community tarball - this can be done manually, or automatically using pkgtool. Solaris specific manual pages are found in tarballs named SUNWgnome-something-manpages-version.tar.bz2. These tarballs are generated from the manual page files found in spec-files/manpages. To generate the tarballs, use the following commands:
The manpage tarballs will be placed in the spec-files/sun-manpage-tarballs directory. Solaris specific changes to translations are found in tarballs named module-po-sun-version.tar.bz2. These tarballs are generated from the .po files found in spec-files/po-sun. To generate the tarballs, use the following commands:
The manpage tarballs will be placed in the spec-files/po-sun/po-sun-tarballs directory. 5. Quickstart to building JDSFirst, set up the environment for building JDS - jdsuser@jdsbuild:~> . /opt/jdsbld/bin/env.sh Uninstall the existing JDS packages using pkgtool - jdsuser@jdsbuild:~> cd spec-files jdsuser@jdsbuild:~> pkgtool uninstall-pkgs *.spec This command extracts the package names from the spec files and then uninstalls them using the pkgrm command. Packages are uninstalled even if other installed packages require them. It is advised that you are not logged into GNOME during this step as it uninstalls all GNOME packages. Use a CDE session, remote login or a failsafe session instead. Now build the entire stack - jdsuser@jdsbuild:~> pkgtool --download build -v *.spec pkgtool will read all spec files to determine the build order, then builds and installs them one by one. For more details on building JDS manually, see the following sections. Build log files for individual packages are placed in /tmp by default. You can change this using the --logdir option or specifying logdir in ~/.pkgtoolrc: jdsuser@jdsbuild:~> echo 'logdir: /path/to/my/logdir' >> ~/.pkgtoolrc 6. Building Solaris PackagesAt the heart of the JDS build environment is pkgbuild, a perl script for building Solaris SVr4 packages from an RPM spec file. It is intended to be a plug-in replacement of the rpmbuild command on many Linux distributions. pkgbuild allows you to build a single package at a time. Building a package goes through 4 stages - A command summary of pkgbuild is as follows -
jdsuser@jdsbuild:~> pkgbuild --help
pkgbuild version 1.3.2
Copyright 2003-2008 - Sun Microsystems, Inc.
This may be freely redistributed under the terms of the GNU GPL
* = the option is implemented
Usage:
* --help - print this message
* --version - print the version of rpm being used
* --interactive - start a shell in the build directory if fails
and allow to continue after the shell terminates
all modes support the following arguments:
--rcfile <file> - use <file> instead of /etc/rpmrc and $HOME/.rpmrc
-v - be a little more verbose
-vv - be incredibly verbose (for debugging)
* -b<stage> <spec>
-t<stage> <tarball> - build package, where <stage> is one of:
* p - prep (unpack sources and apply patches)
l - list check (do some cursory checks on %files)
* c - compile (prep and compile)
* i - install (prep, compile, install)
* b - binary package (prep, compile, install, package)
* a - bin/src package (prep, compile, install, package)
* --short-circuit - skip straight to specified stage (only for c,i)
--clean - remove build tree when done
--rmsource - remove sources and spec file when done
--sign - generate PGP/GPG signature
--buildroot <dir> - use <dir> as the build root
--target=<platform>+ - build the packages for the build targets
platform1...platformN.
--nobuild - do not execute any stages
--timecheck <secs> - set the time check to <secs> seconds (0 disables)
* --define "<name> <value>"
- define <name> as <value> as if you had
"%define <name> <value>" in the spec file
* --rebuild <src_pkg> - install source package, build binary package and
remove spec file, sources, patches, and icons.
--rmsource <spec> - remove sources and spec file
--recompile <src_pkg> - like --rebuild, but don't build any package
7. Manually building your first package with pkgbuildAs an example package to build, take SUNWspeex. Speex is an open source and patent-free speech multimedia codec. As mentioned in the source code tour, the Solaris SUNWspeex package is built from a RPM spec file. Looking at the SUNWspeex.spec file within the spec-files directory of the JDS build sources, you will notice the lines - %include Solaris.inc %use speex = speex.spec The SUNWspeex.spec file includes much of the core information already detailed in the speex.spec "base" spec file, which is in the spec-files/base-specs. As such, the SUNWspeex.spec file is an extension, detailing how the Solaris package is created. You will need both of these files to successfully build the package - copy them to ~/packages/SPECS. Along with that, you'll notice it includes some default settings as detailed in Solaris.inc. This, and other include files are in the spec-files/include directory. Copy this file, along with default-depend.inc into ~/packages/SPECS. Also, copy the default-copyright.txt file, (which is available in the ext-sources top-level directory) into ~/packages/SOURCES. Within the speex.spec file you will notice the block of lines -
Name: speex
License: Xiph
Group: Application/Devel
Version: 1.0.5
Distribution: Java Desktop System
Vendor: Sun Microsystems, Inc.
Summary: An open-source, patent-free speech codec
Source: http://www.speex.org/download/%{name}-%{version}.tar.gz
URL: http://www.speex.org/
This describes much of the core information about the package - what version and license it uses, along with details of where to download it. While we have automated much of the process of downloading the sources from their original community as you will see a little later, for now, proceed to download speex-1.0.5.tar.gz. Copy the downloaded file to /jds/packages/SOURCES. Now you are ready to build your first package. All the spec files and the sources are in the correct directory locations under ~/packages/, as follows -
We want to create a full binary and source SUNWspeex package, so we will use the -ba option with pkgbuild - jdsuser@jdsbuild:~> . /opt/jdsbld/bin/env.sh jdsuser@jdsbuild:~> cd ~/packages/SPECS jdsuser@jdsbuild:~> pkgbuild -ba SUNWspeex.spec Executing(%prep): /bin/bash /var/tmp/pkgbuild-tmp-1.11242 + umask 022 + uname -a SunOS zenity 5.10 Generic i86pc i386 i86pc + cd /home/jdsuser/packages/BUILD + rm -rf SUNWspeex-2.12.0 + mkdir SUNWspeex-2.12.0 + cd /home/jdsuser/packages/BUILD + cd /home/jdsuser/packages/BUILD/SUNWspeex-2.12.0 + rm -rf speex-1.0.5 + /usr/bin/gzip -dc /home/jdsuser/packages/SOURCES/speex-1.0.5.tar.gz + /bin/tar xf - + STATUS=0 + '[' 0 -ne 0 ']' + cd speex-1.0.5 + ++ /usr/xpg4/bin/id -u + '[' 100 = 0 ']' + ++ /usr/xpg4/bin/id -u + '[' 100 = 0 ']' + /bin/chmod -Rf a+rX,g-w,o-w . + cd .. + exit 0 Executing(%build): /bin/bash /var/tmp/pkgbuild-tmp-2.11242 + umask 022 + uname -a SunOS zenity 5.10 Generic i86pc i386 i86pc + cd /home/jdsuser/packages/BUILD + cd SUNWspeex-2.12.0 + cd /home/jdsuser/packages/BUILD/SUNWspeex-2.12.0 + cd speex-1.0.5 ++ /usr/sbin/psrinfo ++ grep on-line ++ wc -l ++ tr -d ' ' + CPUS=1 + test x1 = x -o 1 = 0 + CFLAGS='-i -x04 -xspace -xstrconst -xpentium -mr' + ./configure --enable-shared --enable-static --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man ..... ..... ## Packaging one part. /home/jdsuser/packages/SPKGS/SUNWspeex-src/pkgmap /home/jdsuser/packages/SPKGS/SUNWspeex-src/pkginfo /home/jdsuser/packages/SPKGS/SUNWspeex-src/install/copyright /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SOURCES/default-copyright.txt /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SOURCES/speex-1.0.5.tar.gz /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SPECS/..pkgbuild /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SPECS/SUNWspeex.spec /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SPECS/Solaris.inc /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SPECS/default-depend.inc /home/jdsuser/packages/SPKGS/SUNWspeex-src/reloc/share/src/SUNWspeex-2.12.0/SPECS/speex.spec ## Validating control scripts. ## Packaging complete. Executing(%clean): /bin/bash /var/tmp/pkgbuild-tmp-15.11388 + umask 022 + uname -a SunOS zenity 5.10 Generic i86pc i386 i86pc + cd /home/jdsuser/packages/BUILD + cd SUNWspeex-2.12.0 + rm -rf /var/tmp/SUNWspeex-2.12.0-build + exit 0 8. Automatically building packages with pkgtoolWhile using pkgbuild allows you to build Solaris packages easily, it doesn't allow for automatic dependency checking, and very much relies on the spec files and the sources to be in the correct place. pkgtool is a wrapper script around pkgbuild that helps to solve this problem. pkgtool will also allow you to download the original source community tarballs. Not only is pkgtool very useful in this respect, it also acts as a tinderbox script allowing you log your builds and report any errors that might have occurred. A command summary of pkgtool is as follows -
jdsuser@jdsbuild:~> pkgtool --help
pkgtool [options] [command] specs...
Options:
General:
-v|--verbose:
Increase verbosity: the more -v's the more diag messages.
-q|--quiet:
Silent operation.
--halt-on-errors:
Halt on the first build error, do not attempt to continue.
--rcfile=file
Read default configuration from file.
Default: ./.pkgtoolrc, ~/.pkgtoolrc
--norc
Ignore the default rc files.
--dumprc
Print the current configuration in a format suitable
for an rc file, then exit.
--download
Automatically download sources if not found in the local
search paths (requires wget) Specify your proxy servers
using the http_proxy and ftp_proxy environment variables.
--download-to=dir
Save downloaded files in dir. By default, files are
downloaded to /usr/src/packages/SOURCES. Implies --download.
--interactive [EXPERIMENTAL]
Interactive mode: pkgbuild/rpm output is displayed on
the standard output; pkgbuild is executed in interactive
mode which makes it start a subshell if the build fails
Directories and search paths:
--specdirs=path, --spec=path:
Specify a colon separated list of directories to search
for spec files in
--tarballdirs=path, --tarballs=path, --tar=path:
Specify a colon separated list of directories to search
for tarballs in
--sourcedirs=path, --src=path:
Specify a colon separated list of directories to search
for additional source files in
--patchdirs=path, --patches=path, --patch=path
Specify a colon separated list of directories to search
for patches (source diffs) in
--topdir=dir
Use dir as the rpm base directory (aka %topdir, where the
SPECS, SOURCES, RPMS, SRPMS, BUILD directories are found).
Default: /usr/src/packages
--logdir=dir, --log=dir:
Write build logs to dir.
Options controlling the build:
--nodeps, --deps:
Ignore/verify dependencies before building a component.
Default: --deps
--with foo, --without foo
This option is passed on to rpm/pkgbuild as is. Use it
for enabling/disabling conditional build options.
--target=arch
This option is passed on to rpm/pkgbuild as is.
--pkgformat={filesystem|fs|datastream|ds}
Create Solaris packages in filesystem or datastream format.
This option is ignored when running on Linux.
Default: filesystem
--nightly, --nonightly:
Suffix/Don't suffix the rpm Release with the current date.
Default: --nonightly; See also: --date-format
--date-format=format, --date=format:
Use "date +format" to generate the date suffix for
the nightly builds. Default: %y%m%d
Reporting:
--mail-errors-to=address
Send the last few lines of the build log to address
if the build fails
--report=file
Write a build report to file (in HTML format)
--prodname=string
The name of the product as appears in the build report
--full-path:
Print the full path to the package when running install-order
Commands:
build-install Build and install the specs listed on the command line.
The build order is determined by the dependencies
defined in the spec files.
build Same as build-install
build-only Build the specs listed on the command line, don't install
them.
prep run the %prep section of the spec files listed on the
command line
spkg create source package(s) only (no build done)
build-order Print the build order of the specs listed on the
command line.
install-order Print the rpms in the order they should be installed
install-pkgs (not implemented yet): install the packages defined
by the spec files listed on the command line from
the PKGS directory. No build is done. Useful to
install packages previously built using the build-only
command.
uninstall-pkgs Uninstall all packages defined in the spec files listed
on the command line. (runs rpm --erase --nodeps on
Linux, pkgrm on Solaris)
download Download the source files from the URLs specified in
the spec files listed on the command line. Source
files found in the local search paths will not be
downloaded. (See --tarballdirs, --sourcedirs,
--download-to)
specs...
List of spec files to build. Either full path names or names of spec
files in the spec directory search path.
Build examples with pkgtoolPrint out the build order of the packages - jdsuser@jdsbuild:Solaris> pkgtool -q build-order *.spec /export/home/jdsuser/jds-spec-files/SUNWPython.spec /export/home/jdsuser/jds-spec-files/SUNWTiff.spec /export/home/jdsuser/jds-spec-files/SUNWaspell.spec .... Download all the community source tarballs needed to build the SUNWgnome-panel package - jdsuser@jdsbuild:~> pkgtool download SUNWgnome-panel.spec Download, build, and install all the packages in the correct order. You will need to set the environmental variables http_proxy and ftp_proxy if necessary - jdsuser@jdsbuild:~> pkgtool --download build-install *.spec Uninstall packages SUNWgnome-utils and SUNWgnome-config-editor - jdsuser@jdsbuild:~> pkgtool uninstall-pkgs SUNWgnome-utils.spec SUNWgnome-config-editor.spec Build the SUNWgnome-img-viewer package, but don't install it - jdsuser@jdsbuild:~> pkgtool build-only SUNWgnome-img-viewer.spec |