3 # default value for the build profile that defines the set of source packages
4 # that will be put onto the bootstrap image
5 HAIKU_BOOTSTRAP_SOURCES_PROFILE ?= @minimum-raw ;
7 rule PackageFamily packageBaseName
9 return $(packageBaseName:G=package-family) ;
13 rule SetRepositoryMethod repository : methodName : method
15 HAIKU_REPOSITORY_METHOD_$(methodName) on $(repository) = $(method) ;
18 rule InvokeRepositoryMethod repository : methodName : arg1 : arg2 : arg3 : arg4
22 = [ on $(repository) return $(HAIKU_REPOSITORY_METHOD_$(methodName)) ] ;
24 Exit "Method" $(methodName) " not defined for repository"
28 return [ $(method) $(repository) : $(arg1) : $(arg2) : $(arg3) : $(arg4)
29 : $(arg5) : $(arg6) : $(arg7) ] ;
33 rule AddRepositoryPackage repository : architecture : baseName : version
35 local package = $(baseName)-$(version) ;
36 package = $(package:E=$(baseName):G=package-in-$(repository:G=)) ;
37 HAIKU_PACKAGE_REPOSITORY on $(package) = $(repository) ;
38 HAIKU_PACKAGE_ARCHITECTURE on $(package) = $(architecture) ;
39 local packageFileName = $(package:G=)-$(architecture).hpkg ;
40 HAIKU_PACKAGE_FILE_NAME on $(package) = $(packageFileName) ;
42 local packageFamily = [ InvokeRepositoryMethod $(repository) : PackageFamily
44 baseName = $(packageFamily:G=) ;
46 if $(HAIKU_NO_DOWNLOADS) = 1 && $(HAIKU_IS_BOOTSTRAP) != 1 {
47 # Only add packages to repository that already exist in download
49 if ! [ Glob $(HAIKU_DOWNLOAD_DIR) : $(packageFileName) ] {
54 if ! $(baseName) in $(HAIKU_AVAILABLE_PACKAGES) {
55 HAIKU_AVAILABLE_PACKAGES += $(baseName) ;
58 HAIKU_PACKAGE_VERSIONS on $(packageFamily) += $(package) ;
59 HAIKU_REPOSITORY_PACKAGES on $(repository) += $(package) ;
65 rule AddRepositoryPackages repository : architecture : packages : sourcePackages
68 local packageTargets ;
70 for package in $(packages) {
71 local splitName = [ Match "([^-]*)-(.*)" : $(package) ] ;
72 local baseName = $(splitName[1]:E=$(package)) ;
73 local version = $(splitName[2]) ;
74 packageTargets += [ AddRepositoryPackage $(repository) : $(architecture)
75 : $(baseName) : $(version) ] ;
76 if $(baseName) in $(sourcePackages) {
77 AddRepositoryPackage $(repository) : source : $(baseName)_source
80 if $(baseName) in $(debugInfoPackages) {
81 packageTargets += [ AddRepositoryPackage $(repository)
82 : $(architecture) : $(baseName)_debuginfo : $(version) ] ;
86 return $(packageTargets) ;
90 rule PackageRepository repository : architecture : anyPackages : packages
91 : sourcePackages : debugInfoPackages
93 if $(architecture) != $(HAIKU_PACKAGING_ARCHS[1]) {
97 HAIKU_REPOSITORIES += $(repository) ;
98 HAIKU_REPOSITORY_DEFINITION_FILE on $(repository)
99 = $(HAIKU_REPOSITORY_JAMFILE) ;
101 return [ AddRepositoryPackages $(repository) : any : $(anyPackages)
102 : $(sourcePackages) : $(debugInfoPackages) ]
103 [ AddRepositoryPackages $(repository) : $(architecture) : $(packages)
104 : $(sourcePackages) : $(debugInfoPackages) ] ;
108 #pragma mark - Remote Repository
111 rule RemoteRepositoryPackageFamily repository : packageBaseName
113 return [ PackageFamily $(packageBaseName) ] ;
117 rule RemoteRepositoryFetchPackage repository : package : fileName
119 local baseUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
120 local packagesChecksumFile
122 return $(HAIKU_REPOSITORY_PACKAGES_CHECKSUM_FILE) ] ;
124 local downloadedFile = [ DownloadFile $(fileName)
125 : "$(baseUrl)/`cat $source`/packages/$(fileName)"
126 : $(packagesChecksumFile) ] ;
127 NoUpdate $(downloadedFile) ;
128 # Don't download the file again when something in the repository
129 # changes. It is (supposed to be) still the same file.
130 return $(downloadedFile) ;
134 rule RemotePackageRepository repository : architecture : repositoryUrl
135 : anyPackages : packages : sourcePackages : debugInfoPackages
137 repository = $(repository:G=repository) ;
139 if ! $(HOST_EXTENDED_REGEX_SED) {
140 ECHO "Variable HOST_EXTENDED_REGEX_SED not set. Please run ./configure or" ;
141 EXIT "specify it manually." ;
144 SetRepositoryMethod $(repository) : PackageFamily
145 : RemoteRepositoryPackageFamily ;
146 SetRepositoryMethod $(repository) : FetchPackage
147 : RemoteRepositoryFetchPackage ;
149 HAIKU_REPOSITORY_URL on $(repository) = $(repositoryUrl) ;
151 PackageRepository $(repository) : $(architecture) : $(anyPackages)
152 : $(packages) : $(sourcePackages) : $(debugInfoPackages) ;
154 # build package list file
155 local packageListFile = $(repository:G=repository-package-list)-packages ;
156 local repositoriesDir = $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ;
157 MakeLocate $(packageListFile) : $(repositoriesDir) ;
158 GeneratedRepositoryPackageList $(packageListFile) : $(repository) ;
160 # build package list checksum file
161 local packagesChecksumFile
162 = $(repository:G=repository-package-checksum)-checksum ;
163 local thisPackageRepositoryFile = [ Glob [ FDirName
164 $(HAIKU_BUILD_RULES_DIR) repositories HaikuPorts ] :
165 $(HAIKU_PACKAGING_ARCH) ] ;
166 MakeLocate $(packagesChecksumFile) : $(repositoriesDir) ;
167 Depends $(packagesChecksumFile) : $(thisPackageRepositoryFile) ;
168 ChecksumFileSHA256 $(packagesChecksumFile) : $(thisPackageRepositoryFile) ;
170 local repositoryInfo = $(repository:G=repository-info)-info ;
171 local repositoryFile = $(repository:G=repository-cache) ;
172 local repositoryConfig = $(repository:G=repository-config)-config ;
173 MakeLocate $(repositoryInfo) $(repositoryFile) $(repositoryConfig)
174 : $(repositoriesDir) ;
175 # Use a locally created dummy repository if downloads have been disabled.
176 # This is useful when trying to build everything locally from source.
177 if $(HAIKU_NO_DOWNLOADS) = 1 {
178 # build repository file
179 local packageFileNames = [
180 on $(packageListFile) return $(HAIKU_REPOSITORY_PACKAGE_FILE_NAMES)
184 for packageFile in $(packageFileNames) {
185 MakeLocate $(packageFile) : $(HAIKU_DOWNLOAD_DIR) ;
186 packageFiles += $(packageFile) ;
188 RepositoryCache $(repositoryFile) : $(repositoryInfo)
191 # download repository file
192 local repoUrl = [ on $(repository) return $(HAIKU_REPOSITORY_URL) ] ;
193 DownloadLocatedFile $(repositoryFile)
194 : "$(repoUrl)/`cat $source`/repo"
195 : $(packagesChecksumFile) ;
198 # build the repository info file
199 local repositoryInfoTemplate = <repository-info-template>haikuports ;
200 SEARCH on $(repositoryInfoTemplate)
201 = $(HAIKU_TOP)/src/data/repository_infos ;
202 PreprocessPackageOrRepositoryInfo $(repositoryInfo)
203 : $(repositoryInfoTemplate) : $(architecture) ;
205 # build repository config file
206 RepositoryConfig $(repositoryConfig) : $(repositoryInfo)
207 : $(packagesChecksumFile) ;
209 HAIKU_REPOSITORY_CACHE_FILE on $(repository) = $(repositoryFile) ;
210 HAIKU_REPOSITORY_CONFIG_FILE on $(repository) = $(repositoryConfig) ;
211 HAIKU_REPOSITORY_PACKAGES_CHECKSUM_FILE on $(repository)
212 = $(packagesChecksumFile) ;
216 rule GeneratedRepositoryPackageList target : repository
218 repository = $(repository:G=repository) ;
220 # construct a list of file names
223 for package in [ on $(repository) return $(HAIKU_REPOSITORY_PACKAGES) ] {
224 fileNames += [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
228 = [ on $(repository) return $(HAIKU_REPOSITORY_DEFINITION_FILE) ] ;
229 Depends $(target) : $(definitionFile) ;
231 HAIKU_REPOSITORY_PACKAGE_FILE_NAMES on $(target) = $(fileNames) ;
232 GeneratedRepositoryPackageList1 $(target) ;
236 actions GeneratedRepositoryPackageList1
238 (for file in $(HAIKU_REPOSITORY_PACKAGE_FILE_NAMES) ; do
240 done) | LC_ALL=C sort -u > $(1)
244 rule RepositoryConfig repoConfig : repoInfo : checksumFile
246 Depends $(repoConfig)
247 : <build>create_repository_config $(repoInfo) $(checksumFile) ;
248 RepositoryConfig1 $(repoConfig)
249 : <build>create_repository_config $(repoInfo) $(checksumFile) ;
253 actions RepositoryConfig1
256 if [ -n "$(2[3]:E)" ]; then
257 version=`cat "$(2[3]:E)"`
259 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
264 rule RepositoryCache repoCache : repoInfo : packageFiles
267 : <build>package_repo $(repoInfo) $(packageFiles) ;
268 RepositoryCache1 $(repoCache)
269 : <build>package_repo $(repoInfo) $(packageFiles) ;
273 actions RepositoryCache1
275 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
276 $(2[1]) create -q $(2[2-])
281 #pragma mark - Bootstrap Repository
284 rule BootstrapRepositoryPackageFamily repository : packageBaseName
286 local splitBaseName = [ Match "(.*)_bootstrap(.*)" : $(packageBaseName) ] ;
287 if $(splitBaseName) {
288 packageBaseName = $(splitBaseName[1])$(splitBaseName[2]) ;
291 return [ PackageFamily $(packageBaseName) ] ;
295 rule BootstrapRepositoryFetchPackage repository : package : fileName
298 = [ on $(repository) return $(HAIKU_REPOSITORY_BUILD_DIRECTORY) ] ;
300 = [ on $(repository) return $(HAIKU_REPOSITORY_BUILD_CONFIG_FILE) ] ;
301 local haikuCrossDevelPackages = [ on $(package)
302 return $(HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES) ] ;
304 local packageFile = <cross-built>$(fileName) ;
305 if [ on $(packageFile) return $(HAIKU_REPOSITORY_BUILD_DIRECTORY) ] {
306 # rule already called for this package
307 return $(packageFile) ;
310 HAIKU_REPOSITORY_BUILD_DIRECTORY on $(packageFile) = $(outputDir) ;
312 MakeLocate $(packageFile) : [ FDirName $(outputDir) packages ] ;
313 NoUpdate $(packageFile) ;
314 # Don't rebuild the file. Since the haiku cross devel package is
315 # a dependency and is updated always, this package would otherwise be
316 # rebuilt always as well.
318 Depends $(packageFile) : $(haikuCrossDevelPackages) $(configFile) ;
319 BootstrapRepositoryFetchPackage1 $(packageFile)
320 : $(haikuCrossDevelPackages) ;
322 return $(packageFile) ;
326 actions BootstrapRepositoryFetchPackage1
328 # don't rebuild existing package
330 if [ -e "$package" ]; then
334 # make Haiku cross devel package path absolute
335 haikuCrossDevelPackage="$(2[1])"
336 if [ "x$haikuCrossDevelPackage" = "x${haikuCrossDevelPackage#/}" ]; then
337 haikuCrossDevelPackage="`pwd`/$haikuCrossDevelPackage"
340 # make secondary Haiku cross devel packages path absolute
341 secondaryCrossDevelPackages=
342 if [ -n "$(2[2-]:J)" ]; then
343 for secondaryCrossDevelPackage in "$(2[2-])" ; do
344 if [ "x$secondaryCrossDevelPackage" = "x${secondaryCrossDevelPackage#/}" ]; then
345 secondaryCrossDevelPackage="`pwd`/$secondaryCrossDevelPackage"
347 if [ -n "$secondaryCrossDevelPackages" ]; then
348 secondaryCrossDevelPackages="secondaryCrossDevelPackages,$secondaryCrossDevelPackage"
350 secondaryCrossDevelPackages="--secondary-cross-devel-package=$secondaryCrossDevelPackage"
355 # determine the port-specification from the package name
356 portSpec=`basename "$package" | sed 's@-.*@@'`
358 cd $(HAIKU_REPOSITORY_BUILD_DIRECTORY)
360 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
361 if [ -n "$secondaryCrossDevelPackages" ]; then
362 $(HOST_HAIKU_PORTER) -j$(HAIKU_PORTER_CONCURRENT_JOBS) \
363 --all-dependencies $(HAIKU_PORTER_EXTRA_OPTIONS) \
364 --cross-devel-package "$haikuCrossDevelPackage" \
365 "$secondaryCrossDevelPackages" $portSpec
367 $(HOST_HAIKU_PORTER) -j$(HAIKU_PORTER_CONCURRENT_JOBS) \
368 --all-dependencies $(HAIKU_PORTER_EXTRA_OPTIONS) \
369 --cross-devel-package "$haikuCrossDevelPackage" $portSpec
374 actions BuildBootstrapRepositoryConfig
377 PACKAGER="The Haiku build system <build-system@haiku-os.org>"
378 TREE_PATH="$(HAIKU_REPOSITORY_TREE_PATH)"
379 TARGET_ARCHITECTURE="$(HAIKU_PACKAGING_ARCH)"
381 DOWNLOAD_IN_PORT_DIRECTORY="yes"
382 PACKAGE_COMMAND="$(2[1])"
383 MIMESET_COMMAND="$(2[2])"
384 SYSTEM_MIME_DB="$(2[3])"
385 LICENSES_DIRECTORY="$(HAIKU_TOP)/data/system/data/licenses"
386 OUTPUT_DIRECTORY="$(HAIKU_REPOSITORY_BUILD_DIRECTORY)"
389 # If we have cross tools, add the cross tools directory.
390 gcc=$(HAIKU_CC_$(HAIKU_PACKAGING_ARCH))
391 if [ "x$gcc" != "x${gcc#/}" ]; then
392 if [ `basename $gcc` = \
393 $(HAIKU_GCC_MACHINE_$(HAIKU_PACKAGING_ARCH))-gcc ]; then
396 echo CROSS_TOOLS=\"$dir\" >> $(1)
400 # Add secondary architectures and cross tools.
401 secondaryArchs="$(HAIKU_PACKAGING_ARCHS[2-]:E=)"
402 if [ -n "$secondaryArchs" ]; then
403 echo SECONDARY_TARGET_ARCHITECTURES=\" >> $(1)
404 for arch in $secondaryArchs; do
405 echo " $arch" >> $(1)
409 echo SECONDARY_CROSS_TOOLS=\" >> $(1)
410 for gcc in $(HAIKU_CC_$(HAIKU_PACKAGING_ARCHS[2-])) ; do
420 rule BootstrapPackageRepository repository : architecture
421 : anyPackages : packagesStage0 : packagesStage1 : packagesStage2
422 : sourcePackages : debugInfoPackages
424 repository = $(repository:G=repository) ;
425 packagesStage0 = [ FFilterByBuildFeatures $(packagesStage0) ] ;
426 packagesStage1 = [ FFilterByBuildFeatures $(packagesStage1) ] ;
427 packagesStage2 = [ FFilterByBuildFeatures $(packagesStage2) ] ;
428 sourcePackages = [ FFilterByBuildFeatures $(sourcePackages) ] ;
429 debugInfoPackages = [ FFilterByBuildFeatures $(debugInfoPackages) ] ;
431 SetRepositoryMethod $(repository) : PackageFamily
432 : BootstrapRepositoryPackageFamily ;
433 SetRepositoryMethod $(repository) : FetchPackage
434 : BootstrapRepositoryFetchPackage ;
436 # register repository with stage 0 packages
437 local stage0PackageTargets = [ PackageRepository $(repository)
438 : $(architecture) : $(anyPackages) : $(packagesStage0)
439 : $(sourcePackages) : $(debugInfoPackages) ] ;
440 if ! $(stage0PackageTargets) {
443 local crossDevelPackageSuffixes = $(architecture)
444 $(architecture)_$(HAIKU_PACKAGING_ARCHS[2-]) ;
445 HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES on $(stage0PackageTargets)
446 = haiku_cross_devel_sysroot_stage0_$(crossDevelPackageSuffixes).hpkg ;
448 # register repository with stage 1 packages
449 local stage1PackageTargets = [ PackageRepository $(repository)
450 : $(architecture) : $(anyPackages) : $(packagesStage1)
451 : $(sourcePackages) : $(debugInfoPackages) ] ;
452 if ! $(stage1PackageTargets) {
455 HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES on $(stage1PackageTargets)
456 = haiku_cross_devel_sysroot_stage1_$(crossDevelPackageSuffixes).hpkg ;
458 # add stage 2 packages
459 local stage2PackageTargets = [ AddRepositoryPackages $(repository)
460 : $(architecture) : $(packagesStage2) : $(sourcePackages)
461 : $(debugInfoPackages) ] ;
462 HAIKU_REPOSITORY_HAIKU_CROSS_DEVEL_PACKAGES on $(stage2PackageTargets)
463 = haiku_cross_devel_sysroot_$(crossDevelPackageSuffixes).hpkg ;
465 # prepare the config file for the HaikuPorts cross build
466 local outputDir = [ FDirName
467 $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture))
468 $(repository:G=)-build ] ;
469 local configFile = haikuports.conf ;
470 configFile = $(configFile:G=repository-config-$(repository:G=)) ;
471 MakeLocate $(configFile) : $(outputDir) ;
472 NoUpdate $(configFile) ;
473 Depends $(configFile) : <build>package <build>mimeset <mimedb>mime_db ;
474 HAIKU_REPOSITORY_BUILD_DIRECTORY on $(configFile) = $(outputDir) ;
475 HAIKU_PACKAGING_ARCH on $(configFile) = $(architecture) ;
476 HAIKU_REPOSITORY_TREE_PATH on $(configFile) = $(HAIKU_PORTS_CROSS) ;
477 BuildBootstrapRepositoryConfig $(configFile)
478 : <build>package <build>mimeset <mimedb>mime_db ;
480 HAIKU_REPOSITORY_BUILD_CONFIG_FILE on $(repository) = $(configFile) ;
481 HAIKU_REPOSITORY_BUILD_DIRECTORY on $(repository) = $(outputDir) ;
483 # Serialize all package file targets. We need to do this, since
484 # haikuporter uses a common directory for building the ports, so building
485 # two ports concurrently isn't possible.
486 local previousPackageFile ;
488 for package in $(stage1PackageTargets) $(stage2PackageTargets) {
489 local fileName = [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
490 local packageFile = [ BootstrapRepositoryFetchPackage $(repository)
491 : $(package) : $(fileName) ] ;
492 Depends $(packageFile) : $(previousPackageFile) ;
494 previousPackageFile = $(packageFile) ;
499 #pragma mark - Public
502 rule FSplitPackageName packageName
504 local splitName = [ Match "(.*)_([^_]*)" : $(packageName) ] ;
505 local knownPackageSuffixes = devel doc source debuginfo ;
506 if $(splitName[2]) && $(splitName[2]) in $(knownPackageSuffixes) {
507 return $(splitName) ;
510 return $(packageName) ;
514 rule IsPackageAvailable packageName : flags
516 # for a secondary architecture adjust the package name
517 if $(TARGET_PACKAGING_ARCH) != $(TARGET_PACKAGING_ARCHS[1])
518 && ! nameResolved in $(flags) {
519 # The position of the secondary architecture within the package name
520 # is not well defined, so we scan for it starting from the back.
521 local packageNameHead = $(packageName) ;
522 local packageNameTail = ;
523 while $(packageNameHead) {
524 local splitName = [ FSplitPackageName $(packageNameHead) ] ;
525 splitName = $(splitName[1]) $(TARGET_PACKAGING_ARCH) $(splitName[2])
527 packageName = $(splitName:J=_) ;
528 if $(packageName) in $(HAIKU_AVAILABLE_PACKAGES) {
529 return $(packageName) ;
531 local splitHead = [ Match "(.*)_([^_]*)" : $(packageNameHead) ] ;
532 packageNameHead = $(splitHead[1]) ;
533 packageNameTail = $(splitHead[2]) $(packageNameTail) ;
537 if $(packageName) in $(HAIKU_AVAILABLE_PACKAGES) {
538 return $(packageName) ;
545 rule FetchPackage packageName : flags
547 local foundPackageName = [ IsPackageAvailable $(packageName) : $(flags) ] ;
548 if ! $(foundPackageName) {
549 Exit "FetchPackage: package" $(packageName) "not available!" ;
552 packageName = $(foundPackageName) ;
554 # TODO: We should support explicitly specified versions (or partial/minimum
555 # versions like gcc-2 or gcc-4).
557 local packageFamily = [ PackageFamily $(packageName) ] ;
559 = [ on $(packageFamily) return $(HAIKU_PACKAGE_VERSIONS[1]) ] ;
560 local fileName = [ on $(package) return $(HAIKU_PACKAGE_FILE_NAME) ] ;
561 local repository = [ on $(package) return $(HAIKU_PACKAGE_REPOSITORY) ] ;
563 if $(HAIKU_DONT_FETCH_PACKAGES) {
564 Exit "FetchPackage: file" $(fileName) "not found and fetching"
569 return [ InvokeRepositoryMethod $(repository) : FetchPackage : $(package)
574 rule BuildHaikuPortsSourcePackageDirectory
576 local architecture = $(TARGET_PACKAGING_ARCH) ;
577 local outputDir = [ FDirName
578 $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture))
579 HaikuPorts-sources-build ] ;
581 local sourcePackageDir = <HaikuPorts-repository-source-packages>packages ;
582 MakeLocate $(sourcePackageDir) : $(outputDir) ;
584 # build the package list file
586 = <repository-package-list-HaikuPorts-sources>package_list ;
587 MakeLocate $(packageList) : $(outputDir) ;
588 Depends $(packageList) :
589 [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories HaikuPorts
591 BuildHaikuPortsPackageList $(packageList) ;
593 # prepare the config file for the HaikuPorts build
594 local configFile = <repository-config-HaikuPorts-sources>haikuports.conf ;
595 MakeLocate $(configFile) : $(outputDir) ;
596 NoUpdate $(configFile) ;
597 Depends $(configFile) : <build>package <build>mimeset <mimedb>mime_db ;
598 HAIKU_REPOSITORY_BUILD_DIRECTORY on $(configFile) = $(outputDir) ;
599 HAIKU_PACKAGING_ARCH on $(configFile) = $(architecture) ;
600 HAIKU_REPOSITORY_TREE_PATH on $(configFile) = $(HAIKU_PORTS) ;
601 BuildBootstrapRepositoryConfig $(configFile)
602 : <build>package <build>mimeset <mimedb>mime_db ;
604 # get Haiku cross-devel packages and build the sources
605 local crossDevelPackageSuffixes = $(architecture)
606 $(architecture)_$(HAIKU_PACKAGING_ARCHS[2-]) ;
607 local haikuCrossDevelPackages
608 = haiku_cross_devel_sysroot_stage1_$(crossDevelPackageSuffixes).hpkg ;
610 HAIKU_REPOSITORY_BUILD_DIRECTORY on $(sourcePackageDir) = $(outputDir) ;
612 Depends $(sourcePackageDir) : $(packageList) $(haikuCrossDevelPackages)
614 BuildHaikuPortsSourcePackageDirectory1 $(sourcePackageDir)
615 : $(packageList) $(haikuCrossDevelPackages) ;
617 return $(sourcePackageDir) ;
621 actions BuildHaikuPortsPackageList
623 $(JAM:E=jam) $(HAIKU_BOOTSTRAP_SOURCES_PROFILE) build-package-list $(1) \
624 $(HAIKU_REPOSITORY_BUILD_ADDITIONAL_PACKAGES)
628 actions BuildHaikuPortsSourcePackageDirectory1
630 packageList="$(2[1])"
632 # make Haiku cross devel package path absolute
633 haikuCrossDevelPackage="$(2[2])"
634 if [ "x$haikuCrossDevelPackage" = "x${haikuCrossDevelPackage#/}" ]; then
635 haikuCrossDevelPackage="`pwd`/$haikuCrossDevelPackage"
638 # make secondary Haiku cross devel packages path absolute
639 secondaryCrossDevelPackages=
640 if [ -n "$(2[3-]:J)" ]; then
641 for secondaryCrossDevelPackage in "$(2[3-])" ; do
642 if [ "x$secondaryCrossDevelPackage" = "x${secondaryCrossDevelPackage#/}" ]; then
643 secondaryCrossDevelPackage="`pwd`/$secondaryCrossDevelPackage"
645 if [ -n "$secondaryCrossDevelPackages" ]; then
646 secondaryCrossDevelPackages="secondaryCrossDevelPackages,$secondaryCrossDevelPackage"
648 secondaryCrossDevelPackages="--secondary-cross-devel-package=$secondaryCrossDevelPackage"
653 cd $(HAIKU_REPOSITORY_BUILD_DIRECTORY)
655 $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
656 if [ -n "$secondaryCrossDevelPackages" ]; then
657 $(HOST_HAIKU_PORTER) --cross-devel-package "$haikuCrossDevelPackage" \
658 "$secondaryCrossDevelPackages" \
659 --all-dependencies $(HAIKU_PORTER_EXTRA_OPTIONS) \
660 --create-source-packages-for-bootstrap --portsfile $packageList
662 $(HOST_HAIKU_PORTER) --cross-devel-package "$haikuCrossDevelPackage" \
663 --all-dependencies $(HAIKU_PORTER_EXTRA_OPTIONS) \
664 --create-source-packages-for-bootstrap --portsfile $packageList
669 rule BuildHaikuPortsRepositoryConfig treePath
671 local architecture = $(TARGET_PACKAGING_ARCH) ;
672 local outputDir = [ FDirName
673 $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture))
674 HaikuPorts-bootstrap ] ;
676 local configFile = <repository-config-HaikuPorts-bootstrap>haikuports.conf ;
677 MakeLocate $(configFile) : $(outputDir) ;
678 NoUpdate $(configFile) ;
680 HAIKU_REPOSITORY_TREE_PATH on $(configFile) = $(treePath) ;
681 BuildHaikuPortsRepositoryConfig1 $(configFile) ;
683 return $(configFile) ;
687 actions BuildHaikuPortsRepositoryConfig1
689 # use a specific packager for continuous integration builds (buildbot)
690 if [ "$(HAIKU_CONTINUOUS_INTEGRATION_BUILD)" = "1" ]; then
691 echo 'PACKAGER="Haiku buildmaster <buildmaster@haiku-os.org>"' > $(1)
693 echo '#PACKAGER="Joe Hacker <user@host.com>"' > $(1)
696 TREE_PATH="$(HAIKU_REPOSITORY_TREE_PATH)"
697 TARGET_ARCHITECTURE="$(HAIKU_PACKAGING_ARCH)"
702 rule HaikuRepository repository : repoInfoTemplate : packages
704 # HaikuRepository <repository> : <repoInfoTemplate> : <packages>
705 # [ : <url> [ : <versionFile> ] ] ;
706 # Builds the Haiku repository from the given packages and repository info
707 # template. <repository> must already be located.
709 # <repository> - The repository target. Resolves to a directory that will be
710 # (removed,) created and populated with the package files and repository
712 # <repoInfoTemplate> - The repository info template file to be used.
713 # <packages> - The packages to be added to the repository.
715 local architecture = $(HAIKU_PACKAGING_ARCH) ;
716 local secondaryArchitecture ;
717 if $(TARGET_PACKAGING_ARCH) != $(architecture) {
718 secondaryArchitecture = $(TARGET_PACKAGING_ARCH) ;
721 local repositoriesDir = $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ;
723 # build the repository info
724 local repositoryInfo = $(repository:G=repository-info)-info ;
725 MakeLocate $(repositoryInfo) : $(repositoriesDir) ;
726 PreprocessPackageOrRepositoryInfo $(repositoryInfo) : $(repoInfoTemplate)
727 : $(architecture) : $(secondaryArchitecture) ;
729 # build the respository config
730 local repositoryConfig = $(repository:G=repository-config)-config ;
731 MakeLocate $(repositoryConfig) : $(repositoriesDir) ;
732 RepositoryConfig $(repositoryConfig) : $(repositoryInfo) ;
733 HAIKU_REPOSITORY_CONFIG_FILE on $(repository) = $(repositoryConfig) ;
735 # setup the repository cache file
736 local repositoryCache = $(repository:B=repo:G=repository-cache) ;
737 MakeLocate $(repositoryCache)
738 : [ FDirName $(repositoriesDir) $(repository:G=) ] ;
739 Depends $(repositoryCache) : $(repository) ;
740 HAIKU_REPOSITORY_CACHE_FILE on $(repository) = $(repositoryCache) ;
742 # add the repository to the list of known package repositories
743 HAIKU_REPOSITORIES += $(repository) ;
745 # prepare the script that initializes the shell variables
746 local initVariablesScript = $(repository)-repository-init-vars ;
747 MakeLocate $(initVariablesScript)
748 : $(HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture)) ;
749 Always $(initVariablesScript) ;
751 local script = $(initVariablesScript) ;
752 AddVariableToScript $(script) : addBuildCompatibilityLibDir
753 : $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
754 AddVariableToScript $(script) : sha256 : $(HOST_SHA256) ;
755 AddVariableToScript $(script) : sedExtendedRegex
756 : $(HOST_EXTENDED_REGEX_SED) ;
757 AddTargetVariableToScript $(script) : <build>package ;
758 AddTargetVariableToScript $(script) : <build>package_repo : packageRepo ;
760 # call the build actions
761 local mainScript = build_haiku_repository ;
762 SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
764 Depends $(repository) : $(mainScript) $(initVariablesScript)
765 $(repositoryInfo) $(packages) ;
766 HaikuRepository1 $(repository) : $(mainScript) $(initVariablesScript)
767 $(repositoryInfo) $(packages) ;
768 Always $(repository) ;
770 RmTemps $(repository) : $(initVariablesScript) ;
774 actions HaikuRepository1
776 $(2[1]) "$(2[2])" "$(1)" "$(2[3-])"