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