[haiku-commits] BRANCH HaikuPM-github.package-management [e173a1e] in build/jam: . packages repositories/HaikuPortsCross

  • From: HaikuPM-github.package-management <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 21 Jul 2013 04:15:31 +0200 (CEST)

added 6 changesets to branch 'refs/remotes/HaikuPM-github/package-management'
old head: 21b3820e86796176dcb894fbf60daaf1574d5575
new head: e173a1ec1c0c1f48e355f3cbc34c0114e336ff88
overview: https://github.com/haiku/HaikuPM/compare/21b3820...e173a1e

----------------------------------------------------------------------------

fc8967f: Determine HAIKU_CPU and HAIKU_PACKAGING_ARCH in configure
  
  ... instead of in BuildSetup.

67e8400: rule ExtractBuildFeatureArchives: implement placeholders
  
  Add support for placeholders in the attribute values. The values of the
  currently supported placeholders depend on the package file name
  (package version, actual package and port name, etc.).

d1fe5b9: BuildFeature: get rid of hard-coded package versions
  
  ... using the new placeholder feature of ExtractBuildFeatureArchives.

b9eec51: Include DefaultBuildProfiles earlier
  
  DefaultBuildProfiles is now included earlier (right after BuildSetup).
  This allows us to set HAIKU_BOOTSTRAP_BUILD earlier, so it can be used
  for the repository selection. The actual build profile definitions,
  which cannot be done that early, live in the rule
  DefineDefaultBuildProfiles, which is invoked where the file was
  previously included.

33f23ea: Remove more stuff from the Haiku bootstrap packages/image
  
  Namely GL/Mesa and libtiff.

e173a1e: Integrate building the HaikuPorts bootstrap packages
  
  * Add configure option --bootstrap which allows specifying the
    haikuporter and HaikuPorts repository paths.
  * Add rules for supporting a second repository type. The
    PackageRepository rule is now private and RemotePackageRepository is
    used for remote repositories. The new BootstrapPackageRepository rule
    is for defining a bootstrap repository (there will probably be only
    the HaikuPorts cross repository) whose packages can be built as needed
    via haikuporter.
  * Rename DownloadPackage to FetchPackage.
  * Define repository HaikuPortsCross.
  * HaikuCrossDevel package(s): There are now two sets of packages: A
    "stage1" set with the same content as before and a final set
    additionally containing the libraries libbe, libnetwork, libpackage.
    Those are needed for building the libsolv bootstrap package while for
    building them we need other bootstrap packages (ICU, libz).
  
  This is basically all that's required to build a bootstrap Haiku
  completely from sources, with a few caveats:
  * There's no ICU bootstrap recipe yet (so one has to cheat and use the
    prebuilt package ATM).
  * Probably doesn't work on Haiku yet (tested on Linux only).
  * A 32 bit environment must be used (otherwise building the gcc 2
    bootstrap package fails).
  * Building with multiple jobs doesn't work yet, since haikuporter uses
    common directories for building different packages and there's no
    explicit serialization yet.
  * Haven't tested the resulting image save for booting it. So it probably
    needs a bit more work before it can actually build the final
    HaikuPorts packages.

                                    [ Ingo Weinhold <ingo_weinhold@xxxxxx> ]

----------------------------------------------------------------------------

16 files changed, 704 insertions(+), 287 deletions(-)
Jamfile                                         |   2 +-
Jamrules                                        |  10 +-
build/jam/BuildFeatures                         |   4 +-
build/jam/BuildSetup                            |  22 --
build/jam/DefaultBuildProfiles                  | 273 ++++++++++----------
build/jam/ImageRules                            |   2 +-
build/jam/MiscRules                             | 114 +++++++-
build/jam/RepositoryRules                       | 258 ++++++++++++++++--
build/jam/images/HaikuImageBootstrap            |   4 +-
build/jam/images/HaikuImageCommon               |   3 +-
build/jam/packages/HaikuBootstrap               |   7 -
build/jam/packages/HaikuCrossDevel              | 147 ++++++-----
build/jam/packages/HaikuDevel                   |   6 +-
build/jam/repositories/HaikuPorts/x86_gcc2      |   2 +-
build/jam/repositories/HaikuPortsCross/x86_gcc2 |  59 +++++
configure                                       |  78 +++++-

############################################################################

Commit:      fc8967f1a6ae896205bf4e59a1db2f26ae168a04
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Fri Jul 19 23:01:21 2013 UTC

Determine HAIKU_CPU and HAIKU_PACKAGING_ARCH in configure

... instead of in BuildSetup.

----------------------------------------------------------------------------

diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index fd4ec32..a824d7a 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -202,18 +202,6 @@ switch $(HAIKU_DISTRO_COMPATIBILITY) {
                                                $(HAIKU_DISTRO_COMPATIBILITY) ;
 }
 
-# analyze the gcc machine spec to determine HAIKU_CPU
-switch $(HAIKU_GCC_MACHINE) {
-       case i?86-*             : HAIKU_CPU = x86 ;
-       case x86_64-*   : HAIKU_CPU = x86_64 ;
-       case powerpc-*  : HAIKU_CPU = ppc ;
-       case m68k-*             : HAIKU_CPU = m68k ;
-       case mipsel-*   : HAIKU_CPU = mipsel ;
-       case arm-*              : HAIKU_CPU = arm ;
-       case *                  : Exit "Unsupported gcc target machine:"
-                                               $(HAIKU_GCC_MACHINE) ;
-}
-
 # determine the endianness of the host
 switch $(HOST_GCC_MACHINE) {
        case amd64-*    : HAIKU_HOST_IS_BIG_ENDIAN = 0 ;
@@ -236,7 +224,6 @@ switch $(HAIKU_CPU) {
                HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
                # offset in floppy image (>= sizeof(haiku_loader))
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
-               HAIKU_PACKAGING_ARCH = ppc ;
        }
        case arm :
        {
@@ -249,7 +236,6 @@ switch $(HAIKU_CPU) {
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet
                HAIKU_NO_WERROR = 1 ;
                        # we use #warning as placeholders for things to write...
-               HAIKU_PACKAGING_ARCH = arm ;
        }
        case x86 :
        {
@@ -258,11 +244,6 @@ switch $(HAIKU_CPU) {
                HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
                # offset in floppy image (>= sizeof(haiku_loader))
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB
-               if $(HAIKU_GCC_VERSION[1]) = 2 {
-                       HAIKU_PACKAGING_ARCH = x86_gcc2 ;
-               } else {
-                       HAIKU_PACKAGING_ARCH = x86 ;
-               }
 
                # yasm is required for target arch x86
                if ! $(HAIKU_YASM) {
@@ -276,7 +257,6 @@ switch $(HAIKU_CPU) {
                HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
                # offset in floppy image (>= sizeof(haiku_loader))
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB
-               HAIKU_PACKAGING_ARCH = x86_64 ;
 
                # x86_64 kernel source is under arch/x86.
                HAIKU_KERNEL_ARCH = x86 ;
@@ -305,7 +285,6 @@ switch $(HAIKU_CPU) {
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 260 ; # in kB
                HAIKU_NO_WERROR = 1 ;
                        # we use #warning as placeholders for things to write...
-               HAIKU_PACKAGING_ARCH = m68k ;
        }
        case mipsel :
        {
@@ -316,7 +295,6 @@ switch $(HAIKU_CPU) {
                HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB
                HAIKU_NO_WERROR = 1 ;
                        # we use #warning as placeholders for things to write...
-               HAIKU_PACKAGING_ARCH = mipsel ;
        }
        case * :
                Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ;
diff --git a/configure b/configure
index 8663e7a..ca1a5ac 100755
--- a/configure
+++ b/configure
@@ -183,6 +183,22 @@ standard_gcc_settings()
                # Note: We filter out eabi.o. It's present in gcc's libgcc for 
PPC and
                # neither needed nor wanted.
 
+       # determine architecture from machine triple
+       case $HAIKU_GCC_MACHINE in
+               arm-*)          HAIKU_CPU=arm;;
+               i?86-*)         HAIKU_CPU=x86;;
+               m68k-*)         HAIKU_CPU=m68k;;
+               mipsel-*)       HAIKU_CPU=mipsel;;
+               powerpc-*)      HAIKU_CPU=ppc;;
+               x86_64-*)       HAIKU_CPU=x86_64;;
+               *)
+                       echo "Unsupported gcc target machine: 
$HAIKU_GCC_MACHINE" >&2
+                       exit 1
+                       ;;
+       esac
+
+       HAIKU_PACKAGING_ARCH=$HAIKU_CPU
+
        case $HAIKU_GCC_RAW_VERSION in
                4.*)
                        # for gcc 4 we use the libstdc++ and libsupc++ that 
come with the
@@ -246,7 +262,7 @@ standard_gcc_settings()
                        else
                                HAIKU_SHARED_LIBSUPCXX=`$readlink 
$HAIKU_SHARED_LIBSUPCXX`
                        fi
-               ;;
+                       ;;
                2.9*)
                        # check for correct (most up-to-date) legacy compiler 
and complain
                        # if an older one is installed
@@ -258,7 +274,8 @@ standard_gcc_settings()
 
                        HAIKU_KERNEL_LIBGCC=$HAIKU_GCC_LIBGCC
                        HAIKU_KERNEL_LIBSUPCXX=
-               ;;
+                       HAIKU_PACKAGING_ARCH=x86_gcc2
+                       ;;
        esac
 
        case $HAIKU_GCC_MACHINE in
@@ -266,11 +283,11 @@ standard_gcc_settings()
                        # Boot loader is 32-bit, need the 32-bit libs.
                        HAIKU_BOOT_LIBGCC=`$HAIKU_CC -m32 
-print-libgcc-file-name`
                        HAIKU_BOOT_LIBSUPCXX=`$HAIKU_CC -m32 
-print-file-name=libsupc++.a`
-               ;;
+                       ;;
                *)
                        HAIKU_BOOT_LIBGCC=$HAIKU_GCC_LIBGCC
                        HAIKU_BOOT_LIBSUPCXX=$HAIKU_STATIC_LIBSUPCXX
-               ;;
+                       ;;
        esac
 }
 
@@ -322,7 +339,6 @@ configureArgs="$@"
 #
 platform=`uname`
 platformMachine=`uname  -m`
-targetArch=x86
 crossToolsPrefix=
 buildCrossTools=
 buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools"
@@ -332,6 +348,8 @@ buildCrossToolsJobs=
 # exported (BuildSetup) default parameter values
 #
 HAIKU_GCC_RAW_VERSION=
+HAIKU_CPU=x86
+HAIKU_PACKAGING_ARCH=x86_gcc2
 HAIKU_GCC_MACHINE=i586-pc-haiku
 HAIKU_STATIC_LIBSTDCXX=
 HAIKU_SHARED_LIBSTDCXX=
@@ -427,11 +445,11 @@ while [ $# -gt 0 ] ; do
                        buildCrossToolsScript="${buildCrossToolsScript}_gcc4"
                        case "$2" in
                                x86)    HAIKU_GCC_MACHINE=i586-pc-haiku;;
-                               x86_64) HAIKU_GCC_MACHINE=x86_64-unknown-haiku; 
targetArch=x86_64;;
-                               ppc)    HAIKU_GCC_MACHINE=powerpc-apple-haiku; 
targetArch=ppc;;
-                               m68k)   HAIKU_GCC_MACHINE=m68k-unknown-haiku; 
targetArch=m68k;;
-                               arm)    HAIKU_GCC_MACHINE=arm-unknown-haiku; 
targetArch=arm;;
-                               mipsel) HAIKU_GCC_MACHINE=mipsel-unknown-haiku; 
targetArch=mips;;
+                               x86_64) HAIKU_GCC_MACHINE=x86_64-unknown-haiku;;
+                               ppc)    HAIKU_GCC_MACHINE=powerpc-apple-haiku;;
+                               m68k)   HAIKU_GCC_MACHINE=m68k-unknown-haiku;;
+                               arm)    HAIKU_GCC_MACHINE=arm-unknown-haiku;;
+                               mipsel) HAIKU_GCC_MACHINE=mipsel-unknown-haiku;
                                *)              echo "Unsupported target 
architecture: $2"
                                                exit 1;;
                        esac
@@ -608,6 +626,9 @@ HAIKU_GCC_LIB_DIR                   ?= ${HAIKU_GCC_LIB_DIR} 
;
 HAIKU_GCC_HEADERS_DIR          ?= ${HAIKU_GCC_HEADERS_DIR} ;
 HAIKU_GCC_LIBGCC                       ?= ${HAIKU_GCC_LIBGCC} ;
 
+HAIKU_CPU                                      ?= ${HAIKU_CPU} ;
+HAIKU_PACKAGING_ARCH           ?= ${HAIKU_PACKAGING_ARCH} ;
+
 HAIKU_STATIC_LIBSTDC++         ?= ${HAIKU_STATIC_LIBSTDCXX} ;
 HAIKU_SHARED_LIBSTDC++         ?= ${HAIKU_SHARED_LIBSTDCXX} ;
 HAIKU_STATIC_LIBSUPC++         ?= ${HAIKU_STATIC_LIBSUPCXX} ;

############################################################################

Commit:      67e84002a1f97e4f853f89c0fe41ad358c7389c8
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sun Jul 21 01:12:45 2013 UTC

rule ExtractBuildFeatureArchives: implement placeholders

Add support for placeholders in the attribute values. The values of the
currently supported placeholders depend on the package file name
(package version, actual package and port name, etc.).

----------------------------------------------------------------------------

diff --git a/build/jam/MiscRules b/build/jam/MiscRules
index c7373fe..fc1d318 100644
--- a/build/jam/MiscRules
+++ b/build/jam/MiscRules
@@ -661,22 +661,117 @@ rule BuildFeatureAttribute feature : attribute : flags
 }
 
 
+rule ExtractBuildFeatureArchivesExpandValue value : fileName
+{
+       if ! $(value) {
+               return $(value) ;
+       }
+
+       # split the value
+       local splitValue ;
+       while $(value) {
+               local components = [ Match "([^%]*)(%[^%]*%)(.*)" : $(value) ] ;
+               if ! $(components) {
+                       splitValue += $(value) ;
+                       break ;
+               }
+
+               if $(components[1]) {
+                       splitValue += $(components[1]) ;
+               }
+               splitValue += $(components[2]) ;
+               value = $(components[3]) ;
+       }
+
+       # reassemble the value, performing the substitutions
+       local %packageName% ;
+       local %portName% ;
+       local %packageFullVersion% ;
+       value = "" ;
+       while $(splitValue) {
+               local component = $(splitValue[1]) ;
+               splitValue = $(splitValue[2-]) ;
+               switch $(component) {
+                       case %packageRevisionedName% :
+                               splitValue = %packageName% "-" 
%packageFullVersion%
+                                       $(splitValue) ;
+
+                       case %portRevisionedName% :
+                               splitValue = %portName% "-" 
%packageFullVersion% $(splitValue) ;
+
+                       case %*% :
+                               if ! x$(%packageName%) {
+                                       # extract package name and version from 
file name
+                                       local splitName
+                                               = [ Match "([^-]*)-(.*).hpkg" : 
$(fileName) ] ;
+                                       if $(splitName) {
+                                               %packageName% = $(splitName[1]) 
;
+                                               %packageFullVersion%
+                                                       = [ Match 
"([^-]*-[^-]*)-.*" : $(splitName[2]) ] ;
+                                               if ! $(packageFullVersion%) {
+                                                       packageFullVersion% = 
$(splitName[2]) ;
+                                               }
+                                       } else {
+                                               %packageName% = [ Match 
"(.*).hpkg" : $(fileName) ] ;
+                                               if ! $(%packageName%) {
+                                                       %packageName% = 
$(fileName) ;
+                                               }
+                                               %packageFullVersion% = "" ;
+                                       }
+
+                                       # get the port name from the package 
name
+                                       splitName = [ Match "(.*)_([^_]*)" : 
$(%packageName%) ] ;
+                                       local knownPackageSuffixes = devel doc 
source debuginfo ;
+                                       if $(splitName[2])
+                                               && $(splitName[2]) in 
$(knownPackageSuffixes) {
+                                               %portName% = $(splitName[1]) ;
+                                       } else {
+                                               %portName% = $(%packageName%) ;
+                                       }
+                               }
+
+                               value = "$(value)$($(component):E=)" ;
+
+                       case * :
+                               value = "$(value)$(component)" ;
+               }
+       }
+
+       return $(value) ;
+}
+
+
 rule ExtractBuildFeatureArchives feature : list
 {
        # ExtractBuildFeatureArchives <feature> : <list> ;
        # Downloads and extracts one or more archives for build feature 
<feature>
        # and sets attributes for the build feature to extracted entries. The 
syntax
        # for <list> is:
-       # "file:" <packageName> <url>
+       # "file:" <packageAlias> <packageName>
        #    <attribute>: <value> ...
        #    ...
-       # "file:" <packageName2> <url2>
+       # "file:" <packageAlias2> <packageName2>
        # ...
        #
-       # <packageName> specifies a short name for the archive (e.g. "base" for 
the
-       # base package, "devel" for the development package, etc.), <url> the 
URL
-       # from which to download the file. <attribute> and be any name and 
<value>
-       # any relative path in the extraction directory.
+       # <packageAlias> specifies a short name for the archive (e.g. "base" 
for the
+       # base package, "devel" for the development package, etc.), 
<packageName>
+       # the unversioned name of the package (e.g. "libsolv_devel").
+       # <attribute> can be any name and <value> any relative path in the
+       # extraction directory. The following placeholders in <value> will be
+       # replaced with the respective value:
+       # * %packageName% is replaced with the name of the package as extracted 
from
+       #   the package file name (may differ from the specified package name 
e.g.
+       #   for bootstrap packages).
+       # * %portName% is replaced with the name of the port the package 
belongs to.
+       #   That is %packageName% with any well-known package type suffix 
("_devel",
+       #   "_source", etc.) removed.
+       # * %packageFullVersion% is replaced with the the full version string 
of the
+       #   package (i.e. including the revision) as extracted frmo the package 
file
+       #   name.
+       # * %packageRevisionedName% is replaced with what
+       #   %packageName%-%packageFullVersion% would be replaced.
+       # * %portRevisionedName% is replaced with what
+       #   %portName%-%packageFullVersion% would be replaced.
        #
        # The attribute with the name "depends" will be handled specially. Its
        # <value> specifies the name of a package the current package depends on
@@ -685,7 +780,7 @@ rule ExtractBuildFeatureArchives feature : list
        # the package it depends on. The "depends" attribute must precede any 
other
        # attribute for the package.
        #
-       # The rule also sets the build feature attribute 
"<packageName>:directory"
+       # The rule also sets the build feature attribute 
"<packageAlias>:directory"
        # to the extraction directory for each package.
 
        while $(list) {
@@ -725,7 +820,8 @@ rule ExtractBuildFeatureArchives feature : list
                                        }
                                        case * :
                                        {
-                                               values += $(list[1]) ;
+                                               values += [ 
ExtractBuildFeatureArchivesExpandValue
+                                                       $(list[1]) : 
$(fileName) ] ;
                                                list = $(list[2-]) ;
                                        }
                                }

############################################################################

Commit:      d1fe5b98d9db39ae386988e85abf201db029c53d
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sun Jul 21 01:13:58 2013 UTC

BuildFeature: get rid of hard-coded package versions

... using the new placeholder feature of ExtractBuildFeatureArchives.

----------------------------------------------------------------------------

diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures
index b2a15f3..4bc1a8f 100644
--- a/build/jam/BuildFeatures
+++ b/build/jam/BuildFeatures
@@ -474,7 +474,7 @@ if [ IsPackageAvailable zlib_devel ] {
                        library: develop/lib/libz.so
                        headers: develop/headers
                file: source zlib_source
-                       sources: develop/sources/zlib-1.2.8-2/source
+                       sources: develop/sources/%portRevisionedName%/source
                ;
 
        EnableBuildFeatures zlib ;
@@ -493,7 +493,7 @@ if [ IsPackageAvailable libsolv_devel ] {
                        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
+                       sources: develop/sources/%portRevisionedName%/source
                ;
 
        EnableBuildFeatures libsolv ;

############################################################################

Commit:      b9eec5192d6b6282a2bf5284e8c4121d0a29f09d
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sun Jul 21 01:20:26 2013 UTC

Include DefaultBuildProfiles earlier

DefaultBuildProfiles is now included earlier (right after BuildSetup).
This allows us to set HAIKU_BOOTSTRAP_BUILD earlier, so it can be used
for the repository selection. The actual build profile definitions,
which cannot be done that early, live in the rule
DefineDefaultBuildProfiles, which is invoked where the file was
previously included.

----------------------------------------------------------------------------

diff --git a/Jamrules b/Jamrules
index e6c027f..5274327 100644
--- a/Jamrules
+++ b/Jamrules
@@ -54,6 +54,7 @@ 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 [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ;
 
 # Include the repositories for this architecture.
 local repositoriesDirectory
@@ -90,6 +91,6 @@ if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
        }
 }
 
-include [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ;
+DefineDefaultBuildProfiles ;
 
 PrepareConfigVariables ;
diff --git a/build/jam/DefaultBuildProfiles b/build/jam/DefaultBuildProfiles
index 0a87bb3..59af307 100644
--- a/build/jam/DefaultBuildProfiles
+++ b/build/jam/DefaultBuildProfiles
@@ -1,142 +1,151 @@
-# alpha release profiles
-DefineBuildProfile alpha-raw : image : "haiku-alpha.image" ;
-DefineBuildProfile alpha-vmware : vmware-image : "haiku-alpha.vmdk" ;
-DefineBuildProfile alpha-cd : cd-image : "haiku-alpha.iso" ;
-DefineBuildProfile alpha-anyboot : anyboot-image
-       : "haiku-alpha-anyboot.image" ;
-
-# nightly profiles
-DefineBuildProfile nightly-raw : image : "haiku-nightly.image" ;
-DefineBuildProfile nightly-vmware : vmware-image : "haiku-nightly.vmdk" ;
-DefineBuildProfile nightly-cd : cd-image : "haiku-nightly.iso" ;
-DefineBuildProfile nightly-anyboot : anyboot-image
-       : "haiku-nightly-anyboot.image" ;
-
-# bootstrap profiles
-DefineBuildProfile bootstrap-raw : image : "haiku-bootstrap.image" ;
-DefineBuildProfile bootstrap-vmware : vmware-image : "haiku-bootstrap.vmdk" ;
-
+# set HAIKU_BOOTSTRAP_BUILD early, if building a bootstrap Haiku image
 switch $(HAIKU_BUILD_PROFILE) {
-       case "alpha-*" : {
-               Echo Building Haiku R1/alpha ;
-               HAIKU_ROOT_USER_NAME = user ;
-               HAIKU_ROOT_USER_REAL_NAME = "Yourself" ;
-               AddGroupToHaikuImage party : 101 : user sshd ;
-               HAIKU_IMAGE_HOST_NAME = shredder ;
-               HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
-               HAIKU_IMAGE_SIZE = 800 ;
-
-               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-*" : {
-               Echo You wish. ;
-       }
+       case "bootstrap-*" :
+               HAIKU_BOOTSTRAP_BUILD = 1 ;
+}
 
-       case "nightly-*" : {
-               Echo Building Haiku Nightly ;
-               HAIKU_ROOT_USER_NAME = user ;
-               HAIKU_ROOT_USER_REAL_NAME = "Yourself" ;
-               AddGroupToHaikuImage party : 101 : user sshd ;
-               HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
-               HAIKU_IMAGE_HOST_NAME = shredder ;
-               HAIKU_IMAGE_SIZE = 600 ;
-
-               AddHaikuImagePackages
-                       openssl
-                       wpa_supplicant
-                       :
-                       system
-                       ;
-
-               AddHaikuImagePackages
-                       man
-                       nano
-                       openssh
-                       p7zip
-                       pe
-                       vision
-                       xz_utils
-                       ;
-
-               AddOptionalHaikuImagePackages Development Git WebPositive ;
-       }
 
-       case "bootstrap-*" : {
-               Echo Building Haiku Bootstrap ;
-               HAIKU_BOOTSTRAP_BUILD = 1 ;
-               HAIKU_IMAGE_HOST_NAME = shredder ;
-               HAIKU_IMAGE_SIZE = 1000 ;
-
-               AddHaikuImagePackages
-                       freetype_devel
-                       zlib_devel
-                       :
-                       system
-                       ;
-
-               AddHaikuImagePackages
-                       autoconf
-                       automake
-                       binutils
-                       bison
-                       flex
-                       gcc
-                       jam
-                       libtool
-                       m4
-                       make
-                       mkdepend
-                       perl
-                       texinfo
-                       yasm
-                       ;
-
-               AddOptionalHaikuImagePackages DevelopmentMin ;
+rule DefineDefaultBuildProfiles
+{
+       # alpha release profiles
+       DefineBuildProfile alpha-raw : image : "haiku-alpha.image" ;
+       DefineBuildProfile alpha-vmware : vmware-image : "haiku-alpha.vmdk" ;
+       DefineBuildProfile alpha-cd : cd-image : "haiku-alpha.iso" ;
+       DefineBuildProfile alpha-anyboot : anyboot-image
+               : "haiku-alpha-anyboot.image" ;
+
+       # nightly profiles
+       DefineBuildProfile nightly-raw : image : "haiku-nightly.image" ;
+       DefineBuildProfile nightly-vmware : vmware-image : "haiku-nightly.vmdk" 
;
+       DefineBuildProfile nightly-cd : cd-image : "haiku-nightly.iso" ;
+       DefineBuildProfile nightly-anyboot : anyboot-image
+               : "haiku-nightly-anyboot.image" ;
+
+       # bootstrap profiles
+       DefineBuildProfile bootstrap-raw : image : "haiku-bootstrap.image" ;
+       DefineBuildProfile bootstrap-vmware : vmware-image
+               : "haiku-bootstrap.vmdk" ;
+
+       switch $(HAIKU_BUILD_PROFILE) {
+               case "alpha-*" : {
+                       Echo Building Haiku R1/alpha ;
+                       HAIKU_ROOT_USER_NAME = user ;
+                       HAIKU_ROOT_USER_REAL_NAME = "Yourself" ;
+                       AddGroupToHaikuImage party : 101 : user sshd ;
+                       HAIKU_IMAGE_HOST_NAME = shredder ;
+                       HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
+                       HAIKU_IMAGE_SIZE = 800 ;
+
+                       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-*" : {
+                       Echo You wish. ;
+               }
+
+               case "nightly-*" : {
+                       Echo Building Haiku Nightly ;
+                       HAIKU_ROOT_USER_NAME = user ;
+                       HAIKU_ROOT_USER_REAL_NAME = "Yourself" ;
+                       AddGroupToHaikuImage party : 101 : user sshd ;
+                       HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
+                       HAIKU_IMAGE_HOST_NAME = shredder ;
+                       HAIKU_IMAGE_SIZE = 600 ;
+
+                       AddHaikuImagePackages
+                               openssl
+                               wpa_supplicant
+                               :
+                               system
+                               ;
+
+                       AddHaikuImagePackages
+                               man
+                               nano
+                               openssh
+                               p7zip
+                               pe
+                               vision
+                               xz_utils
+                               ;
+
+                       AddOptionalHaikuImagePackages Development Git 
WebPositive ;
+               }
+
+               case "bootstrap-*" : {
+                       Echo Building Haiku Bootstrap ;
+                       HAIKU_IMAGE_HOST_NAME = shredder ;
+                       HAIKU_IMAGE_SIZE = 1000 ;
+
+                       AddHaikuImagePackages
+                               freetype_devel
+                               zlib_devel
+                               :
+                               system
+                               ;
+
+                       AddHaikuImagePackages
+                               autoconf
+                               automake
+                               binutils
+                               bison
+                               flex
+                               gcc
+#                              jam
+                               libtool
+                               m4
+                               make
+#                              mkdepend
+#                              perl
+#                              texinfo
+                               ;
+
+                       AddOptionalHaikuImagePackages DevelopmentMin ;
+               }
        }
-}
 
 
-# Uncomment in official release branch.
-#HAIKU_DEFINES += HAIKU_OFFICIAL_RELEASE ;
-#TARGET_DEFINES += HAIKU_OFFICIAL_RELEASE ;
+       # Uncomment in official release branch.
+       #HAIKU_DEFINES += HAIKU_OFFICIAL_RELEASE ;
+       #TARGET_DEFINES += HAIKU_OFFICIAL_RELEASE ;
 
 
-# If a build profile was specified on the command line, now is the time to
-# check whether it is unknown or one of the default profiles.
-if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
-       # define the obvious default profiles
-       if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image install
-                       vmware-image {
-               DefineBuildProfile $(HAIKU_BUILD_PROFILE) : 
$(HAIKU_BUILD_PROFILE) ;
-       } else {
-               Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ;
+       # If a build profile was specified on the command line, now is the time 
to
+       # check whether it is unknown or one of the default profiles.
+       if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) {
+               # define the obvious default profiles
+               if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image 
install
+                               vmware-image {
+                       DefineBuildProfile $(HAIKU_BUILD_PROFILE) : 
$(HAIKU_BUILD_PROFILE) ;
+               } else {
+                       Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not 
defined." ;
+               }
        }
 }

############################################################################

Commit:      33f23ea80f263d13f706be43e02bee7de752db87
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sun Jul 21 01:34:35 2013 UTC

Remove more stuff from the Haiku bootstrap packages/image

Namely GL/Mesa and libtiff.

----------------------------------------------------------------------------

diff --git a/Jamfile b/Jamfile
index ee97571..6535ec3 100644
--- a/Jamfile
+++ b/Jamfile
@@ -9,7 +9,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatures ] ;
 # Include packages that are required by all images.
 if $(HAIKU_BOOTSTRAP_BUILD) {
        AddHaikuImagePackages
-               bzip2 freetype glu grep icu libsolv mesa sed tar zlib
+               freetype grep icu libsolv sed zlib
                :
                system
                ;
diff --git a/build/jam/images/HaikuImageBootstrap 
b/build/jam/images/HaikuImageBootstrap
index 0bc3eef..048961b 100644
--- a/build/jam/images/HaikuImageBootstrap
+++ b/build/jam/images/HaikuImageBootstrap
@@ -62,13 +62,13 @@ SYSTEM_DEMOS = ;
 SYSTEM_LIBS = [ FFilterByBuildFeatures
        libbe.so libbsd.so libbnetapi.so
        libdebug.so libdevice.so
-       libgame.so libGL.so@x86 libglut.so@x86
+       libgame.so
        libgnu.so libmail.so libmedia.so libmidi.so libmidi2.so
        libnetwork.so
        libpackage.so
        <revisioned>libroot.so
        libscreensaver.so
-       libtextencoding.so libtiff.so libtracker.so libtranslation.so
+       libtextencoding.so libtracker.so libtranslation.so
        $(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++)
 ] ;
 PRIVATE_SYSTEM_LIBS = [ FFilterByBuildFeatures
diff --git a/build/jam/packages/HaikuBootstrap 
b/build/jam/packages/HaikuBootstrap
index 5072c1d..771692e 100644
--- a/build/jam/packages/HaikuBootstrap
+++ b/build/jam/packages/HaikuBootstrap
@@ -229,13 +229,6 @@ AddFilesToPackage add-ons accelerants      : 
$(SYSTEM_ADD_ONS_ACCELERANTS) ;
 AddFilesToPackage add-ons Translators  : $(SYSTEM_ADD_ONS_TRANSLATORS) ;
 AddFilesToPackage add-ons locale catalogs : $(SYSTEM_ADD_ONS_LOCALE_CATALOGS) ;
 
-AddFilesToPackage add-ons opengl :
-       x86 @{
-               Legacy\ Software\ Rasterizer@gcc2
-               Software\ Rasterizer@!gcc2
-       }@ # x86
-;
-
 AddFilesToPackage add-ons Tracker
        : FileType-F Mark\ as… Mark\ as\ Read-R Open\ Target\ Folder-O
                Open\ Terminal-T ZipOMatic-Z ;
diff --git a/build/jam/packages/HaikuDevel b/build/jam/packages/HaikuDevel
index 7b86707..478d171 100644
--- a/build/jam/packages/HaikuDevel
+++ b/build/jam/packages/HaikuDevel
@@ -68,7 +68,9 @@ AddHeaderDirectoryToPackage compatibility bsd : bsd ;
 AddHeaderDirectoryToPackage compatibility gnu : gnu ;
 
 # third party libs headers
-AddHeaderDirectoryToPackage libs tiff : 3rdparty ;
+if ! $(HAIKU_BOOTSTRAP_BUILD) {
+       AddHeaderDirectoryToPackage libs tiff : 3rdparty ;
+}
 
 # cpp headers
 if $(HAIKU_GCC_VERSION[1]) = 2 {
@@ -78,7 +80,7 @@ if $(HAIKU_GCC_VERSION[1]) = 2 {
 }
 
 # OpenGL headers
-if $(TARGET_ARCH) = x86 {
+if $(TARGET_ARCH) = x86 && ! $(HAIKU_BOOTSTRAP_BUILD) {
        local mesaGlHeaders
                = [ FDirName [ BuildFeatureAttribute mesa : headers : path ] GL 
] ;
        local mesaGlHeadersDependency = [ BuildFeatureAttribute mesa : headers 
] ;

############################################################################

Commit:      e173a1ec1c0c1f48e355f3cbc34c0114e336ff88
Author:      Ingo Weinhold <ingo_weinhold@xxxxxx>
Date:        Sun Jul 21 02:10:48 2013 UTC

Integrate building the HaikuPorts bootstrap packages

* Add configure option --bootstrap which allows specifying the
  haikuporter and HaikuPorts repository paths.
* Add rules for supporting a second repository type. The
  PackageRepository rule is now private and RemotePackageRepository is
  used for remote repositories. The new BootstrapPackageRepository rule
  is for defining a bootstrap repository (there will probably be only
  the HaikuPorts cross repository) whose packages can be built as needed
  via haikuporter.
* Rename DownloadPackage to FetchPackage.
* Define repository HaikuPortsCross.
* HaikuCrossDevel package(s): There are now two sets of packages: A
  "stage1" set with the same content as before and a final set
  additionally containing the libraries libbe, libnetwork, libpackage.
  Those are needed for building the libsolv bootstrap package while for
  building them we need other bootstrap packages (ICU, libz).

This is basically all that's required to build a bootstrap Haiku
completely from sources, with a few caveats:
* There's no ICU bootstrap recipe yet (so one has to cheat and use the
  prebuilt package ATM).
* Probably doesn't work on Haiku yet (tested on Linux only).
* A 32 bit environment must be used (otherwise building the gcc 2
  bootstrap package fails).
* Building with multiple jobs doesn't work yet, since haikuporter uses
  common directories for building different packages and there's no
  explicit serialization yet.
* Haven't tested the resulting image save for booting it. So it probably
  needs a bit more work before it can actually build the final
  HaikuPorts packages.

----------------------------------------------------------------------------

diff --git a/Jamrules b/Jamrules
index 5274327..80189fa 100644
--- a/Jamrules
+++ b/Jamrules
@@ -59,8 +59,13 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) 
DefaultBuildProfiles ] ;
 # Include the repositories for this architecture.
 local repositoriesDirectory
        = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ;
+local repositories = HaikuPorts ;
+if $(HAIKU_BOOTSTRAP_BUILD) {
+       repositories = HaikuPortsCross ;
+}
+
 local repository ;
-for repository in HaikuPorts {
+for repository in $(repositories) {
        local repositoryDirectory
                = [ FDirName $(repositoriesDirectory) $(repository) ] ;
        local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ;
diff --git a/build/jam/ImageRules b/build/jam/ImageRules
index 2d59eb3..f9846c0 100644
--- a/build/jam/ImageRules
+++ b/build/jam/ImageRules
@@ -1021,7 +1021,7 @@ rule AddHaikuImagePackages packages : installationLocation
                        HAIKU_ADDED_PACKAGES += $(package) ;
 
                        # download the package file and add it to the image
-                       local file = [ DownloadPackage $(package) ] ;
+                       local file = [ FetchPackage $(package) ] ;
 
                        if $(HAIKU_UPDATE_ALL_PACKAGES) {
                                HAIKU_INCLUDE_IN_IMAGE on $(file) = 1 ;
diff --git a/build/jam/MiscRules b/build/jam/MiscRules
index fc1d318..64ffffd 100644
--- a/build/jam/MiscRules
+++ b/build/jam/MiscRules
@@ -790,7 +790,7 @@ rule ExtractBuildFeatureArchives feature : list
                }
 
                local package = $(list[2]) ;
-               local file = [ DownloadPackage $(list[3]) ] ;
+               local file = [ FetchPackage $(list[3]) ] ;
                local fileName = $(file:BS) ;
                list = $(list[4-]) ;
 
diff --git a/build/jam/RepositoryRules b/build/jam/RepositoryRules
index 6c33e6f..f263853 100644
--- a/build/jam/RepositoryRules
+++ b/build/jam/RepositoryRules
@@ -1,9 +1,32 @@
+#pragma mark - Private
+
+
 rule PackageFamily packageBaseName
 {
        return $(packageBaseName:G=package-family) ;
 }
 
 
+rule SetRepositoryMethod repository : methodName : method
+{
+       HAIKU_REPOSITORY_METHOD_$(methodName) on $(repository) = $(method) ;
+}
+
+rule InvokeRepositoryMethod repository : methodName : arg1 : arg2 : arg3 : arg4
+       : arg5 : arg6 : arg7
+{
+       local method
+               = [ on $(repository) return 
$(HAIKU_REPOSITORY_METHOD_$(methodName)) ] ;
+       if ! $(method) {
+               Exit "Method" $(methodName) " not defined for repository"
+                       $(repository) ;
+       }
+
+       return [ $(method) $(repository) : $(arg1) : $(arg2) : $(arg3) : $(arg4)
+               : $(arg5) : $(arg6) : $(arg7) ] ;
+}
+
+
 rule AddRepositoryPackage repository : architecture : baseName : version
 {
        local package = $(baseName)-$(version) ;
@@ -12,56 +35,104 @@ rule AddRepositoryPackage repository : architecture : 
baseName : version
        HAIKU_PACKAGE_ARCHITECTURE on $(package) = $(architecture) ;
        HAIKU_PACKAGE_FILE_NAME on $(package) = 
$(package:G=)-$(architecture).hpkg ;
 
+       local packageFamily = [ InvokeRepositoryMethod $(repository) : 
PackageFamily
+               : $(baseName) ] ;
+       baseName = $(packageFamily:G=) ;
+
        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) ;
+
+       return $(package) ;
 }
 
 
 rule AddRepositoryPackages repository : architecture : packages : 
sourcePackages
        : debugInfoPackages
 {
+       local packageTargets ;
        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) ;
+               packageTargets += [ AddRepositoryPackage $(repository) : 
$(architecture)
+                       : $(baseName) : $(version) ] ;
                if $(baseName) in $(sourcePackages) {
                        AddRepositoryPackage $(repository) : source : 
$(baseName)_source
                                : $(version) ;
                }
                if $(baseName) in $(debugInfoPackages) {
-                       AddRepositoryPackage $(repository) : $(architecture)
-                               : $(baseName)_debuginfo : $(version) ;
+                       packageTargets += [ AddRepositoryPackage $(repository)
+                               : $(architecture) : $(baseName)_debuginfo : 
$(version) ] ;
                }
        }
+
+       return $(packageTargets) ;
 }
 
 
-rule PackageRepository repository : architecture : repositoryUrl : anyPackages
-       : packages : sourcePackages : debugInfoPackages
+rule PackageRepository repository : architecture : anyPackages : packages
+       : sourcePackages : debugInfoPackages
 {
-       repository = $(repository:G=repository) ;
-
        if $(architecture) != $(HAIKU_PACKAGING_ARCH) {
                return ;
        }
 
        HAIKU_REPOSITORIES += $(repository) ;
-       HAIKU_REPOSITORY_URL on $(repository) = $(repositoryUrl) ;
        HAIKU_REPOSITORY_DEFINITION_FILE on $(repository)
                = $(HAIKU_REPOSITORY_JAMFILE) ;
 
-       AddRepositoryPackages $(repository) : any : $(anyPackages)
-               : $(sourcePackages) : $(debugInfoPackages) ;
-       AddRepositoryPackages $(repository) : $(architecture) : $(packages)
-               : $(sourcePackages) : $(debugInfoPackages) ;
+       return [ AddRepositoryPackages $(repository) : any : $(anyPackages)
+                       : $(sourcePackages) : $(debugInfoPackages) ]
+               [ AddRepositoryPackages $(repository) : $(architecture) : 
$(packages)
+                       : $(sourcePackages) : $(debugInfoPackages) ] ;
+}
+
+
+#pragma mark - Remote Repository
+
+
+rule RemoteRepositoryPackageFamily repository : packageBaseName
+{
+       return [ PackageFamily $(packageBaseName) ] ;
+}
+
+
+rule RemoteRepositoryFetchPackage repository : package : fileName
+{
+       local baseUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
+       local packagesChecksumFile
+               = [ on $(repository)
+                       return $(HAIKU_REPOSITORY_PACKAGES_CHECKSUM_FILE) ] ;
+
+       local downloadedFile = [ DownloadFile $(fileName)
+               : "$(baseUrl)/`cat $source`/packages/$(fileName)"
+               : $(packagesChecksumFile) ] ;
+       NoUpdate $(downloadedFile) ;
+               # Don't download the file again when something in the repository
+               # changes. It is (supposed to be) still the same file.
+       return $(downloadedFile) ;
+}
+
+
+rule RemotePackageRepository repository : architecture : repositoryUrl
+       : anyPackages : packages : sourcePackages : debugInfoPackages
+{
+       repository = $(repository:G=repository) ;
+
+       SetRepositoryMethod $(repository) : PackageFamily
+               : RemoteRepositoryPackageFamily ;
+       SetRepositoryMethod $(repository) : FetchPackage
+               : RemoteRepositoryFetchPackage ;
+
+       HAIKU_REPOSITORY_URL on $(repository) = $(repositoryUrl) ;
+
+       PackageRepository $(repository) : $(architecture) : $(anyPackages)
+               : $(packages) : $(sourcePackages) : $(debugInfoPackages) ;
 
        # build package list file
        local packageListFile = 
$(repository:G=repository-package-list)-packages ;
@@ -152,6 +223,150 @@ actions RepositoryConfig1
 }
 
 
+#pragma mark - Bootstrap Repository
+
+
+rule BootstrapRepositoryPackageFamily repository : packageBaseName
+{
+       local splitBaseName = [ Match "(.*)_bootstrap(.*)" : $(packageBaseName) 
] ;
+       if $(splitBaseName) {
+               packageBaseName = $(splitBaseName[1])$(splitBaseName[2]) ;
+       }
+
+       return [ PackageFamily $(packageBaseName) ] ;
+}
+
+
+rule BootstrapRepositoryFetchPackage repository : package : fileName
+{
+       local outputDir
+               = [ on $(repository) return $(HAIKU_REPOSITORY_BUILD_DIRECTORY) 
] ;
+       local configFile
+               = [ on $(repository) return 
$(HAIKU_REPOSITORY_BUILD_CONFIG_FILE) ] ;
+       local haikuCrossDevelPackage = [ on $(package)
+               return $(HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGE) ] ;
+
+       local packageFile = <cross-built>$(fileName) ;
+       MakeLocate $(packageFile) : [ FDirName $(outputDir) packages ] ;
+       NoUpdate $(packageFile) ;
+               # Don't rebuild the file. Since the haiku cross devel package is
+               # a dependency and is updated always, this package would 
otherwise be
+               # rebuilt always as well.
+
+       HAIKU_REPOSITORY_BUILD_DIRECTORY on $(packageFile) = $(outputDir) ;
+
+       Depends $(packageFile) : $(haikuCrossDevelPackage) $(configFile) ;
+       BootstrapRepositoryFetchPackage1 $(packageFile)
+               : $(haikuCrossDevelPackage) ;
+
+       return $(packageFile) ;
+}
+
+
+actions BootstrapRepositoryFetchPackage1
+{
+       # don't rebuild existing package
+       package="$(1)"
+       if [ -e "$package" ]; then
+               exit 0
+       fi
+
+       # make Haiku cross devel package path absolute
+       haikuCrossDevelPackage="$(2)"
+       if [[ "$haikuCrossDevelPackage" != /* ]]; then
+               haikuCrossDevelPackage="`pwd`/$haikuCrossDevelPackage"
+       fi
+
+       # determine the portName
+       portName=`basename "$package" | sed 's@-.*@@'`
+       case $portName in
+               *_devel|*_doc|*_source|*_debuginfo)
+                       portName=`echo $portName | sed 's@_[^_]*$@@'`
+                       ;;
+       esac
+
+       cd $(HAIKU_REPOSITORY_BUILD_DIRECTORY)
+
+       $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
+       $(HOST_HAIKU_PORTER) --cross-devel-package "$haikuCrossDevelPackage" \
+               $portName
+}
+
+
+actions BuildBootstrapRepositoryConfig
+{
+cat > $(1) << EOF
+PACKAGER="The Haiku build system <build-system@xxxxxxxxxxxx>"
+TREE_PATH="$(HAIKU_PORTS_CROSS)"
+TARGET_ARCHITECTURE="$(HAIKU_PACKAGING_ARCH)"
+
+DOWNLOAD_IN_PORT_DIRECTORY="yes"
+PACKAGE_COMMAND="$(2[1])"
+MIMESET_COMMAND="$(2[2])"
+SYSTEM_MIME_DB="$(2[3])"
+LICENSES_DIRECTORY="$(HAIKU_TOP)/data/system/data/licenses"
+OUTPUT_DIRECTORY="$(HAIKU_REPOSITORY_BUILD_DIRECTORY)"
+EOF
+
+       # If we have cross tools, add the cross tools directory.
+       gcc=$(HAIKU_CC)
+       if [[ "$gcc" = /* ]]; then
+               if [ `basename $gcc` = $(HAIKU_GCC_MACHINE)-gcc ]; then
+                       dir=`dirname $gcc`
+                       dir=`dirname $dir`
+                       echo CROSS_TOOLS="$dir" >> $(1)
+               fi
+       fi
+}
+
+
+rule BootstrapPackageRepository repository : architecture
+       : anyPackages : packagesStage1 : packagesStage2 : sourcePackages
+       : debugInfoPackages
+{
+       repository = $(repository:G=repository) ;
+
+       SetRepositoryMethod $(repository) : PackageFamily
+               : BootstrapRepositoryPackageFamily ;
+       SetRepositoryMethod $(repository) : FetchPackage
+               : BootstrapRepositoryFetchPackage ;
+
+       # register repository with stage 1 packages
+       local packageTargets = [ PackageRepository $(repository) : 
$(architecture)
+               : $(anyPackages) : $(packagesStage1)  : $(sourcePackages)
+               : $(debugInfoPackages) ] ;
+       if ! $(packageTargets) {
+               return ;
+       }
+       HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGE on $(packageTargets)
+               = haiku_cross_devel_sysroot_stage1_$(HAIKU_PACKAGING_ARCH).hpkg 
;
+
+       # add stage 2 packages
+       packageTargets = [ AddRepositoryPackages $(repository) : $(architecture)
+               : $(packagesStage2) : $(sourcePackages) : $(debugInfoPackages) 
] ;
+       HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGE on $(packageTargets)
+               = haiku_cross_devel_sysroot_$(HAIKU_PACKAGING_ARCH).hpkg ;
+
+       # prepare the config file for the HaikuPorts cross build
+       local outputDir = [ FDirName $(HAIKU_PACKAGE_REPOSITORIES_DIR)
+               $(repository:G=)-build ] ;
+       local configFile = haikuports.conf ;
+       configFile = $(configFile:G=repository-config-$(repository:G=)) ;
+       MakeLocate $(configFile) : $(outputDir) ;
+       NoUpdate $(configFile) ;
+       Depends $(configFile) : <build>package <build>mimeset <mimedb>mime_db ;
+       HAIKU_REPOSITORY_BUILD_DIRECTORY on $(configFile) = $(outputDir) ;
+       BuildBootstrapRepositoryConfig $(configFile)
+               : <build>package <build>mimeset <mimedb>mime_db ;
+
+       HAIKU_REPOSITORY_BUILD_CONFIG_FILE on $(repository) = $(configFile) ;
+       HAIKU_REPOSITORY_BUILD_DIRECTORY on $(repository) = $(outputDir) ;
+}
+
+
+#pragma mark - Public
+
+
 rule IsPackageAvailable package
 {
        if $(package) in $(HAIKU_AVAILABLE_PACKAGES) {
@@ -162,7 +377,7 @@ rule IsPackageAvailable package
 }
 
 
-rule DownloadPackage packageName
+rule FetchPackage packageName
 {
        if ! [ IsPackageAvailable $(packageName) ] {
                Exit "DownloadPackage: package" $(packageName) "not available!" 
;
@@ -177,16 +392,7 @@ rule DownloadPackage packageName
                = [ 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) ] ;
-       local packagesChecksumFile
-               = [ on $(repository)
-                       return $(HAIKU_REPOSITORY_PACKAGES_CHECKSUM_FILE) ] ;
 
-       local downloadedFile = [ DownloadFile $(fileName)
-               : "$(baseUrl)/`cat $source`/packages/$(fileName)"
-               : $(packagesChecksumFile) ] ;
-       NoUpdate $(downloadedFile) ;
-               # Don't download the file again when something in the repository
-               # changes. It is (supposed to be) still the same file.
-       return $(downloadedFile) ;
+       return [ InvokeRepositoryMethod $(repository) : FetchPackage : 
$(package)
+               : $(fileName) ] ;
 }
diff --git a/build/jam/images/HaikuImageCommon 
b/build/jam/images/HaikuImageCommon
index 610f30a..6662789 100644
--- a/build/jam/images/HaikuImageCommon
+++ b/build/jam/images/HaikuImageCommon
@@ -94,7 +94,8 @@ if $(HOST_RM_ATTRS_TARGET) {
 # 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) {
+if ( ! [ IsUpdateHaikuImageOnly ] || $(HAIKU_UPDATE_ALL_PACKAGES) )
+       && ! $(HAIKU_BOOTSTRAP_BUILD) {
        resolvePackageDependencies = 1 ;
 }
 AddVariableToScript $(script) : resolvePackageDependencies
diff --git a/build/jam/packages/HaikuCrossDevel 
b/build/jam/packages/HaikuCrossDevel
index 3e56c4e..d993807 100644
--- a/build/jam/packages/HaikuCrossDevel
+++ b/build/jam/packages/HaikuCrossDevel
@@ -4,73 +4,82 @@
 # The main use of this package is to provide HaikuPorter with a development
 # environment for a cross-build Haiku platform.
 
-# first create the actual cross development package
-
-local haikuCrossDevelSysrootPackage 
-       = haiku_cross_devel_sysroot_$(HAIKU_PACKAGING_ARCH).hpkg ;
-HaikuPackage $(haikuCrossDevelSysrootPackage) ;
-
-local developCrossLibDirTokens = develop lib ;
-
-# glue code
-AddFilesToPackage $(developCrossLibDirTokens) :
-       <src!system!glue!arch!$(TARGET_ARCH)>crti.o
-       <src!system!glue!arch!$(TARGET_ARCH)>crtn.o
-       <src!system!glue>init_term_dyn.o
-       <src!system!glue>start_dyn.o
-       <src!system!glue>haiku_version_glue.o
-;
-
-# kernel
-AddFilesToPackage $(developCrossLibDirTokens) : kernel.so : _KERNEL_ ;
-
-# libraries
-AddLibrariesToPackage $(developCrossLibDirTokens) :
-       libbsd.so
-       <revisioned>libroot.so
-       $(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++)
-;
-
-# static libraries
-AddFilesToPackage $(developCrossLibDirTokens) : liblocalestub.a ;
-
-# the POSIX error code mapper library
-AddFilesToPackage $(developCrossLibDirTokens) : libposix_error_mapper.a ;
-
-# headers
-local developCrossHeadersDirTokens = develop headers ;
-local headerDir ;
-for headerDir in config glibc os posix {
-       CopyDirectoryToPackage $(developCrossHeadersDirTokens)
-               : [ FDirName $(HAIKU_TOP) headers $(headerDir) ] ;
+local additionalLibraries_stage1 ;
+local additionalLibraries = libbe.so libnetwork.so libpackage.so ;
+
+local stage ;
+for stage in _stage1 "" {
+       # first create the actual cross development package
+
+       local haikuCrossDevelSysrootPackage
+               = 
haiku_cross_devel_sysroot$(stage)_$(HAIKU_PACKAGING_ARCH).hpkg ;
+       HaikuPackage $(haikuCrossDevelSysrootPackage) ;
+
+       local developCrossLibDirTokens = develop lib ;
+
+       # glue code
+       AddFilesToPackage $(developCrossLibDirTokens) :
+               <src!system!glue!arch!$(TARGET_ARCH)>crti.o
+               <src!system!glue!arch!$(TARGET_ARCH)>crtn.o
+               <src!system!glue>init_term_dyn.o
+               <src!system!glue>start_dyn.o
+               <src!system!glue>haiku_version_glue.o
+       ;
+
+       # kernel
+       AddFilesToPackage $(developCrossLibDirTokens) : kernel.so : _KERNEL_ ;
+
+       # libraries
+       AddLibrariesToPackage $(developCrossLibDirTokens) :
+               libbsd.so
+               <revisioned>libroot.so
+               $(HAIKU_SHARED_LIBSTDC++) $(HAIKU_SHARED_LIBSUPC++)
+               $(additionalLibraries$(stage))
+       ;
+
+       # static libraries
+       AddFilesToPackage $(developCrossLibDirTokens) : liblocalestub.a ;
+
+       # the POSIX error code mapper library
+       AddFilesToPackage $(developCrossLibDirTokens) : libposix_error_mapper.a 
;
+
+       # headers
+       local developCrossHeadersDirTokens = develop headers ;
+       local headerDir ;
+       for headerDir in config glibc os posix {
+               CopyDirectoryToPackage $(developCrossHeadersDirTokens)
+                       : [ FDirName $(HAIKU_TOP) headers $(headerDir) ] ;
+       }
+
+       # BSD and GNU compatibility headers
+       for headerDir in bsd gnu {
+               CopyDirectoryToPackage $(developCrossHeadersDirTokens)
+                       : [ FDirName $(HAIKU_TOP) headers compatibility 
$(headerDir) ] ;
+       }
+
+       # cpp headers
+       if $(HAIKU_GCC_VERSION[1]) = 2 {
+               # GCC 2 only -- for GCC 4 they come with the DevelopmentBase 
package
+               CopyDirectoryToPackage $(developCrossHeadersDirTokens) c++
+                       : [ FDirName $(HAIKU_TOP) headers cpp ] : 2.95.3 ;
+       }
+
+       BuildHaikuPackage $(haikuCrossDevelSysrootPackage)
+               : haiku_cross_devel_sysroot ;
+
+       # Now create a wrapper package which just contains the actual cross
+       # development package. This wrapper package can safely be installed 
into the
+       # system hierarchy of the target system, from where haikuporter will 
fetch
+       # it when needed.
+
+       local haikuCrossDevelPackage 
+               = haiku_cross_devel$(stage)_$(HAIKU_PACKAGING_ARCH).hpkg ;
+       HaikuPackage $(haikuCrossDevelPackage) ;
+
+       # add the wrapped package
+       local developCrossDirTokens = develop cross ;
+       AddFilesToPackage $(developCrossDirTokens)
+               : $(haikuCrossDevelSysrootPackage) ;
+
+       BuildHaikuPackage $(haikuCrossDevelPackage) : haiku_cross_devel ;
 }
-
-# BSD and GNU compatibility headers
-for headerDir in bsd gnu {
-       CopyDirectoryToPackage $(developCrossHeadersDirTokens)
-               : [ FDirName $(HAIKU_TOP) headers compatibility $(headerDir) ] ;
-}
-
-# cpp headers
-if $(HAIKU_GCC_VERSION[1]) = 2 {
-       # GCC 2 only -- for GCC 4 they come with the DevelopmentBase package
-       CopyDirectoryToPackage $(developCrossHeadersDirTokens) c++
-               : [ FDirName $(HAIKU_TOP) headers cpp ] : 2.95.3 ;
-}
-
-BuildHaikuPackage $(haikuCrossDevelSysrootPackage) : haiku_cross_devel_sysroot 
;
-
-# Now create a wrapper package which just contains the actual cross 
development 
-# package. This wrapper package can safely be installed into the system 
-# hierarchy of the target system, from where haikuporter will fetch it when
-# needed.
-
-local haikuCrossDevelPackage 
-       = haiku_cross_devel_$(HAIKU_PACKAGING_ARCH).hpkg ;
-HaikuPackage $(haikuCrossDevelPackage) ;
-
-# add the wrapped package
-local developCrossDirTokens = develop cross ;
-AddFilesToPackage $(developCrossDirTokens) : $(haikuCrossDevelSysrootPackage) ;
-
-BuildHaikuPackage $(haikuCrossDevelPackage) : haiku_cross_devel ;
diff --git a/build/jam/repositories/HaikuPorts/x86_gcc2 
b/build/jam/repositories/HaikuPorts/x86_gcc2
index 1560fb7..7945801 100644
--- a/build/jam/repositories/HaikuPorts/x86_gcc2
+++ b/build/jam/repositories/HaikuPorts/x86_gcc2
@@ -1,4 +1,4 @@
-PackageRepository HaikuPorts
+RemotePackageRepository HaikuPorts
        : x86_gcc2
        : http://haiku-files.org/files/repo
        :
diff --git a/build/jam/repositories/HaikuPortsCross/x86_gcc2 
b/build/jam/repositories/HaikuPortsCross/x86_gcc2
new file mode 100644
index 0000000..f9cc32e
--- /dev/null
+++ b/build/jam/repositories/HaikuPortsCross/x86_gcc2
@@ -0,0 +1,59 @@
+BootstrapPackageRepository HaikuPortsCross
+       : x86_gcc2
+       :
+       # architecture "any" packages
+       :
+       # repository architecture packages (stage 1)
+       autoconf_bootstrap-2.69-1
+       automake_bootstrap-1.13.1-1
+       binutils_bootstrap-2.17_2013_04_21-2
+       bison_bootstrap-2.4.3-1
+       flex_bootstrap-2.5.35-1
+       freetype_bootstrap-2.4.9-1
+       freetype_bootstrap_devel-2.4.9-1
+       gcc_bootstrap-2.95.3_2013_07_15-2
+       grep_bootstrap-2.14-1
+# TODO: No actual ICU bootstrap recipe yet.
+icu_bootstrap-4.8.1.1-3
+icu_bootstrap_devel-4.8.1.1-3
+       libtool_bootstrap-2.4-8
+       libtool_bootstrap_libltdl-2.4-8
+       m4_bootstrap-1.4.16-1
+       make_bootstrap-3.82-1
+       makeinfo_bootstrap-4.13a-1
+       ncurses_bootstrap-5.9-1
+       ncurses_bootstrap_devel-5.9-1
+       python_bootstrap-2.6.8-1
+       sed_bootstrap-4.2.1-1
+# Available, but probably not needed:
+#      texinfo_bootstrap-4.13a-1
+       zlib_bootstrap-1.2.8-2
+       zlib_bootstrap_devel-1.2.8-2
+       :
+       # repository architecture packages (stage 2)
+       libsolv_bootstrap-0.3.0_haiku_2013_06_16-1
+       libsolv_bootstrap_devel-0.3.0_haiku_2013_06_16-1
+       :
+       # source packages
+       autoconf_bootstrap
+       automake_bootstrap
+       binutils_bootstrap
+       bison_bootstrap
+       flex_bootstrap
+       freetype_bootstrap
+       gawk_bootstrap
+       gcc_bootstrap
+       grep_bootstrap
+       libsolv_bootstrap
+       libtool_bootstrap
+       m4_bootstrap
+       make_bootstrap
+       makeinfo_bootstrap
+       ncurses_bootstrap
+       python_bootstrap
+       sed_bootstrap
+       texinfo_bootstrap
+       zlib_bootstrap
+       :
+       # debuginfo packages
+       ;
diff --git a/configure b/configure
index ca1a5ac..3ecb896 100755
--- a/configure
+++ b/configure
@@ -12,6 +12,16 @@ usage()
 
 Usage: $0 <options>
 options:
+  --bootstrap <haikuporter> <HaikuPorts cross repo> <HaikuPorts repo>
+                              Prepare for a bootstrap build. No pre-built
+                              packages will be used, instead they will be built
+                              from the sources (in several phases).
+                              <haikuporter> is the path to the haikuporter tool
+                              suitable for the host platform.
+                              <HaikuPorts cross repo> is the path to a checked
+                              out HaikuPorts cross-compilation repository.
+                              <HaikuPorts repo> is the path to a checked out
+                              HaikuPorts repository.
   --build-cross-tools <build tools dir>
                               Assume cross compilation. <build tools dir>
                               defines the location of the build tools sources.
@@ -135,6 +145,19 @@ assertparams()
        fi
 }
 
+# absolute_path
+#
+# returns the absolute path of a given path.
+#
+absolute_path()
+{
+       if [[ "$1" == /* ]]; then
+               echo "$1"
+       else
+               echo "`pwd`/$1"
+       fi
+}
+
 # real_path
 #
 # returns the realpath of a symbolic link.
@@ -376,6 +399,9 @@ HOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy`
 SFDISK_BINARY=sfdisk
 HOST_SFDISK=$SFDISK_BINARY
 HOST_SHA256=
+HOST_HAIKU_PORTER=
+HAIKU_PORTS=
+HAIKU_PORTS_CROSS=
 
 if sha256sum < /dev/null > /dev/null 2>&1; then
        HOST_SHA256=sha256sum
@@ -438,6 +464,13 @@ fi
 #
 while [ $# -gt 0 ] ; do
        case "$1" in
+               --bootstrap)
+                       assertparams "$1" 3 $#
+                       HOST_HAIKU_PORTER="`absolute_path $2`"
+                       HAIKU_PORTS_CROSS="`absolute_path $3`"
+                       HAIKU_PORTS="`absolute_path $4`"
+                       shift 4
+                       ;;
                --build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; 
shift 2;;
                --build-cross-tools-gcc4)
                        assertparams "$1" 2 $#
@@ -449,7 +482,7 @@ while [ $# -gt 0 ] ; do
                                ppc)    HAIKU_GCC_MACHINE=powerpc-apple-haiku;;
                                m68k)   HAIKU_GCC_MACHINE=m68k-unknown-haiku;;
                                arm)    HAIKU_GCC_MACHINE=arm-unknown-haiku;;
-                               mipsel) HAIKU_GCC_MACHINE=mipsel-unknown-haiku;
+                               mipsel) HAIKU_GCC_MACHINE=mipsel-unknown-haiku;;
                                *)              echo "Unsupported target 
architecture: $2"
                                                exit 1;;
                        esac
@@ -664,6 +697,10 @@ HOST_OBJCOPY                               ?= 
${HOST_GCC_OBJCOPY} ;
 HOST_SFDISK                                    ?= ${HOST_SFDISK} ;
 HOST_SHA256                                    ?= ${HOST_SHA256} ;
 
+HOST_HAIKU_PORTER                      ?= ${HOST_HAIKU_PORTER} ;
+HAIKU_PORTS                                    ?= ${HAIKU_PORTS} ;
+HAIKU_PORTS_CROSS                      ?= ${HAIKU_PORTS_CROSS} ;
+
 EOF
 
 # Libgcc.a objects


Other related posts:

  • » [haiku-commits] BRANCH HaikuPM-github.package-management [e173a1e] in build/jam: . packages repositories/HaikuPortsCross - HaikuPM-github . package-management