bootstrap image: build needed source packages and add them
* IsPackageAvailable, FetchPackage: Add flags parameter. The only flag supported ATM is nameResolved, indicating that the specified package name does not need to be resolved with respect to a secondary architecture anymore. * Add build profile action "build-package-list". As an argument the file to which the list of all packages needed for the image is written. The rule BuildHaikuImagePackageList implements the action. * BuildBootstrapRepositoryConfig: Does now require the variable HAIKU_REPOSITORY_TREE_PATH to be set on the config file target instead of hard-coding the path. Allows reuse of the actions. * Add rules BuildHaikuPortsSourcePackageDirectory and BuildHaikuPortsRepositoryConfig. The former builds all HaikuPorts source packages needed to build the packages for an alpha image. The latter generates a haikuports.conf file for use on the bootstrap Haiku. * HaikuImageBootstrap: Add directory /boot/home/haikuports which contains a subdirectory with the source packages and a haikuports.conf.
This commit is contained in:
parent
384230184e
commit
c965ee60b5
@ -1035,6 +1035,32 @@ rule IsHaikuImagePackageAdded package
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
packageFiles = [ Match "(.*)-[^-]*-[^-]*" : $(packageFiles:B) ] ;
|
||||
|
||||
HAIKU_IMAGE_PACKAGES on $(target) = $(packageFiles) ;
|
||||
}
|
||||
|
||||
|
||||
actions BuildHaikuImagePackageList
|
||||
{
|
||||
echo $(HAIKU_IMAGE_PACKAGES) | xargs -n 1 echo | LC_ALL=C sort -u > $(1)
|
||||
}
|
||||
|
||||
|
||||
rule InstallSourceArchive file : url
|
||||
{
|
||||
if $(HAIKU_INCLUDE_SOURCES) = 1 {
|
||||
|
@ -423,6 +423,12 @@ rule DefineBuildProfile name : type : path {
|
||||
HAIKU_UPDATE_ALL_PACKAGES = 1 ;
|
||||
}
|
||||
|
||||
case "build-package-list" : {
|
||||
HAIKU_IMAGE_LIST_PACKAGES_TARGET
|
||||
= $(HAIKU_BUILD_PROFILE_PARAMETERS) ;
|
||||
JAM_TARGETS = $(HAIKU_IMAGE_LIST_PACKAGES_TARGET) ;
|
||||
}
|
||||
|
||||
case "mount" : {
|
||||
if $(type) in "install" "cd-image" {
|
||||
Exit "Build action \"mount\" not supported for profile type"
|
||||
|
@ -323,7 +323,7 @@ actions BuildBootstrapRepositoryConfig
|
||||
{
|
||||
cat > $(1) << EOF
|
||||
PACKAGER="The Haiku build system <build-system@haiku-os.org>"
|
||||
TREE_PATH="$(HAIKU_PORTS_CROSS)"
|
||||
TREE_PATH="$(HAIKU_REPOSITORY_TREE_PATH)"
|
||||
TARGET_ARCHITECTURE="$(HAIKU_PACKAGING_ARCH)"
|
||||
|
||||
DOWNLOAD_IN_PORT_DIRECTORY="yes"
|
||||
@ -410,6 +410,7 @@ rule BootstrapPackageRepository repository : architecture
|
||||
Depends $(configFile) : <build>package <build>mimeset <mimedb>mime_db ;
|
||||
HAIKU_REPOSITORY_BUILD_DIRECTORY on $(configFile) = $(outputDir) ;
|
||||
HAIKU_PACKAGING_ARCH on $(configFile) = $(architecture) ;
|
||||
HAIKU_REPOSITORY_TREE_PATH on $(configFile) = $(HAIKU_PORTS_CROSS) ;
|
||||
BuildBootstrapRepositoryConfig $(configFile)
|
||||
: <build>package <build>mimeset <mimedb>mime_db ;
|
||||
|
||||
@ -447,10 +448,11 @@ rule FSplitPackageName packageName
|
||||
}
|
||||
|
||||
|
||||
rule IsPackageAvailable package
|
||||
rule IsPackageAvailable package : flags
|
||||
{
|
||||
# for a secondary architecture adjust the package name
|
||||
if $(TARGET_PACKAGING_ARCH) != $(TARGET_PACKAGING_ARCHS[1]) {
|
||||
if $(TARGET_PACKAGING_ARCH) != $(TARGET_PACKAGING_ARCHS[1])
|
||||
&& ! nameResolved in $(flags) {
|
||||
local splitName = [ FSplitPackageName $(package) ] ;
|
||||
splitName = $(splitName[1]) $(TARGET_PACKAGING_ARCH) $(splitName[2-]) ;
|
||||
package = $(splitName:J=_) ;
|
||||
@ -464,9 +466,9 @@ rule IsPackageAvailable package
|
||||
}
|
||||
|
||||
|
||||
rule FetchPackage packageName
|
||||
rule FetchPackage packageName : flags
|
||||
{
|
||||
local foundPackageName = [ IsPackageAvailable $(packageName) ] ;
|
||||
local foundPackageName = [ IsPackageAvailable $(packageName) : $(flags) ] ;
|
||||
if ! $(foundPackageName) {
|
||||
Exit "DownloadPackage: package" $(packageName) "not available!" ;
|
||||
return ;
|
||||
@ -485,3 +487,123 @@ rule FetchPackage packageName
|
||||
return [ InvokeRepositoryMethod $(repository) : FetchPackage : $(package)
|
||||
: $(fileName) ] ;
|
||||
}
|
||||
|
||||
|
||||
rule BuildHaikuPortsSourcePackageDirectory
|
||||
{
|
||||
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||
local outputDir = [ FDirName
|
||||
$(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture))
|
||||
HaikuPorts-sources-build ] ;
|
||||
|
||||
local sourcePackageDir = <HaikuPorts-repository-source-packages>packages ;
|
||||
MakeLocate $(sourcePackageDir) : $(outputDir) ;
|
||||
|
||||
# build the package list file
|
||||
local packageList
|
||||
= <repository-package-list-HaikuPorts-sources>package_list ;
|
||||
MakeLocate $(packageList) : $(outputDir) ;
|
||||
Depends $(packageList) :
|
||||
[ FDirName $(HAIKU_BUILD_RULES_DIR) repositories HaikuPorts
|
||||
$(architecture) ] ;
|
||||
BuildHaikuPortsPackageList $(packageList) ;
|
||||
|
||||
# prepare the config file for the HaikuPorts build
|
||||
local configFile = <repository-config-HaikuPorts-sources>haikuports.conf ;
|
||||
MakeLocate $(configFile) : $(outputDir) ;
|
||||
NoUpdate $(configFile) ;
|
||||
Depends $(configFile) : <build>package <build>mimeset <mimedb>mime_db ;
|
||||
HAIKU_REPOSITORY_BUILD_DIRECTORY on $(configFile) = $(outputDir) ;
|
||||
HAIKU_PACKAGING_ARCH on $(configFile) = $(architecture) ;
|
||||
HAIKU_REPOSITORY_TREE_PATH on $(configFile) = $(HAIKU_PORTS) ;
|
||||
BuildBootstrapRepositoryConfig $(configFile)
|
||||
: <build>package <build>mimeset <mimedb>mime_db ;
|
||||
|
||||
# get Haiku cross-devel packages and build the sources
|
||||
local crossDevelPackageSuffixes = $(architecture)
|
||||
$(architecture)_$(HAIKU_PACKAGING_ARCHS[2-]) ;
|
||||
local haikuCrossDevelPackages
|
||||
= haiku_cross_devel_sysroot_stage1_$(crossDevelPackageSuffixes).hpkg ;
|
||||
|
||||
HAIKU_REPOSITORY_BUILD_DIRECTORY on $(sourcePackageDir) = $(outputDir) ;
|
||||
|
||||
Depends $(sourcePackageDir) : $(packageList) $(haikuCrossDevelPackages)
|
||||
$(configFile) ;
|
||||
BuildHaikuPortsSourcePackageDirectory1 $(sourcePackageDir)
|
||||
: $(packageList) $(haikuCrossDevelPackages) ;
|
||||
|
||||
return $(sourcePackageDir) ;
|
||||
}
|
||||
|
||||
|
||||
actions BuildHaikuPortsPackageList
|
||||
{
|
||||
HAIKU_BOOTSTRAP_BUILD= $(JAM:E=jam) @alpha-raw build-package-list $(1)
|
||||
}
|
||||
|
||||
|
||||
actions BuildHaikuPortsSourcePackageDirectory1
|
||||
{
|
||||
packageList="$(2[1])"
|
||||
|
||||
# make Haiku cross devel package path absolute
|
||||
haikuCrossDevelPackage="$(2[2])"
|
||||
if [[ "$haikuCrossDevelPackage" != /* ]]; then
|
||||
haikuCrossDevelPackage="`pwd`/$haikuCrossDevelPackage"
|
||||
fi
|
||||
|
||||
# make secondary Haiku cross devel packages path absolute
|
||||
secondaryCrossDevelPackages=
|
||||
if [ -n "$(2[3-]:J)" ]; then
|
||||
for secondaryCrossDevelPackage in "$(2[3-])" ; do
|
||||
if [[ "$secondaryCrossDevelPackage" != /* ]]; then
|
||||
secondaryCrossDevelPackage="`pwd`/$secondaryCrossDevelPackage"
|
||||
fi
|
||||
if [ -n "$secondaryCrossDevelPackages" ]; then
|
||||
secondaryCrossDevelPackages="secondaryCrossDevelPackages,$secondaryCrossDevelPackage"
|
||||
else
|
||||
secondaryCrossDevelPackages="--secondary-cross-devel-package=$secondaryCrossDevelPackage"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
cd $(HAIKU_REPOSITORY_BUILD_DIRECTORY)
|
||||
|
||||
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
if [ -n "$secondaryCrossDevelPackages" ]; then
|
||||
$(HOST_HAIKU_PORTER) --cross-devel-package "$haikuCrossDevelPackage" \
|
||||
"$secondaryCrossDevelPackages" --only-source-packages \
|
||||
--portsfile $packageList
|
||||
else
|
||||
$(HOST_HAIKU_PORTER) --cross-devel-package "$haikuCrossDevelPackage" \
|
||||
--only-source-packages --portsfile $packageList
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
rule BuildHaikuPortsRepositoryConfig treePath
|
||||
{
|
||||
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||
local outputDir = [ FDirName
|
||||
$(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture))
|
||||
HaikuPorts-bootstrap ] ;
|
||||
|
||||
local configFile = <repository-config-HaikuPorts-bootstrap>haikuports.conf ;
|
||||
MakeLocate $(configFile) : $(outputDir) ;
|
||||
NoUpdate $(configFile) ;
|
||||
|
||||
HAIKU_REPOSITORY_TREE_PATH on $(configFile) = $(treePath) ;
|
||||
BuildHaikuPortsRepositoryConfig1 $(configFile) ;
|
||||
|
||||
return $(configFile) ;
|
||||
}
|
||||
|
||||
|
||||
actions BuildHaikuPortsRepositoryConfig1
|
||||
{
|
||||
cat > $(1) << EOF
|
||||
PACKAGER="The Haiku build system <build-system@haiku-os.org>"
|
||||
TREE_PATH="$(HAIKU_REPOSITORY_TREE_PATH)"
|
||||
TARGET_ARCHITECTURE="$(HAIKU_PACKAGING_ARCH)"
|
||||
EOF
|
||||
}
|
||||
|
@ -179,6 +179,14 @@ AddPackageFilesToHaikuImage system :
|
||||
AddPackageFilesToHaikuImage system : haiku_loader.hpkg ;
|
||||
|
||||
|
||||
# build and add the source package directory and a haikuports.config file
|
||||
CopyDirectoryToHaikuImage home haikuports
|
||||
: [ BuildHaikuPortsSourcePackageDirectory ]
|
||||
: input-source-packages : : isTarget ;
|
||||
AddFilesToHaikuImage home haikuports
|
||||
: [ BuildHaikuPortsRepositoryConfig /boot/home/haikuports ] ;
|
||||
|
||||
|
||||
AddSymlinkToHaikuImage home Desktop : /boot/home : Home ;
|
||||
|
||||
# global settings when a package is installed in ~/config
|
||||
|
@ -195,5 +195,10 @@ _BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ;
|
||||
NotFile haiku-vmware-image ;
|
||||
Depends haiku-vmware-image : $(HAIKU_VMWARE_IMAGE) ;
|
||||
|
||||
|
||||
# create a package list
|
||||
BuildHaikuImagePackageList $(HAIKU_IMAGE_LIST_PACKAGES_TARGET) ;
|
||||
|
||||
|
||||
# Execute post-image user config rules.
|
||||
UserBuildConfigRulePostImage ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user