* Modified AddVariableToScript to support multi-element arrays.

* Added rule AddSourceDirectoryToHaikuImage to copy source directories
  onto the image. They will be placed in /boot/home/HaikuSource/...
  according to their relative path. This should make it a bit more
  comfortable to use gdb as a source level debugger. Alas, the
  directories have to be made known to gdb individually (with the
  "directory" command). I guess we should update to 6.6...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20415 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-03-24 23:34:28 +00:00
parent af9825c29c
commit 4477befef2
4 changed files with 58 additions and 6 deletions

View File

@ -336,6 +336,7 @@ AddTargetVariableToScript $(script) : <build>resattr ;
# causes a cyclic dependency
AddVariableToScript $(script) : imagePath
: [ FDirName $(HAIKU_IMAGE_DIR) $(HAIKU_IMAGE_NAME) ] ;
AddVariableToScript $(script) : sourceDirsToCopy : $(HAIKU_INSTALL_SOURCE_DIRS) ;
# create the other scripts
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;

View File

@ -41,17 +41,26 @@ actions InitScript1
echo -n > $(1)
}
rule AddVariableToScript
rule AddVariableToScript script : variable : value
{
# AddVariableToScript <script> : <variable> : <value> ;
#
local script = $(1) ;
local variable = $(2) ;
local value = $(3) ;
# interpret an empty variable value as empty string
if ! $(value) {
value = "" ;
}
InitScript $(script) ;
VARIABLE_DEFS on $(script) += "echo $(variable)=\\\"$(value)\\\" >> " ;
VARIABLE_DEFS on $(script) += "echo $(variable)=\\\"$(value[1])\\\" >> " ;
# if the value is an array, add the other array elements
value = $(value[2-]) ;
while $(value) {
VARIABLE_DEFS on $(script)
+= "echo $(variable)+=\\\" $(value[1])\\\" >> " ;
value = $(value[2-]) ;
}
AddVariableToScript1 $(script) ;
}
@ -155,6 +164,13 @@ rule AddSymlinkToHaikuImage
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
}
rule AddSourceDirectoryToHaikuImage dirTokens
{
# AddSourceDirectoryToHaikuImage <dirTokens> ;
HAIKU_INSTALL_SOURCE_DIRS += [ FDirName $(HAIKU_TOP) $(dirTokens) ] ;
}
rule AddDriversToHaikuImage
{
# AddDriversToHaikuImage <relative directory> : <targets> ;

View File

@ -43,6 +43,10 @@ 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 ;
# Specify scripts that shall be run when populating the image/installation
# directory. The "early" script is run before anything has been copied onto
# the image/into the installation directory. The "late" script is run after

View File

@ -9,6 +9,7 @@
# imagePath
# imageSize
# addBuildCompatibilityLibDir
# sourceDirsToCopy
#
# bfsShell
# copyattr
@ -122,6 +123,36 @@ done
# cleanup tmp dir
rm -rf $mimeTmpDir
# install sources
sourcesDest=${tPrefix}home/HaikuSources
# create sources directory
if [ -n "${sourceDirsToCopy}" ]; then
echo "Installing Haiku Sources ..."
$mkdir -p ${sourcesDest}
fi
for sourcesDir in ${sourceDirsToCopy}; do
echo " sources dir: ${sourcesDir}"
# create all subdirectories
subDirs=$(find ${sourcesDir} -type d | grep -v '.svn' |
sed -e "s@^${sourceDir}@${sourcesDest}@")
$mkdir -p ${subDirs}
# get all files and copy each one individually
sourceFiles=$(find $sourcesDir -type f | grep -v '.svn')
for sourceFile in $sourceFiles; do
destSourceFile=$(echo $sourceFile |
sed -e "s@^${sourceDir}@${sourcesDest}@")
$cp ${sPrefix}$sourceFile $destSourceFile
done
done
# unmount
if [ $isImage ]; then
echo "Unmounting ..."