diff --git a/build/jam/PackageRules b/build/jam/PackageRules index 2fbeea33a6..f61b95b298 100644 --- a/build/jam/PackageRules +++ b/build/jam/PackageRules @@ -50,11 +50,57 @@ rule PreprocessPackageInfo source : directory : architecture ; local target = $(source:BSG=package-info)-package-info ; + if $(HAIKU_BOOTSTRAP_BUILD) { + target = $(target)-bootstrap ; + } + MakeLocate $(target) : $(directory) ; + + PreprocessPackageOrRepositoryInfo $(target) : $(source) : $(architecture) + : $(secondaryArchitecture) : useCPP ; + + # Update requires in the package info. + if ! $(HAIKU_BOOTSTRAP_BUILD) { + local updateRequiresFiles = + update_package_requires + [ on HaikuPorts return $(HAIKU_REPOSITORY_CACHE_FILE) ] + ; + Depends $(target) : $(updateRequiresFiles) ; + UpdatePackageInfoRequires $(target) : $(updateRequiresFiles) ; + } + + return $(target) ; +} + + +actions UpdatePackageInfoRequires +{ + $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) + "$(2[1])" "$(1)" "$(2[2])" +} + + +rule PreprocessPackageOrRepositoryInfo target : source : architecture + : secondaryArchitecture : flags +{ + # PreprocessPackageOrRepositoryInfo : : + # : [ ] [ : ] ; + # Preprocesses the package or repository info template file by + # performing several placeholder substitutions and optionally filtering it + # through the C preprocessor. + # + # - The generated preprocessed file. + # - The package or repository info template file. + # - The primary packaging architecture. + # - If given, the secondary packaging architecture + # the package targets. Otherwise the primary architecture is targeted. + # : + # useCPP - Filter the source file through the C preprocessor after the + # placeholder substitutions have been performed. + local defines = HAIKU_PACKAGING_ARCH=$(architecture) ; local sedReplacements = %HAIKU_PACKAGING_ARCH%,$(architecture) ; if $(HAIKU_BOOTSTRAP_BUILD) { defines += HAIKU_BOOTSTRAP_BUILD ; - target = $(target)-bootstrap ; } if $(secondaryArchitecture) { defines += HAIKU_SECONDARY_PACKAGING_ARCH=$(secondaryArchitecture) ; @@ -68,39 +114,29 @@ rule PreprocessPackageInfo source : directory : architecture } local revisionFile = [ DetermineEffectiveHaikuRevision ] ; - local updateRequiresFiles ; - local haikuPortsRepositoryFile ; - if ! $(HAIKU_BOOTSTRAP_BUILD) { - updateRequiresFiles = - update_package_requires - [ on HaikuPorts return $(HAIKU_REPOSITORY_CACHE_FILE) ] - ; + Depends $(target) : $(source) $(revisionFile) ; + + if useCPP in $(flags) { + PREPROCESSOR on $(target) + = "|" $(HOST_CC) -E -w [ FDefines $(defines) ] - ; + } else { + PREPROCESSOR on $(target) = ; } - MakeLocate $(target) : $(directory) ; - Depends $(target) : $(source) $(revisionFile) $(updateRequiresFiles) ; - - CCDEFS on $(target) = [ FDefines $(defines) ] ; HAIKU_SED_REPLACEMENTS on $(target) = "-e s,$(sedReplacements),g" ; - PreprocessPackageInfo1 $(target) : $(source) $(revisionFile) - $(updateRequiresFiles) ; - - return $(target) ; + PreprocessPackageOrRepositoryInfo1 $(target) : $(source) $(revisionFile) ; } -actions PreprocessPackageInfo1 +actions PreprocessPackageOrRepositoryInfo1 { revision=`cat $(2[2])` + version=$(HAIKU_VERSION)_${revision} sed $(HAIKU_SED_REPLACEMENTS) \ - -e s,%HAIKU_VERSION%,$(HAIKU_VERSION)_${revision}-1, < $(2[1]) \ - | $(HOST_CC) -E -w $(CCDEFS) - -o $(1) - - if [ -n "$(2[4]:E)" ]; then - $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) - "$(2[3])" "$(1)" "$(2[4])" || exit 1 - fi + -e s,%HAIKU_VERSION%,${version}-1, \ + -e s,%HAIKU_VERSION_NO_REVISION%,${version}, $(2[1]) \ + $(PREPROCESSOR) > $(1) } diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules index 00a6aaa116..af0a28f3c9 100644 --- a/build/jam/RepositoryRules +++ b/build/jam/RepositoryRules @@ -677,12 +677,30 @@ actions BuildRemoteHaikuPortsRepository1 } -rule HaikuRepository repository : repoInfo : packages +rule HaikuRepository repository : repoInfoTemplate : packages { + # HaikuRepository : : ; + # Builds the Haiku repository from the given packages and repository info + # template. must already be located. + + local architecture = $(HAIKU_PACKAGING_ARCH) ; + local secondaryArchitecture ; + if $(TARGET_PACKAGING_ARCH) != $(architecture) { + secondaryArchitecture = $(TARGET_PACKAGING_ARCH) ; + } + + local repositoriesDir = $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ; + + # build the repository info + local repoInfo = $(repository:G=repository-info)-info ; + MakeLocate $(repoInfo) : $(repositoriesDir) ; + PreprocessPackageOrRepositoryInfo $(repoInfo) : $(repoInfoTemplate) + : $(architecture) : $(secondaryArchitecture) ; + # prepare the script that initializes the shell variables local initVariablesScript = $(repository)-repository-init-vars ; MakeLocate $(initVariablesScript) - : $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ; + : $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ; Always $(initVariablesScript) ; local script = $(initVariablesScript) ; diff --git a/build/jam/repositories/Haiku b/build/jam/repositories/Haiku index 5ace41ecff..f64c566c94 100644 --- a/build/jam/repositories/Haiku +++ b/build/jam/repositories/Haiku @@ -4,7 +4,7 @@ local haikuRepository = haiku ; MakeLocate $(haikuRepository) : $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ; -local repoInfo = haiku ; +local repoInfo = haiku ; SEARCH on $(repoInfo) = $(HAIKU_TOP)/src/data/repository_infos ; local secondaryArchs = $(TARGET_PACKAGING_ARCHS[2-]) ; diff --git a/build/scripts/build_haiku_repository b/build/scripts/build_haiku_repository index 99d21bd9c2..27a1f8df13 100755 --- a/build/scripts/build_haiku_repository +++ b/build/scripts/build_haiku_repository @@ -35,17 +35,8 @@ for packageFile in "$@"; do cp "$packageFile" "$packageDir/$fileName" done -# prepare the repo info file -fileName=`basename "$packageDir"/haiku-*.hpkg .hpkg` -version=${fileName#*-} -version=${version%%-*} -arch=${fileName##*-} - -sed -e "s/%HAIKU_ARCHITECTURE%/$arch/g" \ - -e "s/%HAIKU_VERSION%/$version/g" \ - "$repoInfo" > "$repositoryDir/repo.info" - # build the repository file +cp "$repoInfo" "$repositoryDir/repo.info" "$packageRepo" create -C "$repositoryDir" "$repositoryDir/repo.info" \ "$packageDir"/*.hpkg diff --git a/src/data/repository_infos/haiku b/src/data/repository_infos/haiku index 0197d8188e..cedaafff5e 100644 --- a/src/data/repository_infos/haiku +++ b/src/data/repository_infos/haiku @@ -1,6 +1,6 @@ name Haiku vendor "Haiku Project" -summary "The Haiku repository (for Haiku %HAIKU_VERSION%)" +summary "The Haiku repository (for Haiku %HAIKU_VERSION_NO_REVISION%)" priority 1 -url http://packages.haiku-os.org/haiku/master/repo/%HAIKU_ARCHITECTURE%/%HAIKU_VERSION% -architecture %HAIKU_ARCHITECTURE% +url http://packages.haiku-os.org/haiku/master/repo/%HAIKU_PACKAGING_ARCH%/%HAIKU_VERSION_NO_REVISION% +architecture %HAIKU_PACKAGING_ARCH%