xref: /haiku/build/jam/images/definitions/common-tail (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1# This file adds content common to all images, it needs to be included after
2# all the other definitions.
3
4# create directories that may remain empty
5AddDirectoryToHaikuImage home : home.rdef ;
6AddDirectoryToHaikuImage home Desktop : home-desktop.rdef ;
7AddDirectoryToHaikuImage home mail ;
8AddDirectoryToHaikuImage home config : home-config.rdef ;
9AddDirectoryToHaikuImage home config cache ;
10AddDirectoryToHaikuImage home config packages ;
11AddDirectoryToHaikuImage home config settings ;
12AddDirectoryToHaikuImage home config var ;
13AddDirectoryToHaikuImage home config non-packaged bin ;
14AddDirectoryToHaikuImage home config non-packaged data fonts ;
15AddDirectoryToHaikuImage home config non-packaged lib ;
16AddDirectoryToHaikuImage home config non-packaged add-ons decorators ;
17AddDirectoryToHaikuImage home config non-packaged add-ons kernel drivers bin ;
18AddDirectoryToHaikuImage home config non-packaged add-ons kernel drivers dev ;
19AddDirectoryToHaikuImage home config non-packaged add-ons input_server devices ;
20AddDirectoryToHaikuImage home config non-packaged add-ons input_server filters ;
21AddDirectoryToHaikuImage home config non-packaged add-ons input_server methods ;
22AddDirectoryToHaikuImage home config non-packaged add-ons media plugins ;
23AddDirectoryToHaikuImage home config non-packaged add-ons Tracker ;
24AddDirectoryToHaikuImage home config non-packaged add-ons Print ;
25AddDirectoryToHaikuImage home config non-packaged add-ons Screen\ Savers ;
26AddDirectoryToHaikuImage home config non-packaged add-ons Translators ;
27AddDirectoryToHaikuImage system : system.rdef ;
28AddDirectoryToHaikuImage system cache tmp ;
29AddDirectoryToHaikuImage system non-packaged bin ;
30AddDirectoryToHaikuImage system non-packaged data fonts ;
31AddDirectoryToHaikuImage system non-packaged lib ;
32AddDirectoryToHaikuImage system non-packaged add-ons decorators ;
33AddDirectoryToHaikuImage system non-packaged add-ons kernel drivers bin ;
34AddDirectoryToHaikuImage system non-packaged add-ons kernel drivers dev ;
35AddDirectoryToHaikuImage system non-packaged add-ons input_server devices ;
36AddDirectoryToHaikuImage system non-packaged add-ons input_server filters ;
37AddDirectoryToHaikuImage system non-packaged add-ons input_server methods ;
38AddDirectoryToHaikuImage system non-packaged add-ons media plugins ;
39AddDirectoryToHaikuImage system non-packaged add-ons Tracker ;
40AddDirectoryToHaikuImage system non-packaged add-ons Print ;
41AddDirectoryToHaikuImage system non-packaged add-ons Screen\ Savers ;
42AddDirectoryToHaikuImage system non-packaged add-ons Translators ;
43AddDirectoryToHaikuImage system var empty ;
44AddDirectoryToHaikuImage system var log ;
45AddDirectoryToHaikuImage trash : trash.rdef ;
46
47
48#pragma mark - Optional Packages
49
50
51include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackages ] ;
52
53
54#pragma mark - User/Group Setup
55
56
57# add the root user and the root and users groups
58AddUserToHaikuImage $(HAIKU_ROOT_USER_NAME:E=baron) : 0 : 0 : /boot/home
59	: /bin/bash : $(HAIKU_ROOT_USER_REAL_NAME:E="Root User") ;
60AddGroupToHaikuImage root : 0 : ;
61AddGroupToHaikuImage users : 100 : ;
62
63
64#pragma mark - Host Name
65
66
67if $(HAIKU_IMAGE_HOST_NAME) {
68	actions BuildHaikuImageHostnameFile
69	{
70		echo "$(HAIKU_IMAGE_HOST_NAME)" > $(1)
71	}
72
73	local file = <haiku-image>hostname ;
74	Always $(file) ;
75	MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
76	BuildHaikuImageHostnameFile $(file) ;
77	AddFilesToHaikuImage system settings network : $(file) ;
78}
79
80
81#pragma mark - Build The Image
82
83
84# Execute pre-image user config rules.
85UserBuildConfigRulePreImage	;
86
87# Set image name and directory defaults and locate the image.
88HAIKU_IMAGE_NAME ?= $(HAIKU_DEFAULT_IMAGE_NAME) ;
89HAIKU_IMAGE_DIR ?= $(HAIKU_DEFAULT_IMAGE_DIR) ;
90HAIKU_IMAGE = $(HAIKU_IMAGE_NAME) ;
91HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 300 MB
92HAIKU_IMAGE_LABEL ?= $(HAIKU_DEFAULT_IMAGE_LABEL) ;
93MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ;
94
95# Set the default installation directory.
96HAIKU_INSTALL_DIR ?= $(HAIKU_DEFAULT_INSTALL_DIR) ;
97
98# the pseudo target all image contents is attached to
99NotFile $(HAIKU_IMAGE_CONTAINER_NAME) ;
100
101# prepare the script that initializes the shell variables
102HAIKU_IMAGE_INIT_VARIABLES_SCRIPT = <HaikuImage>haiku.image-init-vars ;
103local script = $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) ;
104MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
105Always $(script) ;
106
107AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
108AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
109AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
110AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
111#AddVariableToScript $(script) : isImage : 1 ;
112AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
113AddVariableToScript $(script) : imageLabel : $(HAIKU_IMAGE_LABEL) ;
114AddVariableToScript $(script) : addBuildCompatibilityLibDir
115	: "export $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)" ;
116AddVariableToScript $(script) : dontClearImage : $(HAIKU_DONT_CLEAR_IMAGE) ;
117AddVariableToScript $(script) : updateOnly : [ IsUpdateHaikuImageOnly ] ;
118AddTargetVariableToScript $(script) : <build>addattr ;
119AddTargetVariableToScript $(script) : <build>bfs_shell : bfsShell ;
120AddTargetVariableToScript $(script) : <build>fs_shell_command : fsShellCommand ;
121AddTargetVariableToScript $(script) : <build>copyattr ;
122AddTargetVariableToScript $(script) : <build>create_image : createImage ;
123AddTargetVariableToScript $(script) : <build>makebootable ;
124AddTargetVariableToScript $(script) : <build>rc ;
125AddTargetVariableToScript $(script) : <build>resattr ;
126AddTargetVariableToScript $(script) : <build>unzip ;
127AddTargetVariableToScript $(script) : <build>vmdkimage ;
128if $(HOST_RM_ATTRS_TARGET) {
129	AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ;
130} else {
131	AddVariableToScript $(script) : rmAttrs : rm ;
132}
133
134AddPackagesAndRepositoryVariablesToContainerScript $(script)
135	: $(HAIKU_IMAGE_CONTAINER_NAME) ;
136
137# create the other scripts
138HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;
139HAIKU_IMAGE_COPY_FILES_SCRIPT = <HaikuImage>haiku.image-copy-files ;
140HAIKU_IMAGE_EXTRACT_FILES_SCRIPT = <HaikuImage>haiku.image-extract-files ;
141MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT)
142	$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) : $(HAIKU_OUTPUT_DIR) ;
143
144CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ;
145CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
146CreateHaikuImageExtractFilesScript $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) ;
147
148# Convenience wrapper rule around BuildHaikuImage.
149rule _BuildHaikuImage image : isImage : isVMwareImage
150{
151	# _BuildHaikuImage <image target> : <isImage> : <isVMwareImage> ;
152	#
153
154	# build the image
155	# HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be
156	# specified by the user.
157	BuildHaikuImage $(image) :
158		$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
159		$(HAIKU_IMAGE_EARLY_USER_SCRIPTS)
160		$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
161		$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
162		$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT)
163		$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
164		: $(isImage)
165		: $(isVMwareImage)
166	;
167
168	# remove the scripts we have generated
169	RmTemps $(image) :
170		$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
171		$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
172		$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
173		$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT)
174	;
175}
176
177# build the image
178_BuildHaikuImage $(HAIKU_IMAGE) : true ;
179NotFile haiku-image ;
180Depends haiku-image : $(HAIKU_IMAGE) ;
181
182
183# install Haiku into a directory
184NotFile install-haiku ;
185_BuildHaikuImage install-haiku : 0 ;
186
187
188# build the VMware image
189HAIKU_VMWARE_IMAGE_NAME ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ;
190HAIKU_VMWARE_IMAGE = $(HAIKU_VMWARE_IMAGE_NAME) ;
191MakeLocate $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE_DIR) ;
192
193_BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ;
194NotFile haiku-vmware-image ;
195Depends haiku-vmware-image : $(HAIKU_VMWARE_IMAGE) ;
196
197
198# create a package list
199BuildHaikuImagePackageList $(HAIKU_IMAGE_LIST_PACKAGES_TARGET) ;
200
201
202# Execute post-image user config rules.
203UserBuildConfigRulePostImage ;
204