diff --git a/build/jam/FileRules b/build/jam/FileRules index c6c5556ee0..f838c0f648 100644 --- a/build/jam/FileRules +++ b/build/jam/FileRules @@ -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)" } diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules index a3dd5e2676..238690debe 100644 --- a/build/jam/RepositoryRules +++ b/build/jam/RepositoryRules @@ -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 = 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) + : package_repo $(repoInfo) $(packageFiles) ; + RepositoryCache1 $(repoCache) + : 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 diff --git a/configure b/configure index f411fe5f4f..a777e3867c 100755 --- a/configure +++ b/configure @@ -74,6 +74,8 @@ options: -j 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 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} ; diff --git a/src/data/repository_infos/haikuports b/src/data/repository_infos/haikuports new file mode 100644 index 0000000000..3c62733115 --- /dev/null +++ b/src/data/repository_infos/haikuports @@ -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%