build features/bootstrap repo: support secondary arch

* Add rule FSplitPackageName. It splits a package name into port name
  and package suffix.
* FSetConditionsHold: Rename to FConditionsHold and replace the set
  parameter by a predicate rule parameter, thus adding more flexibility.
* FIsBuildFeatureEnabled: Use the faster check.
* Add rule FQualifiedBuildFeatureName. Given a build feature name, it
  prepends the current packaging architecture to yield a qualified
  feature name. Is used by the other build feature rules so that the
  same build feature can be configured differently for each arch.
* ExtractBuildFeatureArchives: The supplied list is now filtered via
  FFilterByBuildFeatures, allowing for build feature conditions in the
  list.
* Add rule InitArchitectureBuildFeatures. It is called early for each
  configured architecture, setting up some basic build features for it.
  "primary" is set for the primary architecture and a "secondary_<arch>"
  is set for each secondary architecture.
* BuildFeatures: Add secondary architecture support: Use the correct
  paths for libraries and headers (subdir for secondary architecture)
  and configure the icu and zlib sources only for the primary
  architecture.
* BootstrapPackageRepository: The package lists are now filtered via
  FFilterByBuildFeatures, allowing for build feature conditions in the
  lists.
* IsPackageAvailable, FetchPackage: Add secondary architecture support.
* HaikuPortsCross/x86_gcc2: Add icu and zlib x86 secondary packages.

The second stage Haiku cross devel package for the secondary
architecture can now be built.
This commit is contained in:
Ingo Weinhold
2013-08-05 07:09:45 +02:00
parent 7bd562abc9
commit 93cfb72270
6 changed files with 210 additions and 97 deletions
+55 -18
View File
@@ -1,3 +1,14 @@
rule FQualifiedBuildFeatureName features
{
# FQualifiedBuildFeatureName <features>
#
# Prepends the name of the current target packaging architecture to the
# given feature names.
return $(TARGET_PACKAGING_ARCH):$(features) ;
}
rule FIsBuildFeatureEnabled feature
{
# FIsBuildFeatureEnabled <feature> ;
@@ -6,11 +17,8 @@ rule FIsBuildFeatureEnabled feature
#
# <feature> - The name of the build feature (all lower case).
if $(feature) in $(HAIKU_BUILD_FEATURES) {
return 1 ;
}
return ;
feature = [ FQualifiedBuildFeatureName $(feature) ] ;
return $(HAIKU_BUILD_FEATURE_$(feature:U)_ENABLED) ;
}
@@ -39,8 +47,7 @@ rule FMatchesBuildFeatures specification
for element in $(specification) {
splitSpecification += [ FSplitString $(element) : "," ] ;
}
return [ FSetConditionsHold $(splitSpecification)
: $(HAIKU_BUILD_FEATURES) ] ;
return [ FConditionsHold $(splitSpecification) : FIsBuildFeatureEnabled ] ;
}
@@ -146,9 +153,10 @@ rule EnableBuildFeatures features : specification
# <specification> - An optional build features specification (cf.
# FMatchesBuildFeatures).
features = [ FQualifiedBuildFeatureName $(features) ] ;
if ! $(specification)
|| [ FMatchesBuildFeatures $(specification)
: $(HAIKU_BUILD_FEATURES) ] {
|| [ FMatchesBuildFeatures $(specification) ] {
local feature ;
for feature in $(features) {
HAIKU_BUILD_FEATURES += $(feature) ;
@@ -164,6 +172,8 @@ rule BuildFeatureObject feature
# Returns a unique object for the given build feature. It is used for
# attaching attribute values to it.
feature = [ FQualifiedBuildFeatureName $(feature) ] ;
local featureObject = $(HAIKU_BUILD_FEATURE_$(feature:U)) ;
if ! $(featureObject) {
featureObject = [ NewUniqueTarget ] ;
@@ -286,14 +296,8 @@ rule ExtractBuildFeatureArchivesExpandValue value : fileName
}
# get the port name from the package name
splitName = [ Match "(.*)_([^_]*)" : $(%packageName%) ] ;
local knownPackageSuffixes = devel doc source debuginfo ;
if $(splitName[2])
&& $(splitName[2]) in $(knownPackageSuffixes) {
%portName% = $(splitName[1]) ;
} else {
%portName% = $(%packageName%) ;
}
splitName = [ FSplitPackageName $(%packageName%) ] ;
%portName% = $(splitName[1]) ;
}
value = "$(value)$($(component):E=)" ;
@@ -349,6 +353,9 @@ rule ExtractBuildFeatureArchives feature : list
# The rule also sets the build feature attribute "<packageAlias>:directory"
# to the extraction directory for each package.
local qualifiedFeature = [ FQualifiedBuildFeatureName $(feature) ] ;
list = [ FFilterByBuildFeatures $(list) ] ;
while $(list) {
if $(list[1]) != file: {
Exit "ExtractBuildFeatureArchives: Expected \"file: ...\", got:"
@@ -405,7 +412,7 @@ rule ExtractBuildFeatureArchives feature : list
SetBuildFeatureAttribute $(feature) : $(attribute)
: [ ExtractArchive $(directory)
: $(values) : $(file)
: extracted-$(feature)-$(package) ] ;
: extracted-$(qualifiedFeature)-$(package) ] ;
SetBuildFeatureAttribute $(feature) : $(attribute):package
: $(package) ;
}
@@ -415,3 +422,33 @@ rule ExtractBuildFeatureArchives feature : list
: $(directory:G=) ;
}
}
rule InitArchitectureBuildFeatures architecture
{
# InitArchitectureBuildFeatures <architecture> ;
#
# Enable the build features that can be derived directly from the
# architecture.
# The build feature rule use TARGET_PACKAGING_ARCH, so set that temporarily.
local savedArchitecture = $(TARGET_PACKAGING_ARCH) ;
TARGET_PACKAGING_ARCH = $(architecture) ;
# Add the target architecture as a build feature.
EnableBuildFeatures $(TARGET_ARCH_$(architecture)) ;
# For the primary architecture add the "primary" build feature.
if $(architecture) = $(TARGET_PACKAGING_ARCHS[1]) {
EnableBuildFeatures primary ;
}
# Add all secondary architectures as build features (with prefix).
EnableBuildFeatures secondary_$(TARGET_PACKAGING_ARCHS[2-]) ;
if $(TARGET_GCC_VERSION_$(architecture)[1]) = 2 {
EnableBuildFeatures gcc2 ;
}
TARGET_PACKAGING_ARCH = $(savedArchitecture) ;
}