2005-10-29 20:27:43 +04:00
|
|
|
rule FSameTargetWithPrependedGrist
|
|
|
|
{
|
|
|
|
# SameTargetWithPrependedGrist <target> : <grist to prepend> ;
|
|
|
|
#
|
|
|
|
local target = $(1) ;
|
|
|
|
local gristToPrepend = $(2) ;
|
|
|
|
local grist = $(target:G) ;
|
|
|
|
|
|
|
|
if $(grist) {
|
|
|
|
grist = $(gristToPrepend)!$(grist) ;
|
|
|
|
} else {
|
|
|
|
grist = $(gristToPrepend) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(target:G=$(grist)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule InitScript
|
|
|
|
{
|
|
|
|
# Note: The script must have been LOCATEd before.
|
|
|
|
local script = $(1) ;
|
|
|
|
local initScript
|
|
|
|
= [ FSameTargetWithPrependedGrist $(script) : init-script ] ;
|
|
|
|
|
|
|
|
if ! [ on $(script) return $(__is_initialized) ] {
|
|
|
|
__is_initialized on $(script) = true ;
|
|
|
|
|
|
|
|
MakeLocate $(initScript) : [ on $(script) return $(LOCATE) ] ;
|
|
|
|
Always $(initScript) ;
|
|
|
|
Depends $(script) : $(initScript) ;
|
|
|
|
|
|
|
|
InitScript1 $(initScript) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(initScript) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions InitScript1
|
|
|
|
{
|
|
|
|
rm -f $(1)
|
|
|
|
echo -n > $(1)
|
|
|
|
}
|
|
|
|
|
2007-03-25 03:34:28 +04:00
|
|
|
rule AddVariableToScript script : variable : value
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
# AddVariableToScript <script> : <variable> : <value> ;
|
2007-03-25 03:34:28 +04:00
|
|
|
|
|
|
|
# interpret an empty variable value as empty string
|
|
|
|
if ! $(value) {
|
|
|
|
value = "" ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
InitScript $(script) ;
|
|
|
|
|
2007-03-25 03:34:28 +04:00
|
|
|
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-]) ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
AddVariableToScript1 $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions together AddVariableToScript1
|
|
|
|
{
|
|
|
|
$(VARIABLE_DEFS)$(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddTargetVariableToScript
|
|
|
|
{
|
|
|
|
# AddTargetVariableToScript <script> : <target> [ : <variable> ] ;
|
|
|
|
#
|
|
|
|
local script = $(1) ;
|
|
|
|
local target = $(2) ;
|
|
|
|
local variable = $(3:E=$(target:BS)) ;
|
|
|
|
|
|
|
|
InitScript $(script) ;
|
|
|
|
|
|
|
|
# That's not completely save, if one has more than on target with the
|
|
|
|
# same base name. A unique pseudo target would have to be introduced
|
|
|
|
# to do it more correctly.
|
|
|
|
VARIABLE_NAME($(target:BS)) on $(script) = $(variable) ;
|
|
|
|
|
|
|
|
Depends $(script) : $(target) ;
|
|
|
|
AddTargetVariableToScript1 $(script) : $(target) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions AddTargetVariableToScript1
|
|
|
|
{
|
|
|
|
echo "$(VARIABLE_NAME($(2:BS)))=\"$(2)\"" >> $(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
rule AddDirectoryToContainer container : directoryTokens
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddDirectoryToContainer <container> : <directoryTokens>
|
2007-04-07 01:13:35 +04:00
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local directory = [ FDirName $(directoryTokens) ] ;
|
2007-07-11 05:04:35 +04:00
|
|
|
directory = $(directory:G=$(containerGrist)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
if ! [ on $(directory) return $(__is_on_image) ] {
|
2007-07-11 05:04:35 +04:00
|
|
|
HAIKU_INSTALL_DIRECTORIES on $(container) += $(directory) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
__is_on_image on $(directory) = true ;
|
|
|
|
NotFile $(directory) ;
|
|
|
|
|
|
|
|
# mark the parent dir as not to be created
|
|
|
|
local parent = [ FReverse $(directoryTokens) ] ;
|
|
|
|
parent = [ FReverse $(parent[2-]) ] ;
|
|
|
|
if $(parent) {
|
|
|
|
parent = [ FDirName $(parent) ] ;
|
2007-07-11 05:04:35 +04:00
|
|
|
parent = $(parent:G=$(containerGrist)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
DONT_CREATE on $(parent) = true ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(directory) ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule FilterContainerUpdateTargets targets : filterVariable
|
2007-04-07 01:13:35 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# FilterContainerUpdateTargets targets : filterVariable
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
local filteredTargets ;
|
|
|
|
local target ;
|
|
|
|
for target in $(targets) {
|
2007-07-11 05:04:35 +04:00
|
|
|
if [ on $(target) return $($(filterVariable)) ] {
|
2007-04-07 01:13:35 +04:00
|
|
|
filteredTargets += $(target) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $(filteredTargets) ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddFilesToContainer container : directoryTokens : targets : destName
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddFilesToContainer <container> : <directoryTokens> : <targets>
|
|
|
|
# [ : dest name ]
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
2007-07-11 05:04:35 +04:00
|
|
|
local directory = [ AddDirectoryToContainer $(container)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
# If the image shall only be updated, we filter out all targets not marked
|
|
|
|
# accordingly.
|
2007-07-11 05:04:35 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
|
|
|
local filterVar
|
|
|
|
= [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ;
|
|
|
|
if $(filterVar) {
|
|
|
|
targets = [ FilterContainerUpdateTargets $(targets)
|
|
|
|
: $(filterVar) ] ;
|
|
|
|
}
|
2007-04-07 01:13:35 +04:00
|
|
|
}
|
|
|
|
|
2006-06-29 16:08:53 +04:00
|
|
|
# We create a unique dummy target per target to install.
|
2007-07-11 05:04:35 +04:00
|
|
|
local installTargetsVar
|
|
|
|
= [ on $(container) return $(HAIKU_INSTALL_TARGETS_VAR) ] ;
|
2006-06-29 16:08:53 +04:00
|
|
|
local target ;
|
|
|
|
for target in $(targets) {
|
|
|
|
local name ;
|
|
|
|
if $(destName) {
|
|
|
|
name = $(destName) ;
|
|
|
|
} else {
|
2007-01-24 21:39:22 +03:00
|
|
|
name = $(target:G=:D=) ;
|
2006-06-29 16:08:53 +04:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
local destTarget = $(name:G=$(containerGrist)__$(directory:G=)) ;
|
2006-06-29 16:08:53 +04:00
|
|
|
TARGET on $(destTarget) = $(target) ;
|
|
|
|
INSTALL_DIR on $(destTarget) = $(directory) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
$(installTargetsVar) on $(target) += $(destTarget) ;
|
2006-06-29 16:08:53 +04:00
|
|
|
TARGETS_TO_INSTALL on $(directory) += $(destTarget) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddSymlinkToContainer container : directoryTokens : linkTarget : linkName
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddSymlinkToContainer <container> : <directory> : <link target>
|
|
|
|
# [ : <link name> ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
# If the image shall only be updated, we don't add any symlinks.
|
2007-07-11 05:04:35 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
2007-04-07 01:13:35 +04:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
local directory = [ AddDirectoryToContainer $(container)
|
|
|
|
: $(directoryTokens) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
if ! $(linkName) {
|
|
|
|
local path = [ FReverse [ FSplitPath $(linkTarget) ] ] ;
|
|
|
|
linkName = $(path[1]) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local link = $(directory)/$(linkName) ;
|
|
|
|
SYMLINK_TARGET on $(link) = $(linkTarget) ;
|
|
|
|
SYMLINKS_TO_INSTALL on $(directory) += $(link) ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddDriversToContainer container : relativeDirectoryTokens : targets
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddDriversToContainer <container> : <relative directory> : <targets> ;
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
|
|
|
local directoryTokens = beos system add-ons kernel drivers dev
|
|
|
|
$(relativeDirectoryTokens) ;
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
AddFilesToContainer $(container) : beos system add-ons kernel drivers bin
|
|
|
|
: $(targets) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
# If the image shall only be updated, we don't add any symlinks.
|
2007-07-11 05:04:35 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
2007-04-07 01:13:35 +04:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# get the relative symlink path prefix
|
|
|
|
local linkPrefix = ;
|
|
|
|
for i in $(relativeDirectoryTokens) {
|
|
|
|
linkPrefix += .. ;
|
|
|
|
}
|
|
|
|
linkPrefix += .. bin ;
|
|
|
|
|
|
|
|
# add the symlinks
|
|
|
|
local name ;
|
|
|
|
for name in $(targets:BS) {
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainer $(container) : $(directoryTokens)
|
2005-10-29 20:27:43 +04:00
|
|
|
: [ FDirName $(linkPrefix) $(name) ] : $(name) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddDriverRegistrationToContainer container : relativeDirectoryTokens
|
|
|
|
: target : links
|
2006-11-29 22:09:45 +03:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddDriverRegistrationToContainer <container> : <directory>
|
|
|
|
# : <link target> : <link names> ] ;
|
2006-11-29 22:09:45 +03:00
|
|
|
#
|
2007-04-07 01:13:35 +04:00
|
|
|
local directoryTokens = beos system add-ons kernel registration
|
|
|
|
$(relativeDirectoryTokens) ;
|
2006-11-29 22:09:45 +03:00
|
|
|
|
|
|
|
# get the relative symlink path prefix
|
|
|
|
local linkPrefix = ;
|
|
|
|
for i in $(relativeDirectoryTokens) {
|
|
|
|
linkPrefix += .. ;
|
|
|
|
}
|
|
|
|
linkPrefix += .. drivers bin ;
|
|
|
|
|
|
|
|
# add the symlink
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainer $(container) : $(directoryTokens)
|
2007-04-07 01:13:35 +04:00
|
|
|
: [ FDirName $(linkPrefix) $(target:BS) ] : $(links) ;
|
2006-11-29 22:09:45 +03:00
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddBootModuleSymlinksToContainer container : targets
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddBootModuleSymlinksToContainer <container> : <targets> ;
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
# If the image shall only be updated, we don't add any symlinks.
|
2007-07-11 05:04:35 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
2007-04-07 01:13:35 +04:00
|
|
|
return ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
# add the symlinks
|
2007-07-11 05:04:35 +04:00
|
|
|
local installTargetsVar
|
|
|
|
= [ on $(container) return $(HAIKU_INSTALL_TARGETS_VAR) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local target ;
|
|
|
|
for target in $(targets) {
|
2006-06-29 16:08:53 +04:00
|
|
|
# Symlink to the first place where the target has been installed.
|
2007-07-11 05:04:35 +04:00
|
|
|
local destTarget = [ on $(target) return $($(installTargetsVar)[1]) ] ;
|
2006-06-29 16:08:53 +04:00
|
|
|
local installDir = [ on $(destTarget) return $(INSTALL_DIR) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
if ! $(installDir) {
|
2007-07-11 05:04:35 +04:00
|
|
|
Echo "ERROR: AddBootModuleSymlinksToContainer: Can't create a "
|
|
|
|
"symlink to target" \"$(target)"\"." ;
|
|
|
|
Exit "ERROR: Add*ToContainer has not been invoked for it yet." ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
local name = $(target:BS) ;
|
|
|
|
local linkTarget = [ FDirName /boot $(installDir:G=) $(name) ] ;
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainer $(container) : beos system add-ons kernel boot
|
2005-10-29 20:27:43 +04:00
|
|
|
: $(linkTarget) : $(name) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
|
|
|
|
rule CreateContainerMakeDirectoriesScript container : script
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
|
|
|
Always $(script) ;
|
|
|
|
|
|
|
|
local initScript = [ InitScript $(script) ] ;
|
|
|
|
|
|
|
|
local scriptBody
|
|
|
|
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
|
|
|
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
|
|
|
Depends $(scriptBody) : $(initScript) ;
|
|
|
|
Depends $(script) : $(scriptBody) ;
|
|
|
|
|
|
|
|
local dirsToCreate ;
|
|
|
|
local dir ;
|
2007-07-11 05:04:35 +04:00
|
|
|
for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] {
|
2005-10-29 20:27:43 +04:00
|
|
|
if ! [ on $(dir) return $(DONT_CREATE) ] {
|
|
|
|
dirsToCreate += $(dir) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Depends $(scriptBody) : $(dirsToCreate) ;
|
2007-04-07 01:13:35 +04:00
|
|
|
# If the image shall only be updated, we don't create directories.
|
2007-07-11 05:04:35 +04:00
|
|
|
if $(dirsToCreate)
|
|
|
|
&& ! [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
|
|
|
CreateContainerMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ;
|
2007-04-07 01:13:35 +04:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
actions piecemeal CreateContainerMakeDirectoriesScript1
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1)
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule CreateContainerCopyFilesScript container : script
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
|
|
|
Always $(script) ;
|
|
|
|
|
|
|
|
local initScript = [ InitScript $(script) ] ;
|
|
|
|
|
|
|
|
local scriptBody
|
|
|
|
= [ FSameTargetWithPrependedGrist $(script) : script-body ] ;
|
|
|
|
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
|
|
|
Depends $(scriptBody) : $(initScript) ;
|
|
|
|
Depends $(script) : $(scriptBody) ;
|
|
|
|
|
|
|
|
local dir ;
|
2007-07-11 05:04:35 +04:00
|
|
|
for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] {
|
2005-10-29 20:27:43 +04:00
|
|
|
# filter the targets that shall be renamed; they have to be copied
|
|
|
|
# individually
|
2006-06-29 16:08:53 +04:00
|
|
|
local destTargets = [ on $(dir) return $(TARGETS_TO_INSTALL) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local remainingTargets ;
|
2006-06-29 16:08:53 +04:00
|
|
|
local destTarget ;
|
|
|
|
for destTarget in $(destTargets) {
|
|
|
|
local target = [ on $(destTarget) return $(TARGET) ] ;
|
|
|
|
local name = $(destTarget:BS) ;
|
|
|
|
if $(name) != $(target:BS) {
|
2005-10-29 20:27:43 +04:00
|
|
|
# use a unique dummy target for this file, on which we
|
|
|
|
# can define the TARGET_DIR variable
|
|
|
|
local dummyTarget = $(script)-dummy-$(dir:G=)-$(target) ;
|
|
|
|
NotFile $(dummyTarget) ;
|
|
|
|
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
2006-06-29 16:08:53 +04:00
|
|
|
INSTALL_TARGET_NAME on $(dummyTarget) = $(name) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
Depends $(dummyTarget) : $(initScript) $(target) ;
|
|
|
|
Depends $(script) : $(dummyTarget) ;
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
AppendToContainerCopyFilesScriptSingleFile $(dummyTarget)
|
2005-10-29 20:27:43 +04:00
|
|
|
: $(initScript) $(target) ;
|
|
|
|
} else {
|
|
|
|
remainingTargets += $(target) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
targets = $(remainingTargets) ;
|
|
|
|
|
|
|
|
if $(targets) {
|
|
|
|
# use a unique dummy target for this directory, on which we
|
|
|
|
# can define the TARGET_DIR variable
|
|
|
|
local dummyTarget = $(script)-dummy-$(dir:G=) ;
|
|
|
|
NotFile $(dummyTarget) ;
|
|
|
|
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
|
|
|
|
|
|
|
Depends $(dummyTarget) : $(initScript) $(targets) ;
|
|
|
|
Depends $(script) : $(dummyTarget) ;
|
|
|
|
|
|
|
|
OUTPUT_SCRIPT on $(dummyTarget) = $(initScript) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
AppendToContainerCopyFilesScript $(dummyTarget) : $(targets) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
local symlinks = [ on $(dir) return $(SYMLINKS_TO_INSTALL) ] ;
|
|
|
|
local symlink ;
|
|
|
|
for symlink in $(symlinks) {
|
|
|
|
NotFile $(symlink) ;
|
|
|
|
|
|
|
|
Depends $(script) : $(symlink) ;
|
|
|
|
Depends $(symlink) : $(initScript) ;
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainerCopyFilesScript $(symlink) : $(initScript) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
actions piecemeal AppendToContainerCopyFilesScript bind OUTPUT_SCRIPT
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" >> $(OUTPUT_SCRIPT)
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
actions AppendToContainerCopyFilesScriptSingleFile
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
echo \$cp "\"\${sPrefix}$(2[2])\"" \
|
|
|
|
"\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1])
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
actions AddSymlinkToContainerCopyFilesScript
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2006-02-11 22:50:38 +03:00
|
|
|
echo \$ln -sfn "\"$(SYMLINK_TARGET)\"" "\"\${tPrefix}$(1:G=)\"" >> $(2[1])
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
|
|
|
|
#pragma mark - Haiku Image rules
|
|
|
|
|
|
|
|
rule SetUpdateHaikuImageOnly flag
|
|
|
|
{
|
|
|
|
HAIKU_CONTAINER_UPDATE_ONLY on $(HAIKU_IMAGE_CONTAINER_NAME) = $(flag) ;
|
|
|
|
}
|
|
|
|
|
2007-07-18 03:37:40 +04:00
|
|
|
rule IsUpdateHaikuImageOnly
|
|
|
|
{
|
|
|
|
on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_CONTAINER_UPDATE_ONLY) ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddDirectoryToHaikuImage directoryTokens
|
|
|
|
{
|
|
|
|
# AddDirectoryToHaikuImage <directoryTokens>
|
|
|
|
|
|
|
|
return [ AddDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddFilesToHaikuImage directory : targets : destName
|
|
|
|
{
|
|
|
|
# AddFilesToHaikuImage <directory> : <targets> [ : dest name ]
|
|
|
|
|
|
|
|
AddFilesToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directory)
|
|
|
|
: $(targets) : $(destName) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddSymlinkToHaikuImage directoryTokens : linkTarget : linkName
|
|
|
|
{
|
|
|
|
# AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ;
|
|
|
|
|
|
|
|
AddSymlinkToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directoryTokens)
|
|
|
|
: $(linkTarget) : $(linkName) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddSourceDirectoryToHaikuImage dirTokens : alwaysUpdate
|
|
|
|
{
|
|
|
|
# AddSourceDirectoryToHaikuImage <dirTokens> : <alwaysUpdate> ;
|
|
|
|
|
|
|
|
# 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 relativeDirectoryTokens : targets
|
|
|
|
{
|
|
|
|
# AddDriversToHaikuImage <relative directory> : <targets> ;
|
|
|
|
|
|
|
|
AddDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddDriverRegistrationToHaikuImage relativeDirectoryTokens : target : links
|
|
|
|
{
|
|
|
|
# AddDriverRegistrationToHaikuImage <directory> : <link target> : <link names> ] ;
|
|
|
|
|
|
|
|
AddDriverRegistrationToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(target) : $(links) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddBootModuleSymlinksToHaikuImage targets
|
|
|
|
{
|
|
|
|
# AddBootModuleSymlinksToHaikuImage <targets> ;
|
|
|
|
|
|
|
|
AddBootModuleSymlinksToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(targets) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateHaikuImageMakeDirectoriesScript script
|
|
|
|
{
|
|
|
|
CreateContainerMakeDirectoriesScript $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateHaikuImageCopyFilesScript script
|
|
|
|
{
|
|
|
|
CreateContainerCopyFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BuildHaikuImage haikuImage : scripts : isImage
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
|
|
|
# BuildHaikuImage <haiku image> : <scripts> : <is image> ;
|
|
|
|
|
|
|
|
if $(isImage) = 1 || $(isImage) = true {
|
|
|
|
IS_IMAGE on $(haikuImage) = 1 ;
|
|
|
|
} else {
|
|
|
|
IS_IMAGE on $(haikuImage) = "" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local mainScript = build_haiku_image ;
|
|
|
|
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
|
|
|
|
|
|
|
Depends $(haikuImage) : $(mainScript) $(scripts) ;
|
|
|
|
BuildHaikuImage1 $(haikuImage) : $(mainScript) $(scripts) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildHaikuImage1
|
|
|
|
{
|
|
|
|
export isImage="$(IS_IMAGE)"
|
|
|
|
$(2[1]) $(2[2-])
|
|
|
|
}
|
2007-01-27 15:54:10 +03:00
|
|
|
|
|
|
|
rule BuildVMWareImage vmwareImage : plainImage : imageSize
|
|
|
|
{
|
|
|
|
# BuildVMWareImage <vmware image> : <plain image> : <image size in MB>
|
|
|
|
|
|
|
|
IMAGE_SIZE on $(vmwareImage) = $(imageSize) ;
|
|
|
|
|
|
|
|
Depends $(vmwareImage) : <build>vmdkheader $(plainImage) ;
|
|
|
|
BuildVMWareImage1 $(vmwareImage) : <build>vmdkheader $(plainImage) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildVMWareImage1
|
|
|
|
{
|
|
|
|
rm -f $(1)
|
|
|
|
$(2[1]) -h 64k -i$(IMAGE_SIZE)M $(1) &&
|
|
|
|
cat $(2[2]) >> $(1)
|
|
|
|
}
|
2007-07-11 05:04:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Network Boot Archive rules
|
|
|
|
|
|
|
|
rule AddDirectoryToNetBootArchive directoryTokens
|
|
|
|
{
|
|
|
|
# AddDirectoryToNetBootArchive <directoryTokens>
|
|
|
|
|
|
|
|
return [ AddDirectoryToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddFilesToNetBootArchive directory : targets : destName
|
|
|
|
{
|
|
|
|
# AddFilesToNetBootArchive <directory> : <targets> [ : dest name ]
|
|
|
|
|
|
|
|
AddFilesToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) : $(directory)
|
|
|
|
: $(targets) : $(destName) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddSymlinkToNetBootArchive directoryTokens : linkTarget : linkName
|
|
|
|
{
|
|
|
|
# AddSymlinkToNetBootArchive <directory> : <link target> [ : <link name> ] ;
|
|
|
|
|
|
|
|
AddSymlinkToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) : $(linkTarget) : $(linkName) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddDriversToNetBootArchive relativeDirectoryTokens : targets
|
|
|
|
{
|
|
|
|
# AddDriversToNetBootArchive <relative directory> : <targets> ;
|
|
|
|
|
|
|
|
AddDriversToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddDriverRegistrationToNetBootArchive relativeDirectoryTokens : target
|
|
|
|
: links
|
|
|
|
{
|
|
|
|
# AddDriverRegistrationToNetBootArchive <directory> : <link target>
|
|
|
|
# : <link names> ] ;
|
|
|
|
|
|
|
|
AddDriverRegistrationToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(target) : $(links) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddBootModuleSymlinksToNetBootArchive targets
|
|
|
|
{
|
|
|
|
# AddBootModuleSymlinksToNetBootArchive <targets> ;
|
|
|
|
|
|
|
|
AddBootModuleSymlinksToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(targets) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateNetBootArchiveMakeDirectoriesScript script
|
|
|
|
{
|
|
|
|
CreateContainerMakeDirectoriesScript
|
|
|
|
$(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) : $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateNetBootArchiveCopyFilesScript script
|
|
|
|
{
|
|
|
|
CreateContainerCopyFilesScript $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BuildNetBootArchive archive : scripts
|
|
|
|
{
|
|
|
|
# BuildHNetBootArchive <archive> : <scripts> ;
|
|
|
|
|
|
|
|
local mainScript = build_tgz_archive ;
|
|
|
|
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
|
|
|
|
|
|
|
Depends $(archive) : $(mainScript) $(scripts) ;
|
|
|
|
BuildNetBootArchive1 $(archive) : $(mainScript) $(scripts) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildNetBootArchive1
|
|
|
|
{
|
|
|
|
$(2[1]) $(1) $(2[2-])
|
|
|
|
}
|