diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 43b48e69f7..040d84dc34 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -27,6 +27,22 @@ if $(JAM_TARGETS) { } else if $(JAM_TARGETS[1]) = run && $(JAM_TARGETS[2]) { local run = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; JAM_TARGETS = $(run) ; + + # "update-image", "update-vmware-image", and "update-install" targets allow + # for updating only specific targets in the image/installation dir. + } else if $(JAM_TARGETS[1]) = update-image + || $(JAM_TARGETS[1]) = update-vmware-image + || $(JAM_TARGETS[1]) = update-install { + HAIKU_IMAGE_UPDATE_ONLY = 1 ; + HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; + + if $(JAM_TARGETS[1]) = update-image { + JAM_TARGETS = haiku-image ; + } else if $(JAM_TARGETS[1]) = update-vmware-image { + JAM_TARGETS = haiku-vmware-image ; + } else { + JAM_TARGETS = install-haiku ; + } } } diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index b7ba670820..e6a33a1abe 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -348,6 +348,7 @@ AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ; AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ; AddVariableToScript $(script) : addBuildCompatibilityLibDir : $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ; +AddVariableToScript $(script) : updateOnly : $(HAIKU_IMAGE_UPDATE_ONLY) ; AddTargetVariableToScript $(script) : bfs_shell : bfsShell ; AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ; AddTargetVariableToScript $(script) : copyattr ; diff --git a/build/jam/ImageRules b/build/jam/ImageRules index 342753a00c..84cfdc9844 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -95,10 +95,10 @@ actions AddTargetVariableToScript1 } -rule AddDirectoryToHaikuImage +rule AddDirectoryToHaikuImage directoryTokens { - # AddDirectoryToHaikuImage - local directoryTokens = $(1) ; + # AddDirectoryToHaikuImage + local directory = [ FDirName $(directoryTokens) ] ; directory = $(directory:G=HaikuImage) ; @@ -120,6 +120,20 @@ rule AddDirectoryToHaikuImage return $(directory) ; } +rule FilterImageUpdateTargets targets +{ + # FilterImageUpdateTargets targets + + local filteredTargets ; + local target ; + for target in $(targets) { + if [ on $(target) return $(HAIKU_INCLUDE_IN_IMAGE) ] { + filteredTargets += $(target) ; + } + } + return $(filteredTargets) ; +} + rule AddFilesToHaikuImage { # AddFilesToHaikuImage : [ : dest name ] @@ -128,6 +142,12 @@ rule AddFilesToHaikuImage local targets = $(2) ; local destName = $(3) ; + # If the image shall only be updated, we filter out all targets not marked + # accordingly. + if $(HAIKU_IMAGE_UPDATE_ONLY) { + targets = [ FilterImageUpdateTargets $(targets) ] ; + } + # We create a unique dummy target per target to install. local target ; for target in $(targets) { @@ -146,13 +166,17 @@ rule AddFilesToHaikuImage } } -rule AddSymlinkToHaikuImage +rule AddSymlinkToHaikuImage directoryTokens : linkTarget : linkName { # AddSymlinkToHaikuImage : [ : ] ; # - local directory = [ AddDirectoryToHaikuImage $(1) ] ; - local linkTarget = $(2) ; - local linkName = $(3) ; + + # If the image shall only be updated, we don't add any symlinks. + if $(HAIKU_IMAGE_UPDATE_ONLY) { + return ; + } + + local directory = [ AddDirectoryToHaikuImage $(directoryTokens) ] ; if ! $(linkName) { local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ; @@ -164,11 +188,15 @@ rule AddSymlinkToHaikuImage SYMLINKS_TO_INSTALL on $(directory) += $(link) ; } -rule AddSourceDirectoryToHaikuImage dirTokens +rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate { - # AddSourceDirectoryToHaikuImage ; + # AddSourceDirectoryToHaikuImage : ; - HAIKU_INSTALL_SOURCE_DIRS += [ FDirName $(HAIKU_TOP) $(dirTokens) ] ; + # If the image shall only be updated, we update sources only, if explicitely + # requested. + if ! $(HAIKU_IMAGE_UPDATE_ONLY) || $(alwaysUpdate) { + HAIKU_INSTALL_SOURCE_DIRS += [ FDirName $(HAIKU_TOP) $(dirTokens) ] ; + } } rule AddDriversToHaikuImage @@ -182,6 +210,11 @@ rule AddDriversToHaikuImage AddFilesToHaikuImage beos system add-ons kernel drivers bin : $(targets) ; + # If the image shall only be updated, we don't add any symlinks. + if $(HAIKU_IMAGE_UPDATE_ONLY) { + return ; + } + # get the relative symlink path prefix local linkPrefix = ; for i in $(relativeDirectoryTokens) { @@ -204,7 +237,8 @@ rule AddDriverRegistrationToHaikuImage local relativeDirectoryTokens = $(1) ; local target = $(2) ; local links = $(3) ; - local directoryTokens = beos system add-ons kernel registration $(relativeDirectoryTokens) ; + local directoryTokens = beos system add-ons kernel registration + $(relativeDirectoryTokens) ; # get the relative symlink path prefix local linkPrefix = ; @@ -214,14 +248,19 @@ rule AddDriverRegistrationToHaikuImage linkPrefix += .. drivers bin ; # add the symlink - AddSymlinkToHaikuImage $(directoryTokens) : [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ; + AddSymlinkToHaikuImage $(directoryTokens) + : [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ; } -rule AddBootModuleSymlinks +rule AddBootModuleSymlinks targets { # AddBootModuleSymlinks ; # - local targets = $(1) ; + + # If the image shall only be updated, we don't add any symlinks. + if $(HAIKU_IMAGE_UPDATE_ONLY) { + return ; + } # add the symlinks local target ; @@ -267,7 +306,10 @@ rule CreateHaikuImageMakeDirectoriesScript } Depends $(scriptBody) : $(dirsToCreate) ; - CreateHaikuImageMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ; + # If the image shall only be updated, we don't create directories. + if $(dirsToCreate) && ! $(HAIKU_IMAGE_UPDATE_ONLY) { + CreateHaikuImageMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ; + } } actions piecemeal CreateHaikuImageMakeDirectoriesScript1 diff --git a/build/jam/UserBuildConfig.sample b/build/jam/UserBuildConfig.sample index 5d3339f4d6..661daf8daa 100644 --- a/build/jam/UserBuildConfig.sample +++ b/build/jam/UserBuildConfig.sample @@ -35,6 +35,17 @@ HAIKU_VMWARE_IMAGE_NAME = walter.vmdk ; # Install Haiku in directory /Haiku. HAIKU_INSTALL_DIR = /Haiku ; +# Affects the haiku-image, haiku-vmware-image, and install-haiku targets. Only +# targets on which the HAIKU_INCLUDE_IN_IMAGE variable has been set will be +# updated in the image file/installation directory. +# The update-image, update-vmware-image, and update-install targets always set +# this variable, so one likely doesn't ever need to set it manually. +HAIKU_IMAGE_UPDATE_ONLY = 1 ; + +# libbe.so and the kernel will be updated on image updates. Note that this +# doesn't work for pseudo targets like "kernel". +HAIKU_INCLUDE_IN_IMAGE on libbe.so kernel_x86 = 1 ; + # Add "crashing_app" to the beos/bin directory of the Haiku image/installation. # Note, that this also makes the image depend on the target, i.e. it is # automatically updated when the image is built. @@ -43,9 +54,13 @@ AddFilesToHaikuImage beos bin : crashing_app ; # Make a symlink to home/config/bin/crash. AddSymlinkToHaikuImage home config bin : /beos/bin/crashing_app : crash ; -# Adds the source directory src/kits/storage (recursively) to the image -# (as /boot/home/HaikuSources/src/kits/storage). -AddSourceDirectoryToHaikuImage src kits storage ; +# Adds the source directories src/kits/storage and src/tests/servers/debug +# (recursively) to the image (as /boot/home/HaikuSources/src/kits/storage +# and /boot/home/HaikuSources/src/tests/servers/debug respectively). +# Note that the second directory will also be copied, if the image will only +# be updated; the first one won't in that case. +AddSourceDirectoryToHaikuImage src/kits/storage ; +AddSourceDirectoryToHaikuImage src/tests/servers/debug : 1 ; # Specify scripts that shall be run when populating the image/installation # directory. The "early" script is run before anything has been copied onto diff --git a/build/scripts/build_haiku_image b/build/scripts/build_haiku_image index bbc8ff149a..1c7ab54172 100755 --- a/build/scripts/build_haiku_image +++ b/build/scripts/build_haiku_image @@ -1,6 +1,6 @@ #!/bin/sh -# The first argument is the shell script that initializes the variables. +# The first argument is the shell script that initializes the variables: # sourceDir # outputDir # tmpDir @@ -10,6 +10,7 @@ # imageSize # addBuildCompatibilityLibDir # sourceDirsToCopy +# updateOnly # # bfsShell # copyattr @@ -53,16 +54,20 @@ fi # create the image and mount it if [ $isImage ]; then echo - echo "Creating image ..." - dd if=/dev/zero of=$imagePath bs=1M count=$imageSize - $bfsShell --initialize $imagePath Haiku - $makebootable $imagePath + if [ ! $updateOnly ]; then + echo "Creating image ..." + dd if=/dev/zero of=$imagePath bs=1M count=$imageSize + $bfsShell --initialize $imagePath Haiku + $makebootable $imagePath + fi $bfsShell -n $imagePath > /dev/null & sleep 1 fi -$mkindex BEOS:APP_SIG - # needed to launch apps via signature +# create BEOS:APP_SIG index -- needed to launch apps via signature +if [ ! $updateOnly ]; then + $mkindex BEOS:APP_SIG +fi echo "Populating image ..." while [ $# -gt 0 ]; do @@ -73,55 +78,58 @@ done # install MIME database # TODO: It should be possible to do that in the build system too. -mimeDBSource=$sourceDir/src/data/beos_mime -mimeDBDest=${tPrefix}home/config/settings/beos_mime -echo "Deleting old MIME database ..." +if [ ! $updateOnly ]; then + mimeDBSource=$sourceDir/src/data/beos_mime + mimeDBDest=${tPrefix}home/config/settings/beos_mime -$rm -rf $mimeDBDest -$mkdir -p $mimeDBDest -mkdir -p $tmpDir -mimeTmpDir=$tmpDir/mime -mimeTmpIndex=0 + echo "Deleting old MIME database ..." -# create tmp dir for the MIME conversion stuff -mkdir -p $mimeTmpDir + $rm -rf $mimeDBDest + $mkdir -p $mimeDBDest + mkdir -p $tmpDir + mimeTmpDir=$tmpDir/mime + mimeTmpIndex=0 -echo "Installing MIME database ..." + # create tmp dir for the MIME conversion stuff + mkdir -p $mimeTmpDir -for inSuperFile in $mimeDBSource/*.super; do - superType=$(basename $inSuperFile .super) - outSuperDir=$mimeDBDest/$superType + echo "Installing MIME database ..." - # compile rdef to rsrc file and the rsrc file to attributes - mimeTmpIndex=$(($mimeTmpIndex + 1)) - tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc - tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime - $rc -o $tmpFile $inSuperFile - mkdir -p $tmpFile2 - $resattr -O -o $tmpFile2 $tmpFile - $cp -r ${sPrefix}$tmpFile2 $outSuperDir + for inSuperFile in $mimeDBSource/*.super; do + superType=$(basename $inSuperFile .super) + outSuperDir=$mimeDBDest/$superType - # iterate through the sub types - for inSubFile in $mimeDBSource/$superType/*; do - # check, if the type exists - if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then - subType=$(basename $inSubFile) - outSubFile=$outSuperDir/$subType + # compile rdef to rsrc file and the rsrc file to attributes + mimeTmpIndex=$(($mimeTmpIndex + 1)) + tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc + tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime + $rc -o $tmpFile $inSuperFile + mkdir -p $tmpFile2 + $resattr -O -o $tmpFile2 $tmpFile + $cp -r ${sPrefix}$tmpFile2 $outSuperDir - # compile rdef to rsrc file and the rsrc file to attributes - mimeTmpIndex=$(($mimeTmpIndex + 1)) - tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc - tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime - $rc -o $tmpFile $inSubFile - $resattr -O -o $tmpFile2 $tmpFile - $cp ${sPrefix}$tmpFile2 $outSubFile - fi + # iterate through the sub types + for inSubFile in $mimeDBSource/$superType/*; do + # check, if the type exists + if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then + subType=$(basename $inSubFile) + outSubFile=$outSuperDir/$subType + + # compile rdef to rsrc file and the rsrc file to attributes + mimeTmpIndex=$(($mimeTmpIndex + 1)) + tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc + tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime + $rc -o $tmpFile $inSubFile + $resattr -O -o $tmpFile2 $tmpFile + $cp ${sPrefix}$tmpFile2 $outSubFile + fi + done done -done -# cleanup tmp dir -rm -rf $mimeTmpDir + # cleanup tmp dir + rm -rf $mimeTmpDir +fi # ! updateOnly # install sources