xref: /haiku/build/jam/images/definitions/common-tail (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
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 ;
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 ;
45
46
47#pragma mark - Optional Packages
48
49
50include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackages ] ;
51
52
53#pragma mark - User/Group Setup
54
55
56# add the root user and the root and users groups
57AddUserToHaikuImage $(HAIKU_ROOT_USER_NAME:E=baron) : 0 : 0 : /boot/home
58	: /bin/bash : $(HAIKU_ROOT_USER_REAL_NAME:E="Root User") ;
59AddGroupToHaikuImage root : 0 : ;
60AddGroupToHaikuImage users : 100 : ;
61
62
63#pragma mark - Host Name
64
65
66if $(HAIKU_IMAGE_HOST_NAME) {
67	actions BuildHaikuImageHostnameFile
68	{
69		echo "$(HAIKU_IMAGE_HOST_NAME)" > $(1)
70	}
71
72	local file = <haiku-image>hostname ;
73	Always $(file) ;
74	MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
75	BuildHaikuImageHostnameFile $(file) ;
76	AddFilesToHaikuImage system settings network : $(file) ;
77}
78
79
80#pragma mark - Build The Image
81
82
83# Execute pre-image user config rules.
84UserBuildConfigRulePreImage	;
85
86# Set image name and directory defaults and locate the image.
87HAIKU_IMAGE_NAME ?= $(HAIKU_DEFAULT_IMAGE_NAME) ;
88HAIKU_IMAGE_DIR ?= $(HAIKU_DEFAULT_IMAGE_DIR) ;
89HAIKU_IMAGE = $(HAIKU_IMAGE_NAME) ;
90HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 300 MB
91HAIKU_IMAGE_LABEL ?= $(HAIKU_DEFAULT_IMAGE_LABEL) ;
92MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ;
93
94# Set the default installation directory.
95HAIKU_INSTALL_DIR ?= $(HAIKU_DEFAULT_INSTALL_DIR) ;
96
97# the pseudo target all image contents is attached to
98NotFile $(HAIKU_IMAGE_CONTAINER_NAME) ;
99
100# prepare the script that initializes the shell variables
101HAIKU_IMAGE_INIT_VARIABLES_SCRIPT = <HaikuImage>haiku.image-init-vars ;
102local script = $(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT) ;
103MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
104Always $(script) ;
105
106AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
107AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
108AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
109AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
110#AddVariableToScript $(script) : isImage : 1 ;
111AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
112AddVariableToScript $(script) : imageLabel : $(HAIKU_IMAGE_LABEL) ;
113AddVariableToScript $(script) : addBuildCompatibilityLibDir
114	: "export $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)" ;
115AddVariableToScript $(script) : dontClearImage : $(HAIKU_DONT_CLEAR_IMAGE) ;
116AddVariableToScript $(script) : updateOnly : [ IsUpdateHaikuImageOnly ] ;
117AddTargetVariableToScript $(script) : <build>addattr ;
118AddTargetVariableToScript $(script) : <build>bfs_shell : bfsShell ;
119AddTargetVariableToScript $(script) : <build>fs_shell_command : fsShellCommand ;
120AddTargetVariableToScript $(script) : <build>copyattr ;
121AddTargetVariableToScript $(script) : <build>create_image : createImage ;
122AddTargetVariableToScript $(script) : <build>makebootable ;
123AddTargetVariableToScript $(script) : <build>rc ;
124AddTargetVariableToScript $(script) : <build>resattr ;
125AddTargetVariableToScript $(script) : <build>unzip ;
126AddTargetVariableToScript $(script) : <build>vmdkimage ;
127if $(HOST_RM_ATTRS_TARGET) {
128	AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ;
129} else {
130	AddVariableToScript $(script) : rmAttrs : rm ;
131}
132
133AddPackagesAndRepositoryVariablesToContainerScript $(script)
134	: $(HAIKU_IMAGE_CONTAINER_NAME) ;
135
136# create the other scripts
137HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;
138HAIKU_IMAGE_COPY_FILES_SCRIPT = <HaikuImage>haiku.image-copy-files ;
139HAIKU_IMAGE_EXTRACT_FILES_SCRIPT = <HaikuImage>haiku.image-extract-files ;
140MakeLocate $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) $(HAIKU_IMAGE_COPY_FILES_SCRIPT)
141	$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) : $(HAIKU_OUTPUT_DIR) ;
142
143CreateHaikuImageMakeDirectoriesScript $(HAIKU_IMAGE_MAKE_DIRS_SCRIPT) ;
144CreateHaikuImageCopyFilesScript $(HAIKU_IMAGE_COPY_FILES_SCRIPT) ;
145CreateHaikuImageExtractFilesScript $(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT) ;
146
147# Convenience wrapper rule around BuildHaikuImage.
148rule _BuildHaikuImage image : isImage : isVMwareImage
149{
150	# _BuildHaikuImage <image target> : <isImage> : <isVMwareImage> ;
151	#
152
153	# build the image
154	# HAIKU_IMAGE_EARLY_USER_SCRIPTS, HAIKU_IMAGE_LATE_USER_SCRIPTS can be
155	# specified by the user.
156	BuildHaikuImage $(image) :
157		$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
158		$(HAIKU_IMAGE_EARLY_USER_SCRIPTS)
159		$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
160		$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
161		$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT)
162		$(HAIKU_IMAGE_LATE_USER_SCRIPTS)
163		: $(isImage)
164		: $(isVMwareImage)
165	;
166
167	# remove the scripts we have generated
168	RmTemps $(image) :
169		$(HAIKU_IMAGE_INIT_VARIABLES_SCRIPT)
170		$(HAIKU_IMAGE_MAKE_DIRS_SCRIPT)
171		$(HAIKU_IMAGE_COPY_FILES_SCRIPT)
172		$(HAIKU_IMAGE_EXTRACT_FILES_SCRIPT)
173	;
174}
175
176# build the image
177_BuildHaikuImage $(HAIKU_IMAGE) : true ;
178NotFile haiku-image ;
179Depends haiku-image : $(HAIKU_IMAGE) ;
180
181
182# install Haiku into a directory
183NotFile install-haiku ;
184_BuildHaikuImage install-haiku : 0 ;
185
186
187# build the VMware image
188HAIKU_VMWARE_IMAGE_NAME ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ;
189HAIKU_VMWARE_IMAGE = $(HAIKU_VMWARE_IMAGE_NAME) ;
190MakeLocate $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE_DIR) ;
191
192_BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ;
193NotFile haiku-vmware-image ;
194Depends haiku-vmware-image : $(HAIKU_VMWARE_IMAGE) ;
195
196
197# create a package list
198BuildHaikuImagePackageList $(HAIKU_IMAGE_LIST_PACKAGES_TARGET) ;
199
200
201# Execute post-image user config rules.
202UserBuildConfigRulePostImage ;
203