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) ;
|
|
|
|
}
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
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
|
|
|
|
{
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
$(RM) $(1)
|
2008-04-03 23:52:43 +04:00
|
|
|
touch $(1)
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
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)
|
2008-02-22 13:33:43 +03:00
|
|
|
+= "echo $(variable)=\\\" \\\$$(variable) $(value[1])\\\" >> " ;
|
2007-03-25 03:34:28 +04:00
|
|
|
value = $(value[2-]) ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
AddVariableToScript1 $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions together AddVariableToScript1
|
|
|
|
{
|
|
|
|
$(VARIABLE_DEFS)$(1);
|
|
|
|
}
|
|
|
|
|
2013-04-29 19:57:37 +04:00
|
|
|
|
|
|
|
rule AddTargetVariableToScript script : targets : variable
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2013-04-29 19:57:37 +04:00
|
|
|
# AddTargetVariableToScript <script> : <targets> [ : <variable> ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
2013-04-29 19:57:37 +04:00
|
|
|
# If <targets> contains multiple targets, their paths must not contain
|
|
|
|
# whitespaces or other characters that need to be escaped in the shell.
|
|
|
|
#
|
|
|
|
variable ?= $(3:E=$(targets[1]:BS)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-04-29 19:57:37 +04:00
|
|
|
local initScript = [ InitScript $(script) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-04-29 19:57:37 +04:00
|
|
|
serialization = [ on $(script) return $(HAIKU_SERIALIZATION) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-04-29 19:57:37 +04:00
|
|
|
local variableTarget = [ NewUniqueTarget ] ;
|
|
|
|
NotFile $(variableTarget) ;
|
|
|
|
Depends $(variableTarget) : $(initScript) $(targets) $(serialization) ;
|
|
|
|
Depends $(script) : $(variableTarget) ;
|
|
|
|
|
|
|
|
HAIKU_SERIALIZATION on $(script) = $(variableTarget) ;
|
|
|
|
|
|
|
|
HAIKU_VARIABLE_NAME on $(variableTarget) = $(variable) ;
|
|
|
|
AddTargetVariableToScript1 $(variableTarget) : $(initScript) $(targets) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2013-04-29 19:57:37 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
actions AddTargetVariableToScript1
|
|
|
|
{
|
2013-04-29 19:57:37 +04:00
|
|
|
script="$(2[1])"
|
|
|
|
echo "$(HAIKU_VARIABLE_NAME)=" >> "$script"
|
|
|
|
|
|
|
|
firstSeen=
|
|
|
|
for value in "$(2[2-])" ; do
|
|
|
|
if [ -z "$firstSeen" ]; then
|
|
|
|
echo "$(HAIKU_VARIABLE_NAME)=\"$value\"" >> "$script"
|
|
|
|
firstSeen=1
|
|
|
|
else
|
|
|
|
echo "$(HAIKU_VARIABLE_NAME)=\"\$$(HAIKU_VARIABLE_NAME) $value\"" \
|
|
|
|
>> "$script"
|
|
|
|
fi
|
|
|
|
done
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
#pragma mark -
|
|
|
|
|
2011-06-18 03:57:35 +04:00
|
|
|
rule AddDirectoryToContainer container : directoryTokens : attributeFiles
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2011-06-18 03:57:35 +04:00
|
|
|
# AddDirectoryToContainer <container> : <directoryTokens> : <attributeFiles>
|
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 ;
|
2007-07-27 03:20:58 +04:00
|
|
|
DIRECTORY_TOKENS on $(directory) = $(directoryTokens) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
NotFile $(directory) ;
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# 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 ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-18 03:57:35 +04:00
|
|
|
if $(attributeFiles) {
|
|
|
|
SEARCH on $(attributeFiles)
|
2018-11-16 05:20:24 +03:00
|
|
|
+= [ FDirName $(HAIKU_TOP) src data directory_attrs ] ;
|
2018-11-16 06:17:46 +03:00
|
|
|
ATTRIBUTE_FILES on $(directory) += $(attributeFiles) ;
|
2011-06-18 03:57:35 +04:00
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
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) ;
|
|
|
|
}
|
|
|
|
|
2008-07-15 23:23:34 +04:00
|
|
|
|
|
|
|
rule IncludeAllTargetsInContainer container
|
|
|
|
{
|
|
|
|
local filterVar
|
|
|
|
= [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ;
|
|
|
|
if $(filterVar) {
|
|
|
|
return $($(filterVar)) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-03 11:29:24 +04:00
|
|
|
rule PropagateContainerUpdateTargetFlags toTarget : fromTarget
|
|
|
|
{
|
|
|
|
if [ on $(fromTarget) return $(HAIKU_INCLUDE_IN_IMAGE) ] {
|
|
|
|
HAIKU_INCLUDE_IN_IMAGE on $(toTarget) = 1 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ on $(fromTarget) return $(HAIKU_INCLUDE_IN_PACKAGES) ] {
|
|
|
|
HAIKU_INCLUDE_IN_PACKAGES on $(toTarget) = 1 ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddFilesToContainer container : directoryTokens : targets : destName
|
2013-10-09 05:38:49 +04:00
|
|
|
: flags
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2007-07-11 05:04:35 +04:00
|
|
|
# AddFilesToContainer <container> : <directoryTokens> : <targets>
|
2013-10-09 05:38:49 +04:00
|
|
|
# : [ <destName> ] : [ <flags> ]
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
2013-10-09 05:38:49 +04:00
|
|
|
# Supported flags:
|
|
|
|
# computeName - <destName> is the name of a shell command/function that
|
|
|
|
# computes the destination name.
|
2013-11-13 04:42:04 +04:00
|
|
|
# alwaysUpdate - When only updating the container, always also update the
|
|
|
|
# given targets.
|
2013-10-09 05:38:49 +04:00
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ;
|
2011-06-19 19:01:23 +04:00
|
|
|
local systemDirTokens
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2012-12-09 06:50:31 +04:00
|
|
|
targets = [ FFilterByBuildFeatures $(targets) ] ;
|
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
# If the image shall only be updated, we filter out all targets not marked
|
|
|
|
# accordingly.
|
2008-07-15 23:23:34 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
2013-11-13 04:42:04 +04:00
|
|
|
&& ! [ IncludeAllTargetsInContainer $(container) ]
|
|
|
|
&& ! alwaysUpdate in $(flags) {
|
2007-07-11 05:04:35 +04:00
|
|
|
local filterVar
|
|
|
|
= [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ;
|
|
|
|
if $(filterVar) {
|
|
|
|
targets = [ FilterContainerUpdateTargets $(targets)
|
|
|
|
: $(filterVar) ] ;
|
2011-07-03 10:44:19 +04:00
|
|
|
|
|
|
|
# If there are any targets, mark the container as to be included in
|
|
|
|
# an update, too, if it has set the update inheritance variable.
|
|
|
|
# This makes updating a target that lives in a package on an image
|
|
|
|
# work.
|
|
|
|
if $(targets) {
|
|
|
|
local updateVariable = [ on $(container) return
|
|
|
|
$(HAIKU_CONTAINER_INHERIT_UPDATE_VARIABLE) ] ;
|
|
|
|
if $(updateVariable) {
|
|
|
|
$(updateVariable) on $(container) = 1 ;
|
|
|
|
}
|
|
|
|
}
|
2007-07-11 05:04:35 +04:00
|
|
|
}
|
2007-04-07 01:13:35 +04:00
|
|
|
}
|
|
|
|
|
2011-07-03 11:06:10 +04:00
|
|
|
if ! $(targets) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local directory = [ AddDirectoryToContainer $(container)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
|
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) ] ;
|
2013-10-12 19:23:56 +04:00
|
|
|
local stripExecutables
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_STRIP_EXECUTABLES) ] ;
|
2006-06-29 16:08:53 +04:00
|
|
|
local target ;
|
|
|
|
for target in $(targets) {
|
|
|
|
local name ;
|
2013-10-09 05:38:49 +04:00
|
|
|
local nameFunction ;
|
2006-06-29 16:08:53 +04:00
|
|
|
if $(destName) {
|
2013-10-09 05:38:49 +04:00
|
|
|
if computeName in $(flags) {
|
|
|
|
nameFunction = $(destName) ;
|
2014-08-10 12:17:26 +04:00
|
|
|
name = $(destName)/$(target:BSM) ;
|
2013-10-09 05:38:49 +04:00
|
|
|
} else {
|
|
|
|
name = $(destName) ;
|
|
|
|
}
|
2006-06-29 16:08:53 +04:00
|
|
|
} else {
|
2014-08-10 12:17:26 +04:00
|
|
|
name = $(target:BSM) ;
|
2006-06-29 16:08:53 +04:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-10-12 19:23:56 +04:00
|
|
|
local installTarget = $(target) ;
|
|
|
|
if $(stripExecutables)
|
|
|
|
&& [ on $(target) return $(HAIKU_TARGET_IS_EXECUTABLE) ] {
|
|
|
|
installTarget = [ StripFiles $(target) ] ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
local destTarget = $(name:G=$(containerGrist)__$(directory:G=)) ;
|
2013-10-12 19:23:56 +04:00
|
|
|
TARGET on $(destTarget) = $(installTarget) ;
|
2006-06-29 16:08:53 +04:00
|
|
|
INSTALL_DIR on $(destTarget) = $(directory) ;
|
2013-10-09 05:38:49 +04:00
|
|
|
NAME_FUNCTION on $(destTarget) = $(nameFunction) ;
|
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) ;
|
2010-03-30 01:36:00 +04:00
|
|
|
|
2013-01-04 21:48:34 +04:00
|
|
|
# If the target and its static libraries are associated with catalog
|
|
|
|
# files, add those, too.
|
|
|
|
local catalogTargets = $(target) + [ on $(target) return $(NEEDLIBS) ] ;
|
|
|
|
for catalogTarget in $(catalogTargets) {
|
|
|
|
local catalogs
|
|
|
|
= [ on $(catalogTarget) return $(HAIKU_CATALOG_FILES) ] ;
|
|
|
|
if $(catalogs) {
|
|
|
|
local signature
|
|
|
|
= [ on $(catalogTarget)
|
|
|
|
return $(HAIKU_CATALOG_SIGNATURE) ] ;
|
|
|
|
AddFilesToContainer $(container)
|
|
|
|
: $(systemDirTokens) data locale catalogs $(signature)
|
|
|
|
: $(catalogs) ;
|
|
|
|
}
|
2010-03-30 01:36:00 +04:00
|
|
|
}
|
2013-05-09 05:38:10 +04:00
|
|
|
|
|
|
|
# If the target is associated with MIME DB entries, add those, too.
|
|
|
|
local mimeDBEntries = [ on $(target) return $(HAIKU_MIME_DB_ENTRIES) ] ;
|
|
|
|
if $(mimeDBEntries) {
|
|
|
|
# Make sure we add the entries only once by tracking the containers
|
|
|
|
# we have already added it to.
|
|
|
|
local containers = [ on $(mimeDBEntries)
|
|
|
|
return $(HAIKU_MIME_DB_ENTRIES_IN_CONTAINERS) ] ;
|
|
|
|
if ! $(container) in $(containers) {
|
|
|
|
HAIKU_MIME_DB_ENTRIES_IN_CONTAINERS on $(mimeDBEntries)
|
|
|
|
= $(containers) $(container) ;
|
|
|
|
CopyDirectoryToContainer $(container) : data
|
|
|
|
: $(mimeDBEntries) : mime_db : : alwaysUpdate isTarget ;
|
|
|
|
}
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-18 03:31:04 +04:00
|
|
|
rule FFilesInContainerDirectory container : directoryTokens
|
|
|
|
{
|
|
|
|
local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ;
|
|
|
|
local directory = [ FDirName $(directoryTokens) ] ;
|
|
|
|
directory = $(directory:G=$(containerGrist)) ;
|
|
|
|
|
|
|
|
if [ on $(directory) return $(__is_on_image) ] {
|
|
|
|
on $(directory) return $(TARGETS_TO_INSTALL) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
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.
|
2008-07-15 23:23:34 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
|
|
|
&& ! [ IncludeAllTargetsInContainer $(container) ] {
|
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) ;
|
|
|
|
}
|
|
|
|
|
2008-05-18 03:31:04 +04:00
|
|
|
rule FSymlinksInContainerDirectory container : directoryTokens
|
|
|
|
{
|
|
|
|
local containerGrist = [ on $(container) return $(HAIKU_CONTAINER_GRIST) ] ;
|
|
|
|
local directory = [ FDirName $(directoryTokens) ] ;
|
|
|
|
directory = $(directory:G=$(containerGrist)) ;
|
|
|
|
|
|
|
|
if [ on $(directory) return $(__is_on_image) ] {
|
|
|
|
on $(directory) return $(SYMLINKS_TO_INSTALL) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2008-03-26 07:14:25 +03:00
|
|
|
rule CopyDirectoryToContainer container : directoryTokens : sourceDirectory
|
2013-05-07 04:38:55 +04:00
|
|
|
: targetDirectoryName : excludePatterns : flags
|
2008-03-26 07:14:25 +03:00
|
|
|
{
|
|
|
|
# CopyDirectoryToContainer <container> : <directoryTokens>
|
|
|
|
# : <sourceDirectory> : <targetDirectoryName> : <excludePatterns>
|
2013-05-07 04:38:55 +04:00
|
|
|
# [ : <flags> ] ;
|
2008-03-26 07:14:25 +03:00
|
|
|
#
|
2013-05-07 05:13:37 +04:00
|
|
|
# Supported flags: alwaysUpdate, isTarget
|
|
|
|
# isTarget: <sourceDirectory> is a target, not a path
|
2008-03-26 07:14:25 +03:00
|
|
|
|
|
|
|
# If the image shall only be updated, we don't copy any directories
|
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
2008-07-15 23:23:34 +04:00
|
|
|
&& ! [ IncludeAllTargetsInContainer $(container) ]
|
2013-05-07 04:38:55 +04:00
|
|
|
&& ! alwaysUpdate in $(flags) {
|
2008-03-26 07:14:25 +03:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! $(targetDirectoryName) {
|
2014-08-10 12:17:26 +04:00
|
|
|
targetDirectoryName = $(sourceDirectory[1]:BSM) ;
|
2013-05-07 05:13:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# If sourceDirectory is a path, not a target, make it a target, so we can
|
2013-05-09 05:30:19 +04:00
|
|
|
# treat both the same way.
|
2013-05-07 05:13:37 +04:00
|
|
|
if ! isTarget in $(flags) {
|
|
|
|
sourceDirectory = $(sourceDirectory:G=copy-directory-to-container) ;
|
|
|
|
SEARCH on $(sourceDirectory) = ;
|
|
|
|
TARGET on $(sourceDirectory) = ;
|
2008-03-26 07:14:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
local directory = [ AddDirectoryToContainer $(container)
|
|
|
|
: $(directoryTokens) $(targetDirectoryName) ] ;
|
|
|
|
|
|
|
|
local targetDir = $(directory)/-/$(sourceDirectory) ;
|
2013-05-07 05:13:37 +04:00
|
|
|
Depends $(targetDir) : $(sourceDirectory) ;
|
2008-03-26 07:14:25 +03:00
|
|
|
EXCLUDE_PATTERNS on $(targetDir) = $(excludePatterns) ;
|
|
|
|
SOURCE_DIRECTORY on $(targetDir) = $(sourceDirectory) ;
|
|
|
|
TARGET_DIRECTORY on $(targetDir) = $(directory) ;
|
|
|
|
DIRECTORIES_TO_INSTALL on $(directory) += $(targetDir) ;
|
|
|
|
}
|
|
|
|
|
2011-06-17 16:56:35 +04:00
|
|
|
|
|
|
|
rule AddHeaderDirectoryToContainer container : dirTokens : dirName
|
2013-05-07 04:38:55 +04:00
|
|
|
: flags
|
2011-06-17 16:56:35 +04:00
|
|
|
{
|
|
|
|
# AddHeaderDirectoryToContainer <container> : <dirTokens> : [ <dirName> ]
|
2013-05-07 04:38:55 +04:00
|
|
|
# [ : <flags> ] ;
|
|
|
|
#
|
|
|
|
# Supported flags: alwaysUpdate
|
2011-06-17 16:56:35 +04:00
|
|
|
|
2011-06-19 19:01:23 +04:00
|
|
|
local systemDirTokens
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) ] ;
|
|
|
|
|
|
|
|
CopyDirectoryToContainer $(container) : $(systemDirTokens) develop headers
|
2011-06-17 16:56:35 +04:00
|
|
|
: [ FDirName $(HAIKU_TOP) headers $(dirTokens) ]
|
2014-04-26 13:47:34 +04:00
|
|
|
: $(dirName) : -x *~ : $(flags) ;
|
2011-06-17 16:56:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule AddWifiFirmwareToContainer container : driver : package : archive : extract
|
|
|
|
{
|
|
|
|
# AddWifiFirmwareToContainer <container> : <driver> : <package> : <archive>
|
|
|
|
# : <extract>
|
|
|
|
|
|
|
|
# complete location to wifi firmware archive
|
|
|
|
local firmwareArchive = [ FDirName
|
|
|
|
$(HAIKU_TOP) data system data firmware $(driver) $(archive) ] ;
|
|
|
|
|
2011-06-19 19:01:23 +04:00
|
|
|
local systemDirTokens
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) ] ;
|
|
|
|
|
|
|
|
local dirTokens = $(systemDirTokens) data firmware $(driver) ;
|
2011-06-17 16:56:35 +04:00
|
|
|
if $(extract) = true || $(extract) = 1 {
|
|
|
|
ExtractArchiveToContainer $(container) : $(dirTokens)
|
2011-07-03 11:12:57 +04:00
|
|
|
: $(firmwareArchive) : : $(package) ;
|
2011-06-17 16:56:35 +04:00
|
|
|
} else {
|
2018-05-07 03:54:32 +03:00
|
|
|
AddFilesToContainer $(container) : $(dirTokens) : $(firmwareArchive) ;
|
2011-06-17 16:56:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-27 21:23:52 +03:00
|
|
|
rule ExtractArchiveToContainer container : directoryTokens : archiveFile
|
2013-05-07 04:38:55 +04:00
|
|
|
: flags : extractedSubDir
|
2007-09-05 01:50:00 +04:00
|
|
|
{
|
2010-02-27 21:23:52 +03:00
|
|
|
# ExtractArchiveToContainer <container> : <directory> : <archiveFile>
|
2013-05-07 04:38:55 +04:00
|
|
|
# : [ <flags> ] : <extractedSubDir> ;
|
|
|
|
#
|
2013-08-01 10:53:06 +04:00
|
|
|
# Supported flags: alwaysUpdate
|
2011-07-03 11:12:57 +04:00
|
|
|
|
|
|
|
# If the container shall only be updated, we extract only, if explicitely
|
|
|
|
# requested.
|
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
2013-05-07 04:38:55 +04:00
|
|
|
&& ! alwaysUpdate in $(flags) {
|
2011-07-03 11:12:57 +04:00
|
|
|
return ;
|
|
|
|
}
|
2007-09-05 01:50:00 +04:00
|
|
|
|
|
|
|
local directory = [ AddDirectoryToContainer $(container)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
|
2010-02-27 20:48:12 +03:00
|
|
|
ARCHIVE_FILES_TO_INSTALL on $(directory) += $(archiveFile) ;
|
2010-02-27 21:15:47 +03:00
|
|
|
ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(archiveFile) = $(extractedSubDir) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
#
|
2011-06-19 19:01:23 +04:00
|
|
|
local systemDirTokens
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) ] ;
|
|
|
|
local directoryTokens = $(systemDirTokens) add-ons kernel drivers dev
|
2005-10-29 20:27:43 +04:00
|
|
|
$(relativeDirectoryTokens) ;
|
|
|
|
|
2012-12-09 06:50:31 +04:00
|
|
|
targets = [ FFilterByBuildFeatures $(targets) ] ;
|
|
|
|
|
2013-05-09 05:29:53 +04:00
|
|
|
# A driver can be in multiple categories. Avoid adding it to the bin/
|
|
|
|
# directory more than once.
|
|
|
|
local binTargets ;
|
|
|
|
local target ;
|
|
|
|
for target in $(targets) {
|
|
|
|
local containers
|
|
|
|
= [ on $(target) return $(HAIKU_DRIVER_IN_CONTAINERS) ] ;
|
|
|
|
if ! $(container) in $(containers) {
|
|
|
|
HAIKU_DRIVER_IN_CONTAINERS on $(target)
|
|
|
|
= $(containers) $(container) ;
|
|
|
|
binTargets += $(target) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-16 11:00:06 +04:00
|
|
|
AddFilesToContainer $(container)
|
2011-06-19 19:01:23 +04:00
|
|
|
: $(systemDirTokens) add-ons kernel drivers bin
|
2013-05-09 05:29:53 +04:00
|
|
|
: $(binTargets) ;
|
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.
|
2008-07-15 23:23:34 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
|
|
|
&& ! [ IncludeAllTargetsInContainer $(container) ] {
|
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 = ;
|
2014-07-31 20:34:37 +04:00
|
|
|
local i ;
|
2005-10-29 20:27:43 +04:00
|
|
|
for i in $(relativeDirectoryTokens) {
|
|
|
|
linkPrefix += .. ;
|
|
|
|
}
|
|
|
|
linkPrefix += .. bin ;
|
|
|
|
|
|
|
|
# add the symlinks
|
|
|
|
local name ;
|
2014-08-10 12:17:26 +04:00
|
|
|
for name in $(targets:BSM) {
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainer $(container) : $(directoryTokens)
|
2005-10-29 20:27:43 +04:00
|
|
|
: [ FDirName $(linkPrefix) $(name) ] : $(name) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-10 00:32:54 +04:00
|
|
|
rule AddNewDriversToContainer container : relativeDirectoryTokens
|
2013-11-13 04:42:04 +04:00
|
|
|
: targets : flags
|
2006-11-29 22:09:45 +03:00
|
|
|
{
|
2013-11-13 04:42:04 +04:00
|
|
|
# AddNewDriversToContainer <container> : <directory> : <targets> : <flags> ;
|
2006-11-29 22:09:45 +03:00
|
|
|
#
|
2013-11-13 04:42:04 +04:00
|
|
|
# Supported flags:
|
|
|
|
# alwaysUpdate - When only updating the container, always also update the
|
|
|
|
# given targets.
|
|
|
|
|
2011-06-19 19:01:23 +04:00
|
|
|
local systemDirTokens
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) ] ;
|
|
|
|
local directoryTokens = $(systemDirTokens) add-ons kernel drivers
|
2007-04-07 01:13:35 +04:00
|
|
|
$(relativeDirectoryTokens) ;
|
2006-11-29 22:09:45 +03:00
|
|
|
|
2012-12-09 06:50:31 +04:00
|
|
|
targets = [ FFilterByBuildFeatures $(targets) ] ;
|
|
|
|
|
2008-06-10 00:32:54 +04:00
|
|
|
AddFilesToContainer $(container) : $(directoryTokens)
|
2013-11-13 04:42:04 +04:00
|
|
|
: $(targets) : : $(flags) ;
|
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
|
|
|
|
2011-06-17 16:56:35 +04:00
|
|
|
# If the container shall only be updated, we don't add any symlinks.
|
|
|
|
|
2008-07-15 23:23:34 +04:00
|
|
|
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
|
|
|
&& ! [ IncludeAllTargetsInContainer $(container) ] {
|
2007-04-07 01:13:35 +04:00
|
|
|
return ;
|
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2011-06-19 19:01:23 +04:00
|
|
|
local systemDirTokens
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_SYSTEM_DIR_TOKENS) ] ;
|
2012-12-09 06:50:31 +04:00
|
|
|
targets = [ FFilterByBuildFeatures $(targets) ] ;
|
2011-06-19 19:01:23 +04:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2013-09-13 01:27:22 +04:00
|
|
|
# chop off the system dir prefix from installDir
|
|
|
|
installDir = [ on $(installDir) return $(DIRECTORY_TOKENS) ] ;
|
|
|
|
local dummy ;
|
|
|
|
for dummy in $(systemDirTokens) {
|
|
|
|
installDir = $(installDir[2-]) ;
|
|
|
|
}
|
|
|
|
|
2014-08-10 12:17:26 +04:00
|
|
|
local name = $(target:BSM) ;
|
2013-09-13 01:27:22 +04:00
|
|
|
local linkTarget = [ FDirName ../../.. $(installDir) $(name) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2011-06-16 11:00:06 +04:00
|
|
|
AddSymlinkToContainer $(container)
|
2011-06-19 19:01:23 +04:00
|
|
|
: $(systemDirTokens) add-ons kernel boot
|
2005-10-29 20:27:43 +04:00
|
|
|
: $(linkTarget) : $(name) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
|
2011-06-17 16:56:35 +04:00
|
|
|
rule AddLibrariesToContainer container : directory : libs
|
|
|
|
{
|
|
|
|
# AddLibrariesToContainer <container> : <directory> : <libs>
|
|
|
|
#
|
|
|
|
# Installs libraries with the appropriate links into the container.
|
|
|
|
#
|
|
|
|
|
|
|
|
local lib ;
|
|
|
|
for lib in $(libs) {
|
|
|
|
local abiVersion = [ on $(lib) return $(HAIKU_LIB_ABI_VERSION) ] ;
|
|
|
|
if $(abiVersion) {
|
2013-08-10 11:52:10 +04:00
|
|
|
local abiVersionedLib = $(lib:G=).$(abiVersion) ;
|
2011-06-17 16:56:35 +04:00
|
|
|
AddFilesToContainer $(container) : $(directory) : $(lib)
|
|
|
|
: $(abiVersionedLib) ;
|
|
|
|
AddSymlinkToContainer $(container) : $(directory)
|
2013-08-10 11:52:10 +04:00
|
|
|
: $(abiVersionedLib) : $(lib:G=) ;
|
2011-06-17 16:56:35 +04:00
|
|
|
} else {
|
|
|
|
AddFilesToContainer $(container) : $(directory) : $(lib) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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) ;
|
2007-07-27 03:20:58 +04:00
|
|
|
|
|
|
|
# collect the directories to create
|
2005-10-29 20:27:43 +04:00
|
|
|
local dirsToCreate ;
|
2010-02-27 21:23:52 +03:00
|
|
|
local directories
|
|
|
|
= [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] ;
|
2005-10-29 20:27:43 +04:00
|
|
|
local dir ;
|
2007-07-27 03:20:58 +04:00
|
|
|
for dir in $(directories) {
|
2005-10-29 20:27:43 +04:00
|
|
|
if ! [ on $(dir) return $(DONT_CREATE) ] {
|
|
|
|
dirsToCreate += $(dir) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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)
|
2008-07-15 23:23:34 +04:00
|
|
|
&& ( ! [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
|
2011-07-03 10:44:19 +04:00
|
|
|
|| [ IncludeAllTargetsInContainer $(container) ]
|
|
|
|
|| [ on $(container) return
|
|
|
|
$(HAIKU_CONTAINER_ALWAYS_CREATE_DIRECTORIES) ] ) {
|
2007-07-27 03:20:58 +04:00
|
|
|
Depends $(scriptBody) : $(dirsToCreate) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
CreateContainerMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ;
|
2007-07-27 03:20:58 +04:00
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
local serializationDependency = $(scriptBody) ;
|
|
|
|
# Used to create a dependency chain between the dummy targets.
|
|
|
|
# This forces jam to build them one after the other, thus preventing
|
|
|
|
# concurrent writes to the script file when building with multiple
|
|
|
|
# jobs.
|
|
|
|
|
2007-07-27 03:20:58 +04:00
|
|
|
# For directories with attributes, we convert those the specified
|
|
|
|
# resource files to files with attributes and add commands to the script
|
|
|
|
# adding the attributes to the directories.
|
|
|
|
for dir in $(directories) {
|
|
|
|
local resourceFiles = [ on $(dir) return $(ATTRIBUTE_FILES) ] ;
|
|
|
|
if $(resourceFiles) {
|
|
|
|
local dirTokens = [ on $(dir) return $(DIRECTORY_TOKENS) ] ;
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2007-07-27 03:20:58 +04:00
|
|
|
# translate resources file to file with attributes
|
|
|
|
local attributeFile = $(script)-attributes-$(dirTokens:J=-) ;
|
|
|
|
ResAttr $(attributeFile) : $(resourceFiles) ;
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2007-07-27 03:20:58 +04:00
|
|
|
# use a unique dummy target for this file, on which we
|
|
|
|
# can define the TARGET_DIR variable
|
|
|
|
local dummyTarget = $(script)-attributes-dummy-$(dir:G=) ;
|
|
|
|
NotFile $(dummyTarget) ;
|
|
|
|
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
Depends $(dummyTarget) : $(initScript) $(attributeFile)
|
|
|
|
$(serializationDependency) ;
|
2007-07-27 03:20:58 +04:00
|
|
|
Depends $(script) : $(dummyTarget) ;
|
2009-07-06 16:24:17 +04:00
|
|
|
serializationDependency = $(dummyTarget) ;
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2007-07-27 03:20:58 +04:00
|
|
|
AppendToContainerMakeDirectoriesScriptAttributes $(dummyTarget)
|
|
|
|
: $(initScript) $(attributeFile) ;
|
|
|
|
}
|
|
|
|
}
|
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-27 03:20:58 +04:00
|
|
|
actions AppendToContainerMakeDirectoriesScriptAttributes
|
|
|
|
{
|
|
|
|
echo \$copyAttrs "\"\${sPrefix}$(2[2])\"" \
|
|
|
|
"\"\${tPrefix}$(TARGET_DIR)\"" >> $(2[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) ;
|
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
local serializationDependency = $(scriptBody) ;
|
|
|
|
# Used to create a dependency chain between the dummy targets.
|
|
|
|
# This forces jam to build them one after the other, thus preventing
|
|
|
|
# concurrent writes to the script file when building with multiple
|
|
|
|
# jobs.
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
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) ] ;
|
2013-10-09 05:38:49 +04:00
|
|
|
local name = $(destTarget:G=) ;
|
2014-08-10 12:17:26 +04:00
|
|
|
if $(name) != $(target:BSM) {
|
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=) ;
|
2013-10-09 05:38:49 +04:00
|
|
|
|
|
|
|
local nameFunction
|
|
|
|
= [ on $(destTarget) return $(NAME_FUNCTION) ] ;
|
|
|
|
if $(nameFunction) {
|
|
|
|
INSTALL_TARGET_NAME on $(dummyTarget) = "\\${name}" ;
|
|
|
|
} else {
|
|
|
|
INSTALL_TARGET_NAME on $(dummyTarget) = $(name) ;
|
|
|
|
}
|
|
|
|
NAME_FUNCTION on $(dummyTarget) = $(nameFunction) ;
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
Depends $(dummyTarget) : $(initScript) $(target)
|
|
|
|
$(serializationDependency) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
Depends $(script) : $(dummyTarget) ;
|
2009-07-06 16:24:17 +04:00
|
|
|
serializationDependency = $(dummyTarget) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2013-10-12 18:00:02 +04:00
|
|
|
AppendToContainerCopyFilesScriptSingleFile $(dummyTarget)
|
|
|
|
: $(initScript) $(target) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
} 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=) ;
|
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
Depends $(dummyTarget) : $(initScript) $(targets)
|
|
|
|
$(serializationDependency) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
Depends $(script) : $(dummyTarget) ;
|
2009-07-06 16:24:17 +04:00
|
|
|
serializationDependency = $(dummyTarget) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
OUTPUT_SCRIPT on $(dummyTarget) = $(initScript) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
AppendToContainerCopyFilesScript $(dummyTarget) : $(targets) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2008-07-15 23:23:34 +04:00
|
|
|
|
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) ;
|
2009-07-06 16:24:17 +04:00
|
|
|
Depends $(symlink) : $(initScript) $(serializationDependency) ;
|
|
|
|
serializationDependency = $(symlink) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainerCopyFilesScript $(symlink) : $(initScript) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
2008-03-26 07:14:25 +03:00
|
|
|
|
|
|
|
local targetDirs = [ on $(dir) return $(DIRECTORIES_TO_INSTALL) ] ;
|
|
|
|
local targetDir ;
|
|
|
|
for targetDir in $(targetDirs) {
|
|
|
|
NotFile $(targetDir) ;
|
|
|
|
|
|
|
|
Depends $(script) : $(targetDir) ;
|
2009-07-06 16:24:17 +04:00
|
|
|
Depends $(targetDir) : $(initScript) $(serializationDependency) ;
|
|
|
|
serializationDependency = $(targetDir) ;
|
2008-03-26 07:14:25 +03:00
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
AddDirectoryToContainerCopyFilesScript $(targetDir)
|
|
|
|
: $(initScript) ;
|
2008-03-26 07:14:25 +03:00
|
|
|
}
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
actions piecemeal AppendToContainerCopyFilesScript bind OUTPUT_SCRIPT
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2009-07-06 16:24:17 +04:00
|
|
|
echo \$cp "\"\${sPrefix}$(2)\"" "\"\${tPrefix}$(TARGET_DIR)\"" \
|
|
|
|
>> $(OUTPUT_SCRIPT)
|
2013-10-12 03:32:59 +04:00
|
|
|
}
|
|
|
|
|
2013-10-09 20:30:03 +04:00
|
|
|
|
2013-10-12 18:00:02 +04:00
|
|
|
actions AppendToContainerCopyFilesScriptSingleFile
|
2013-10-12 03:32:59 +04:00
|
|
|
{
|
|
|
|
if [ -n "$(NAME_FUNCTION:E)" ]; then
|
|
|
|
echo "name=\`$(NAME_FUNCTION:E) \"$(2[2])\" 2> /dev/null \` || exit 1" \
|
|
|
|
>> $(2[1])
|
2013-10-09 20:30:03 +04:00
|
|
|
fi
|
2013-10-12 03:32:59 +04:00
|
|
|
|
2013-10-12 17:59:19 +04:00
|
|
|
echo \$cp "\"\${sPrefix}$(2[2])\"" \
|
2013-10-12 03:32:59 +04:00
|
|
|
"\"\${tPrefix}$(TARGET_DIR)/$(INSTALL_TARGET_NAME)\"" >> $(2[1])
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
2008-07-15 23:23:34 +04:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2008-07-15 23:23:34 +04:00
|
|
|
|
2013-05-07 05:13:37 +04:00
|
|
|
actions AddDirectoryToContainerCopyFilesScript bind SOURCE_DIRECTORY
|
2008-03-26 07:14:25 +03:00
|
|
|
{
|
|
|
|
echo \$cp -r $(EXCLUDE_PATTERNS) "\"\${sPrefix}$(SOURCE_DIRECTORY)/.\"" \
|
|
|
|
"\"\${tPrefix}$(TARGET_DIRECTORY:G=)\"" >> $(2[1])
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
|
2010-02-27 20:48:12 +03:00
|
|
|
rule CreateContainerExtractFilesScript container : script
|
2007-09-05 01:50:00 +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) ;
|
|
|
|
|
2009-07-06 16:24:17 +04:00
|
|
|
local serializationDependency = $(scriptBody) ;
|
|
|
|
# Used to create a dependency chain between the dummy targets.
|
|
|
|
# This forces jam to build them one after the other, thus preventing
|
|
|
|
# concurrent writes to the script file when building with multiple
|
|
|
|
# jobs.
|
|
|
|
|
2007-09-05 01:50:00 +04:00
|
|
|
local dir ;
|
|
|
|
for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] {
|
2010-02-27 20:48:12 +03:00
|
|
|
local archiveFiles = [ on $(dir) return $(ARCHIVE_FILES_TO_INSTALL) ] ;
|
|
|
|
local archiveFile ;
|
|
|
|
for archiveFile in $(archiveFiles) {
|
2007-09-05 01:50:00 +04:00
|
|
|
# use a unique dummy target for this file, on which we
|
|
|
|
# can define the TARGET_DIR variable
|
2010-02-27 20:48:12 +03:00
|
|
|
local dummyTarget = $(script)-dummy-$(dir:G=)-$(archiveFile) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
NotFile $(dummyTarget) ;
|
|
|
|
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
|
|
|
|
2010-02-27 21:15:47 +03:00
|
|
|
local extractedSubDir = [ on $(archiveFile)
|
|
|
|
return $(ARCHIVE_SUBDIR_TO_INSTALL_FROM) ] ;
|
2010-04-24 23:52:36 +04:00
|
|
|
ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(dummyTarget) =
|
|
|
|
$(extractedSubDir:E=.) ;
|
|
|
|
|
2010-02-27 20:48:12 +03:00
|
|
|
Depends $(dummyTarget) : $(initScript) $(archiveFile)
|
2009-07-06 16:24:17 +04:00
|
|
|
$(serializationDependency) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
Depends $(script) : $(dummyTarget) ;
|
2009-07-06 16:24:17 +04:00
|
|
|
serializationDependency = $(dummyTarget) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
|
2010-02-27 21:15:47 +03:00
|
|
|
AddExtractFileToContainerExtractFilesScript $(dummyTarget)
|
2010-04-24 23:52:36 +04:00
|
|
|
: $(initScript) $(archiveFile) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-27 20:48:12 +03:00
|
|
|
|
|
|
|
actions AddExtractFileToContainerExtractFilesScript
|
2007-09-05 01:50:00 +04:00
|
|
|
{
|
2010-04-24 23:52:36 +04:00
|
|
|
echo extractFile "\"$(2[2])\"" "\"$(TARGET_DIR)\"" \
|
2013-08-01 10:53:06 +04:00
|
|
|
"\"$(ARCHIVE_SUBDIR_TO_INSTALL_FROM)\"" >> $(2[1])
|
2007-09-05 01:50:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-13 02:04:51 +04:00
|
|
|
rule AddPackagesAndRepositoryVariablesToContainerScript script : container
|
|
|
|
{
|
|
|
|
AddVariableToScript $(script) : downloadDir : $(HAIKU_DOWNLOAD_DIR) ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>package ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>get_package_dependencies
|
|
|
|
: getPackageDependencies ;
|
|
|
|
|
|
|
|
# Add a variable to indicate whether packages dependencies shall be
|
|
|
|
# resolved. We always want to do that in non-update mode, but also in update
|
|
|
|
# mode when all packages are updated.
|
|
|
|
local updateOnly
|
|
|
|
= [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] ;
|
|
|
|
local resolvePackageDependencies ;
|
|
|
|
if ( ! $(updateOnly) || $(HAIKU_UPDATE_ALL_PACKAGES) )
|
2014-03-22 23:23:10 +04:00
|
|
|
&& $(HAIKU_BUILD_TYPE) != bootstrap {
|
2013-09-13 02:04:51 +04:00
|
|
|
resolvePackageDependencies = 1 ;
|
|
|
|
}
|
|
|
|
AddVariableToScript $(script) : resolvePackageDependencies
|
|
|
|
: $(resolvePackageDependencies) ;
|
|
|
|
|
2014-05-01 21:42:36 +04:00
|
|
|
AddVariableToScript $(script) : noDownloads : $(HAIKU_NO_DOWNLOADS) ;
|
|
|
|
|
2013-10-06 00:28:59 +04:00
|
|
|
AddVariableToScript $(script) : updateAllPackages
|
|
|
|
: $(HAIKU_UPDATE_ALL_PACKAGES) ;
|
|
|
|
|
2018-05-07 03:54:32 +03:00
|
|
|
# Add variable "systemPackages" with the packages copied/updated.
|
2020-04-20 00:53:10 +03:00
|
|
|
local systemPackages = [ on $(container) return $(HAIKU_SYSTEM_PACKAGES_IN_IMAGE) ] ;
|
2013-09-13 02:04:51 +04:00
|
|
|
if $(updateOnly) && ! [ IncludeAllTargetsInContainer $(container) ] {
|
2020-04-20 00:53:10 +03:00
|
|
|
systemPackages = [ FilterContainerUpdateTargets $(systemPackages)
|
2013-09-13 02:04:51 +04:00
|
|
|
: [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ] ;
|
|
|
|
}
|
2020-04-20 00:53:10 +03:00
|
|
|
AddTargetVariableToScript $(script) : $(systemPackages) : systemPackages ;
|
2013-09-13 02:04:51 +04:00
|
|
|
|
2020-04-20 00:53:10 +03:00
|
|
|
# Add variable "otherPackages" with the packages copied/updated.
|
|
|
|
local otherPackages = [ on $(container) return $(HAIKU_OTHER_PACKAGES_IN_IMAGE) ] ;
|
|
|
|
if $(updateOnly) && ! [ IncludeAllTargetsInContainer $(container) ] {
|
|
|
|
otherPackages = [ FilterContainerUpdateTargets $(otherPackages)
|
|
|
|
: [ on $(container) return $(HAIKU_INCLUDE_IN_CONTAINER_VAR) ] ] ;
|
|
|
|
}
|
|
|
|
AddTargetVariableToScript $(script) : $(otherPackages) : otherPackages ;
|
2013-09-13 02:04:51 +04:00
|
|
|
|
|
|
|
# Generate the repository package lists and add variables for the
|
|
|
|
# repositories.
|
|
|
|
local repository ;
|
|
|
|
local repositoryFiles ;
|
|
|
|
for repository in $(HAIKU_REPOSITORIES) {
|
|
|
|
repositoryFiles
|
2016-12-10 14:51:50 +03:00
|
|
|
+= [ on $(repository) return $(HAIKU_REPOSITORY_CACHE_FILE) ] ;
|
2013-09-13 02:04:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
AddTargetVariableToScript $(script) : $(repositoryFiles) : repositories ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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-27 03:20:58 +04:00
|
|
|
rule AddDirectoryToHaikuImage directoryTokens : attributeFiles
|
2007-07-11 05:04:35 +04:00
|
|
|
{
|
2011-06-18 03:57:35 +04:00
|
|
|
# AddDirectoryToHaikuImage <directoryTokens> : <attributeFiles>
|
2007-07-27 03:20:58 +04:00
|
|
|
|
2011-06-18 03:57:35 +04:00
|
|
|
return [ AddDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) : $(attributeFiles) ] ;
|
2007-07-11 05:04:35 +04:00
|
|
|
}
|
|
|
|
|
2013-10-09 05:38:49 +04:00
|
|
|
rule AddFilesToHaikuImage directory : targets : destName : flags
|
2007-07-11 05:04:35 +04:00
|
|
|
{
|
2013-10-09 05:38:49 +04:00
|
|
|
# AddFilesToHaikuImage <directory> : <targets> : [ <destName> ]
|
|
|
|
# : [ <flags> ]
|
2007-07-11 05:04:35 +04:00
|
|
|
|
|
|
|
AddFilesToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directory)
|
2013-10-09 05:38:49 +04:00
|
|
|
: $(targets) : $(destName) : $(flags) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
}
|
|
|
|
|
2008-05-18 03:31:04 +04:00
|
|
|
rule FFilesInHaikuImageDirectory directoryTokens
|
|
|
|
{
|
|
|
|
return [ FFilesInContainerDirectory $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddSymlinkToHaikuImage directoryTokens : linkTarget : linkName
|
|
|
|
{
|
|
|
|
# AddSymlinkToHaikuImage <directory> : <link target> [ : <link name> ] ;
|
|
|
|
|
2011-06-16 11:00:06 +04:00
|
|
|
linkTarget = $(linkTarget:J=/) ;
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
AddSymlinkToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directoryTokens)
|
|
|
|
: $(linkTarget) : $(linkName) ;
|
|
|
|
}
|
|
|
|
|
2008-05-18 03:31:04 +04:00
|
|
|
rule FSymlinksInHaikuImageDirectory directoryTokens
|
|
|
|
{
|
|
|
|
return [ FSymlinksInContainerDirectory $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
}
|
|
|
|
|
2008-03-26 07:14:25 +03:00
|
|
|
rule CopyDirectoryToHaikuImage directoryTokens : sourceDirectory
|
2013-05-07 04:38:55 +04:00
|
|
|
: targetDirectoryName : excludePatterns : flags
|
2008-03-26 07:14:25 +03:00
|
|
|
{
|
|
|
|
CopyDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directoryTokens)
|
|
|
|
: $(sourceDirectory) : $(targetDirectoryName) : $(excludePatterns)
|
2013-05-07 04:38:55 +04:00
|
|
|
: $(flags) ;
|
2008-03-26 07:14:25 +03:00
|
|
|
}
|
|
|
|
|
2013-05-07 04:38:55 +04:00
|
|
|
rule AddSourceDirectoryToHaikuImage dirTokens : flags
|
2007-07-11 05:04:35 +04:00
|
|
|
{
|
2013-05-07 04:38:55 +04:00
|
|
|
# AddSourceDirectoryToHaikuImage <dirTokens> : <flags> ;
|
2007-07-11 05:04:35 +04:00
|
|
|
|
2008-03-26 07:14:25 +03:00
|
|
|
CopyDirectoryToHaikuImage home HaikuSources
|
|
|
|
: [ FDirName $(HAIKU_TOP) $(dirTokens) ]
|
2013-05-07 04:38:55 +04:00
|
|
|
: : : $(flags) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
}
|
|
|
|
|
2013-05-07 04:38:55 +04:00
|
|
|
rule AddHeaderDirectoryToHaikuImage dirTokens : dirName : flags
|
2008-02-22 13:33:43 +03:00
|
|
|
{
|
2008-03-27 02:48:41 +03:00
|
|
|
# AddHeaderDirectoryToHaikuImage <dirTokens> : [ <dirName> ]
|
2013-05-07 04:38:55 +04:00
|
|
|
# : <flags> ;
|
2008-02-22 13:33:43 +03:00
|
|
|
|
2011-06-17 16:56:35 +04:00
|
|
|
AddHeaderDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens)
|
2013-05-07 04:38:55 +04:00
|
|
|
: $(dirName) : $(flags) ;
|
2008-02-22 13:33:43 +03:00
|
|
|
}
|
|
|
|
|
2010-03-03 20:23:06 +03:00
|
|
|
rule AddWifiFirmwareToHaikuImage driver : package : archive : extract
|
2010-02-27 21:15:47 +03:00
|
|
|
{
|
2011-06-17 16:56:35 +04:00
|
|
|
# AddWifiFirmwareToHaikuImage <driver> : <package> : <archive> : <extract>
|
2010-02-27 21:15:47 +03:00
|
|
|
|
2011-06-17 16:56:35 +04:00
|
|
|
AddWifiFirmwareToHaikuImage $(HAIKU_IMAGE_CONTAINER_NAME) : $(driver)
|
|
|
|
: $(package) : $(archive) : $(extract) ;
|
2010-02-27 21:15:47 +03:00
|
|
|
}
|
|
|
|
|
2013-05-07 04:38:55 +04:00
|
|
|
rule ExtractArchiveToHaikuImage dirTokens : archiveFile : flags
|
|
|
|
: extractedSubDir
|
2007-09-05 01:50:00 +04:00
|
|
|
{
|
2013-05-07 04:38:55 +04:00
|
|
|
# ExtractArchiveToHaikuImage <dirTokens> : <archiveFile> : <flags>
|
2011-03-06 01:55:31 +03:00
|
|
|
# : <extractedSubDir> ;
|
2007-09-05 01:50:00 +04:00
|
|
|
|
2011-07-03 11:12:57 +04:00
|
|
|
ExtractArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens)
|
2013-05-07 04:38:55 +04:00
|
|
|
: $(archiveFile) : $(flags) : $(extractedSubDir) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule AddDriversToHaikuImage relativeDirectoryTokens : targets
|
|
|
|
{
|
|
|
|
# AddDriversToHaikuImage <relative directory> : <targets> ;
|
|
|
|
|
|
|
|
AddDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
|
|
|
}
|
|
|
|
|
2013-11-13 04:42:04 +04:00
|
|
|
rule AddNewDriversToHaikuImage relativeDirectoryTokens : targets : flags
|
2007-07-11 05:04:35 +04:00
|
|
|
{
|
2013-11-13 04:42:04 +04:00
|
|
|
# AddNewDriversToHaikuImage <relative directory> : <targets> : <flags> ;
|
2007-07-11 05:04:35 +04:00
|
|
|
|
2008-06-10 00:32:54 +04:00
|
|
|
AddNewDriversToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
2013-11-13 04:42:04 +04:00
|
|
|
: $(relativeDirectoryTokens) : $(targets) : $(flags) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule AddBootModuleSymlinksToHaikuImage targets
|
|
|
|
{
|
|
|
|
# AddBootModuleSymlinksToHaikuImage <targets> ;
|
|
|
|
|
|
|
|
AddBootModuleSymlinksToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(targets) ;
|
|
|
|
}
|
|
|
|
|
2013-10-09 05:47:28 +04:00
|
|
|
rule AddPackageFilesToHaikuImage location : packages : flags
|
2013-04-29 18:13:03 +04:00
|
|
|
{
|
2013-10-09 05:47:28 +04:00
|
|
|
# AddPackageFilesToHaikuImage <location> : <packages> : <flags>
|
|
|
|
#
|
|
|
|
# Supported flags:
|
|
|
|
# nameFromMetaInfo - determine the target file name from the package meta
|
|
|
|
# info
|
|
|
|
|
2013-08-10 16:55:29 +04:00
|
|
|
packages = [ FFilterByBuildFeatures $(packages) ] ;
|
2020-04-20 00:53:10 +03:00
|
|
|
|
|
|
|
if $(location[1]) = system && $(location[2]) = packages && ! $(location[3]) {
|
|
|
|
HAIKU_SYSTEM_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
= [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_SYSTEM_PACKAGES_IN_IMAGE) ]
|
|
|
|
$(packages) ;
|
|
|
|
} else {
|
|
|
|
HAIKU_OTHER_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
= [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_OTHER_PACKAGES_IN_IMAGE) ]
|
|
|
|
$(packages) ;
|
|
|
|
}
|
2013-10-09 05:47:28 +04:00
|
|
|
|
|
|
|
if nameFromMetaInfo in $(flags) {
|
2020-01-26 00:27:48 +03:00
|
|
|
AddFilesToHaikuImage $(location) : $(packages)
|
2013-10-09 05:47:28 +04:00
|
|
|
: packageFileName : computeName ;
|
|
|
|
} else {
|
2020-01-26 00:27:48 +03:00
|
|
|
AddFilesToHaikuImage $(location) : $(packages) ;
|
2013-10-09 05:47:28 +04:00
|
|
|
}
|
2013-04-29 18:13:03 +04:00
|
|
|
}
|
|
|
|
|
2007-09-05 22:36:17 +04:00
|
|
|
rule AddOptionalHaikuImagePackages packages
|
|
|
|
{
|
2009-02-24 01:33:09 +03:00
|
|
|
local package ;
|
|
|
|
for package in $(packages) {
|
|
|
|
if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] {
|
|
|
|
HAIKU_OPTIONAL_PACKAGE_ADDED on $(package) = 1 ;
|
|
|
|
HAIKU_ADDED_OPTIONAL_PACKAGES += $(package) ;
|
|
|
|
}
|
2010-03-15 19:11:47 +03:00
|
|
|
local dependencies = [ on $(package)
|
|
|
|
return $(HAIKU_OPTIONAL_PACKAGE_DEPENDENCIES) ] ;
|
|
|
|
AddOptionalHaikuImagePackages $(dependencies) ;
|
2009-02-24 01:33:09 +03:00
|
|
|
}
|
2007-09-05 22:36:17 +04:00
|
|
|
}
|
|
|
|
|
2010-08-14 20:43:55 +04:00
|
|
|
rule SuppressOptionalHaikuImagePackages packages
|
|
|
|
{
|
|
|
|
local package ;
|
|
|
|
for package in $(packages) {
|
|
|
|
if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_SUPPRESSED) ] {
|
|
|
|
HAIKU_OPTIONAL_PACKAGE_SUPPRESSED on $(package) = 1 ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-05 22:36:17 +04:00
|
|
|
rule IsOptionalHaikuImagePackageAdded package
|
|
|
|
{
|
2009-02-24 01:33:09 +03:00
|
|
|
if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_EXISTS) ] {
|
|
|
|
HAIKU_OPTIONAL_PACKAGE_EXISTS on $(package) = 1 ;
|
|
|
|
HAIKU_EXISTING_OPTIONAL_PACKAGES += $(package) ;
|
|
|
|
}
|
|
|
|
|
2010-08-14 20:43:55 +04:00
|
|
|
if [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] &&
|
|
|
|
! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_SUPPRESSED) ] {
|
2007-09-05 22:36:17 +04:00
|
|
|
return 1 ;
|
|
|
|
}
|
|
|
|
|
2009-02-24 01:33:09 +03:00
|
|
|
return ;
|
2007-09-05 22:36:17 +04:00
|
|
|
}
|
|
|
|
|
2008-03-29 18:15:18 +03:00
|
|
|
rule OptionalPackageDependencies package : dependencies
|
|
|
|
{
|
2010-03-15 19:11:47 +03:00
|
|
|
HAIKU_OPTIONAL_PACKAGE_DEPENDENCIES on $(package) = $(dependencies) ;
|
|
|
|
if [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] {
|
2008-03-29 18:15:18 +03:00
|
|
|
AddOptionalHaikuImagePackages $(dependencies) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-05 12:51:42 +04:00
|
|
|
|
2020-01-26 00:27:48 +03:00
|
|
|
rule AddHaikuImagePackages packages : directory
|
2013-07-05 12:51:42 +04:00
|
|
|
{
|
2020-01-26 00:27:48 +03:00
|
|
|
# AddHaikuImagePackages <packages> : <directory> ;
|
|
|
|
# Adds the given packages <packages> to the image in the given directory.
|
2013-07-06 20:06:02 +04:00
|
|
|
|
2013-08-10 16:55:29 +04:00
|
|
|
packages = [ FFilterByBuildFeatures $(packages) ] ;
|
|
|
|
|
2013-07-05 12:51:42 +04:00
|
|
|
local package ;
|
|
|
|
for package in $(packages) {
|
2013-08-06 05:24:14 +04:00
|
|
|
local resolvedPackage = [ IsPackageAvailable $(package) ] ;
|
|
|
|
if ! $(resolvedPackage) {
|
|
|
|
Echo "AddHaikuImagePackages: package" $(package)
|
|
|
|
"not available!" ;
|
|
|
|
continue ;
|
|
|
|
}
|
2013-07-05 12:51:42 +04:00
|
|
|
|
2013-08-06 05:24:14 +04:00
|
|
|
if ! [ on $(resolvedPackage) return $(HAIKU_PACKAGE_ADDED) ] {
|
|
|
|
HAIKU_PACKAGE_ADDED on $(resolvedPackage) = 1 ;
|
|
|
|
HAIKU_ADDED_PACKAGES += $(resolvedPackage) ;
|
2013-07-05 12:51:42 +04:00
|
|
|
|
2013-07-06 20:06:02 +04:00
|
|
|
# download the package file and add it to the image
|
2013-07-21 06:10:48 +04:00
|
|
|
local file = [ FetchPackage $(package) ] ;
|
2013-07-06 20:06:02 +04:00
|
|
|
|
|
|
|
if $(HAIKU_UPDATE_ALL_PACKAGES) {
|
|
|
|
HAIKU_INCLUDE_IN_IMAGE on $(file) = 1 ;
|
|
|
|
}
|
|
|
|
|
2020-01-26 00:27:48 +03:00
|
|
|
AddPackageFilesToHaikuImage $(directory) : $(file) ;
|
2013-07-05 12:51:42 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-01 21:25:10 +03:00
|
|
|
rule AddHaikuImageSourcePackages packages
|
|
|
|
{
|
|
|
|
# AddHaikuImageSourcePackages <packages> ;
|
|
|
|
# Adds the given source packages for <packages> to the image.
|
|
|
|
|
|
|
|
if $(HAIKU_INCLUDE_SOURCES) = 1 {
|
2020-01-26 00:27:48 +03:00
|
|
|
AddHaikuImagePackages $(packages)_source : _sources_ ;
|
2018-07-01 21:25:10 +03:00
|
|
|
}
|
|
|
|
}
|
2013-07-05 12:51:42 +04:00
|
|
|
|
2020-01-26 00:27:48 +03:00
|
|
|
rule AddHaikuImageSystemPackages packages
|
|
|
|
{
|
|
|
|
# AddHaikuImageSystemPackages <packages> ;
|
|
|
|
# Adds the given packages for <packages> to the image, in the system
|
|
|
|
# directory, so they will be activated on first boot.
|
|
|
|
|
|
|
|
AddHaikuImagePackages $(packages) : system packages ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddHaikuImageDisabledPackages packages
|
|
|
|
{
|
|
|
|
# AddHaikuImageDisabledPackages <packages> ;
|
|
|
|
# Adds the given packages for <packages> to the image, in the _packages_
|
|
|
|
# directory, so they can be later enabled in Installer.
|
|
|
|
|
|
|
|
AddHaikuImagePackages $(packages) : _packages_ ;
|
|
|
|
}
|
|
|
|
|
2013-07-05 12:51:42 +04:00
|
|
|
rule IsHaikuImagePackageAdded package
|
|
|
|
{
|
2013-08-06 05:24:14 +04:00
|
|
|
local resolvedPackage = [ IsPackageAvailable $(package) ] ;
|
|
|
|
if $(resolvedPackage)
|
|
|
|
&& [ on $(resolvedPackage) return $(HAIKU_PACKAGE_ADDED) ] {
|
2013-07-05 12:51:42 +04:00
|
|
|
return 1 ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-07 01:02:10 +04:00
|
|
|
rule BuildHaikuImagePackageList target
|
|
|
|
{
|
|
|
|
if ! $(target) {
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# get the file names of all added packages
|
|
|
|
local packageFiles ;
|
|
|
|
local package ;
|
|
|
|
for package in $(HAIKU_ADDED_PACKAGES) {
|
|
|
|
packageFiles += [ FetchPackage $(package) : nameResolved ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# extract the versioned package names (without revision)
|
2014-03-15 20:08:38 +04:00
|
|
|
packageFiles = [ Match "^([^-]*)" : $(packageFiles:B) ] ;
|
2013-08-07 01:02:10 +04:00
|
|
|
|
|
|
|
HAIKU_IMAGE_PACKAGES on $(target) = $(packageFiles) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
actions BuildHaikuImagePackageList
|
|
|
|
{
|
|
|
|
echo $(HAIKU_IMAGE_PACKAGES) | xargs -n 1 echo | LC_ALL=C sort -u > $(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-02 18:02:52 +04:00
|
|
|
rule AddEntryToHaikuImageUserGroupFile file : entry
|
|
|
|
{
|
|
|
|
local allEntries = [ on $(file) return $(HAIKU_IMAGE_USER_GROUP_ENTRIES) ] ;
|
|
|
|
|
|
|
|
if $(allEntries) {
|
|
|
|
allEntries = $(allEntries)|$(entry) ;
|
|
|
|
} else {
|
|
|
|
allEntries = $(entry) ;
|
|
|
|
|
|
|
|
Always $(file) ;
|
|
|
|
MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ;
|
|
|
|
BuildHaikuImageUserGroupFile $(file) ;
|
2013-09-30 00:09:00 +04:00
|
|
|
AddFilesToHaikuImage system settings etc : $(file) ;
|
2008-04-02 18:02:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
HAIKU_IMAGE_USER_GROUP_ENTRIES on $(file) = $(allEntries) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildHaikuImageUserGroupFile
|
|
|
|
{
|
2008-07-15 23:23:34 +04:00
|
|
|
echo "$(HAIKU_IMAGE_USER_GROUP_ENTRIES)" | tr '|' '\n' > $(1)
|
2008-04-02 18:02:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rule AddUserToHaikuImage user : uid : gid : home : shell : realName
|
|
|
|
{
|
|
|
|
if ! $(user) || ! $(uid) || ! $(gid) || ! $(home) {
|
|
|
|
Exit "Invalid haiku user specification passed to AddUserToHaikuImage." ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local entry
|
|
|
|
= $(user):x:$(uid):$(gid):$(realName:E=$(user)):$(home):$(shell:E="") ;
|
|
|
|
|
|
|
|
AddEntryToHaikuImageUserGroupFile <haiku-image>passwd : $(entry) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddGroupToHaikuImage group : gid : members
|
|
|
|
{
|
|
|
|
if ! $(group) || ! $(gid) {
|
|
|
|
Exit "Invalid haiku group specification passed to"
|
|
|
|
"AddGroupToHaikuImage." ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local entry = $(group):x:$(gid):$(members:J=,:E) ;
|
|
|
|
|
|
|
|
AddEntryToHaikuImageUserGroupFile <haiku-image>group : $(entry) ;
|
|
|
|
}
|
|
|
|
|
2010-03-02 17:41:06 +03:00
|
|
|
|
2011-06-17 16:56:35 +04:00
|
|
|
rule AddLibrariesToHaikuImage directory : libs
|
|
|
|
{
|
|
|
|
# AddLibraryToHaikuImage <directory> : <libs>
|
|
|
|
#
|
|
|
|
# Installs libraries with the appropriate links onto the image.
|
|
|
|
#
|
|
|
|
|
|
|
|
AddLibrariesToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(directory)
|
|
|
|
: $(libs) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
rule CreateHaikuImageMakeDirectoriesScript script
|
|
|
|
{
|
|
|
|
CreateContainerMakeDirectoriesScript $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateHaikuImageCopyFilesScript script
|
|
|
|
{
|
|
|
|
CreateContainerCopyFilesScript $(HAIKU_IMAGE_CONTAINER_NAME) : $(script) ;
|
|
|
|
}
|
|
|
|
|
2010-02-27 20:48:12 +03:00
|
|
|
rule CreateHaikuImageExtractFilesScript script
|
2007-09-05 01:50:00 +04:00
|
|
|
{
|
2010-02-27 21:23:52 +03:00
|
|
|
CreateContainerExtractFilesScript $(HAIKU_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(script) ;
|
2007-09-05 01:50:00 +04:00
|
|
|
}
|
|
|
|
|
2008-02-17 16:54:32 +03:00
|
|
|
rule BuildHaikuImage haikuImage : scripts : isImage : isVMwareImage
|
2005-10-29 20:27:43 +04:00
|
|
|
{
|
2008-02-17 16:54:32 +03:00
|
|
|
# BuildHaikuImage <haiku image> : <scripts> : <is image> : <isVMwareImage> ;
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
if $(isImage) = 1 || $(isImage) = true {
|
|
|
|
IS_IMAGE on $(haikuImage) = 1 ;
|
|
|
|
} else {
|
|
|
|
IS_IMAGE on $(haikuImage) = "" ;
|
|
|
|
}
|
|
|
|
|
2008-02-17 16:54:32 +03:00
|
|
|
if $(isVMwareImage) = 1 || $(isVMwareImage) = true {
|
|
|
|
IS_VMWARE_IMAGE on $(haikuImage) = 1 ;
|
|
|
|
} else {
|
|
|
|
IS_VMWARE_IMAGE on $(haikuImage) = "" ;
|
|
|
|
}
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
local mainScript = build_haiku_image ;
|
|
|
|
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
|
|
|
|
|
|
|
Depends $(haikuImage) : $(mainScript) $(scripts) ;
|
2018-11-03 06:26:11 +03:00
|
|
|
BuildHaikuImage1 $(haikuImage) : $(mainScript)
|
|
|
|
$(scripts:R=$(HAIKU_ABSOLUTE_OUTPUT_DIR)) ;
|
2005-10-29 20:27:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildHaikuImage1
|
|
|
|
{
|
2008-02-17 16:54:32 +03:00
|
|
|
export imagePath="$(1)"
|
2005-10-29 20:27:43 +04:00
|
|
|
export isImage="$(IS_IMAGE)"
|
2008-02-17 16:54:32 +03:00
|
|
|
export isVMwareImage="$(IS_VMWARE_IMAGE)"
|
2005-10-29 20:27:43 +04:00
|
|
|
$(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
|
|
|
|
{
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
$(RM) $(1)
|
2007-01-27 15:54:10 +03:00
|
|
|
$(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) ;
|
|
|
|
}
|
|
|
|
|
2008-11-14 23:26:17 +03:00
|
|
|
rule AddNewDriversToNetBootArchive relativeDirectoryTokens : targets
|
|
|
|
{
|
|
|
|
# AddNewDriversToNetBootArchive <relative directory> : <targets> ;
|
|
|
|
|
|
|
|
AddNewDriversToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
|
|
|
}
|
|
|
|
|
2007-07-11 05:04:35 +04:00
|
|
|
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
|
|
|
|
{
|
2018-05-07 03:54:32 +03:00
|
|
|
# BuildNetBootArchive <archive> : <scripts> ;
|
2007-07-11 05:04:35 +04:00
|
|
|
|
2010-03-30 09:32:50 +04:00
|
|
|
local mainScript = build_archive ;
|
2007-07-11 05:04:35 +04:00
|
|
|
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
|
|
|
|
|
|
|
Depends $(archive) : $(mainScript) $(scripts) ;
|
2018-11-03 04:46:22 +03:00
|
|
|
BuildNetBootArchive1 $(archive) : $(mainScript)
|
|
|
|
$(scripts:R=$(HAIKU_ABSOLUTE_OUTPUT_DIR)) ;
|
2007-07-11 05:04:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildNetBootArchive1
|
|
|
|
{
|
|
|
|
$(2[1]) $(1) $(2[2-])
|
|
|
|
}
|
2008-03-02 06:05:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Floppy Boot Archive rules
|
|
|
|
|
2009-05-25 05:21:32 +04:00
|
|
|
|
2008-03-02 06:05:23 +03:00
|
|
|
rule AddDirectoryToFloppyBootArchive directoryTokens
|
|
|
|
{
|
|
|
|
# AddDirectoryToFloppyBootArchive <directoryTokens>
|
|
|
|
|
|
|
|
return [ AddDirectoryToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddFilesToFloppyBootArchive directory : targets : destName
|
|
|
|
{
|
|
|
|
# AddFilesToFloppyBootArchive <directory> : <targets> [ : dest name ]
|
|
|
|
|
|
|
|
AddFilesToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) : $(directory)
|
|
|
|
: $(targets) : $(destName) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddSymlinkToFloppyBootArchive directoryTokens : linkTarget : linkName
|
|
|
|
{
|
2010-02-27 21:23:52 +03:00
|
|
|
# AddSymlinkToFloppyBootArchive <directory> : <link target>
|
|
|
|
# [ : <link name> ] ;
|
2008-03-02 06:05:23 +03:00
|
|
|
|
|
|
|
AddSymlinkToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(directoryTokens) : $(linkTarget) : $(linkName) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddDriversToFloppyBootArchive relativeDirectoryTokens : targets
|
|
|
|
{
|
|
|
|
# AddDriversToFloppyBootArchive <relative directory> : <targets> ;
|
|
|
|
|
|
|
|
AddDriversToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
|
|
|
}
|
|
|
|
|
2008-11-14 23:26:17 +03:00
|
|
|
rule AddNewDriversToFloppyBootArchive relativeDirectoryTokens : targets
|
|
|
|
{
|
|
|
|
# AddNewDriversToFloppyBootArchive <relative directory> : <targets> ;
|
|
|
|
|
|
|
|
AddNewDriversToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
|
|
|
}
|
|
|
|
|
2008-03-02 06:05:23 +03:00
|
|
|
rule AddDriverRegistrationToFloppyBootArchive relativeDirectoryTokens : target
|
|
|
|
: links
|
|
|
|
{
|
|
|
|
# AddDriverRegistrationToFloppyBootArchive <directory> : <link target>
|
|
|
|
# : <link names> ] ;
|
|
|
|
|
|
|
|
AddDriverRegistrationToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(relativeDirectoryTokens) : $(target) : $(links) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule AddBootModuleSymlinksToFloppyBootArchive targets
|
|
|
|
{
|
|
|
|
# AddBootModuleSymlinksToFloppyBootArchive <targets> ;
|
|
|
|
|
|
|
|
AddBootModuleSymlinksToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(targets) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateFloppyBootArchiveMakeDirectoriesScript script
|
|
|
|
{
|
|
|
|
CreateContainerMakeDirectoriesScript
|
|
|
|
$(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) : $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule CreateFloppyBootArchiveCopyFilesScript script
|
|
|
|
{
|
|
|
|
CreateContainerCopyFilesScript $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
|
|
|
|
: $(script) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule BuildFloppyBootArchive archive : scripts
|
|
|
|
{
|
2018-05-07 03:54:32 +03:00
|
|
|
# BuildHFloppyBootArchive <archive> : <scripts> ;
|
2008-03-02 06:05:23 +03:00
|
|
|
|
2010-03-30 09:32:50 +04:00
|
|
|
local mainScript = build_archive ;
|
2008-03-02 06:05:23 +03:00
|
|
|
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
|
|
|
|
|
|
|
Depends $(archive) : $(mainScript) $(scripts) ;
|
2018-11-03 04:46:22 +03:00
|
|
|
BuildFloppyBootArchive1 $(archive) : $(mainScript)
|
|
|
|
$(scripts:R=$(HAIKU_ABSOLUTE_OUTPUT_DIR)) ;
|
2008-03-02 06:05:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildFloppyBootArchive1
|
|
|
|
{
|
|
|
|
$(2[1]) $(1) $(2[2-])
|
|
|
|
}
|
|
|
|
|
|
|
|
# warning: that is quite x86 dependant...
|
|
|
|
|
2009-04-03 13:02:44 +04:00
|
|
|
rule BuildFloppyBootImage image : haikuLoader : archive
|
2008-03-02 06:05:23 +03:00
|
|
|
{
|
2009-04-03 13:02:44 +04:00
|
|
|
Depends $(image) : $(haikuLoader) ;
|
2008-03-02 06:05:23 +03:00
|
|
|
Depends $(image) : $(archive) ;
|
|
|
|
#MakeLocateDebug $(image) ;
|
2009-04-27 23:28:13 +04:00
|
|
|
FLOPPY_IMAGE_SIZE on $(image) = $(HAIKU_BOOT_FLOPPY_IMAGE_SIZE) ;
|
2008-11-15 06:30:00 +03:00
|
|
|
ARCHIVE_IMAGE_OFFSET on $(image) = $(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
2021-08-14 16:22:51 +03:00
|
|
|
|
|
|
|
# FreeBSD's stat command doesn't support -c/--format option
|
|
|
|
# and use %z specifier for file size
|
|
|
|
if $(HOST_PLATFORM) = freebsd || $(HOST_PLATFORM) = darwin
|
|
|
|
|| $(HOST_PLATFORM) = openbsd {
|
|
|
|
STAT_GET_SIZE = "stat -f %z" ;
|
|
|
|
} else {
|
|
|
|
STAT_GET_SIZE = "stat -c %s" ;
|
|
|
|
}
|
|
|
|
|
2009-04-03 13:02:44 +04:00
|
|
|
BuildFloppyBootImage1 $(image) : $(haikuLoader) $(archive) ;
|
2018-10-09 03:28:00 +03:00
|
|
|
if $(HAIKU_KERNEL_PLATFORM) = atari_m68k {
|
2009-04-28 00:00:28 +04:00
|
|
|
Depends $(image) : <build>fixup_tos_boot_checksum ;
|
2010-02-27 21:23:52 +03:00
|
|
|
BuildFloppyBootImageFixupM68K $(image)
|
|
|
|
: <build>fixup_tos_boot_checksum ;
|
2010-01-11 03:17:10 +03:00
|
|
|
}
|
2018-10-09 03:28:00 +03:00
|
|
|
if $(HAIKU_KERNEL_PLATFORM) = amiga_m68k {
|
2010-01-11 03:17:10 +03:00
|
|
|
Depends $(image) : <build>fixup_amiga_boot_checksum ;
|
2010-02-27 21:23:52 +03:00
|
|
|
BuildFloppyBootImageFixupM68K $(image)
|
|
|
|
: <build>fixup_amiga_boot_checksum ;
|
2009-04-28 00:00:28 +04:00
|
|
|
}
|
2008-03-02 06:05:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
actions BuildFloppyBootImage1
|
|
|
|
{
|
2021-08-14 16:22:51 +03:00
|
|
|
haiku_loader_size=`$(STAT_GET_SIZE) "$(>[1])"`
|
|
|
|
drivers_tgz_size=`$(STAT_GET_SIZE) "$(>[2])"`
|
|
|
|
|
2010-11-19 20:17:45 +03:00
|
|
|
archive_image_offset=`echo "$(ARCHIVE_IMAGE_OFFSET) * 1024" | bc`
|
2013-09-30 06:38:50 +04:00
|
|
|
floppy_tgz_size=\
|
|
|
|
`echo "($(FLOPPY_IMAGE_SIZE) - $(ARCHIVE_IMAGE_OFFSET)) * 1024" | bc`
|
2010-11-19 20:17:45 +03:00
|
|
|
if [ $haiku_loader_size -gt $archive_image_offset ] ; then
|
|
|
|
echo "Error: $(>[1]) is too big ($haiku_loader_size) to fit "
|
|
|
|
echo " before the boot archive starting at $archive_image_offset!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-09-30 06:38:50 +04:00
|
|
|
if [ $drivers_tgz_size -gt $floppy_tgz_size ] ; then
|
|
|
|
echo "Error: $(>[2]) is too big ($drivers_tgz_size) to fit "
|
|
|
|
echo " in the boot floppy ($floppy_tgz_size)!"
|
|
|
|
exit 1
|
|
|
|
fi
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
$(RM) $(<)
|
2008-03-02 06:05:23 +03:00
|
|
|
# make an empty image
|
2022-04-09 22:46:23 +03:00
|
|
|
dd if=/dev/zero of=$(<) bs=1024 count=$(FLOPPY_IMAGE_SIZE)
|
2010-11-19 20:17:45 +03:00
|
|
|
# add haiku_loader
|
|
|
|
dd if=$(>[1]) of=$(<) conv=notrunc
|
|
|
|
# add the boot drivers tgz archive
|
|
|
|
dd if=$(>[2]) of=$(<) bs=$(ARCHIVE_IMAGE_OFFSET)k seek=1 conv=notrunc
|
2008-03-02 06:05:23 +03:00
|
|
|
}
|
|
|
|
|
2010-01-11 03:17:10 +03:00
|
|
|
actions BuildFloppyBootImageFixupM68K
|
2009-04-28 00:00:28 +04:00
|
|
|
{
|
|
|
|
# fixup the boot sector checksum
|
|
|
|
$(>[1]) $(<)
|
|
|
|
}
|
2008-03-02 06:05:23 +03:00
|
|
|
|
2008-03-02 07:38:29 +03:00
|
|
|
#pragma mark - CD Boot Image rules
|
|
|
|
|
2022-10-06 11:29:55 +03:00
|
|
|
rule BuildCDBootImageEFI image : bootfloppy : bootefi : extrafiles
|
2008-03-02 07:38:29 +03:00
|
|
|
{
|
|
|
|
Depends $(image) : $(bootfloppy) ;
|
2018-10-09 03:28:00 +03:00
|
|
|
Depends $(image) : $(bootefi) ;
|
2008-03-02 07:38:29 +03:00
|
|
|
Depends $(image) : $(extrafiles) ;
|
|
|
|
BOOTIMG on $(image) = $(bootfloppy) ;
|
2020-04-20 00:53:10 +03:00
|
|
|
|
2019-02-14 23:09:24 +03:00
|
|
|
if $(HAIKU_NIGHTLY_BUILD) = 1 {
|
|
|
|
VOLID on $(image) = haiku-nightly-$(TARGET_ARCH) ;
|
|
|
|
} else {
|
|
|
|
VOLID on $(image) = haiku-$(HAIKU_VERSION)-$(TARGET_ARCH) ;
|
|
|
|
}
|
2008-03-02 07:38:29 +03:00
|
|
|
|
2022-10-06 11:29:55 +03:00
|
|
|
BOOTEFI on $(image) = $(bootefi) ;
|
|
|
|
BuildCDBootImageEFI1 $(image) : $(bootfloppy) $(bootefi) $(extrafiles) ;
|
2008-03-02 07:38:29 +03:00
|
|
|
}
|
|
|
|
|
2022-10-06 11:29:55 +03:00
|
|
|
actions BuildCDBootImageEFI1
|
2008-03-02 07:38:29 +03:00
|
|
|
{
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
$(RM) $(<)
|
2019-01-09 03:31:15 +03:00
|
|
|
xorriso -as mkisofs -b $(BOOTIMG) -eltorito-alt-boot -no-emul-boot -e $(BOOTEFI) \
|
2019-02-12 00:18:14 +03:00
|
|
|
-r -J -V $(VOLID) -o $(<) $(>[1]) $(>[2]) $(>[3-])
|
2008-03-02 07:38:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-07 05:35:46 +03:00
|
|
|
#pragma mark - CD Boot PPC Image rules
|
|
|
|
|
2010-02-27 21:23:52 +03:00
|
|
|
rule BuildCDBootPPCImage image : hfsmaps : elfloader : coffloader : chrpscript
|
|
|
|
: extrafiles
|
2008-11-07 05:35:46 +03:00
|
|
|
{
|
2008-11-11 22:22:16 +03:00
|
|
|
Depends $(image) : $(elfloader) ;
|
|
|
|
Depends $(image) : $(coffloader) ;
|
2008-11-10 00:36:07 +03:00
|
|
|
Depends $(image) : $(chrpscript) ;
|
2008-11-07 05:35:46 +03:00
|
|
|
Depends $(image) : $(extrafiles) ;
|
2008-11-07 19:45:29 +03:00
|
|
|
Depends $(image) : $(hfsmaps) ;
|
|
|
|
MAPS on $(image) = $(hfsmaps) ;
|
2019-02-14 23:09:24 +03:00
|
|
|
|
|
|
|
if $(HAIKU_NIGHTLY_BUILD) = 1 {
|
|
|
|
VOLID on $(image) = haiku-nightly-$(TARGET_ARCH) ;
|
|
|
|
} else {
|
|
|
|
VOLID on $(image) = haiku-$(HAIKU_VERSION)-$(TARGET_ARCH) ;
|
|
|
|
}
|
2008-11-07 05:35:46 +03:00
|
|
|
|
2010-02-27 21:23:52 +03:00
|
|
|
BuildCDBootPPCImage1 $(image) : $(elfloader) $(coffloader) $(chrpscript)
|
|
|
|
$(extrafiles) ;
|
2008-11-07 05:35:46 +03:00
|
|
|
}
|
|
|
|
|
2008-11-07 19:45:29 +03:00
|
|
|
actions BuildCDBootPPCImage1 bind MAPS
|
2008-11-07 05:35:46 +03:00
|
|
|
{
|
|
|
|
$(RM) $(<)
|
2021-11-02 03:23:23 +03:00
|
|
|
|
2008-11-10 00:36:07 +03:00
|
|
|
mkdir -p $(HAIKU_OUTPUT_DIR)/cd/ppc
|
2013-06-05 07:07:52 +04:00
|
|
|
mkdir -p $(HAIKU_OUTPUT_DIR)/cd/boot
|
|
|
|
# CHRP Boot script
|
2008-11-11 22:22:16 +03:00
|
|
|
cp $(>[3]) $(HAIKU_OUTPUT_DIR)/cd/ppc/bootinfo.txt
|
2013-06-05 12:24:42 +04:00
|
|
|
cp $(>[3]) $(HAIKU_OUTPUT_DIR)/cd/boot/boot.chrp
|
|
|
|
# Haiku Bootloaders
|
|
|
|
cp $(>[2]) $(HAIKU_OUTPUT_DIR)/cd/boot/haikuloader.xcf
|
|
|
|
cp $(>[1]) $(HAIKU_OUTPUT_DIR)/cd/boot/haikuloader.elf
|
2013-06-05 07:07:52 +04:00
|
|
|
# Extras (readme files, etc)
|
|
|
|
cp $(>[4]) $(HAIKU_OUTPUT_DIR)/cd/
|
|
|
|
|
2020-02-12 19:24:50 +03:00
|
|
|
# Xorriso doesn't have map and some other required tools
|
|
|
|
# to make bootable PowerPC images
|
2021-11-02 03:23:23 +03:00
|
|
|
genisoimage -v -hfs -map $(MAPS) \
|
2020-02-12 19:24:50 +03:00
|
|
|
-hfs-bless $(HAIKU_OUTPUT_DIR)/cd/boot -part -no-desktop \
|
|
|
|
-hfs-parms MAX_XTCSIZE=2656248 -hfs-volid Haiku \
|
2021-11-02 03:23:23 +03:00
|
|
|
--prep-boot boot/haikuloader.elf \
|
2020-02-12 19:24:50 +03:00
|
|
|
--chrp-boot -r -J -o $(<) $(HAIKU_OUTPUT_DIR)/cd
|
|
|
|
|
2018-03-13 23:51:38 +03:00
|
|
|
$(RM) -r $(HAIKU_OUTPUT_DIR)/cd
|
2008-11-07 05:35:46 +03:00
|
|
|
}
|
2018-10-09 03:28:00 +03:00
|
|
|
|
|
|
|
#pragma mark - EFI System Partition rules
|
|
|
|
|
|
|
|
rule BuildEfiSystemPartition image : efiLoader
|
|
|
|
{
|
2020-02-17 05:46:51 +03:00
|
|
|
local macVolumeIcon = [ FDirName
|
|
|
|
$(HAIKU_TOP) data artwork VolumeIcon.icns ] ;
|
2021-07-02 05:41:16 +03:00
|
|
|
local fatshell = <build>fat_shell ;
|
2020-02-17 05:46:51 +03:00
|
|
|
|
2018-10-09 03:28:00 +03:00
|
|
|
Depends $(image) : $(efiLoader) ;
|
2020-02-17 05:46:51 +03:00
|
|
|
Depends $(image) : $(macVolumeIcon) ;
|
2021-07-02 05:41:16 +03:00
|
|
|
Depends $(image) : $(fatshell) ;
|
2020-02-17 05:46:51 +03:00
|
|
|
|
2020-03-10 17:38:01 +03:00
|
|
|
switch $(TARGET_ARCH) {
|
2021-12-01 16:21:25 +03:00
|
|
|
case x86 :
|
|
|
|
EFINAME on $(image) = "BOOTIA32.EFI" ;
|
2020-03-10 17:38:01 +03:00
|
|
|
case x86_64 :
|
|
|
|
EFINAME on $(image) = "BOOTX64.EFI" ;
|
|
|
|
case arm :
|
|
|
|
EFINAME on $(image) = "BOOTARM.EFI" ;
|
|
|
|
case arm64 :
|
|
|
|
EFINAME on $(image) = "BOOTAA64.EFI" ;
|
|
|
|
case riscv32 :
|
|
|
|
EFINAME on $(image) = "BOOTRISCV32.EFI" ;
|
|
|
|
case riscv64 :
|
|
|
|
EFINAME on $(image) = "BOOTRISCV64.EFI" ;
|
|
|
|
case * :
|
|
|
|
Exit "Error: Unknown EFI architecture!" ;
|
|
|
|
}
|
|
|
|
|
2022-02-07 01:24:02 +03:00
|
|
|
# public efi keys for efi bios trust
|
|
|
|
EFIKEYS on $(image) = [ FDirName $(HAIKU_TOP) data boot efi keys ] ;
|
|
|
|
|
2021-07-02 05:41:16 +03:00
|
|
|
BuildEfiSystemPartition1 $(image) : $(fatshell) $(macVolumeIcon) $(efiLoader) ;
|
2018-10-09 03:28:00 +03:00
|
|
|
}
|
|
|
|
|
2021-07-02 05:41:16 +03:00
|
|
|
# Usage:
|
|
|
|
# out : fatshell volumeIcon loader
|
2018-10-09 03:28:00 +03:00
|
|
|
actions BuildEfiSystemPartition1
|
|
|
|
{
|
|
|
|
$(RM) $(<)
|
2021-07-02 05:41:16 +03:00
|
|
|
|
|
|
|
export $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
|
2018-10-09 03:28:00 +03:00
|
|
|
dd if=/dev/zero of=$(<) bs=1024 count=2880
|
2021-07-02 05:41:16 +03:00
|
|
|
|
|
|
|
FATFS="$(2[1])"
|
|
|
|
EFIICON="$(2[2])"
|
|
|
|
LOADER="$(2[3])"
|
|
|
|
|
|
|
|
${FATFS} --initialize "$(<)" 'Haiku ESP'
|
|
|
|
echo "mkdir myfs/EFI" | ${FATFS} $(<)
|
2022-02-07 01:24:02 +03:00
|
|
|
echo "mkdir myfs/KEYS" | ${FATFS} $(<)
|
2021-07-02 05:41:16 +03:00
|
|
|
echo "mkdir myfs/EFI/BOOT" | ${FATFS} $(<)
|
2022-02-07 01:24:02 +03:00
|
|
|
|
2021-07-02 05:41:16 +03:00
|
|
|
echo "cp :${LOADER} myfs/EFI/BOOT/$(EFINAME)" | ${FATFS} $(<)
|
|
|
|
echo "cp :${EFIICON} myfs/.VolumeIcon.icns" | ${FATFS} $(<)
|
2022-02-07 01:24:02 +03:00
|
|
|
|
|
|
|
# Copy UEFI signing keys and a README for end users
|
|
|
|
echo "cp :$(EFIKEYS)/README.md myfs/KEYS/README.md" | ${FATFS} $(<)
|
|
|
|
for i in auth cer crt; do
|
|
|
|
echo "cp :$(EFIKEYS)/DB.$i myfs/KEYS/DB.$i" | ${FATFS} $(<)
|
|
|
|
done
|
2018-10-09 03:28:00 +03:00
|
|
|
}
|