xref: /haiku/build/jam/UserBuildConfig.ReadMe (revision 9829800d2c60d6aba146af7fde09601929161730)
1# UserBuildConfig ReadMe
2# ----------------------
3
4# UserBuildConfig can be used to customize the build according to your needs.
5# If existent it is included by the build system, but it is ignored by svn.
6# This file documents a few examples, what can be done. Don't just rename it
7# to UserBuildConfig -- you don't want all the things to happen, that are
8# specified here. Rather create an empty UserBuildConfig and copy the lines
9# you really want, or start out with UserBuildConfig.sample.
10# Of course, noone reads ReadMe files, so they will just get an error here
11# when copying it and jamming:
12Exit You must NOT copy UserBuildConfig.ReadMe directly but use parts of it! ;
13
14
15# Adjusting Build Variables
16
17# The following variables can be configured per subdirectory (or subtree) or
18# even per object file:
19#
20#	CCFLAGS C++FLAGS DEBUG DEFINES HDRS LINKFLAGS OPTIM OPTIMIZE SYSHDRS
21#	WARNINGS
22#	HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS
23#	TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS
24#	PLATFORM SUPPORTED_PLATFORMS
25#
26# The following examples would work analogously for any of these variables.
27
28# Turn off warnings in directory src/system/kernel. As fourth (scope) parameter
29# "local" is specified, which means, that this setting applies only to the
30# given directory, but not any of its subdirectories.
31SetConfigVar WARNINGS : HAIKU_TOP src system kernel : 0 : local ;
32
33# Set the debug level for directory src/system/boot/loader and recursively all
34# of its subdirectories (scope is "global") to 1. All affected generated files
35# will be put into another subtree of the "generated" directory, which allows
36# for fast switching between normal and debug builds.
37SetConfigVar DEBUG : HAIKU_TOP src system boot loader : 1 : global ;
38
39# Add "RUN_WITHOUT_REGISTRAR" to the DEFINES for the directory src/kits and
40# all of its subdirectories.
41AppendToConfigVar DEFINES : HAIKU_TOP src kits : RUN_WITHOUT_REGISTRAR
42	: global ;
43
44# Set the debug level for file src/bin/gdb/gdb/haiku-nat.c (note, that
45# the object file must be specified) to 1. It is worth mentioning, that the
46# executable the object file is linked into (gdb), will still be placed in
47# generated/objects/.../release/... Only when setting DEBUG for the executable,
48# too, it will be placed in .../debug_1/.... Apart from that, the DEBUG variable
49# has no effect on executables or other shared objects.
50DEBUG on <src!bin!gdb!gdb!>haiku-nat.o = 1 ;
51
52# Enables the SSL build feature. Several targets will be compiled with SSL
53# support. Adding the OpenSSL optional package will automatically enable this
54# feature.
55HAIKU_BUILD_FEATURE_SSL = 1 ;
56
57
58# Haiku Image Related Modifications
59
60# Create a 100 MB image at /tmp/walter.image.
61HAIKU_IMAGE_NAME	= walter.image ;
62HAIKU_IMAGE_DIR		= /tmp ;
63HAIKU_IMAGE_SIZE	= 100 ;
64
65# Enable stripping the debug symbols from optional packages.
66HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
67
68# Set image volume label to "Walter". Default label is "Haiku".
69HAIKU_IMAGE_LABEL	= Walter ;
70
71# Name the VMWare image walter.vmdk (in directory $(HAIKU_IMAGE_DIR)).
72HAIKU_VMWARE_IMAGE_NAME	= walter.vmdk ;
73
74# Install Haiku in directory /Haiku.
75HAIKU_INSTALL_DIR = /Haiku ;
76
77# If the image does already exist it won't be zeroed out. It will nevertheless
78# freshly be initialized with BFS. Useful when installing Haiku on a partition.
79HAIKU_DONT_CLEAR_IMAGE = 1 ;
80
81
82# Affects the haiku-image, haiku-vmware-image, and install-haiku targets. Only
83# targets on which the HAIKU_INCLUDE_IN_IMAGE variable has been set will be
84# updated in the image file/installation directory.
85# The update-image, update-vmware-image, and update-install targets always invoke
86# this rule, so one likely doesn't ever need to do it manually.
87SetUpdateHaikuImageOnly 1 ;
88
89# libbe.so and the kernel will be updated on image updates. Note that this
90# generally doesn't work for pseudo targets (it does where special support
91# has been added, like for "kernel").
92HAIKU_INCLUDE_IN_IMAGE on libbe.so kernel = 1 ;
93
94# Add "crashing_app" to the system/bin directory of the Haiku image/installation.
95# Note, that this also makes the image depend on the target, i.e. it is
96# automatically updated when the image is built.
97AddFilesToHaikuImage system bin : crashing_app ;
98
99# Make a symlink to home/config/bin/crash.
100AddSymlinkToHaikuImage home config bin : /bin/crashing_app : crash ;
101
102# Add keymap settings.
103AddFilesToHaikuImage home config settings : <keymap>US-International : Key_map ;
104
105# Adds the source directories src/kits/storage and src/tests/servers/debug
106# (recursively) to the image (as /boot/home/HaikuSources/src/kits/storage
107# and /boot/home/HaikuSources/src/tests/servers/debug respectively).
108# Note that the second directory will also be copied, if the image will only
109# be updated; the first one won't in that case.
110AddSourceDirectoryToHaikuImage src/kits/storage ;
111AddSourceDirectoryToHaikuImage src/tests/servers/debug : 1 ;
112
113# Copy the jam sources (assuming they are located ../buildtools/jam relatively
114# to your Haiku sources) to the image as /boot/home/Desktop/jam-src, excluding
115# any file or directory named ".svn" and any source path that matches the
116# pattern "*/jam/./bin.*". Note that the "*" character needs to be escaped with
117# two backslashes (one because it goes through a shell and one to quote the
118# first one in jam), and that the build system always appends "/." to the source
119# path (hence this pattern). Just as AddSourceDirectoryToHaikuImage this rule
120# can also take another optional parameter indicating whether the directory shall
121# also be copied in update mode.
122CopyDirectoryToHaikuImage home Desktop
123	: $(HAIKU_TOP)/../buildtools/jam
124	: "jam-src" : -x .svn -X \\*/jam/./bin.\\* ;
125
126# Extracts the given archive onto the image under /boot/develop/tools.
127ExtractArchiveToHaikuImage develop tools
128	: /home/bonefish/develop/haiku/misc/gcc-2.95.3-beos-070218/gcc-2.95.3_binutils-2.17_rel-070218.zip ;
129
130# Add the optional package WonderBrush to the image. The package is downloaded
131# via wget (i.e. wget must be installed).
132AddOptionalHaikuImagePackages WonderBrush ;
133
134# Add the optional package WebPositive to the image but don't add its
135# dependent SQLite optional package to the image. WebPositive still needs
136# SQLite to run, this allows you to test a different version of it though.
137AddOptionalHaikuImagePackages WebPositive ;
138SuppressOptionalHaikuImagePackages SQLite ;
139
140# Don't add the libraries built with the alternative gcc version.
141# If the alternative gcc generated directory has been specified via the
142# configure option --alternative-gcc-output-dir, the libraries for the
143# alternative gcc version are added by default. Unsetting this variable disables
144# building and adding the libraries. Ignored, if --alternative-gcc-output-dir
145# was not specified.
146HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 0 ;
147
148# Specify scripts that shall be run when populating the image/installation
149# directory. The "early" script is run before anything has been copied onto
150# the image/into the installation directory. The "late" script is run after
151# everything has been copied, but before the MIME database is installed.
152HAIKU_IMAGE_EARLY_USER_SCRIPTS	= $(HAIKU_TOP)/../early-image-script.sh ;
153HAIKU_IMAGE_LATE_USER_SCRIPTS	= $(HAIKU_TOP)/../late-image-script.sh ;
154
155# Set name and real name of the root user. Defaults to "baron" and "Root User".
156HAIKU_ROOT_USER_NAME = bond  ;
157HAIKU_ROOT_USER_REAL_NAME = "James Bond" ;
158
159# Set host name to "mybox". By default the installation doesn't have a host
160# name.
161HAIKU_IMAGE_HOST_NAME = mybox ;
162
163# Add user "walter" with user ID 1000 and group ID 100 (note, that a group with
164# that ID should exist -- 100 already exists and is the "users" group), home
165# directory "/boot/home", shell "/bin/bash", and real name "Just Walter" to the
166# image.
167AddUserToHaikuImage walter : 1000 : 100 : /boot/home : /bin/bash
168	: "Just Walter" ;
169
170# Add group "party" with group ID 101 and members "baron" and "walter" to the
171# image.
172AddGroupToHaikuImage party : 101 : baron walter ;
173
174
175# Build Profiles
176
177# A build profile is a named set of settings for building a Haiku image or
178# installation. The following lines define five different build profiles:
179# disk    - Installation on device /dev/sda57. A lengthy list of optional
180#           packages will be included. Profile type "disk" implies
181#           "HAIKU_DONT_CLEAR_IMAGE = 1".
182# qemu    - A plain 200 MB disk image (type "image") named "haiku-qemu.image".
183#           Since only the image name is given, the default location will be
184#           chosen for the image, unless HAIKU_IMAGE_DIR has been set
185#           beforehand.
186# vmware  - A 400 MB VMware image (type "vmware-image"). It will not be zeroed,
187#           if not necessary. The optional packages Development and Pe will be
188#           installed. No image name or path is given, so the defaults
189#            ("haiku.vmdk" in the generated directory) will be used, unless the
190#           respective variables are set.
191# anyboot - A custom image (type "anyboot-image"), its size will be 4 MB larger
192#           than the value of HAIKU_IMAGE_SIZE, named haiku-anyboot.image.
193# crash   - Similar to the vmware profile, but created at a specific location
194#           and 1 GB size. Furthermore a "crash-tests" directory will be copied
195#           to the image.
196# install - Installation in directory "/Haiku2" (type "install").
197
198DefineBuildProfile disk : disk : "/dev/sda57" ;
199DefineBuildProfile qemu : image : "haiku-qemu.image" ;
200DefineBuildProfile vmware : vmware-image ;
201DefineBuildProfile anyboot : anyboot-image : "haiku-anyboot.image" ;
202DefineBuildProfile crash : vmware-image
203	: "/home/foobar/vmware/Virtual Machines/CrashOMatic/CrashOMatic.vmdk" ;
204DefineBuildProfile install : install : /Haiku2 ;
205
206switch $(HAIKU_BUILD_PROFILE) {
207	case "disk" : {
208		AddOptionalHaikuImagePackages BeBook BeHappy BePDF Bluetooth CVS
209			Development Firefox OpenSSH OpenSSL P7zip Pe Subversion Vision
210			Welcome WonderBrush ;
211	}
212
213	case "qemu" : {
214		HAIKU_IMAGE_SIZE = 200 ;
215	}
216
217	case "vmware" : {
218		HAIKU_IMAGE_SIZE = 400 ;
219		HAIKU_DONT_CLEAR_IMAGE = 1 ;
220		AddOptionalHaikuImagePackages Development Pe ;
221	}
222
223	case "anyboot" : {
224		HAIKU_IMAGE_SIZE = 400 ;
225	}
226
227	case "crash" : {
228		HAIKU_IMAGE_SIZE = 1024 ;
229		HAIKU_DONT_CLEAR_IMAGE = 1 ;
230		AddOptionalHaikuImagePackages Development Pe ;
231		CopyDirectoryToHaikuImage home Desktop : $(HAIKU_TOP)/../crash-tests ;
232	}
233}
234
235# By specifying the build profile name as first (non-option) parameter on the
236# jam command line prefixed by an "@" character, the profile will be selected.
237# The second parameter specifies the action to be performed, further optional
238# parameters may follow. Jam command line examples:
239#
240# jam -q @disk build
241#	-> Equivalent to running "jam -q haiku-image" with the settings for the
242#      "disk" profile. "build" is the default action, so it could even be
243#      omitted.
244# jam -q @vmware update kernel
245#	-> Equivalent to running "jam -q update-vmware-image kernel" with the
246#      settings for the "vmware" profile.
247# jam -q @crash mount
248#	-> Enters the bfs_shell mounting the image specified by the "crash" profile.
249#
250# Note, that the build system will automatically define the build profiles
251# "image", "vmware-image", and "install", unless they are already defined in
252# the UserBuildConfig. They correspond to the respective build profile types
253# and use the values of the variables HAIKU[_VMWARE]_IMAGE_NAME,
254# HAIKU_IMAGE_DIR, HAIKU_INSTALL_DIR, respectively their default values.
255# "jam -q @image" will therefore be equivalent to "jam -q haiku-image".
256
257
258# Creating Sourceable Shell Scripts
259
260# If you use shell scripts (e.g. for testing) that need to access targets or
261# build system properties, you can tell the build system to generate a
262# variables defining shell script you can source from your shell script.
263
264# General setup for the shell script to generate. Name is test.inc, located
265# in the output directory.
266MakeLocate test.inc : $(HAIKU_OUTPUT_DIR) ;
267Always test.inc ;
268
269# Define variable "outputDir" in the shell script, with the value of
270# HAIKU_OUTPUT_DIR.
271AddVariableToScript test.inc : outputDir : $(HAIKU_OUTPUT_DIR) ;
272
273# Define variables "bfsShell" and "fsShellCommand" referring to the
274# generated bfs_shell and fs_shell_command respectively.
275AddTargetVariableToScript test.inc : bfs_shell : bfsShell ;
276AddTargetVariableToScript test.inc : fs_shell_command : fsShellCommand ;
277
278# If no variable name is given, the name (without grist) of the target is
279# used, i.e. a variable "rc" referring to the rc command built for the host
280# platform is defined in the script.
281AddTargetVariableToScript test.inc : <build>rc ;
282
283
284# Optimizing Jamfile Parsing Times / Third Party Inclusion
285
286# Setting this variable will prevent the root Jamfile to include the Jamfile
287# in the src directory. Instead only the directories required for building the
288# build tools are included. Only useful in combination with DeferredSubInclude.
289HAIKU_DONT_INCLUDE_SRC = 1 ;
290
291# Schedule the given subdirectory for inclusion at the end of the root
292# Jamfile (directly using SubInclude here is not possible). Using this
293# feature together with HAIKU_DONT_INCLUDE_SRC allows developers working
294# only on a subproject to reduce Jamfile parsing times considerably.
295DeferredSubInclude HAIKU_TOP src tests add-ons kernel file_systems
296	userlandfs ;
297
298# Schedule src/3rdparty/myproject/Jamfile.haiku for later inclusion. The "local"
299# parameter specifies that the alternative Jamfile name shall not be used for
300# any subdirectory of the given directory (i.e. "Jamfile" will be used as
301# usual). Omitting this parameter or specifying "global" will cause the given
302# name to be used recursively.
303DeferredSubInclude HAIKU_TOP src 3rdparty myproject : Jamfile.haiku : local ;
304
305# The following rules can be overriden to do things at different points of
306# the build system execution by jam (note: we're talking about execution of
307# Jamfiles, not the build actions they define):
308#
309# UserBuildConfigRulePostBuildTargets:
310#	Executed after the complete Jamfile tree has been processed. I.e. all build
311#	targets are known and located at this point.
312# UserBuildConfigRulePreImage:
313#	Executed after the contents of the Haiku image has been defined, but before
314#	the scripts generating the images are defined.
315# UserBuildConfigRulePostImage:
316#	Executed after the Haiku image build target has been fully defined.
317#
318# E.g. making use of the fact that all targets have already been located when
319# UserBuildConfigRulePostBuildTargets is called, we can print the directory
320# where the StyledEdit executable will be generated.
321rule UserBuildConfigRulePostBuildTargets
322{
323	Echo "StyledEdit will appear here:" [ on StyledEdit return $(LOCATE) ] ;
324}
325