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) ;
}
+52 -52
View File
@@ -1,22 +1,12 @@
# This file contains setup for build features that are not available for all
# architectures/setups or that are optional for the build. For features that
# require downloading a zip file from somewhere it is likely the same file used
# for an optional package.
# This file contains setup for build features that require external packages. It
# is included once for each configured packaging architecture (with
# TARGET_PACKAGING_ARCH set accordingly).
local architecture = $(TARGET_PACKAGING_ARCH) ;
# Add the target architecture as a build feature.
EnableBuildFeatures $(TARGET_ARCH_$(architecture)) ;
if $(TARGET_GCC_VERSION_$(architecture)[1]) = 2 {
EnableBuildFeatures gcc2 ;
}
local baseURL = http://www.haiku-files.org/files/optional-packages ;
local hpkgBaseURL = http://haiku-files.org/files/hpkg ;
local secondaryArchSubDir = [ MultiArchIfPrimary "" : /$(architecture) ] ;
local developLibDir = develop/lib$(secondaryArchSubDir) ;
local developHeadersDir = develop/headers$(secondaryArchSubDir) ;
# SSL
@@ -33,8 +23,10 @@ if $(HAIKU_BUILD_FEATURE_SSL) {
runtime: lib
file: devel openssl_devel
depends: base
libraries: develop/lib/libcrypto.so develop/lib/libssl.so
headers: develop/headers
libraries:
$(developLibDir)/libcrypto.so
$(developLibDir)/libssl.so
headers: $(developHeadersDir)
;
EnableBuildFeatures openssl ;
@@ -54,14 +46,14 @@ if [ IsPackageAvailable icu_devel ] {
file: devel icu_devel
depends: base
libraries:
develop/lib/libicudata.so
develop/lib/libicui18n.so
develop/lib/libicuio.so
develop/lib/libicule.so
develop/lib/libiculx.so
develop/lib/libicutu.so
develop/lib/libicuuc.so
headers: develop/headers
$(developLibDir)/libicudata.so
$(developLibDir)/libicui18n.so
$(developLibDir)/libicuio.so
$(developLibDir)/libicule.so
$(developLibDir)/libiculx.so
$(developLibDir)/libicutu.so
$(developLibDir)/libicuuc.so
headers: $(developHeadersDir)
;
EnableBuildFeatures icu ;
@@ -244,8 +236,8 @@ if [ IsPackageAvailable glu_devel ] {
runtime: lib
file: devel glu_devel
depends: base
library: develop/lib/libGLU.so
headers: develop/headers
library: $(developLibDir)/libGLU.so
headers: $(developHeadersDir)
;
EnableBuildFeatures glu ;
@@ -258,19 +250,19 @@ if [ IsPackageAvailable glu_devel ] {
if [ IsPackageAvailable mesa_devel ] {
ExtractBuildFeatureArchives mesa : [ FFilterByBuildFeatures
file: devel mesa_devel
mesaLibrary: develop/lib/libmesa.a
glapiLibrary: develop/lib/libglapi.a
headers: develop/headers
privateHeaders: develop/headers/mesa_private
mesaLibrary: $(developLibDir)/libmesa.a
glapiLibrary: $(developLibDir)/libglapi.a
headers: $(developHeadersDir)
privateHeaders: $(developHeadersDir)/mesa_private
!gcc2 @{
glslLibrary: develop/lib/libglsl.a
galliumLibrary: develop/lib/libgallium.a
glslLibrary: $(developLibDir)/libglsl.a
galliumLibrary: $(developLibDir)/libgallium.a
llvm @{
galliumLlvmpipeLibrary: develop/lib/libllvmpipe.a
galliumLlvmpipeLibrary: $(developLibDir)/libllvmpipe.a
}@
!llvm @{
galliumSoftpipeLibrary: develop/lib/libsoftpipe.a
galliumSoftpipeLibrary: $(developLibDir)/libsoftpipe.a
}@
}@ # !gcc2
] ;
@@ -301,8 +293,8 @@ if [ IsPackageAvailable ffmpeg_devel ] {
runtime: lib
file: devel $(feature)_devel
depends: base
libraries: develop/lib/$($(feature)Libs)
headers: develop/headers
libraries: $(developLibDir)/$($(feature)Libs)
headers: $(developHeadersDir)
;
EnableBuildFeatures $(feature) ;
@@ -319,8 +311,8 @@ if [ IsPackageAvailable freetype_devel ] {
runtime: lib
file: devel freetype_devel
depends: base
library: develop/lib/libfreetype.so
headers: develop/headers develop/headers/freetype2
library: $(developLibDir)/libfreetype.so
headers: $(developHeadersDir) $(developHeadersDir)/freetype2
;
EnableBuildFeatures freetype ;
@@ -442,8 +434,8 @@ if [ IsPackageAvailable libpng_devel ] {
runtime: lib
file: devel libpng_devel
depends: base
library: develop/lib/libpng.so
headers: develop/headers
library: $(developLibDir)/libpng.so
headers: $(developHeadersDir)
;
EnableBuildFeatures libpng ;
@@ -459,8 +451,8 @@ if [ IsPackageAvailable jpeg_devel ] {
runtime: lib
file: devel jpeg_devel
depends: base
library: develop/lib/libjpeg.so
headers: develop/headers
library: $(developLibDir)/libjpeg.so
headers: $(developHeadersDir)
;
EnableBuildFeatures jpeg ;
@@ -476,10 +468,13 @@ if [ IsPackageAvailable zlib_devel ] {
runtime: lib
file: devel zlib_devel
depends: base
library: develop/lib/libz.so
headers: develop/headers
file: source zlib_source
sources: develop/sources/%portRevisionedName%/source
library: $(developLibDir)/libz.so
headers: $(developHeadersDir)
# sources are required for the primary architecture only
primary @{
file: source zlib_source
sources: develop/sources/%portRevisionedName%/source
}@
;
EnableBuildFeatures zlib ;
@@ -495,10 +490,15 @@ if [ IsPackageAvailable libsolv_devel ] {
runtime: lib
file: devel libsolv_devel
depends: base
libraries: develop/lib/libsolv.so develop/lib/libsolvext.so
headers: develop/headers
file: source libsolv_source
sources: develop/sources/%portRevisionedName%/source
libraries:
$(developLibDir)/libsolv.so
$(developLibDir)/libsolvext.so
headers: $(developHeadersDir)
# sources are required for the primary architecture only
primary @{
file: source libsolv_source
sources: develop/sources/%portRevisionedName%/source
}@
;
EnableBuildFeatures libsolv ;
+7
View File
@@ -900,6 +900,13 @@ for architecture in $(TARGET_PACKAGING_ARCHS) {
}
# set up architecture build features
local architecture ;
for architecture in $(TARGET_PACKAGING_ARCHS) {
InitArchitectureBuildFeatures $(architecture) ;
}
# The following directories cannot currently be compiled with DEBUG=1
SetConfigVar DEBUG : HAIKU_TOP src add-ons disk_systems bfs : 0 : local ;
SetConfigVar DEBUG : HAIKU_TOP src add-ons kernel drivers audio hda : 0 : local ;
+16 -14
View File
@@ -97,26 +97,28 @@ rule FSplitPath
}
rule FSetConditionsHold conditions : set
rule FConditionsHold conditions : predicate
{
# FSetConditionsHold <conditions> : <set> ;
# Checks whether the conditions <conditions> are satisfied by the list of
# elements <set> and returns a respective result (if so: "1", if not: empty
# list). The conditions are satisfied when <conditions> is not empty and
# FConditionsHold <conditions> : <predicate> ;
# Checks whether the conditions <conditions> are satisfied by the predicate
# rule <predicate> and returns a respective result (if so: "1", if not:
# empty list). The conditions are satisfied when <conditions> is not empty
# and
# * none of the negative conditions it contains hold and
# * if <conditions> contains any positive conditions, at least one one of
# those holds.
# * if <conditions> contains any positive conditions, at least one of those
# holds.
# A positive condition is an element not starting with a "!". It holds when
# the element is contained in <set>.
# the predicate rule <predicate> returns true for the element.
# A negative condition is an element that starts with a "!". It holds when
# the string resulting from removing the leading "!" is not contained in
# <set>.
# the predicate rule <predicate> returns true for the string resulting from
# removing the leading "!".
#
# <conditions> - The list of conditions.
# <set> - The elements against which the conditions are tested.
# <predicate> - The predicate rule invoked to test the elements.
#
# Examples:
# For set { a b c } the following conditions hold:
# For a predicate that holds for the elements of the set { a b c } the
# following conditions hold:
# { a }, { a d }, { !d }, { !d !e }, { a !d }, { b !e !f }
# The following conditions don't hold:
# { }, { d }, { d e }, { !a }, { !a b }, { !d e } { a b !c !d }
@@ -131,14 +133,14 @@ rule FSetConditionsHold conditions : set
{
hasNegative = 1 ;
condition = [ Match "!(.*)" : $(condition) ] ;
if $(condition) in $(set) {
if [ $(predicate) $(condition) ] {
return ;
}
}
case * :
{
hasPositive = 1 ;
if $(condition) in $(set) {
if [ $(predicate) $(condition) ] {
positiveMatch = 1 ;
}
}
+73 -13
View File
@@ -244,8 +244,8 @@ rule BootstrapRepositoryFetchPackage repository : package : fileName
= [ on $(repository) return $(HAIKU_REPOSITORY_BUILD_DIRECTORY) ] ;
local configFile
= [ on $(repository) return $(HAIKU_REPOSITORY_BUILD_CONFIG_FILE) ] ;
local haikuCrossDevelPackage = [ on $(package)
return $(HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGE) ] ;
local haikuCrossDevelPackages = [ on $(package)
return $(HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES) ] ;
local packageFile = <cross-built>$(fileName) ;
if [ on $(packageFile) return $(HAIKU_REPOSITORY_BUILD_DIRECTORY) ] {
@@ -261,9 +261,9 @@ rule BootstrapRepositoryFetchPackage repository : package : fileName
# a dependency and is updated always, this package would otherwise be
# rebuilt always as well.
Depends $(packageFile) : $(haikuCrossDevelPackage) $(configFile) ;
Depends $(packageFile) : $(haikuCrossDevelPackages) $(configFile) ;
BootstrapRepositoryFetchPackage1 $(packageFile)
: $(haikuCrossDevelPackage) ;
: $(haikuCrossDevelPackages) ;
return $(packageFile) ;
}
@@ -278,11 +278,26 @@ actions BootstrapRepositoryFetchPackage1
fi
# make Haiku cross devel package path absolute
haikuCrossDevelPackage="$(2)"
haikuCrossDevelPackage="$(2[1])"
if [[ "$haikuCrossDevelPackage" != /* ]]; then
haikuCrossDevelPackage="`pwd`/$haikuCrossDevelPackage"
fi
# make secondary Haiku cross devel packages path absolute
secondaryCrossDevelPackages=
if [ -n "$(2[2-]:J)" ]; then
for secondaryCrossDevelPackage in "$(2[2-])" ; 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
# determine the portName
portName=`basename "$package" | sed 's@-.*@@'`
case $portName in
@@ -295,7 +310,7 @@ actions BootstrapRepositoryFetchPackage1
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(HOST_HAIKU_PORTER) --cross-devel-package "$haikuCrossDevelPackage" \
$portName
"$secondaryCrossDevelPackages" $portName
}
@@ -321,9 +336,27 @@ EOF
$(HAIKU_GCC_MACHINE_$(HAIKU_PACKAGING_ARCH))-gcc ]; then
dir=`dirname $gcc`
dir=`dirname $dir`
echo CROSS_TOOLS="$dir" >> $(1)
echo CROSS_TOOLS=\"$dir\" >> $(1)
fi
fi
# Add secondary architectures and cross tools.
secondaryArchs="$(HAIKU_PACKAGING_ARCHS[2-]:E=)"
if [ -n "$secondaryArchs" ]; then
echo SECONDARY_TARGET_ARCHITECTURES=\" >> $(1)
for arch in $secondaryArchs; do
echo " $arch" >> $(1)
done
echo \" >> $(1)
echo SECONDARY_CROSS_TOOLS=\" >> $(1)
for gcc in $(HAIKU_CC_$(HAIKU_PACKAGING_ARCHS[2-])); do
dir=`dirname $gcc`
dir=`dirname $dir`
echo " $dir" >> $(1)
done
echo \" >> $(1)
fi
}
@@ -332,6 +365,10 @@ rule BootstrapPackageRepository repository : architecture
: debugInfoPackages
{
repository = $(repository:G=repository) ;
packagesStage1 = [ FFilterByBuildFeatures $(packagesStage1) ] ;
packagesStage2 = [ FFilterByBuildFeatures $(packagesStage2) ] ;
sourcePackages = [ FFilterByBuildFeatures $(sourcePackages) ] ;
debugInfoPackages = [ FFilterByBuildFeatures $(debugInfoPackages) ] ;
SetRepositoryMethod $(repository) : PackageFamily
: BootstrapRepositoryPackageFamily ;
@@ -345,15 +382,17 @@ rule BootstrapPackageRepository repository : architecture
if ! $(stage1PackageTargets) {
return ;
}
HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGE on $(stage1PackageTargets)
= haiku_cross_devel_sysroot_stage1_$(architecture).hpkg ;
local crossDevelPackageSuffixes = $(architecture)
$(architecture)_$(HAIKU_PACKAGING_ARCHS[2-]) ;
HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES on $(stage1PackageTargets)
= haiku_cross_devel_sysroot_stage1_$(crossDevelPackageSuffixes).hpkg ;
# add stage 2 packages
local stage2PackageTargets = [ AddRepositoryPackages $(repository)
: $(architecture) : $(packagesStage2) : $(sourcePackages)
: $(debugInfoPackages) ] ;
HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGE on $(stage2PackageTargets)
= haiku_cross_devel_sysroot_$(architecture).hpkg ;
HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES on $(stage2PackageTargets)
= haiku_cross_devel_sysroot_$(crossDevelPackageSuffixes).hpkg ;
# prepare the config file for the HaikuPorts cross build
local outputDir = [ FDirName
@@ -391,10 +430,29 @@ rule BootstrapPackageRepository repository : architecture
#pragma mark - Public
rule FSplitPackageName packageName
{
local splitName = [ Match "(.*)_([^_]*)" : $(packageName) ] ;
local knownPackageSuffixes = devel doc source debuginfo ;
if $(splitName[2]) && $(splitName[2]) in $(knownPackageSuffixes) {
return $(splitName) ;
}
return $(packageName) ;
}
rule IsPackageAvailable package
{
# for a secondary architecture adjust the package name
if $(TARGET_PACKAGING_ARCH) != $(TARGET_PACKAGING_ARCHS[1]) {
local splitName = [ FSplitPackageName $(package) ] ;
splitName = $(splitName[1]) $(TARGET_PACKAGING_ARCH) $(splitName[2-]) ;
package = $(splitName:J=_) ;
}
if $(package) in $(HAIKU_AVAILABLE_PACKAGES) {
return 1 ;
return $(package) ;
}
return ;
@@ -403,10 +461,12 @@ rule IsPackageAvailable package
rule FetchPackage packageName
{
if ! [ IsPackageAvailable $(packageName) ] {
local foundPackageName = [ IsPackageAvailable $(packageName) ] ;
if ! $(foundPackageName) {
Exit "DownloadPackage: package" $(packageName) "not available!" ;
return ;
}
packageName = $(foundPackageName) ;
# TODO: We should support explicitly specified versions (or partial/minimum
# versions like gcc-2 or gcc-4).
@@ -27,6 +27,13 @@ BootstrapPackageRepository HaikuPortsCross
texinfo_bootstrap-4.13a-1
zlib_bootstrap-1.2.8-2
zlib_bootstrap_devel-1.2.8-2
secondary_x86 @{
icu_bootstrap_x86-4.8.1.1-1
icu_bootstrap_x86_devel-4.8.1.1-1
zlib_bootstrap_x86-1.2.8-2
zlib_bootstrap_x86_devel-1.2.8-2
}@ # secondary_x86
:
# repository architecture packages (stage 2)
libsolv_bootstrap-0.3.0_haiku_2013_06_16-1