Switch build system from optional package to repositories

* Build libsolv and the dependency solver part of the package kit for
  the build platform.
* Add build tool get_package_dependencies. Given a list of package files
  and a list of repository files it determines the additional packages
  that need to be retrieved from the repositories and prints their URLs.
* Add rules to work with external repositories in the build system
  (build/jam/RepositoryRules):
  - PackageRepository declares an external repository with all its
    packages. The URL of the repository file isn't specified. It is
    computed from a given base URL and the SHA256 hash of the list of
    package files.
  - GeneratedRepositoryPackageList generates a file containing the file
    names of all packages in a repository.
  - IsPackageAvailable returns whether a package is available in any
    repository.
  - PackageURL returns the URL for a package.
* Declare the HaikuPorts repository for x86_gcc2
  (build/jam/repositories/HaikuPorts/x86_gcc2).
* Add rule AddHaikuImagePackages to add a package to the image and rule
  IsHaikuImagePackageAdded to determine whether a package has been
  added.
* OptionalPackages: Remove all entries that just downloaded and
  installed an external package. AddHaikuImagePackages can be used
  instead and is used in the remaining entries. Also move the remaining
  optional package dependency declarations from
  OptionalPackageDependencies here.
* ExtractBuildFeatureArchives: Instead of the URL parameter a package
  name must be specified now. This allows to simplify BuildFeatures
  significantly, since there's no dealing with URLs anymore. "if" out
  the entries that aren't supported yet.
* build_haiku_image: For the packages installed in system and common
  resolve their dependencies and download and install them as well.
This commit is contained in:
Ingo Weinhold 2013-07-05 10:51:42 +02:00
parent 43d96d8f7a
commit 98c6dfa41e
30 changed files with 1146 additions and 2352 deletions

20
Jamfile
View File

@ -3,28 +3,22 @@ SubDir HAIKU_TOP ;
NotFile doc_files ;
Depends files : doc_files ;
# Add optional packages given via HAIKU_ADD_OPTIONAL_PACKAGES.
if $(HAIKU_ADD_OPTIONAL_PACKAGES) {
AddOptionalHaikuImagePackages
[ FSplitString $(HAIKU_ADD_OPTIONAL_PACKAGES) : / ] ;
}
# Prepare the optional build features before parsing the Jamfile tree.
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatures ] ;
# Include packages that are required by all images.
AddOptionalHaikuImagePackages MandatoryPackages ;
AddHaikuImagePackages
bzip2 ctags ffmpeg freetype glu grep icu jpeg libpng libsolv mesa sed tar
zlib
:
system
;
# If enabled, make sure that OpenSSL is added to the image.
if $(HAIKU_BUILD_FEATURE_OPENSSL_ENABLED) {
AddOptionalHaikuImagePackages OpenSSL ;
AddHaikuImagePackages openssl ;
}
AddOptionalHaikuImagePackages ICU ;
# Evaluate optional package dependencies
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ;
# Optionally we allow not to include the "src" subdirectory.
if $(HAIKU_DONT_INCLUDE_SRC) {
# Don't include "src", but at least include the stuff needed for the

View File

@ -51,9 +51,23 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ;
include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ;
# Include the repositories for this architecture.
local repositoriesDirectory
= [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ;
local repository ;
for repository in HaikuPorts {
local repositoryDirectory
= [ FDirName $(repositoriesDirectory) $(repository) ] ;
local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ;
if $(file) {
include $(file) ;
}
}
# Declare no-op user-overridable build rules.
rule UserBuildConfigRulePostBuildTargets { }
rule UserBuildConfigRulePreImage { }

View File

@ -18,34 +18,17 @@ local hpkgBaseURL = http://haiku-files.org/files/hpkg ;
# SSL
# Automatically enable the SSL feature, when the optional OpenSSL optional
# package is enabled.
if [ IsOptionalHaikuImagePackageAdded OpenSSL ] {
# Automatically enable the SSL feature, when the OpenSSL package is enabled.
if [ IsHaikuImagePackageAdded openssl ] {
HAIKU_BUILD_FEATURE_SSL = 1 ;
}
if $(HAIKU_BUILD_FEATURE_SSL) {
if $(TARGET_ARCH) in x86 x86_64 {
if $(HAIKU_GCC_VERSION[1]) >= 4 {
if $(TARGET_ARCH) = x86_64 {
HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86_64-2012-12-18.zip ;
} else {
HAIKU_OPENSSL_PACKAGE
= openssl-1.0.0j-r1a4-x86-gcc4-2012-08-29.zip ;
}
} else {
HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-2-x86_gcc2.hpkg ;
HAIKU_OPENSSL_DEVEL_PACKAGE = openssl_devel-1.0.0j-2-x86_gcc2.hpkg ;
}
HAIKU_OPENSSL_URL = $(hpkgBaseURL)/$(HAIKU_OPENSSL_PACKAGE) ;
HAIKU_OPENSSL_DEVEL_URL
= $(hpkgBaseURL)/$(HAIKU_OPENSSL_DEVEL_PACKAGE) ;
if [ IsPackageAvailable openssl_devel ] {
ExtractBuildFeatureArchives openssl :
file: base $(HAIKU_OPENSSL_URL)
file: base openssl
runtime: lib
file: devel $(HAIKU_OPENSSL_DEVEL_URL)
file: devel openssl_devel
depends: base
libraries: develop/lib/libcrypto.so develop/lib/libssl.so
headers: develop/headers
@ -61,31 +44,11 @@ if $(HAIKU_BUILD_FEATURE_SSL) {
# ICU
# Note ICU isn't actually optional, but is still an external package
if $(TARGET_ARCH) in arm ppc x86 x86_64 {
if $(TARGET_ARCH) = ppc {
HAIKU_ICU_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ;
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-ppc-2011-12-19.zip ;
} else if $(TARGET_ARCH) = arm {
HAIKU_ICU_PACKAGE = icu-4.8.1.1-arm-2012-11-21.zip ;
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-arm-2012-11-21.zip ;
} else if $(TARGET_ARCH) = x86_64 {
HAIKU_ICU_PACKAGE = icu-4.8.1.1-x86_64-2012-07-30.zip ;
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86_64-2012-07-30.zip ;
} else if $(HAIKU_GCC_VERSION[1]) = 2 {
HAIKU_ICU_PACKAGE = icu-4.8.1.1-3-x86_gcc2.hpkg ;
HAIKU_ICU_DEVEL_PACKAGE = icu_devel-4.8.1.1-3-x86_gcc2.hpkg ;
} else {
HAIKU_ICU_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc4-2012-08-29.zip ;
HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86-gcc4-2011-12-20.zip ;
}
HAIKU_ICU_URL = $(hpkgBaseURL)/$(HAIKU_ICU_PACKAGE) ;
HAIKU_ICU_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_ICU_DEVEL_PACKAGE) ;
if [ IsPackageAvailable icu_devel ] {
ExtractBuildFeatureArchives icu :
file: base $(HAIKU_ICU_URL)
file: base icu
runtime: lib
file: devel $(HAIKU_ICU_DEVEL_URL)
file: devel icu_devel
depends: base
libraries:
develop/lib/libicudata.so
@ -106,9 +69,12 @@ if $(TARGET_ARCH) in arm ppc x86 x86_64 {
# CLucene
# Automatically install the CLucene feature, when the optional CLucene optional
# package is enabled.
if [ IsOptionalHaikuImagePackageAdded CLucene ] {
# TODO: Update to packages!
if ! 1 {
# Automatically install the CLucene feature, when the CLucene package is
# enabled.
if [ IsHaikuImagePackageAdded clucene ] {
HAIKU_BUILD_FEATURE_CLUCENE = 1 ;
}
@ -148,6 +114,11 @@ if $(HAIKU_BUILD_FEATURE_CLUCENE) {
}
}
} # ! 1
# TODO: Update to packages!
if ! 1 {
# LLVM
if $(TARGET_ARCH) = x86 {
@ -260,24 +231,15 @@ if $(TARGET_ARCH) = x86 {
Echo "LLVM not yet available on $(TARGET_ARCH)" ;
}
} # ! 1
# GLU (GL Utilities)
if $(TARGET_ARCH) = x86 {
if $(HAIKU_GCC_VERSION[1]) >= 4 {
# TODO:...
HAIKU_GLU_PACKAGE = glu-9.0-x86-gcc4-2012-11-13.zip ;
} else {
HAIKU_GLU_PACKAGE = glu-9.0.0-1-x86_gcc2.hpkg ;
HAIKU_GLU_DEVEL_PACKAGE = glu_devel-9.0.0-1-x86_gcc2.hpkg ;
}
HAIKU_GLU_URL = $(hpkgBaseURL)/$(HAIKU_GLU_PACKAGE) ;
HAIKU_GLU_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_GLU_DEVEL_PACKAGE) ;
if [ IsPackageAvailable glu_devel ] {
ExtractBuildFeatureArchives glu :
file: base $(HAIKU_GLU_URL)
file: base glu
runtime: lib
file: devel $(HAIKU_GLU_DEVEL_URL)
file: devel glu_devel
depends: base
library: develop/lib/libGLU.so
headers: develop/headers
@ -290,21 +252,9 @@ if $(TARGET_ARCH) = x86 {
# Mesa
if $(TARGET_ARCH) = x86 {
local zipFile ;
if $(HAIKU_GCC_VERSION[1]) >= 4 {
# TODO:...
HAIKU_MESA_PACKAGE = mesa-9.1.1-x86-gcc4-2013-04-27.zip ;
} else {
HAIKU_MESA_PACKAGE = mesa-7.8.2-3-x86_gcc2.hpkg ;
HAIKU_MESA_DEVEL_PACKAGE = mesa_devel-7.8.2-3-x86_gcc2.hpkg ;
}
HAIKU_MESA_URL = $(hpkgBaseURL)/$(HAIKU_MESA_PACKAGE) ;
HAIKU_MESA_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_MESA_DEVEL_PACKAGE) ;
if [ IsPackageAvailable mesa_devel ] {
ExtractBuildFeatureArchives mesa : [ FFilterByBuildFeatures
file: devel $(HAIKU_MESA_DEVEL_URL)
file: devel mesa_devel
mesaLibrary: develop/lib/libmesa.a
glapiLibrary: develop/lib/libglapi.a
headers: develop/headers
@ -332,31 +282,7 @@ if $(TARGET_ARCH) = x86 {
# FFmpeg
local ffmpegBaseURL = $(baseURL)/lib ;
if $(TARGET_ARCH) = x86 {
if $(HAIKU_GCC_VERSION[1]) >= 4 {
# TODO:...
HAIKU_FFMPEG_PACKAGE = ffmpeg-0.10.2-r1a4-x86-gcc4-2012-09-02.zip ;
HAIKU_SPEEX_PACKAGE = speex-1.2rc1-r1a4-x86-gcc4-2012-09-02.zip ;
HAIKU_LIBTHEORA_PACKAGE = libtheora-1.1.1-r1a4-x86-gcc4-2012-09-02.zip ;
HAIKU_LIBVORBIS_PACKAGE = libvorbis-1.3.2-r1a4-x86-gcc4-2012-09-02.zip ;
HAIKU_LIBOGG_PACKAGE = libogg-1.3.0-r1a4-x86-gcc4-2012-09-02.zip ;
HAIKU_LIBVPX_PACKAGE = libvpx-1.0.0-r1a4-x86-gcc4-2012-09-02.zip ;
} else {
HAIKU_FFMPEG_PACKAGE = ffmpeg-0.10.2-2-x86_gcc2.hpkg ;
HAIKU_FFMPEG_DEVEL_PACKAGE = ffmpeg_devel-0.10.2-2-x86_gcc2.hpkg ;
HAIKU_SPEEX_PACKAGE = speex-1.2~rc1-1-x86_gcc2.hpkg ;
HAIKU_SPEEX_DEVEL_PACKAGE = speex_devel-1.2~rc1-1-x86_gcc2.hpkg ;
HAIKU_LIBTHEORA_PACKAGE = libtheora-1.1.1-1-x86_gcc2.hpkg ;
HAIKU_LIBTHEORA_DEVEL_PACKAGE = libtheora_devel-1.1.1-1-x86_gcc2.hpkg ;
HAIKU_LIBVORBIS_PACKAGE = libvorbis-1.3.2-1-x86_gcc2.hpkg ;
HAIKU_LIBVORBIS_DEVEL_PACKAGE = libvorbis_devel-1.3.2-1-x86_gcc2.hpkg ;
HAIKU_LIBOGG_PACKAGE = libogg-1.3.0-1-x86_gcc2.hpkg ;
HAIKU_LIBOGG_DEVEL_PACKAGE = libogg_devel-1.3.0-1-x86_gcc2.hpkg ;
HAIKU_LIBVPX_PACKAGE = libvpx-1.0.0-1-x86_gcc2.hpkg ;
HAIKU_LIBVPX_DEVEL_PACKAGE = libvpx_devel-1.0.0-1-x86_gcc2.hpkg ;
}
if [ IsPackageAvailable ffmpeg_devel ] {
local ffmpegLibs = libavformat.so libavcodec.so libavdevice.so
libavfilter.so libswscale.so libavutil.so ;
local speexLibs = libspeex.so ;
@ -367,14 +293,10 @@ if $(TARGET_ARCH) = x86 {
local feature ;
for feature in ffmpeg speex libtheora libvorbis libogg libvpx {
HAIKU_$(feature:U)_URL = $(hpkgBaseURL)/$(HAIKU_$(feature:U)_PACKAGE) ;
HAIKU_$(feature:U)_DEVEL_URL
= $(hpkgBaseURL)/$(HAIKU_$(feature:U)_DEVEL_PACKAGE) ;
ExtractBuildFeatureArchives $(feature) :
file: base $(HAIKU_$(feature:U)_URL)
file: base $(feature)
runtime: lib
file: devel $(HAIKU_$(feature:U)_DEVEL_URL)
file: devel $(feature)_devel
depends: base
libraries: develop/lib/$($(feature)Libs)
headers: develop/headers
@ -388,28 +310,11 @@ if $(TARGET_ARCH) = x86 {
# Freetype
local freetypeBaseURL = $(baseURL)/lib ;
if $(TARGET_ARCH) in arm ppc x86 x86_64 {
if $(TARGET_ARCH) = arm {
HAIKU_FREETYPE_PACKAGE = freetype-2.4.9-arm-2012-11-21.zip ;
} else if $(TARGET_ARCH) = ppc {
HAIKU_FREETYPE_PACKAGE = freetype-2.4.9-ppc-gcc4-2012-06-26.zip ;
} else if $(TARGET_ARCH) = x86_64 {
HAIKU_FREETYPE_PACKAGE = freetype-2.4.9-x86_64-2012-08-04.zip ;
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_FREETYPE_PACKAGE = freetype-2.4.9-r1a4-x86-gcc4-2012-09-02.zip ;
} else {
HAIKU_FREETYPE_PACKAGE = freetype-2.4.9-2-x86_gcc2.hpkg ;
HAIKU_FREETYPE_DEVEL_PACKAGE = freetype_devel-2.4.9-2-x86_gcc2.hpkg ;
}
HAIKU_FREETYPE_URL = $(hpkgBaseURL)/$(HAIKU_FREETYPE_PACKAGE) ;
HAIKU_FREETYPE_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_FREETYPE_DEVEL_PACKAGE) ;
if [ IsPackageAvailable freetype_devel ] {
ExtractBuildFeatureArchives freetype :
file: base $(HAIKU_FREETYPE_URL)
file: base freetype
runtime: lib
file: devel $(HAIKU_FREETYPE_DEVEL_URL)
file: devel freetype_devel
depends: base
library: develop/lib/libfreetype.so
headers: develop/headers develop/headers/freetype2
@ -423,9 +328,12 @@ if $(TARGET_ARCH) in arm ppc x86 x86_64 {
# TagLib
# TODO: Update to packages!
if ! 1 {
# Automatically install the TagLib feature, when the optional TagLib optional
# package is enabled.
if [ IsOptionalHaikuImagePackageAdded TagLib ] {
if [ IsHaikuImagePackageAdded taglib ] {
HAIKU_BUILD_FEATURE_TAGLIB = 1 ;
}
@ -465,8 +373,14 @@ if $(HAIKU_BUILD_FEATURE_TAGLIB) {
}
}
} # ! 1
# WebKit
# TODO: Update to packages!
if ! 1 {
# Automatically install the WebKit feature, when the optional WebPositive
# optional package is enabled.
if [ IsOptionalHaikuImagePackageAdded WebPositive ] {
@ -513,29 +427,15 @@ if $(HAIKU_BUILD_FEATURE_WEBKIT) {
}
}
} # ! 1
# libpng
local libpngBaseURL = $(baseURL)/lib ;
if $(TARGET_ARCH) in arm ppc x86 x86_64 {
if $(TARGET_ARCH) = arm {
HAIKU_LIBPNG_PACKAGE = libpng-1.5.12-arm-2012-11-21.zip ;
} else if $(TARGET_ARCH) = ppc {
HAIKU_LIBPNG_PACKAGE = libpng-1.5.12-ppc-gcc4-2012-08-27.zip ;
} else if $(TARGET_ARCH) = x86_64 {
HAIKU_LIBPNG_PACKAGE = libpng-1.5.12-x86_64-2012-11-18.zip ;
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_LIBPNG_PACKAGE = libpng-1.5.12-x86-gcc4-2012-08-23.zip ;
} else {
HAIKU_LIBPNG_PACKAGE = libpng-1.5.12-2-x86_gcc2.hpkg ;
HAIKU_LIBPNG_DEVEL_PACKAGE = libpng_devel-1.5.12-2-x86_gcc2.hpkg ;
}
HAIKU_LIBPNG_URL = $(hpkgBaseURL)/$(HAIKU_LIBPNG_PACKAGE) ;
HAIKU_LIBPNG_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_LIBPNG_DEVEL_PACKAGE) ;
if [ IsPackageAvailable libpng_devel ] {
ExtractBuildFeatureArchives libpng :
file: base $(HAIKU_LIBPNG_URL)
file: base libpng
runtime: lib
file: devel $(HAIKU_LIBPNG_DEVEL_URL)
file: devel libpng_devel
depends: base
library: develop/lib/libpng.so
headers: develop/headers
@ -546,29 +446,13 @@ if $(TARGET_ARCH) in arm ppc x86 x86_64 {
Echo "libpng support not available on $(TARGET_ARCH)" ;
}
# jpeg
local jpegBaseURL = $(baseURL)/lib ;
if $(TARGET_ARCH) in arm ppc x86 x86_64 {
if $(TARGET_ARCH) = arm {
HAIKU_JPEG_PACKAGE = jpeg-8d-arm-2012-11-21.zip ;
} else if $(TARGET_ARCH) = ppc {
HAIKU_JPEG_PACKAGE = jpeg-8d-ppc-gcc4-2012-08-27.zip ;
} else if $(TARGET_ARCH) = x86_64 {
HAIKU_JPEG_PACKAGE = jpeg-8d-x86_64-2012-11-18.zip ;
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_JPEG_PACKAGE = jpeg-8d-x86-gcc4-2012-08-23.zip ;
} else {
HAIKU_JPEG_PACKAGE = jpeg-9-2-x86_gcc2.hpkg ;
HAIKU_JPEG_DEVEL_PACKAGE = jpeg_devel-9-2-x86_gcc2.hpkg ;
}
HAIKU_JPEG_URL = $(hpkgBaseURL)/$(HAIKU_JPEG_PACKAGE) ;
HAIKU_JPEG_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_JPEG_DEVEL_PACKAGE) ;
if [ IsPackageAvailable jpeg_devel ] {
ExtractBuildFeatureArchives jpeg :
file: base $(HAIKU_JPEG_URL)
file: base jpeg
runtime: lib
file: devel $(HAIKU_JPEG_DEVEL_URL)
file: devel jpeg_devel
depends: base
library: develop/lib/libjpeg.so
headers: develop/headers
@ -581,33 +465,15 @@ if $(TARGET_ARCH) in arm ppc x86 x86_64 {
# zlib
if $(TARGET_ARCH) in arm ppc x86 x86_64 {
if $(TARGET_ARCH) = arm {
HAIKU_ZLIB_PACKAGE = zlib-1.2.7-arm-2012-11-21.zip ;
} else if $(TARGET_ARCH) = ppc {
HAIKU_ZLIB_PACKAGE = zlib-1.2.7-ppc-gcc4-2012-10-30.zip ;
} else if $(TARGET_ARCH) = x86_64 {
HAIKU_ZLIB_PACKAGE = zlib-1.2.7-x86_64-2012-11-18.zip ;
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
HAIKU_ZLIB_PACKAGE = zlib-1.2.7-x86-gcc4-2012-10-30.zip ;
} else {
HAIKU_ZLIB_PACKAGE = zlib-1.2.8-2-x86_gcc2.hpkg ;
HAIKU_ZLIB_DEVEL_PACKAGE = zlib_devel-1.2.8-2-x86_gcc2.hpkg ;
}
HAIKU_ZLIB_SOURCE_PACKAGE = zlib_source-1.2.8-2-source.hpkg ;
HAIKU_ZLIB_URL = $(hpkgBaseURL)/$(HAIKU_ZLIB_PACKAGE) ;
HAIKU_ZLIB_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_ZLIB_DEVEL_PACKAGE) ;
HAIKU_ZLIB_SOURCE_URL = $(hpkgBaseURL)/$(HAIKU_ZLIB_SOURCE_PACKAGE) ;
if [ IsPackageAvailable zlib_devel ] {
ExtractBuildFeatureArchives zlib :
file: base $(HAIKU_ZLIB_URL)
file: base zlib
runtime: lib
file: devel $(HAIKU_ZLIB_DEVEL_URL)
file: devel zlib_devel
depends: base
library: develop/lib/libz.so
headers: develop/headers
file: source $(HAIKU_ZLIB_SOURCE_URL)
file: source zlib_source
sources: develop/sources/zlib-1.2.8-2/source
;
@ -617,33 +483,22 @@ if $(TARGET_ARCH) in arm ppc x86 x86_64 {
}
# LibSolv
if $(TARGET_ARCH) != x86 {
Echo "Libsolv not available for $(TARGET_ARCH)." ;
} else if $(HAIKU_GCC_VERSION[1]) = 2 {
HAIKU_LIBSOLV_PACKAGE
= libsolv-0.3.0_haiku_2013_06_16-1-x86_gcc2.hpkg ;
HAIKU_LIBSOLV_DEVEL_PACKAGE
= libsolv_devel-0.3.0_haiku_2013_06_16-1-x86_gcc2.hpkg ;
} else {
Echo "Libsolv not available for gcc4." ;
}
if $(HAIKU_LIBSOLV_PACKAGE) {
HAIKU_LIBSOLV_URL = $(hpkgBaseURL)/$(HAIKU_LIBSOLV_PACKAGE) ;
HAIKU_LIBSOLV_DEVEL_URL = $(hpkgBaseURL)/$(HAIKU_LIBSOLV_DEVEL_PACKAGE) ;
# libsolv
if [ IsPackageAvailable libsolv_devel ] {
ExtractBuildFeatureArchives libsolv :
file: base $(HAIKU_LIBSOLV_URL)
file: base libsolv
runtime: lib
file: devel $(HAIKU_LIBSOLV_DEVEL_URL)
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/libsolv-0.3.0_haiku_2013_06_16-1/source
;
EnableBuildFeatures libsolv ;
} else {
Echo "libsolv package not available for $(TARGET_ARCH)" ;
}

View File

@ -1120,6 +1120,10 @@ if $(HOST_PLATFORM_IS_64_BIT) {
HOST_DEFINES += HAIKU_HOST_PLATFORM_64_BIT ;
}
# define Haiku packaging architecture macro for host build
HOST_DEFINES += HAIKU_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ;
#pragma mark -
# In case we build for a BeOS compatible platform, but not for Haiku, we

View File

@ -393,6 +393,7 @@ Always $(script) ;
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
AddVariableToScript $(script) : downloadDir : $(HAIKU_DOWNLOAD_DIR) ;
AddVariableToScript $(script) : installDir : $(HAIKU_INSTALL_DIR) ;
#AddVariableToScript $(script) : isImage : 1 ;
AddVariableToScript $(script) : imageSize : $(HAIKU_IMAGE_SIZE) ;
@ -410,6 +411,8 @@ AddTargetVariableToScript $(script) : <build>makebootable ;
AddTargetVariableToScript $(script) : <build>package ;
AddTargetVariableToScript $(script) : <build>rc ;
AddTargetVariableToScript $(script) : <build>resattr ;
AddTargetVariableToScript $(script) : <build>get_package_dependencies
: getPackageDependencies ;
AddTargetVariableToScript $(script) : <build>unzip ;
AddTargetVariableToScript $(script) : <build>vmdkimage ;
AddVariableToScript $(script) : stripCommand : $(HAIKU_STRIP) ;
@ -423,16 +426,57 @@ if $(optionalPackageDescriptions) {
: optionalPackageDescriptions ;
}
# add a variable "packages" with the packages copied/updated
# Add a variable to indicate whether packages dependencies shall be resolved. We
# always want to do that in non-update mode, but also in update mode when all
# packages are updated.
local resolvePackageDependencies ;
if ! [ IsUpdateHaikuImageOnly ] || $(HAIKU_UPDATE_ALL_PACKAGES) {
resolvePackageDependencies = 1 ;
}
AddVariableToScript $(script) : resolvePackageDependencies
: $(resolvePackageDependencies) ;
# Add variables "systemPackages" and "commonPackages" with the packages
# copied/updated.
local container = $(HAIKU_IMAGE_CONTAINER_NAME) ;
local packages = [ on $(container) return $(HAIKU_PACKAGES_IN_IMAGE) ] ;
local allPackages = [ on $(container) return $(HAIKU_PACKAGES_IN_IMAGE) ] ;
if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ]
&& ! [ IncludeAllTargetsInContainer $(container) ] {
packages = [ FilterContainerUpdateTargets $(packages)
allPackages = [ FilterContainerUpdateTargets $(allPackages)
: HAIKU_INCLUDE_IN_IMAGE ] ;
}
AddTargetVariableToScript $(script) : $(packages) : packages ;
local systemPackages ;
local commonPackages ;
local package ;
for package in $(allPackages) {
if [ on $(package) return $(HAIKU_PACKAGE_INSTALLATION_LOCATION) ]
= system {
systemPackages += $(package) ;
} else {
commonPackages += $(package) ;
}
}
AddTargetVariableToScript $(script) : $(systemPackages) : systemPackages ;
AddTargetVariableToScript $(script) : $(commonPackages) : commonPackages ;
# Generate the repository package lists and add variables for the repositories.
local repository ;
for repository in $(HAIKU_REPOSITORIES) {
local packageListFile = $(repository:G=repository-package-list) ;
MakeLocate $(packageListFile)
: [ FDirName $(TARGET_OBJECT_BASE_DIR) $(HAIKU_PACKAGING_ARCH) ] ;
Always $(packageListFile) ;
GeneratedRepositoryPackageList $(packageListFile) : $(repository) ;
AddTargetVariableToScript $(script) : $(packageListFile)
: repositoryPackageList_$(repository:G=) ;
AddVariableToScript $(script) : repositoryUrl_$(repository:G=)
: [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
}
AddVariableToScript $(script) : repositories : $(HAIKU_REPOSITORIES:G=) ;
# create the other scripts
HAIKU_IMAGE_MAKE_DIRS_SCRIPT = <HaikuImage>haiku.image-make-dirs ;

View File

@ -947,6 +947,7 @@ rule AddPackageFilesToHaikuImage location : packages
HAIKU_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME)
= [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_PACKAGES_IN_IMAGE) ]
$(packages) ;
HAIKU_PACKAGE_INSTALLATION_LOCATION on $(packages) = $(location) ;
AddFilesToHaikuImage $(location) packages : $(packages) ;
}
@ -997,6 +998,43 @@ rule OptionalPackageDependencies package : dependencies
}
}
rule AddHaikuImagePackages packages : installationLocation
{
# AddHaikuImagePackages <packages> [ : <installationLocation> ] ;
# Adds the given package <packages>s to the image. <installationLocation>
# is either "system" or "common" (the default) and specifies where the
# packages shall be installed.
local package ;
for package in $(packages) {
if ! [ on $(package) return $(HAIKU_PACKAGE_ADDED) ] {
if ! [ IsPackageAvailable $(package) ] {
Echo "AddHaikuImagePackages: package" $(package)
"not available!" ;
continue ;
}
HAIKU_PACKAGE_ADDED on $(package) = 1 ;
HAIKU_ADDED_PACKAGES += $(package) ;
InstallOptionalHaikuImagePackage [ PackageURL $(package) ]
: $(installationLocation) ;
}
}
}
rule IsHaikuImagePackageAdded package
{
if [ on $(package) return $(HAIKU_PACKAGE_ADDED) ] {
return 1 ;
}
return ;
}
rule InstallSourceArchive file : url
{
if $(HAIKU_INCLUDE_SOURCES) = 1 {

View File

@ -695,7 +695,7 @@ rule ExtractBuildFeatureArchives feature : list
}
local package = $(list[2]) ;
local url = $(list[3]) ;
local url = [ PackageURL $(list[3]) ] ;
local fileName = $(url:BS) ;
list = $(list[4-]) ;

View File

@ -1,52 +0,0 @@
# package dependencies
OptionalPackageDependencies APR-util : APR Expat ;
OptionalPackageDependencies AllegroLibs : XiphLibs ;
OptionalPackageDependencies ArmyKnife : TagLib ;
OptionalPackageDependencies Beam : LibIconv LibLayout OpenSSL PCRE ;
OptionalPackageDependencies BeHappy : BeBook NetSurf ;
OptionalPackageDependencies BurnItNow : CDRecord ;
OptionalPackageDependencies Caya : Expat ;
OptionalPackageDependencies CDRecord : GetTextLibintl LibIconv ;
OptionalPackageDependencies Curl : OpenSSL ;
OptionalPackageDependencies DevelopmentBase : CDRecord DevelopmentMin Yasm ;
OptionalPackageDependencies Development :
DevelopmentBase FFMpeg-devel FreeType-devel GLU-devel Jpeg Libpng-devel Perl
Zlib-devel
;
OptionalPackageDependencies DevelopmentPowerPC : DevelopmentMin ;
OptionalPackageDependencies GetText : GetTextLibintl ;
OptionalPackageDependencies GetTextLibintl : LibIconv ;
OptionalPackageDependencies Git : Expat Curl LibIconv Man OpenSSL Perl Python ;
OptionalPackageDependencies ICU-devel : DevelopmentBase ;
OptionalPackageDependencies LibEdit : NCurses ;
OptionalPackageDependencies LibLayout : DevelopmentBase ;
OptionalPackageDependencies LibSolv : Expat ;
OptionalPackageDependencies LibXML2 : XZ-Utils ;
OptionalPackageDependencies Man : Groff ;
OptionalPackageDependencies Tar : LibIconv ;
OptionalPackageDependencies Python : Bzip OpenSSL SQLite Readline ;
OptionalPackageDependencies Mercurial : Python ;
OptionalPackageDependencies Nano : NCurses ;
OptionalPackageDependencies Neon : LibXML2 ;
OptionalPackageDependencies NetFS : UserlandFS ;
OptionalPackageDependencies NetSurf : OpenSSL Curl LibXML2 LibIconv Libmng ;
OptionalPackageDependencies OpenSSH : LibEdit OpenSSL ;
OptionalPackageDependencies OpenSSL : CARootCertificates ;
OptionalPackageDependencies Paladin : CCache Fastdep PCRE ;
OptionalPackageDependencies Pe : PCRE ;
OptionalPackageDependencies Readline : NCurses ;
OptionalPackageDependencies SDLLibs : XiphLibs libmad libmikmod Libmng libmodplug physfs ;
OptionalPackageDependencies Subversion : APR-util Neon LibIconv LibXML2 OpenSSL SQLite ;
OptionalPackageDependencies Transmission : LibEvent Curl OpenSSL LibIconv ;
OptionalPackageDependencies Vim : GetTextLibintl LibIconv ;
OptionalPackageDependencies WebPositive : Curl LibXML2 SQLite WebKit WebPositiveBookmarks ;
OptionalPackageDependencies wpa_supplicant : OpenSSL ;
OptionalPackageDependencies XZ-Utils : Tar ;
OptionalPackageDependencies Zlib-devel : Zlib ;
OptionalPackageDependencies MandatoryPackages :
Bzip Ctags FFMpeg FreeType GLU Grep ICU Jpeg Libpng LibSolv Mesa Sed Tar
Zlib
;

File diff suppressed because it is too large Load Diff

View File

@ -19,14 +19,34 @@ switch $(HAIKU_BUILD_PROFILE) {
HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
HAIKU_IMAGE_SIZE = 800 ;
AddOptionalHaikuImagePackages TimGMSoundFont WQY-MicroHei ;
AddOptionalHaikuImagePackages BePDF Pe Vision
WebPositive WonderBrush ;
AddOptionalHaikuImagePackages CVS Development Git Mercurial
Python Subversion OpenSSH OpenSSL ;
AddOptionalHaikuImagePackages KeymapSwitcher Nano P7zip Welcome
BeBook XZ-Utils ;
AddOptionalHaikuImagePackages wpa_supplicant Man ;
AddHaikuImagePackages
openssl
wpa_supplicant
:
system
;
AddHaikuImagePackages
bepdf
cvs
keymapswitcher
man
mercurial
nano
openssh
p7zip
pe
python
subversion
timgmsoundfont
vision
wonderbrush
wqy_microhei
xz_utils
;
AddOptionalHaikuImagePackages BeBook Development Git WebPositive
Welcome ;
}
case "beta-*" : {
@ -42,9 +62,24 @@ switch $(HAIKU_BUILD_PROFILE) {
HAIKU_IMAGE_HOST_NAME = shredder ;
HAIKU_IMAGE_SIZE = 600 ;
AddOptionalHaikuImagePackages Pe Nano Vision P7zip XZ-Utils ;
AddOptionalHaikuImagePackages Development Git OpenSSH OpenSSL ;
AddOptionalHaikuImagePackages wpa_supplicant WebPositive Man ;
AddHaikuImagePackages
openssl
wpa_supplicant
:
system
;
AddHaikuImagePackages
man
nano
openssh
p7zip
pe
vision
xz_utils
;
AddOptionalHaikuImagePackages Development Git WebPositive ;
}
}

113
build/jam/RepositoryRules Normal file
View File

@ -0,0 +1,113 @@
rule PackageFamily packageBaseName
{
return $(packageBaseName:G=package-family) ;
}
rule AddRepositoryPackage repository : architecture : baseName : version
{
local package = $(baseName)-$(version) ;
package = $(package:E=$(baseName):G=package-in-$(repository:G=)) ;
HAIKU_PACKAGE_REPOSITORY on $(package) = $(repository) ;
HAIKU_PACKAGE_ARCHITECTURE on $(package) = $(architecture) ;
HAIKU_PACKAGE_FILE_NAME on $(package) = $(package:G=)-$(architecture).hpkg ;
if ! $(baseName) in $(HAIKU_AVAILABLE_PACKAGES) {
HAIKU_AVAILABLE_PACKAGES += $(baseName) ;
}
local packageFamily = [ PackageFamily $(baseName) ] ;
HAIKU_PACKAGE_VERSIONS on $(packageFamily) += $(package) ;
HAIKU_REPOSITORY_PACKAGES on $(repository) += $(package) ;
}
rule AddRepositoryPackages repository : architecture : packages : sourcePackages
{
local package ;
for package in $(packages) {
local splitName = [ Match "([^-]*)-(.*)" : $(package) ] ;
local baseName = $(splitName[1]:E=$(package)) ;
local version = $(splitName[2]) ;
AddRepositoryPackage $(repository) : $(architecture) : $(baseName)
: $(version) ;
if $(baseName) in $(sourcePackages) {
AddRepositoryPackage $(repository) : source : $(baseName)_source
: $(version) ;
}
}
}
rule PackageRepository repository : architecture : url : anyPackages : packages
: sourcePackages
{
repository = $(repository:G=repository) ;
if $(architecture) != $(HAIKU_PACKAGING_ARCH) {
return ;
}
HAIKU_REPOSITORIES += $(repository) ;
HAIKU_REPOSITORY_URL on $(repository) = $(url) ;
AddRepositoryPackages $(repository) : any : $(anyPackages)
: $(sourcePackages) ;
AddRepositoryPackages $(repository) : $(architecture) : $(packages)
: $(sourcePackages) ;
}
rule GeneratedRepositoryPackageList target : repository
{
repository = $(repository:G=repository) ;
# construct a list of file names
local fileNames ;
local package ;
for package in [ on $(repository) return $(HAIKU_REPOSITORY_PACKAGES) ] {
fileNames += [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
}
HAIKU_REPOSITORY_PACKAGE_FILE_NAMES on $(target) = $(fileNames) ;
GeneratedRepositoryPackageList1 $(target) ;
}
actions GeneratedRepositoryPackageList1
{
(for file in $(HAIKU_REPOSITORY_PACKAGE_FILE_NAMES) ; do
echo $file
done) | sort -u > $(1)
}
rule IsPackageAvailable package
{
if $(package) in $(HAIKU_AVAILABLE_PACKAGES) {
return 1 ;
}
return ;
}
rule PackageURL packageName
{
if ! [ IsPackageAvailable $(packageName) ] {
Exit "PackageURL: package" $(packageName) "not available!" ;
return ;
}
# TODO: We should support explicitly specified versions (or partial/minimum
# versions like gcc-2 or gcc-4).
local packageFamily = [ PackageFamily $(packageName) ] ;
local package
= [ on $(packageFamily) return $(HAIKU_PACKAGE_VERSIONS[1]) ] ;
local fileName = [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
local repository = [ on $(package) return $(HAIKU_PACKAGE_REPOSITORY) ] ;
local baseUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
return $(baseUrl)/$(fileName) ;
}

View File

@ -0,0 +1,167 @@
PackageRepository HaikuPorts
: x86_gcc2
: http://haiku-files.org/files/hpkg
:
# architecture "any" packages
be_book-2008_10_26-1
ca_root_certificates-2012_12_29-1
timgmsoundfont-2004_01_24-3
wqy_microhei-0.2.0~beta-3
:
# repository architecture packages
apr-1.4.6-7
apr_util-1.4.1-3
autoconf-2.69-4
automake-1.13.1-4
bepdf-1.1.1~beta5_2013_04_28-1
# bezillabrowser-2.0.0.22pre_2010_05_02-1
binutils-2.17_130421-2
bison-2.4.3-5
bzip2-1.0.6-3
cdrtools-3.01~a07-3
cmake-2.8.5-5
ctags-5.8-3
curl-7.26.0-4
cvs-1.12.13.1-5
doxygen-1.6.3-3
expat-2.0.1-6
ffmpeg-0.10.2-2
ffmpeg_devel-0.10.2-2
flex-2.5.35-6
freetype-2.4.9-2
freetype_devel-2.4.9-2
gcc-2.95.3_130425-2
gettext-0.18.1.1-4
gettext_libintl-0.18.1.1-4
git-1.7.10.2-2
git_arch-1.7.10.2-2
git_cvs-1.7.10.2-2
git_daemon-1.7.10.2-2
git_email-1.7.10.2-2
git_svn-1.7.10.2-2
glu-9.0.0-1
glu_devel-9.0.0-1
grep-2.14-4
groff-1.20.1-2
icu-4.8.1.1-3
icu_devel-4.8.1.1-3
jam-2.5_2012_10_12-1
jpeg-9-2
jpeg_devel-9-2
keymapswitcher-1.2.7.10-1
libedit-2012_06_01_3.0-1
libiconv-1.13.1-5
libogg-1.3.0-1
libogg_devel-1.3.0-1
libpcre-8.21-5
libpng-1.5.12-2
libpng_devel-1.5.12-2
libsolv-0.3.0_haiku_2013_06_16-1
libsolv_devel-0.3.0_haiku_2013_06_16-1
libtheora-1.1.1-1
libtheora_devel-1.1.1-1
libtool-2.4-8
libtool_libltdl-2.4-8
libvorbis-1.3.2-1
libvorbis_devel-1.3.2-1
libvpx-1.0.0-1
libvpx_devel-1.0.0-1
libxml2-2.8.0-3
m4-1.4.16-5
make-3.82-5
man-1.6g-2
mercurial-2.2.2-3
mesa-7.8.2-3
mesa_devel-7.8.2-3
mkdepend-1.7-3
nano-2.2.6-3
ncurses-5.9-7
neon-0.29.6-6
openssh-6.0p1-6
openssl-1.0.0j-2
openssl_devel-1.0.0j-2
p7zip-9.20.1-4
pe-2.4.3_hg602-4
perl-5.10.1-5
python-2.6.8-4
readline-6.2-3
sed-4.2.1-5
speex-1.2~rc1-1
speex_devel-1.2~rc1-1
sqlite-3.7.13-3
subversion-1.6.18-5
tar-1.26-5
texinfo-4.13a-7
vision-0.9.7.r944-1
wonderbrush-2.1.2-3
wpa_supplicant-2.0-3
yasm-1.2.0-3
zlib-1.2.8-2
zlib_devel-1.2.8-2
:
# source packages
apr
autoconf
automake
# bepdf
binutils
bison
bzip2
cdrtools
cmake
ctags
curl
cvs
doxygen
expat
ffmpeg
flex
freetype
gcc
gettext
git
glu
grep
groff
icu
jam
jpeg
keymapswitcher
libedit
libiconv
libogg
libpcre
libpng
libsolv
libtheora
libtool
libvorbis
libvpx
libxml2
m4
make
man
mercurial
mesa
mkdepend
nano
ncurses
neon
openssh
openssl
p7zip
pe
perl
python
readline
sed
speex
sqlite
subversion
tar
texinfo
vision
wpa_supplicant
yasm
zlib
;

View File

@ -6,13 +6,16 @@ set -o errexit
# outputDir
# tmpDir
# addBuildCompatibilityLibDir
# packages - a list of the hpkg packages copied/updated
# systemPackages, commonPackages - lists of the hpkg packages copied/updated
# (in "system" and "common" respectively)
# downloadDir
# The following are only for image types:
# installDir
# isImage
# imagePath
# imageSize
# imageLabel
# resolvePackageDependencies
# updateOnly
# dontClearImage
# isVMwareImage
@ -20,6 +23,7 @@ set -o errexit
#
# addattr
# copyattr
# getPackageDependencies
# package
# rc
# rmAttrs
@ -226,6 +230,17 @@ extractFile()
}
downloadFile()
{
url=$1
path=$2
if [ ! -f "$path" ]; then
wget -O "$path" "$url"
fi
}
mkdir -p $tmpDir
copyrightsFile=$tmpDir/copyrights
$rmAttrs -f $copyrightsFile
@ -287,8 +302,48 @@ while [ $# -gt 0 ]; do
done
# resolve package dependencies
if [ -n "$resolvePackageDependencies" ]; then
echo "Resolving package dependencies ..."
repoFiles=
for repository in $repositories; do
eval 'repositoryPackageList=$repositoryPackageList_'$repository
eval 'repositoryUrl=$repositoryUrl_'$repository
packageListHash=`sha256sum $repositoryPackageList \
| sed -r 's,([^[:space:]]*).*,\1,'`
repoFileName=repo-$packageListHash
repoFileUrl="$repositoryUrl/repos/$repoFileName"
repoFilePath="$downloadDir/$repoFileName"
downloadFile $repoFileUrl $repoFilePath
repoFiles="$repoFiles $repoFilePath"
done
# additional packages for system
packageUrls=`$getPackageDependencies $repoFiles -- $systemPackages`
for packageUrl in $packageUrls; do
packageFileName=`basename $packageUrl`
packageFilePath="$downloadDir/$packageFileName"
downloadFile $packageUrl "$packageFilePath"
$cp "${sPrefix}$packageFilePath" "${tPrefix}system/packages"
systemPackages="$systemPackages $packageFilePath"
done
# additional packages for common
packageUrls=`$getPackageDependencies $repoFiles -- $systemPackages \
$commonPackages`
for packageUrl in $packageUrls; do
packageFileName=`basename $packageUrl`
packageFilePath="$downloadDir/$packageFileName"
downloadFile $packageUrl "$packageFilePath"
$cp "${sPrefix}$packageFilePath" "${tPrefix}common/packages"
commonPackages="$commonPackages $packageFilePath"
done
fi
# install default settings for packages
for packageFile in $packages; do
for packageFile in $systemPackages $commonPackages; do
if $package list -p $packageFile | egrep '^settings/' > /dev/null; then
extractFile $packageFile common/settings settings
fi

View File

@ -0,0 +1 @@
#include <../os/package/solver/Solver.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverPackage.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverPackageSpecifier.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverPackageSpecifierList.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverProblem.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverProblemSolution.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverRepository.h>

View File

@ -0,0 +1 @@
#include <../os/package/solver/SolverResult.h>

View File

@ -6,3 +6,4 @@ SubInclude HAIKU_TOP src build libicon ;
SubInclude HAIKU_TOP src build libpackage ;
SubInclude HAIKU_TOP src build libroot ;
SubInclude HAIKU_TOP src build libshared ;
SubInclude HAIKU_TOP src build libsolv ;

View File

@ -5,6 +5,7 @@ UsePrivateBuildHeaders kernel package shared ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg v1 ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package solver ] ;
USES_BE_API on libpackage_build.so = true ;
@ -115,6 +116,18 @@ BuildPlatformSharedLibrary libpackage_build.so
NoErrorOutput.cpp
StandardErrorOutput.cpp
# solver
Solver.cpp
SolverPackage.cpp
SolverPackageSpecifier.cpp
SolverPackageSpecifierList.cpp
SolverProblem.cpp
SolverProblemSolution.cpp
SolverRepository.cpp
SolverResult.cpp
:
libshared_build.a $(HOST_LIBBE) z $(HOST_LIBSTDC++)
;
HaikuSubInclude solver ;

View File

@ -0,0 +1,29 @@
SubDir HAIKU_TOP src build libpackage solver ;
UseBuildFeatureHeaders libsolv ;
local libsolvHeaders = [ BuildFeatureAttribute libsolv : headers : path ] ;
UseHeaders [ FDirName $(libsolvHeaders) solv ] ;
UsePrivateHeaders shared ;
USES_BE_API on libpackage-add-on-libsolv_build.so = true ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package solver ] ;
MakeLocate libpackage-add-on-libsolv_build.so
: $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
BuildPlatformSharedLibrary libpackage-add-on-libsolv_build.so
:
LibsolvSolver.cpp
:
libsolvext_build.so libsolv_build.so
libpackage_build.so
libbe_build.so $(HOST_LIBSTDC++)
;
Includes [ FGristFiles LibsolvSolver.cpp ]
: [ BuildFeatureAttribute libsolv : headers ] ;

107
src/build/libsolv/Jamfile Normal file
View File

@ -0,0 +1,107 @@
SubDir HAIKU_TOP src build libsolv ;
local libsolvSourceBaseDirectory
= [ BuildFeatureAttribute libsolv : sources : path ] ;
local libsolvSourceDirectory = [ FDirName $(libsolvSourceBaseDirectory) src ] ;
local libsolvextSourceDirectory
= [ FDirName $(libsolvSourceBaseDirectory) ext ] ;
UseHeaders $(libsolvSourceDirectory) ;
local libsolvSources = [ FGristFiles
bitmap.c poolarch.c poolvendor.c poolid.c strpool.c dirpool.c
solver.c solverdebug.c repo_solv.c repo_write.c evr.c pool.c
queue.c repo.c repodata.c repopage.c util.c policy.c solvable.c
transaction.c rules.c problems.c
chksum.c md5.c sha1.c sha2.c solvversion.c selection.c
] ;
local libsolvMajor = 0 ;
local libsolvMinor = 3 ;
local libsolvPatch = 0 ;
local libsolvVersion = $(libsolvMajor).$(libsolvMinor).$(libsolvPatch) ;
DEFINES =
LIBSOLV_INTERNAL
HAIKU
ENABLE_HAIKU
VERSION=\\\"$(libsolvVersion)\\\"
;
# One of the following must be defined:
# * HAVE_FUNOPEN / HAVE_FOPENCOOKIE
#
# One of the following can be defined:
# * HAVE_QSORT_R / HAVE___QSORT ?
switch $(HOST_PLATFORM) {
case linux :
DEFINES += HAVE_STRCHRNUL HAVE_QSORT_R HAVE_FOPENCOOKIE ;
case haiku_host :
DEFINES += HAVE_FOPENCOOKIE ;
}
SubDirCcFlags -Wno-sign-compare -Wno-missing-prototypes ;
# libsolv
LOCATE on $(libsolvSources) = $(libsolvSourceDirectory) ;
Depends $(libsolvSources) : [ BuildFeatureAttribute libsolv : sources ] ;
MakeLocate libsolv_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
BuildPlatformSharedLibrary libsolv_build.so
:
$(libsolvSources)
;
UseHeaders $(libsolvSourceDirectory) ;
local libsolvextSources = [ FGristFiles
solv_xfopen.c testcase.c
repo_haiku.cpp
] ;
# libsolvext
LOCATE on $(libsolvextSources) = $(libsolvextSourceDirectory) ;
Depends $(libsolvextSources) : [ BuildFeatureAttribute libsolv : sources ] ;
USES_BE_API on libsolvext_build.so = true ;
MakeLocate libsolvext_build.so : $(HOST_BUILD_COMPATIBILITY_LIB_DIR) ;
BuildPlatformSharedLibrary libsolvext_build.so
:
$(libsolvextSources)
:
libsolv_build.so
libpackage_build.so
;
# generate solvversion.h
actions GenerateLibsolvVersionHeader
{
sed -e s,@VERSION@,$(LIBSOLV_VERSION),g \
-e s,@LIBSOLV_MAJOR@,$(LIBSOLV_MAJOR),g \
-e s,@LIBSOLV_MINOR@,$(LIBSOLV_MINOR),g \
-e s,@LIBSOLV_PATCH@,$(LIBSOLV_PATCH),g \
$(2) > $(1)
}
local versionHeaderIn = solvversion.h.in ;
SEARCH on $(versionHeaderIn) = $(libsolvSourceDirectory) ;
local versionHeader = [ FGristFiles solvversion.h ] ;
MakeLocate $(versionHeader) : $(LOCATE_SOURCE) ;
Depends $(versionHeader) : $(versionHeaderIn) ;
LIBSOLV_VERSION on $(versionHeader) = $(libsolvVersion) ;
LIBSOLV_MAJOR on $(versionHeader) = $(libsolvMajor) ;
LIBSOLV_MINOR on $(versionHeader) = $(libsolvMinor) ;
LIBSOLV_PATCH on $(versionHeader) = $(libsolvPatch) ;
GenerateLibsolvVersionHeader $(versionHeader) : $(versionHeaderIn) ;
Includes $(libsolvSources) $(libsolvextSources) : $(versionHeader) ;

View File

@ -38,6 +38,9 @@
// abort()s. Obviously that isn't good behavior for a library.
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
BSolver*
BPackageKit::create_solver()
{
@ -45,6 +48,19 @@ BPackageKit::create_solver()
}
#else
extern "C" BSolver*
__create_libsolv_solver()
{
return new(std::nothrow) LibsolvSolver;
}
#endif
struct LibsolvSolver::SolvQueue : Queue {
SolvQueue()
{
@ -583,17 +599,21 @@ LibsolvSolver::_InitPool()
// x86 gcc2.
{
const char* arch;
#ifdef __HAIKU_ARCH_X86
#if (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_2
arch = "x86_gcc2";
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
#ifdef __HAIKU_ARCH_X86
#if (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_2
arch = "x86_gcc2";
#else
arch = "x86";
#endif
#else
arch = "x86";
struct utsname info;
if (uname(&info) != 0)
return errno;
arch = info.machine;
#endif
#else
struct utsname info;
if (uname(&info) != 0)
return errno;
arch = info.machine;
arch = HAIKU_PACKAGING_ARCH;
#endif
pool_setarchpolicy(fPool, arch);

View File

@ -9,14 +9,18 @@
#include <package/solver/Solver.h>
#include <dlfcn.h>
#include <pthread.h>
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
# include <dlfcn.h>
# include <pthread.h>
#endif
namespace BPackageKit {
typedef BPackageKit::BSolver* CreateSolverFunction();
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
typedef BSolver* CreateSolverFunction();
static CreateSolverFunction* sCreateSolver = NULL;
static pthread_once_t sLoadLibsolvSolverAddOnInitOnce = PTHREAD_ONCE_INIT;
@ -34,6 +38,19 @@ load_libsolv_solver_add_on()
dlclose(imageHandle);
}
#else
static BPackageKit::BSolver* __create_libsolv_solver()
__attribute__((weakref("__create_libsolv_solver")));
static CreateSolverFunction* sCreateSolver = &__create_libsolv_solver;
#endif
namespace BPackageKit {
BSolver::BSolver()
{
@ -48,7 +65,9 @@ BSolver::~BSolver()
/*static*/ status_t
BSolver::Create(BSolver*& _solver)
{
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
pthread_once(&sLoadLibsolvSolverAddOnInitOnce, &load_libsolv_solver_add_on);
#endif
if (sCreateSolver == NULL)
return B_NOT_SUPPORTED;

View File

@ -94,6 +94,7 @@ SubInclude HAIKU_TOP src tools fixup_amiga_boot_checksum ;
SubInclude HAIKU_TOP src tools fixup_tos_boot_checksum ;
SubInclude HAIKU_TOP src tools fs_shell ;
SubInclude HAIKU_TOP src tools gensyscalls ;
SubInclude HAIKU_TOP src tools get_package_dependencies ;
SubInclude HAIKU_TOP src tools hack_coff ;
SubInclude HAIKU_TOP src tools keymap ;
SubInclude HAIKU_TOP src tools locale ;

View File

@ -0,0 +1,19 @@
SubDir HAIKU_TOP src tools get_package_dependencies ;
UsePrivateBuildHeaders shared ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src bin pkgman ] ;
USES_BE_API on <build>get_package_dependencies = true ;
BuildPlatformMain <build>get_package_dependencies :
get_package_dependencies.cpp
# pkgman sources
PackageInfoErrorListener.cpp
RepositoryBuilder.cpp
:
libpackage-add-on-libsolv_build.so
libsolvext_build.so libsolv_build.so
libpackage_build.so $(HOST_LIBBE) $(HOST_LIBSTDC++)
;

View File

@ -0,0 +1,160 @@
/*
* Copyright 2013, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <ingo_weinhold@gmx.de>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <package/RepositoryCache.h>
#include <package/solver/Solver.h>
#include <package/solver/SolverPackageSpecifier.h>
#include <package/solver/SolverPackageSpecifierList.h>
#include <package/solver/SolverProblem.h>
#include <package/solver/SolverProblemSolution.h>
#include <package/solver/SolverRepository.h>
#include <package/solver/SolverResult.h>
#include "pkgman.h"
#include "RepositoryBuilder.h"
static const char* sProgramName = "get_package_dependencies";
void
print_usage_and_exit(bool error)
{
fprintf(error ? stderr : stdout,
"Usage: %s <repository> ... -- <package> ...\n"
"Resolves the dependencies of the given packages using the given\n"
"repositories and prints the URLs of the packages that are also\n"
"needed to satisfy all requirements. Fails, if there are conflicts\n"
"or some requirements cannot be satisfied.\n",
sProgramName);
exit(error ? 1 : 0);
}
int
main(int argc, const char* const* argv)
{
if (argc < 2)
print_usage_and_exit(true);
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
print_usage_and_exit(false);
// get lists of repositories and packages
int argIndex = 1;
const char* const* repositories = argv + argIndex;
while (argIndex < argc && strcmp(argv[argIndex], "--") != 0)
argIndex++;
int repositoryCount = argv + argIndex - repositories;
if (repositoryCount == 0 || argIndex == argc)
print_usage_and_exit(true);
const char* const* packages = argv + argIndex + 1;
int packageCount = argv + argc - packages;
// create the solver
BSolver* solver;
status_t error = BSolver::Create(solver);
if (error != B_OK)
DIE(error, "failed to create solver");
// add the "installed" repository with the given packages
BSolverRepository installedRepository;
{
RepositoryBuilder installedRepositoryBuilder(installedRepository,
"installed");
for (int i = 0; i < packageCount; i++)
installedRepositoryBuilder.AddPackage(packages[i]);
installedRepositoryBuilder.AddToSolver(solver, true);
}
// add external repositories
std::map<BSolverRepository*, BRepositoryInfo> repositoryInfos;
for (int i = 0; i < repositoryCount; i++) {
BSolverRepository* repository = new BSolverRepository;
BRepositoryCache cache;
error = cache.SetTo(repositories[i]);
if (error != B_OK)
DIE(error, "failed to read repository file '%s'", repositories[i]);
RepositoryBuilder(*repository, cache)
.AddToSolver(solver, false);
repositoryInfos[repository] = cache.Info();
}
// solve
error = solver->VerifyInstallation();
if (error != B_OK)
DIE(error, "failed to compute packages to install");
// print problems (and fail), if any
if (solver->HasProblems()) {
fprintf(stderr, "Encountered problems:\n");
int32 problemCount = solver->CountProblems();
for (int32 i = 0; i < problemCount; i++) {
// print problem and possible solutions
BSolverProblem* problem = solver->ProblemAt(i);
fprintf(stderr, "problem %" B_PRId32 ": %s\n", i + 1,
problem->ToString().String());
int32 solutionCount = problem->CountSolutions();
for (int32 k = 0; k < solutionCount; k++) {
const BSolverProblemSolution* solution = problem->SolutionAt(k);
fprintf(stderr, " solution %" B_PRId32 ":\n", k + 1);
int32 elementCount = solution->CountElements();
for (int32 l = 0; l < elementCount; l++) {
const BSolverProblemSolutionElement* element
= solution->ElementAt(l);
fprintf(stderr, " - %s\n", element->ToString().String());
}
}
}
exit(1);
}
// print URL of packages that additionally need to be installed
BSolverResult result;
error = solver->GetResult(result);
if (error != B_OK)
DIE(error, "failed to compute packages to install");
bool duplicatePackage = false;
for (int32 i = 0; const BSolverResultElement* element = result.ElementAt(i);
i++) {
BSolverPackage* package = element->Package();
switch (element->Type()) {
case BSolverResultElement::B_TYPE_INSTALL:
if (package->Repository() != &installedRepository) {
const BRepositoryInfo& info
= repositoryInfos[package->Repository()];
BString url = info.OriginalBaseURL();
url << '/' << package->Info().CanonicalFileName();
printf("%s\n", url.String());
}
break;
case BSolverResultElement::B_TYPE_UNINSTALL:
fprintf(stderr, "Error: would need to uninstall package %s\n",
package->VersionedName().String());
duplicatePackage = true;
break;
}
}
return duplicatePackage ? 1 : 0;
}