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 Git.
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_<packageArch> TARGET_WARNING_C++FLAGS_<packageArch>
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# Set image volume label to "Walter". Default label is "Haiku".
66HAIKU_IMAGE_LABEL	= Walter ;
67
68# Name the VMWare image walter.vmdk (in directory $(HAIKU_IMAGE_DIR)).
69HAIKU_VMWARE_IMAGE_NAME	= walter.vmdk ;
70
71# Install Haiku in directory /Haiku.
72HAIKU_INSTALL_DIR = /Haiku ;
73
74# If the image does already exist it won't be zeroed out. It will nevertheless
75# freshly be initialized with BFS. Useful when installing Haiku on a partition.
76HAIKU_DONT_CLEAR_IMAGE = 1 ;
77
78# Set the compression level for the creation and update of Haiku packages to 1.
79# Values from 0 to 9 are supported. 0 means no compression, 1 fastest, ..., and
80# 9 best. The default is 9 which should be used for official builds (release or
81# nightly) to achieve the smallest possible package files at the cost of long
82# package building times. For developers who frequently rebuild/update packages
83# level 1 is a good compromise. Depending on the package data it's about an
84# order of magnitude faster while still achieving acceptable compression ratios.
85# Using level 0 will make package creation mostly I/O bound. It can be used, if
86# package size is not a concern. Depending on the package data, files may be
87# several times larger than even with level 1.
88HAIKU_PACKAGE_COMPRESSION_LEVEL = 1 ;
89
90# Override the Haiku revision string determined via git. This is e.g. useful,
91# when your git repository doesn't have hrev tags. You may need to remove the
92# file <generated>/build/haiku-revision whenever you change this variable.
93HAIKU_REVISION = hrev66666 ;
94
95# Affects the haiku-image, haiku-vmware-image, and install-haiku targets. Only
96# targets on which the HAIKU_INCLUDE_IN_IMAGE variable has been set will be
97# updated in the image file/installation directory.
98# The update-image, update-vmware-image, and update-install targets always invoke
99# this rule, so one likely doesn't ever need to do it manually.
100SetUpdateHaikuImageOnly 1 ;
101
102# libbe.so and the kernel will be updated on image updates. Note that this
103# generally doesn't work for pseudo targets (it does where special support
104# has been added, like for "kernel").
105HAIKU_INCLUDE_IN_IMAGE on libbe.so kernel = 1 ;
106
107# Add "crashing_app" to the system/bin directory of the Haiku image/installation.
108# Note, that this also makes the image depend on the target, i.e. it is
109# automatically updated when the image is built.
110AddFilesToHaikuImage system bin : crashing_app ;
111
112# Make a symlink to home/config/bin/crash.
113AddSymlinkToHaikuImage home config bin : /bin/crashing_app : crash ;
114
115# Add keymap settings.
116AddFilesToHaikuImage home config settings : <keymap>US-International : Key_map ;
117
118# Adds the source directories src/kits/storage and src/tests/servers/debug
119# (recursively) to the image (as /boot/home/HaikuSources/src/kits/storage
120# and /boot/home/HaikuSources/src/tests/servers/debug respectively).
121# Note that the second directory will also be copied, if the image will only
122# be updated; the first one won't in that case.
123AddSourceDirectoryToHaikuImage src kits storage ;
124AddSourceDirectoryToHaikuImage src tests servers debug : alwaysUpdate ;
125
126# Copy the jam sources (assuming they are located ../buildtools/jam relatively
127# to your Haiku sources) to the image as /boot/home/Desktop/jam-src, excluding
128# any file or directory named ".git" and any source path that matches the
129# pattern "*/jam/./bin.*". Note that the "*" character needs to be escaped with
130# two backslashes (one because it goes through a shell and one to quote the
131# first one in jam), and that the build system always appends "/." to the source
132# path (hence this pattern). Just as AddSourceDirectoryToHaikuImage this rule
133# can also take another optional parameter indicating whether the directory shall
134# also be copied in update mode.
135CopyDirectoryToHaikuImage home Desktop
136	: $(HAIKU_TOP)/../buildtools/jam
137	: "jam-src" : -x .git -X \\*/jam/./bin.\\* ;
138
139# Extracts the given archive onto the image under /boot/develop/tools.
140ExtractArchiveToHaikuImage develop tools
141	: /home/bonefish/develop/haiku/misc/gcc-2.95.3-beos-070218/gcc-2.95.3_binutils-2.17_rel-070218.zip ;
142
143# Add the optional package WonderBrush to the image. The package is downloaded
144# via wget (i.e. wget must be installed).
145AddHaikuImageSystemPackages WonderBrush ;
146
147# Add the optional package WebPositive to the image but don't add its
148# dependent SQLite optional package to the image. WebPositive still needs
149# SQLite to run, this allows you to test a different version of it though.
150AddOptionalHaikuImagePackages WebPositive ;
151SuppressHaikuImagePackages SQLite ;
152
153# Specify scripts that shall be run when populating the image/installation
154# directory. The "early" script is run before anything has been copied onto
155# the image/into the installation directory. The "late" script is run after
156# everything has been copied, but before the MIME database is installed.
157HAIKU_IMAGE_EARLY_USER_SCRIPTS	= $(HAIKU_TOP)/../early-image-script.sh ;
158HAIKU_IMAGE_LATE_USER_SCRIPTS	= $(HAIKU_TOP)/../late-image-script.sh ;
159
160# Set name and real name of the root user. Defaults to "baron" and "Root User".
161HAIKU_ROOT_USER_NAME = bond ;
162HAIKU_ROOT_USER_REAL_NAME = "James Bond" ;
163
164# Set host name to "mybox". By default the installation doesn't have a host
165# name.
166HAIKU_IMAGE_HOST_NAME = mybox ;
167
168# Add user "walter" with user ID 1000 and group ID 100 (note, that a group with
169# that ID should exist -- 100 already exists and is the "users" group), home
170# directory "/boot/home", shell "/bin/bash", and real name "Just Walter" to the
171# image.
172AddUserToHaikuImage walter : 1000 : 100 : /boot/home : /bin/bash
173	: "Just Walter" ;
174
175# Add group "party" with group ID 101 and members "baron" and "walter" to the
176# image.
177AddGroupToHaikuImage party : 101 : baron walter ;
178
179
180# Build Profiles
181
182# A build profile is a named set of settings for building a Haiku image or
183# installation. The following lines define five different build profiles:
184# disk    - Installation on device /dev/sda57. A lengthy list of optional
185#           packages will be included. Profile type "disk" implies
186#           "HAIKU_DONT_CLEAR_IMAGE = 1".
187# qemu    - A plain 200 MB disk image (type "image") named "haiku-qemu.image".
188#           Since only the image name is given, the default location will be
189#           chosen for the image, unless HAIKU_IMAGE_DIR has been set
190#           beforehand.
191# vmware  - A 400 MB VMware image (type "vmware-image"). It will not be zeroed,
192#           if not necessary. The optional packages Development and Pe will be
193#           installed. No image name or path is given, so the defaults
194#            ("haiku.vmdk" in the generated directory) will be used, unless the
195#           respective variables are set.
196# anyboot - A custom image (type "anyboot-image"), its size will be 4 MB larger
197#           than the value of HAIKU_IMAGE_SIZE, named haiku-anyboot.iso.
198# crash   - Similar to the vmware profile, but created at a specific location
199#           and 1 GB size. Furthermore a "crash-tests" directory will be copied
200#           to the image.
201# install - Installation in directory "/Haiku2" (type "install").
202
203DefineBuildProfile disk : disk : "/dev/sda57" ;
204DefineBuildProfile qemu : image : "haiku-qemu.image" ;
205DefineBuildProfile vmware : vmware-image ;
206DefineBuildProfile anyboot : anyboot-image : "haiku-anyboot.iso" ;
207DefineBuildProfile crash : vmware-image
208	: "/home/foobar/vmware/Virtual Machines/CrashOMatic/CrashOMatic.vmdk" ;
209DefineBuildProfile install : install : /Haiku2 ;
210
211switch $(HAIKU_BUILD_PROFILE) {
212	case "disk" : {
213		AddOptionalHaikuImagePackages BeBook BeHappy Bluetooth Development
214			OpenSSH OpenSSL Welcome ;
215		AddHaikuImageSystemPackages bepdf git p7zip pe vision wonderbrush ;
216	}
217
218	case "qemu" : {
219		HAIKU_IMAGE_SIZE = 200 ;
220	}
221
222	case "vmware" : {
223		HAIKU_IMAGE_SIZE = 400 ;
224		HAIKU_DONT_CLEAR_IMAGE = 1 ;
225		AddOptionalHaikuImagePackages Development ;
226		AddHaikuImageSystemPackages pe ;
227	}
228
229	case "anyboot" : {
230		HAIKU_IMAGE_SIZE = 400 ;
231	}
232
233	case "crash" : {
234		HAIKU_IMAGE_SIZE = 1024 ;
235		HAIKU_DONT_CLEAR_IMAGE = 1 ;
236		AddOptionalHaikuImagePackages Development ;
237		AddHaikuImageSystemPackages pe ;
238		CopyDirectoryToHaikuImage home Desktop : $(HAIKU_TOP)/../crash-tests ;
239	}
240}
241
242# By specifying the build profile name as first (non-option) parameter on the
243# jam command line prefixed by an "@" character, the profile will be selected.
244# The second parameter specifies the action to be performed, further optional
245# parameters may follow. Jam command line examples:
246#
247# jam -q @disk build
248#	-> Equivalent to running "jam -q haiku-image" with the settings for the
249#      "disk" profile. "build" is the default action, so it could even be
250#      omitted.
251# jam -q @release-raw build haiku.hpkg
252#	-> Build's haiku.hpkg under the influence of the "release-raw" profile. This
253#      is is different to "jam -q haiku.hpkg" in that the build profile may
254#      enable certain build features that might not be enabled by default.
255# jam -q @vmware update kernel
256#	-> Equivalent to running "jam -q update-vmware-image kernel" with the
257#      settings for the "vmware" profile.
258# jam -q @crash mount
259#	-> Enters the bfs_shell mounting the image specified by the "crash" profile.
260#
261# Note, that the build system will automatically define the build profiles
262# for the common combination of release type (nightly, minimal, release) and
263# image type (raw, anyboot, vmware), as well as the "install" profile,
264# unless they are already defined in the UserBuildConfig. They correspond to
265# the respective build profile types and use the values of the variables
266# HAIKU[_VMWARE]_IMAGE_NAME, HAIKU_IMAGE_DIR, HAIKU_INSTALL_DIR, respectively
267# their default values.
268# "jam -q @nightly-raw" will therefore be equivalent to "jam -q haiku-image".
269
270
271# Creating Sourceable Shell Scripts
272
273# If you use shell scripts (e.g. for testing) that need to access targets or
274# build system properties, you can tell the build system to generate a
275# variables defining shell script you can source from your shell script.
276
277# General setup for the shell script to generate. Name is test.inc, located
278# in the output directory.
279MakeLocate test.inc : $(HAIKU_OUTPUT_DIR) ;
280Always test.inc ;
281
282# Define variable "outputDir" in the shell script, with the value of
283# HAIKU_OUTPUT_DIR.
284AddVariableToScript test.inc : outputDir : $(HAIKU_OUTPUT_DIR) ;
285
286# Define variables "bfsShell" and "fsShellCommand" referring to the
287# generated bfs_shell and fs_shell_command respectively.
288AddTargetVariableToScript test.inc : bfs_shell : bfsShell ;
289AddTargetVariableToScript test.inc : fs_shell_command : fsShellCommand ;
290
291# If no variable name is given, the name (without grist) of the target is
292# used, i.e. a variable "rc" referring to the rc command built for the host
293# platform is defined in the script.
294AddTargetVariableToScript test.inc : <build>rc ;
295
296
297# Optimizing Jamfile Parsing Times / Third Party Inclusion
298
299# Setting this variable will prevent the root Jamfile to include the Jamfile
300# in the src directory. Instead only the directories required for building the
301# build tools are included. Only useful in combination with DeferredSubInclude.
302HAIKU_DONT_INCLUDE_SRC = 1 ;
303
304# Schedule the given subdirectory for inclusion at the end of the root
305# Jamfile (directly using SubInclude here is not possible). Using this
306# feature together with HAIKU_DONT_INCLUDE_SRC allows developers working
307# only on a subproject to reduce Jamfile parsing times considerably.
308DeferredSubInclude HAIKU_TOP src tests add-ons kernel file_systems
309	userlandfs ;
310
311# Schedule src/3rdparty/myproject/Jamfile.haiku for later inclusion. The "local"
312# parameter specifies that the alternative Jamfile name shall not be used for
313# any subdirectory of the given directory (i.e. "Jamfile" will be used as
314# usual). Omitting this parameter or specifying "global" will cause the given
315# name to be used recursively.
316DeferredSubInclude HAIKU_TOP src 3rdparty myproject : Jamfile.haiku : local ;
317
318# The following rules can be overriden to do things at different points of
319# the build system execution by jam (note: we're talking about execution of
320# Jamfiles, not the build actions they define):
321#
322# UserBuildConfigRulePostBuildTargets:
323#	Executed after the complete Jamfile tree has been processed. I.e. all build
324#	targets are known and located at this point.
325# UserBuildConfigRulePreImage:
326#	Executed after the contents of the Haiku image has been defined, but before
327#	the scripts generating the images are defined.
328# UserBuildConfigRulePostImage:
329#	Executed after the Haiku image build target has been fully defined.
330#
331# E.g. making use of the fact that all targets have already been located when
332# UserBuildConfigRulePostBuildTargets is called, we can print the directory
333# where the StyledEdit executable will be generated.
334rule UserBuildConfigRulePostBuildTargets
335{
336	Echo "StyledEdit will appear here:" [ on StyledEdit return $(LOCATE) ] ;
337}
338