Add new configuration option --no-downloads.

* If --no-downloads has been given, Haiku will be built without
  trying to download anything, all required packages need to be put
  into the download folder manually (the build will stop on missing
  packages).
* As the required HaikuPorts repository can't be downloaded in this
  mode, a local repository is created during the build, which only
  contains the packages available in the downloads folder.

This is useful for building Haiku completely from source.
This commit is contained in:
Oliver Tappe 2014-04-30 23:47:55 +02:00
parent 3d9c3125ac
commit aa2e5eca78
4 changed files with 73 additions and 15 deletions

View File

@ -468,6 +468,10 @@ rule DownloadLocatedFile target : url : source
actions DownloadLocatedFile1
{
source="$(2)"
if [ "$(HAIKU_NO_DOWNLOADS)" = 1 ]; then
echo "ERROR: Would need to download $(URL), but HAIKU_NO_DOWNLOADS is set!" ;
exit 1
fi
wget -O "$(1)" $(URL) || exit 1
touch "$(1)"
}

View File

@ -155,25 +155,50 @@ rule RemotePackageRepository repository : architecture : repositoryUrl
Depends $(packagesChecksumFile) : $(packageListFile) ;
ChecksumFileSHA256 $(packagesChecksumFile) : $(packageListFile) ;
# download repository info file
local repositoryInfo = $(repository:G=repository-info)-info ;
MakeLocate $(repositoryInfo) : $(repositoriesDir) ;
local repoUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
DownloadLocatedFile $(repositoryInfo)
: "$(repoUrl)/`cat $source`/repo.info"
: $(packagesChecksumFile) ;
# download repository file
local repositoryFile = $(repository:G=repository-cache) ;
MakeLocate $(repositoryFile) : $(repositoriesDir) ;
local repoUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
DownloadLocatedFile $(repositoryFile)
: "$(repoUrl)/`cat $source`/repo"
: $(packagesChecksumFile) ;
local repositoryConfig = $(repository:G=repository-config)-config ;
MakeLocate $(repositoryInfo) $(repositoryFile) $(repositoryConfig)
: $(repositoriesDir) ;
# Use a locally created dummy repository if downloads have been disabled.
# This is useful when trying to build everything locally from source.
if $(HAIKU_NO_DOWNLOADS) = 1 {
# build the dummy repository info file
local repositoryInfoTemplate = <repository-info-template>haikuports ;
SEARCH on $(repositoryInfoTemplate)
= $(HAIKU_TOP)/src/data/repository_infos ;
PreprocessPackageOrRepositoryInfo $(repositoryInfo)
: $(repositoryInfoTemplate) : $(architecture) ;
# build repository file, using only packages available in the download
# directory
local allPackageFiles = [
on $(packageListFile) return $(HAIKU_REPOSITORY_PACKAGE_FILE_NAMES)
] ;
local packageFiles ;
for packageFile in $(allPackageFiles) {
if [ Glob $(HAIKU_DOWNLOAD_DIR) : $(packageFile) ] {
packageFile = $(packageFile:G=package-file) ;
MakeLocate $(packageFile) : $(HAIKU_DOWNLOAD_DIR) ;
packageFiles += $(packageFile) ;
}
}
RepositoryCache $(repositoryFile) : $(repositoryInfo)
: $(packageFiles) ;
} else {
# download repository info file
local repoUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
DownloadLocatedFile $(repositoryInfo)
: "$(repoUrl)/`cat $source`/repo.info"
: $(packagesChecksumFile) ;
# download repository file
DownloadLocatedFile $(repositoryFile)
: "$(repoUrl)/`cat $source`/repo"
: $(packagesChecksumFile) ;
}
# build repository config file
local repositoryConfig = $(repository:G=repository-config)-config ;
MakeLocate $(repositoryConfig) : $(repositoriesDir) ;
RepositoryConfig $(repositoryConfig) : $(repositoryInfo)
: $(repositoryUrl)/$version : $(packagesChecksumFile) ;
@ -233,6 +258,23 @@ actions RepositoryConfig1
}
rule RepositoryCache repoCache : repoInfo : packageFiles
{
Depends $(repoCache)
: <build>package_repo $(repoInfo) $(packageFiles) ;
RepositoryCache1 $(repoCache)
: <build>package_repo $(repoInfo) $(packageFiles) ;
}
actions RepositoryCache1
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(2[1]) create -q $(2[2-])
mv $(1:B=repo) $(1)
}
#pragma mark - Bootstrap Repository

6
configure vendored
View File

@ -74,6 +74,8 @@ options:
-j<n> Only relevant for --build-cross-tools and
--build-cross-tools-gcc4. Is passed on to the
make building the build tools.
--no-downloads Do not download anything. Useful when trying to
bootstrap and build Haiku from source only.
--remote-user <username> Use given username when logging into
git.haiku-os.org (via ssh).
--target=TARGET Select build target platform.
@ -528,6 +530,7 @@ HOST_HAIKU_PORTER=
HAIKU_PORTS=
HAIKU_PORTS_CROSS=
HAIKU_BOOT_BOARD=
HAIKU_NO_DOWNLOADS=0
HAIKU_PACKAGING_ARCHS=
@ -670,6 +673,7 @@ while [ $# -gt 0 ] ; do
--include-sources) HAIKU_INCLUDE_SOURCES=1; shift 1;;
--include-3rdparty) HAIKU_INCLUDE_3RDPARTY=1; shift 1;;
-j*) buildCrossToolsJobs="$1"; shift 1;;
--no-downloads) HAIKU_NO_DOWNLOADS=1; shift 1;;
--target=*) TARGET_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;;
--target-arch)
assertparam "$1" $#
@ -944,6 +948,8 @@ HAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ;
HAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ;
HAIKU_NO_DOWNLOADS ?= "${HAIKU_NO_DOWNLOADS}" ;
HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ;
HAIKU_NASM ?= ${HAIKU_NASM} ;

View File

@ -0,0 +1,6 @@
name HaikuPorts
vendor "Haiku Project"
summary "The HaikuPorts repository (for Haiku %HAIKU_VERSION_NO_REVISION%)"
priority 1
url http://packages.haiku-os.org/haikuports/master/repo/%HAIKU_PACKAGING_ARCH%/dummy
architecture %HAIKU_PACKAGING_ARCH%