New build system feature to shorten the turn-around times when working
with image files. E.g. jam -q update-image libbe.so kernel_x86 will only build libbe.so and the kernel (if necessary) and copy them onto the already existing Haiku image. The MIME DB will not be reinstalled, and only those source directories will be copied for which the AddSourceDirectoryToHaikuImage rule is given a second argument (e.g. "1"). The image will otherwise remain unchanged. The "update-vmware-image" and "update-install" work similarly for the VMWare image and the directory installation respectively. Note that, due to the way the VMWare image is created (prepending a header to the standard image), the file itself is fully rebuilt, i.e. changes made during the emulation will be lost after updating the VMWare image. The feature requires Haiku's jam. With other jam versions a similar effect can be reached by accordingly setting the HAIKU_IMAGE_UPDATE_ONLY and HAIKU_INCLUDE_IN_IMAGE in the UserBuildConfig file. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20602 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -27,6 +27,22 @@ if $(JAM_TARGETS) {
|
|||||||
} else if $(JAM_TARGETS[1]) = run && $(JAM_TARGETS[2]) {
|
} else if $(JAM_TARGETS[1]) = run && $(JAM_TARGETS[2]) {
|
||||||
local run = [ RunCommandLine $(JAM_TARGETS[2-]) ] ;
|
local run = [ RunCommandLine $(JAM_TARGETS[2-]) ] ;
|
||||||
JAM_TARGETS = $(run) ;
|
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 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
|
|||||||
AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
|
AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
|
||||||
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
||||||
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
||||||
|
AddVariableToScript $(script) : updateOnly : $(HAIKU_IMAGE_UPDATE_ONLY) ;
|
||||||
AddTargetVariableToScript $(script) : bfs_shell : bfsShell ;
|
AddTargetVariableToScript $(script) : bfs_shell : bfsShell ;
|
||||||
AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ;
|
AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ;
|
||||||
AddTargetVariableToScript $(script) : <build>copyattr ;
|
AddTargetVariableToScript $(script) : <build>copyattr ;
|
||||||
|
|||||||
+57
-15
@@ -95,10 +95,10 @@ actions AddTargetVariableToScript1
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
rule AddDirectoryToHaikuImage
|
rule AddDirectoryToHaikuImage directoryTokens
|
||||||
{
|
{
|
||||||
# AddDirectoryToHaikuImage <directory>
|
# AddDirectoryToHaikuImage <directoryTokens>
|
||||||
local directoryTokens = $(1) ;
|
|
||||||
local directory = [ FDirName $(directoryTokens) ] ;
|
local directory = [ FDirName $(directoryTokens) ] ;
|
||||||
directory = $(directory:G=HaikuImage) ;
|
directory = $(directory:G=HaikuImage) ;
|
||||||
|
|
||||||
@@ -120,6 +120,20 @@ rule AddDirectoryToHaikuImage
|
|||||||
return $(directory) ;
|
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
|
rule AddFilesToHaikuImage
|
||||||
{
|
{
|
||||||
# AddFilesToHaikuImage <directory> : <targets> [ : dest name ]
|
# AddFilesToHaikuImage <directory> : <targets> [ : dest name ]
|
||||||
@@ -128,6 +142,12 @@ rule AddFilesToHaikuImage
|
|||||||
local targets = $(2) ;
|
local targets = $(2) ;
|
||||||
local destName = $(3) ;
|
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.
|
# We create a unique dummy target per target to install.
|
||||||
local target ;
|
local target ;
|
||||||
for target in $(targets) {
|
for target in $(targets) {
|
||||||
@@ -146,13 +166,17 @@ rule AddFilesToHaikuImage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rule AddSymlinkToHaikuImage
|
rule AddSymlinkToHaikuImage directoryTokens : linkTarget : linkName
|
||||||
{
|
{
|
||||||
# AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ;
|
# AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ;
|
||||||
#
|
#
|
||||||
local directory = [ AddDirectoryToHaikuImage $(1) ] ;
|
|
||||||
local linkTarget = $(2) ;
|
# If the image shall only be updated, we don't add any symlinks.
|
||||||
local linkName = $(3) ;
|
if $(HAIKU_IMAGE_UPDATE_ONLY) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
local directory = [ AddDirectoryToHaikuImage $(directoryTokens) ] ;
|
||||||
|
|
||||||
if ! $(linkName) {
|
if ! $(linkName) {
|
||||||
local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ;
|
local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ;
|
||||||
@@ -164,11 +188,15 @@ rule AddSymlinkToHaikuImage
|
|||||||
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
|
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule AddSourceDirectoryToHaikuImage dirTokens
|
rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate
|
||||||
{
|
{
|
||||||
# AddSourceDirectoryToHaikuImage <dirTokens> ;
|
# AddSourceDirectoryToHaikuImage <dirTokens> : <alwaysUpdate> ;
|
||||||
|
|
||||||
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
|
rule AddDriversToHaikuImage
|
||||||
@@ -182,6 +210,11 @@ rule AddDriversToHaikuImage
|
|||||||
|
|
||||||
AddFilesToHaikuImage beos system add-ons kernel drivers bin : $(targets) ;
|
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
|
# get the relative symlink path prefix
|
||||||
local linkPrefix = ;
|
local linkPrefix = ;
|
||||||
for i in $(relativeDirectoryTokens) {
|
for i in $(relativeDirectoryTokens) {
|
||||||
@@ -204,7 +237,8 @@ rule AddDriverRegistrationToHaikuImage
|
|||||||
local relativeDirectoryTokens = $(1) ;
|
local relativeDirectoryTokens = $(1) ;
|
||||||
local target = $(2) ;
|
local target = $(2) ;
|
||||||
local links = $(3) ;
|
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
|
# get the relative symlink path prefix
|
||||||
local linkPrefix = ;
|
local linkPrefix = ;
|
||||||
@@ -214,14 +248,19 @@ rule AddDriverRegistrationToHaikuImage
|
|||||||
linkPrefix += .. drivers bin ;
|
linkPrefix += .. drivers bin ;
|
||||||
|
|
||||||
# add the symlink
|
# add the symlink
|
||||||
AddSymlinkToHaikuImage $(directoryTokens) : [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ;
|
AddSymlinkToHaikuImage $(directoryTokens)
|
||||||
|
: [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule AddBootModuleSymlinks
|
rule AddBootModuleSymlinks targets
|
||||||
{
|
{
|
||||||
# AddBootModuleSymlinks <targets> ;
|
# AddBootModuleSymlinks <targets> ;
|
||||||
#
|
#
|
||||||
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
|
# add the symlinks
|
||||||
local target ;
|
local target ;
|
||||||
@@ -267,7 +306,10 @@ rule CreateHaikuImageMakeDirectoriesScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
Depends $(scriptBody) : $(dirsToCreate) ;
|
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
|
actions piecemeal CreateHaikuImageMakeDirectoriesScript1
|
||||||
|
|||||||
@@ -35,6 +35,17 @@ HAIKU_VMWARE_IMAGE_NAME = walter.vmdk ;
|
|||||||
# Install Haiku in directory /Haiku.
|
# Install Haiku in directory /Haiku.
|
||||||
HAIKU_INSTALL_DIR = /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.
|
# 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
|
# Note, that this also makes the image depend on the target, i.e. it is
|
||||||
# automatically updated when the image is built.
|
# automatically updated when the image is built.
|
||||||
@@ -43,9 +54,13 @@ AddFilesToHaikuImage beos bin : crashing_app ;
|
|||||||
# Make a symlink to home/config/bin/crash.
|
# Make a symlink to home/config/bin/crash.
|
||||||
AddSymlinkToHaikuImage home config bin : /beos/bin/crashing_app : crash ;
|
AddSymlinkToHaikuImage home config bin : /beos/bin/crashing_app : crash ;
|
||||||
|
|
||||||
# Adds the source directory src/kits/storage (recursively) to the image
|
# Adds the source directories src/kits/storage and src/tests/servers/debug
|
||||||
# (as /boot/home/HaikuSources/src/kits/storage).
|
# (recursively) to the image (as /boot/home/HaikuSources/src/kits/storage
|
||||||
AddSourceDirectoryToHaikuImage 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
|
# Specify scripts that shall be run when populating the image/installation
|
||||||
# directory. The "early" script is run before anything has been copied onto
|
# directory. The "early" script is run before anything has been copied onto
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/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
|
# sourceDir
|
||||||
# outputDir
|
# outputDir
|
||||||
# tmpDir
|
# tmpDir
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
# imageSize
|
# imageSize
|
||||||
# addBuildCompatibilityLibDir
|
# addBuildCompatibilityLibDir
|
||||||
# sourceDirsToCopy
|
# sourceDirsToCopy
|
||||||
|
# updateOnly
|
||||||
#
|
#
|
||||||
# bfsShell
|
# bfsShell
|
||||||
# copyattr
|
# copyattr
|
||||||
@@ -53,16 +54,20 @@ fi
|
|||||||
# create the image and mount it
|
# create the image and mount it
|
||||||
if [ $isImage ]; then
|
if [ $isImage ]; then
|
||||||
echo
|
echo
|
||||||
echo "Creating image ..."
|
if [ ! $updateOnly ]; then
|
||||||
dd if=/dev/zero of=$imagePath bs=1M count=$imageSize
|
echo "Creating image ..."
|
||||||
$bfsShell --initialize $imagePath Haiku
|
dd if=/dev/zero of=$imagePath bs=1M count=$imageSize
|
||||||
$makebootable $imagePath
|
$bfsShell --initialize $imagePath Haiku
|
||||||
|
$makebootable $imagePath
|
||||||
|
fi
|
||||||
$bfsShell -n $imagePath > /dev/null &
|
$bfsShell -n $imagePath > /dev/null &
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$mkindex BEOS:APP_SIG
|
# create BEOS:APP_SIG index -- needed to launch apps via signature
|
||||||
# needed to launch apps via signature
|
if [ ! $updateOnly ]; then
|
||||||
|
$mkindex BEOS:APP_SIG
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Populating image ..."
|
echo "Populating image ..."
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@@ -73,55 +78,58 @@ done
|
|||||||
|
|
||||||
# install MIME database
|
# install MIME database
|
||||||
# TODO: It should be possible to do that in the build system too.
|
# 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
|
echo "Deleting old MIME database ..."
|
||||||
$mkdir -p $mimeDBDest
|
|
||||||
mkdir -p $tmpDir
|
|
||||||
mimeTmpDir=$tmpDir/mime
|
|
||||||
mimeTmpIndex=0
|
|
||||||
|
|
||||||
# create tmp dir for the MIME conversion stuff
|
$rm -rf $mimeDBDest
|
||||||
mkdir -p $mimeTmpDir
|
$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
|
echo "Installing MIME database ..."
|
||||||
superType=$(basename $inSuperFile .super)
|
|
||||||
outSuperDir=$mimeDBDest/$superType
|
|
||||||
|
|
||||||
# compile rdef to rsrc file and the rsrc file to attributes
|
for inSuperFile in $mimeDBSource/*.super; do
|
||||||
mimeTmpIndex=$(($mimeTmpIndex + 1))
|
superType=$(basename $inSuperFile .super)
|
||||||
tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc
|
outSuperDir=$mimeDBDest/$superType
|
||||||
tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime
|
|
||||||
$rc -o $tmpFile $inSuperFile
|
|
||||||
mkdir -p $tmpFile2
|
|
||||||
$resattr -O -o $tmpFile2 $tmpFile
|
|
||||||
$cp -r ${sPrefix}$tmpFile2 $outSuperDir
|
|
||||||
|
|
||||||
# iterate through the sub types
|
# compile rdef to rsrc file and the rsrc file to attributes
|
||||||
for inSubFile in $mimeDBSource/$superType/*; do
|
mimeTmpIndex=$(($mimeTmpIndex + 1))
|
||||||
# check, if the type exists
|
tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc
|
||||||
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime
|
||||||
subType=$(basename $inSubFile)
|
$rc -o $tmpFile $inSuperFile
|
||||||
outSubFile=$outSuperDir/$subType
|
mkdir -p $tmpFile2
|
||||||
|
$resattr -O -o $tmpFile2 $tmpFile
|
||||||
|
$cp -r ${sPrefix}$tmpFile2 $outSuperDir
|
||||||
|
|
||||||
# compile rdef to rsrc file and the rsrc file to attributes
|
# iterate through the sub types
|
||||||
mimeTmpIndex=$(($mimeTmpIndex + 1))
|
for inSubFile in $mimeDBSource/$superType/*; do
|
||||||
tmpFile=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.rsrc
|
# check, if the type exists
|
||||||
tmpFile2=$mimeTmpDir/mimedb$$_${mimeTmpIndex}.mime
|
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
||||||
$rc -o $tmpFile $inSubFile
|
subType=$(basename $inSubFile)
|
||||||
$resattr -O -o $tmpFile2 $tmpFile
|
outSubFile=$outSuperDir/$subType
|
||||||
$cp ${sPrefix}$tmpFile2 $outSubFile
|
|
||||||
fi
|
# 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
|
||||||
done
|
|
||||||
|
|
||||||
# cleanup tmp dir
|
# cleanup tmp dir
|
||||||
rm -rf $mimeTmpDir
|
rm -rf $mimeTmpDir
|
||||||
|
fi # ! updateOnly
|
||||||
|
|
||||||
|
|
||||||
# install sources
|
# install sources
|
||||||
|
|||||||
Reference in New Issue
Block a user