diff --git a/Jamfile b/Jamfile index d015453d39..d4cc4f2164 100644 --- a/Jamfile +++ b/Jamfile @@ -73,6 +73,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootPPCImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuCD ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) images AnybootImage ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories Haiku ] ; # Check whether all requested optional packages do actually exist. local package ; diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules index 11741305e4..8c818fc7c2 100644 --- a/build/jam/RepositoryRules +++ b/build/jam/RepositoryRules @@ -675,3 +675,40 @@ actions BuildRemoteHaikuPortsRepository1 ssh $remote "build_repository_for_testing.sh $branch $repoArch" } + + +rule HaikuRepository repository : repoInfo : packages +{ + # prepare the script that initializes the shell variables + local initVariablesScript = $(repository)-repository-init-vars ; + MakeLocate $(initVariablesScript) + : $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ; + Always $(initVariablesScript) ; + + local script = $(initVariablesScript) ; + AddVariableToScript $(script) : addBuildCompatibilityLibDir + : $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ; + AddVariableToScript $(script) : sha256 : $(HOST_SHA256) ; + AddVariableToScript $(script) : sedExtendedRegex + : $(HOST_EXTENDED_REGEX_SED) ; + AddTargetVariableToScript $(script) : package ; + AddTargetVariableToScript $(script) : package_repo : packageRepo ; + + # call the build actions + local mainScript = build_haiku_repository ; + SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; + + Depends $(repository) : $(mainScript) $(initVariablesScript) $(repoInfo) + $(packages) ; + HaikuRepository1 $(repository) : $(mainScript) $(initVariablesScript) + $(repoInfo) $(packages) ; + Always $(repository) ; + + RmTemps $(repository) : $(initVariablesScript) ; +} + + +actions HaikuRepository1 +{ + $(2[1]) "$(2[2])" "$(1)" "$(2[3-])" +} diff --git a/build/jam/repositories/Haiku b/build/jam/repositories/Haiku new file mode 100644 index 0000000000..aa40eda6bc --- /dev/null +++ b/build/jam/repositories/Haiku @@ -0,0 +1,23 @@ +# Builds the Haiku packages repository. + +local haikuRepository = haiku ; +MakeLocate $(haikuRepository) + : $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(HAIKU_PACKAGING_ARCH)) ; + +local repoInfo = haiku ; +SEARCH on $(repoInfo) = $(HAIKU_TOP)/src/data/repository_infos ; + +local secondaryArchs = $(TARGET_PACKAGING_ARCHS[2-]) ; +local packages = + haiku + haiku_devel + haiku_loader + haiku_userguide + haiku_welcome + makefile_engine + + haiku_$(secondaryArchs) + haiku_$(secondaryArchs)_devel + ; + +HaikuRepository $(haikuRepository) : $(repoInfo) : $(packages:S=.hpkg) ; diff --git a/build/scripts/build_haiku_repository b/build/scripts/build_haiku_repository new file mode 100755 index 0000000000..99d21bd9c2 --- /dev/null +++ b/build/scripts/build_haiku_repository @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Usage: build_haiku_repository +# ... + +set -o errexit + +if [ $# -le 2 ]; then + echo "$0: Missing parameters!" >&2 + exit 1 +fi + +. $1 +shift + +repositoryDir="$1" +repoInfo="$2" +shift 2 +# the remaining arguments are the packages + +# this adds the build library dir to LD_LIBRARY_PATH +eval "$addBuildCompatibilityLibDir" + +# create a clean repository directory +rm -rf "$repositoryDir" +mkdir "$repositoryDir" + +packageDir="$repositoryDir/packages" +mkdir "$packageDir" + +# Get the canonical names for the packages and copy them to the package +# directory. +for packageFile in "$@"; do + fileName=`"$package" info -f "%fileName%" "$packageFile"` + 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 +"$packageRepo" create -C "$repositoryDir" "$repositoryDir/repo.info" \ + "$packageDir"/*.hpkg + +# create the checksum file +$sha256 "$repositoryDir/repo" \ + | $sedExtendedRegex 's,([^[:space:]]*).*,\1,' > "$repositoryDir/repo.sha256" + # The sed part is only necessary for sha256sum, but it doesn't harm for + # sha256 either. diff --git a/src/data/repository_infos/haiku b/src/data/repository_infos/haiku new file mode 100644 index 0000000000..0197d8188e --- /dev/null +++ b/src/data/repository_infos/haiku @@ -0,0 +1,6 @@ +name Haiku +vendor "Haiku Project" +summary "The Haiku repository (for Haiku %HAIKU_VERSION%)" +priority 1 +url http://packages.haiku-os.org/haiku/master/repo/%HAIKU_ARCHITECTURE%/%HAIKU_VERSION% +architecture %HAIKU_ARCHITECTURE%