Merge commit '37e84ab74e939caf52150fc3352081786ecc0c29' into merges
[unleashed.git] / usr / src / tools / README.tools
blob5e80bd7535ed4d587f5cfb0f75038c05ddda14fa
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
22 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 This directory contains the tools used to do a full build of the
26 OS/Net workspace.  They usually live in the /opt/onbld directory on build
27 machines. From here, 'make install' will build and install the tools
28 in $ROOT/opt/onbld. 
30 Layout of /opt/onbld
31 --------------------
33 /opt/onbld/etc/abi
34         contains Solaris ABI database (ABI_*.db) and exceptions
35         for ABI Auditing tool (interface_check, interface_cmp).
37 /opt/onbld/bin
38         basic bin directory - contains scripts.
40 /opt/onbld/bin/${MACH}
41         architecture-specific bin directory for binaries.
43 /opt/onbld/env
44         build environment files.
46 /opt/onbld/lib
47         libraries used by the build tools.
49 /opt/onbld/lib/python<version>/
50         python modules used by the build tools.
52 /opt/onbld/lib/python/ 
53         symlink to the modules directory of the currently preferred
54         python version.  This exists to retain compatibility both for
55         tools expecting only one supported version of python, and for
56         user .hgrc files that expect to find cdm.py in
57         /opt/onbld/lib/python/onbld/hgext.
59 /opt/onbld/man
60         rudimentary man pages for some of the tools.
63 Tool Summary
64 ------------
66 bldenv
67         companion to 'nightly.' Takes the same environment file you
68         used with 'nightly,' and starts a shell with the environment
69         set up the same way as 'nightly' set it up. This is useful
70         if you're trying to quickly rebuild portions of a workspace
71         built by 'nightly'. 'ws' should not be used for this since it
72         sets the environment up differently and may cause everything
73         to rebuild (because of different -I or -L paths).
75 cdm 
76         A Mercurial extension providing various commands useful for ON
77         development
79 check_rtime
80         checks ELF attributes used by ELF dynamic objects in the proto area.
81         Used by 'nightly's -r option, to check a number of ELF runtime
82         attributes for consistency with common build rules.  nightly uses
83         the -o option to simplify the output for diffing with previous
84         build results.  It also uses the -i option to obtain NEEDED and RUNPATH
85         entries, which help detect changes in software dependencies and makes
86         sure objects don't have any strange runpaths like /opt/SUNWspro/lib.
88 checkproto
89         Runs protocmp and protolist on a workspace (or uses the environment
90         variable SRCTOP to determine the workspace). Checks the proto area
91         against the packages.
93 codereview
94         Given two filenames, creates a postscript file with the file 
95         differences highlighted.
97 copyrightchk
98         Checks that files have appropriate SMI copyright notices.
99         Primarily used by wx
101 cstyle
102         checks C source for compliance with OS/Net guidelines.
104 ctfconvert
105         Convert symbolic debugging information in an object file to the Compact
106         ANSI-C Type Format (CTF).
108 ctfdump
109         Decode and display CTF data stored in a raw file or in an ELF file.
111 ctfmerge
112         Merge the CTF data from one or more object files.
114 depcheck
115         A tool to try an assess the dependencies of executables.  This tool 
116         is not a definitive dependency check, but it does use "strings" and 
117         "ldd" to gather as much information as it can.  The dependency check
118         tool can handle filenames and pkgnames.  Before using the dependency
119         checker you must build a database which reflects the properties and
120         files in your system.
122 elfcmp
123         Compares two ELF modules (e.g. .o files, executables) section by
124         section.  Useful for determining whether "trivial" changes -
125         cstyle, lint, etc - actually changed the code.  The -S option
126         is used to test whether two binaries are the same except for
127         the elfsign signature.
129 find_elf
130         Search a directory tree for ELF objects, and produce one line of
131         output per object. Used by check_rtime and interface_check to locate
132         the objects to examine.
134 hdrchk
135         checks headers for compliance with OS/Net standards (form, includes,
136         C++ guards).
138 interface_check
139         detects and reports invalid versioning in ELF objects.
140         Optionally generates an interface description file for
141         the workspace.
143 interface_cmp
144         Compares two interface description files, as produced by
145         interface_check, and flags invalid deviations in ELF object
146         versioning between them. interface_cmp can be used between Solaris
147         gates to ensure that older releases remain compatible with the
148         development gate. It can also be used to validate new changes to
149         the development gate before they are integrated.
151 ndrgen
152         Network Data Language (NDL) RPC protocol compiler to support DCE
153         RPC/MSRPC and SMB/CIFS.  ndrgen takes an input protocol definition
154         file (say, proto.ndl) and generates an output C source file
155         (proto_ndr.c) containing the Network Data Representation (NDR)
156         marshalling routines to implement the RPC protocol.
158 nightly
159         nightly build script. Takes an environment (or 'env') file describing
160         such things as the workspace, the parent, and what to build. See
161         env/developer and env/gatekeeper for sample, hopefully well-commented
162         env files.
164 pmodes
165         enforces proper file ownership and permissions in pkgmap and package
166         prototype* files.  converts files if necessary
168 protocmp
169         compares proto lists and the package definitions. Used by nightly
170         to determine if the proto area matches the packages, and to detect
171         differences between a childs proto area and a parents.
173 protocmp.terse
174         transforms the output of protocmp into something a bit more friendly
176 protolist
177         create a list of what's in the proto area, to feed to protocmp.
181         creates a shell with the environment set up to build in the given
182         workspace. Used mostly for non-full-build workspaces, so it sets up
183         to pull headers and libraries from the proto area of the parent if
184         they aren't in the childs proto area.
186 tokenize
187         Used to build the sun4u boot block.
189 webrev
190         Generates a set of HTML pages that show side-by-side diffs of
191         changes in your workspace, for easy communication of code
192         review materials.  Can automatically find edited files or use a
193         manually-generated list.
195 wsdiff
196         Detect object differences between two ON proto areas. Used by
197         nightly(1) to determine what changed between two builds. Handy
198         for identifying the set of built objects impacted by a given
199         source change. This information is needed for patch construction.
202 How to do a full build
203 ----------------------
205 1. Find an environment file that might do what you want to do. If you're just
206    a developer wanting to do a full build in a child of the gate, copy the
207    'developer' environment file to a new name (private to you and/or the
208    work being done in this workspace, to avoid collisions with others). Then
209    edit the file and tailor it to your workspace. Remember that this file
210    is a shell script, so it can do more than set environment variables.
212 2. Run 'nightly' and give it your environment file as an
213    option. 'nightly' will first look for your environment file in
214    /opt/onbld/env, and if it's not there then it will look for it as an
215    absolute or relative path. Some people put their environment files in
216    their workspace to keep them close.
218 3. When 'nightly' is complete, it will send a summary of what happened to
219    $MAILTO. Usually, the less info in the mail the better. If you have failures,
220    you can go look at the full log of what happened, generally in
221    $SRCTOP/log/log.<date>/nightly.log (the mail_msg it sent and the proto
222    list are there too). You can also find the individual build logs, like
223    'make clobber' and 'make install' output in $SRC, under names like
224    clobber-${MACH}.out and install-${MACH}.out (for a DEBUG build). These
225    will be smaller than nightly.log, and maybe more searchable.
227 Files you have to update to add a tool
228 --------------------------------------
230 1.  Add the tool in its appropriate place.
231 2.  Update the Makefile as required.
232 3.  Update usr/src/pkg/manifests/developer-build-onbld.mf
233 4.  Update usr/src/tools/README.tools (this file).
234 5.  Repeat 1-4 for any man pages.