2011-06-17 17:11:16 +04:00
|
|
|
rule FHaikuPackageGrist package
|
|
|
|
{
|
|
|
|
local grist = [ Match "<(.*)>" : $(package:G) ] ;
|
2013-06-05 01:59:37 +04:00
|
|
|
return hpkg_$(grist:E="")-$(package:G=) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule HaikuPackage package
|
|
|
|
{
|
|
|
|
local grist = [ FHaikuPackageGrist $(package) ] ;
|
|
|
|
|
|
|
|
HAIKU_CONTAINER_GRIST on $(package) = $(grist) ;
|
2011-07-03 10:44:19 +04:00
|
|
|
HAIKU_INCLUDE_IN_CONTAINER_VAR on $(package) = HAIKU_INCLUDE_IN_PACKAGES ;
|
2011-06-17 17:11:16 +04:00
|
|
|
HAIKU_INSTALL_TARGETS_VAR on $(package)
|
|
|
|
= $(grist)_HAIKU_PACKAGE_INSTALL_TARGETS ;
|
2011-06-19 19:01:23 +04:00
|
|
|
HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(package) = ;
|
2011-06-18 04:19:53 +04:00
|
|
|
|
|
|
|
HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE = $(package) ;
|
2011-07-03 10:44:19 +04:00
|
|
|
|
|
|
|
if $(HAIKU_PACKAGES_UPDATE_ONLY) {
|
|
|
|
HAIKU_CONTAINER_UPDATE_ONLY on $(package) = 1 ;
|
|
|
|
HAIKU_CONTAINER_INHERIT_UPDATE_VARIABLE on $(package)
|
|
|
|
= HAIKU_INCLUDE_IN_IMAGE ;
|
2013-04-21 03:44:21 +04:00
|
|
|
} else if $(HAIKU_UPDATE_ALL_PACKAGES) {
|
|
|
|
HAIKU_INCLUDE_IN_IMAGE on $(package) = 1 ;
|
2011-07-03 10:44:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
HAIKU_CONTAINER_ALWAYS_CREATE_DIRECTORIES on $(package) = 1 ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
rule PreprocessPackageInfo source : directory : architecture
|
2013-08-06 01:23:48 +04:00
|
|
|
: secondaryArchitecture
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2013-07-07 17:02:29 +04:00
|
|
|
source = $(source:G=package-info-source) ;
|
|
|
|
SEARCH on $(source) +=
|
2013-08-01 10:51:16 +04:00
|
|
|
[ FDirName $(HAIKU_PACKAGE_INFOS_DIR) $(architecture) ]
|
2013-07-07 17:02:29 +04:00
|
|
|
[ FDirName $(HAIKU_PACKAGE_INFOS_DIR) any ]
|
|
|
|
[ FDirName $(HAIKU_PACKAGE_INFOS_DIR) generic ]
|
|
|
|
;
|
|
|
|
|
|
|
|
local target = $(source:BSG=package-info)-package-info ;
|
2013-08-01 10:51:16 +04:00
|
|
|
local defines = HAIKU_PACKAGING_ARCH=$(architecture) ;
|
2013-08-06 06:11:44 +04:00
|
|
|
local sedReplacements = %HAIKU_PACKAGING_ARCH%,$(architecture) ;
|
2013-07-07 17:02:29 +04:00
|
|
|
if $(HAIKU_BOOTSTRAP_BUILD) {
|
|
|
|
defines += HAIKU_BOOTSTRAP_BUILD ;
|
|
|
|
target = $(target)-bootstrap ;
|
|
|
|
}
|
2013-08-06 01:23:48 +04:00
|
|
|
if $(secondaryArchitecture) {
|
|
|
|
defines += HAIKU_SECONDARY_PACKAGING_ARCH=$(secondaryArchitecture) ;
|
2013-08-06 06:11:44 +04:00
|
|
|
sedReplacements
|
|
|
|
+= %HAIKU_SECONDARY_PACKAGING_ARCH%,$(secondaryArchitecture) ;
|
2013-08-10 17:04:48 +04:00
|
|
|
sedReplacements +=
|
|
|
|
%HAIKU_SECONDARY_PACKAGING_ARCH_SUFFIX%,_$(secondaryArchitecture) ;
|
|
|
|
} else {
|
|
|
|
sedReplacements
|
|
|
|
+= %HAIKU_SECONDARY_PACKAGING_ARCH_SUFFIX%, ;
|
2013-08-06 01:23:48 +04:00
|
|
|
}
|
2013-07-07 17:02:29 +04:00
|
|
|
|
2013-10-10 23:38:07 +04:00
|
|
|
local revisionFile = [ DetermineHaikuRevision ] ;
|
2013-10-30 05:15:45 +04:00
|
|
|
local updateRequiresFiles ;
|
|
|
|
local haikuPortsRepositoryFile ;
|
|
|
|
if ! $(HAIKU_BOOTSTRAP_BUILD) {
|
|
|
|
updateRequiresFiles =
|
|
|
|
<build>update_package_requires
|
|
|
|
[ on <repository>HaikuPorts return $(HAIKU_REPOSITORY_CACHE_FILE) ]
|
|
|
|
;
|
|
|
|
}
|
2013-10-10 23:38:07 +04:00
|
|
|
|
2013-07-07 17:02:29 +04:00
|
|
|
MakeLocate $(target) : $(directory) ;
|
2013-10-30 05:15:45 +04:00
|
|
|
Depends $(target) : $(source) $(revisionFile) $(updateRequiresFiles) ;
|
2013-07-07 17:02:29 +04:00
|
|
|
|
|
|
|
CCDEFS on $(target) = [ FDefines $(defines) ] ;
|
2013-08-06 06:11:44 +04:00
|
|
|
HAIKU_SED_REPLACEMENTS on $(target) = "-e s,$(sedReplacements),g" ;
|
2013-07-07 17:02:29 +04:00
|
|
|
|
2013-10-30 05:15:45 +04:00
|
|
|
PreprocessPackageInfo1 $(target) : $(source) $(revisionFile)
|
|
|
|
$(updateRequiresFiles) ;
|
2013-07-07 17:02:29 +04:00
|
|
|
|
|
|
|
return $(target) ;
|
|
|
|
}
|
2013-05-20 21:30:54 +04:00
|
|
|
|
2013-07-07 17:02:29 +04:00
|
|
|
|
|
|
|
actions PreprocessPackageInfo1
|
|
|
|
{
|
2013-10-10 23:38:07 +04:00
|
|
|
revision=`sed -n 's,^\(hrev[0-9]*\).*,\1,p' $(2[2])`
|
|
|
|
sed $(HAIKU_SED_REPLACEMENTS) \
|
|
|
|
-e s,%HAIKU_VERSION%,$(HAIKU_VERSION)_${revision:-0}-1, < $(2[1]) \
|
|
|
|
| $(HOST_CC) -E -w $(CCDEFS) - -o $(1)
|
2013-10-30 05:15:45 +04:00
|
|
|
|
|
|
|
if [ -n "$(2[4]:E)" ]; then
|
|
|
|
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
|
|
|
"$(2[3])" "$(1)" "$(2[4])" || exit 1
|
|
|
|
fi
|
2013-07-07 17:02:29 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule BuildHaikuPackage package : packageInfo
|
|
|
|
{
|
2013-08-01 10:51:16 +04:00
|
|
|
local architecture = $(HAIKU_PACKAGING_ARCH) ;
|
2013-08-06 01:23:48 +04:00
|
|
|
local secondaryArchitecture ;
|
|
|
|
if $(TARGET_PACKAGING_ARCH) != $(architecture) {
|
|
|
|
secondaryArchitecture = $(TARGET_PACKAGING_ARCH) ;
|
|
|
|
}
|
|
|
|
|
2011-06-17 17:11:16 +04:00
|
|
|
local grist = [ FHaikuPackageGrist $(package) ] ;
|
|
|
|
|
2013-08-01 10:51:16 +04:00
|
|
|
local tempDir
|
|
|
|
= [ FDirName $(HAIKU_PACKAGES_BUILD_DIR_$(architecture)) $(grist) ] ;
|
2011-06-17 17:11:16 +04:00
|
|
|
local scriptDir = [ FDirName $(tempDir) scripts ] ;
|
|
|
|
|
2013-07-07 17:02:29 +04:00
|
|
|
# build the package info and locate the package
|
2013-08-01 10:51:16 +04:00
|
|
|
packageInfo = [ PreprocessPackageInfo $(packageInfo) : $(tempDir)
|
2013-08-06 01:23:48 +04:00
|
|
|
: $(architecture) : $(secondaryArchitecture) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
MakeLocate $(package) : $(HAIKU_PACKAGES_DIR_$(architecture)) ;
|
2013-07-07 17:02:29 +04:00
|
|
|
Depends $(package) : $(packageInfo) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
|
|
|
|
# prepare the script that initializes the shell variables
|
|
|
|
local initVariablesScript = <$(grist)>haiku.package-init-vars ;
|
|
|
|
MakeLocate $(initVariablesScript) : $(scriptDir) ;
|
|
|
|
Always $(initVariablesScript) ;
|
|
|
|
|
|
|
|
local script = $(initVariablesScript) ;
|
|
|
|
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
|
|
|
|
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
|
|
|
AddVariableToScript $(script) : tmpDir : $(tempDir) ;
|
|
|
|
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
|
|
|
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
2013-05-19 03:48:53 +04:00
|
|
|
AddVariableToScript $(script) : compressionLevel
|
2013-05-20 21:30:54 +04:00
|
|
|
: [ on $(package) return $(HAIKU_PACKAGE_COMPRESSION_LEVEL) ] ;
|
2011-07-03 10:44:19 +04:00
|
|
|
AddVariableToScript $(script) : updateOnly
|
|
|
|
: [ on $(package) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] ;
|
2013-08-01 10:51:16 +04:00
|
|
|
AddVariableToScript $(script) : cc : $(TARGET_CC_$(architecture)) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
AddTargetVariableToScript $(script) : <build>addattr ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>copyattr ;
|
2013-05-09 05:38:10 +04:00
|
|
|
AddTargetVariableToScript $(script) : <mimedb>mime_db : mimeDB ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>mimeset ;
|
2011-06-17 17:11:16 +04:00
|
|
|
AddTargetVariableToScript $(script) : <build>package ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>rc ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>resattr ;
|
|
|
|
AddTargetVariableToScript $(script) : <build>unzip ;
|
|
|
|
if $(HOST_RM_ATTRS_TARGET) {
|
|
|
|
AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET)
|
|
|
|
: rmAttrs ;
|
|
|
|
} else {
|
|
|
|
AddVariableToScript $(script) : rmAttrs : rm ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# create the other scripts
|
|
|
|
local makeDirsScript = <$(grist)>haiku.package-make-dirs ;
|
|
|
|
local copyFilesScript = <$(grist)>haiku.package-copy-files ;
|
2013-06-01 00:37:13 +04:00
|
|
|
local extractFilesScript = <$(grist)>haiku.package-extract-files ;
|
2011-06-17 17:11:16 +04:00
|
|
|
|
2013-06-08 02:20:24 +04:00
|
|
|
MakeLocate $(makeDirsScript) $(copyFilesScript) $(extractFilesScript)
|
|
|
|
: $(scriptDir) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
|
|
|
|
CreateContainerMakeDirectoriesScript $(package) : $(makeDirsScript) ;
|
|
|
|
CreateContainerCopyFilesScript $(package) : $(copyFilesScript) ;
|
2013-06-01 00:37:13 +04:00
|
|
|
CreateContainerExtractFilesScript $(package) : $(extractFilesScript) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
|
|
|
|
local scripts = $(initVariablesScript) $(makeDirsScript)
|
2013-06-01 00:37:13 +04:00
|
|
|
$(copyFilesScript) $(extractFilesScript) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
|
|
|
|
# call the build actions
|
|
|
|
local mainScript = build_haiku_package ;
|
|
|
|
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
|
|
|
|
|
|
|
LocalDepends $(package) : $(mainScript) $(scripts) ;
|
|
|
|
BuildHaikuPackage1 $(package) : $(mainScript) $(packageInfo) $(scripts) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
actions BuildHaikuPackage1
|
|
|
|
{
|
|
|
|
$(2[1]) "$(1)" "$(2[2])" $(2[3-])
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddDirectoryToPackage directoryTokens : attributeFiles
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
return [ AddDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
2011-06-18 03:57:35 +04:00
|
|
|
: $(directoryTokens) : $(attributeFiles) ] ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddFilesToPackage directory : targets : destName
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddFilesToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE) : $(directory)
|
|
|
|
: $(targets) : $(destName) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddSymlinkToPackage directoryTokens : linkTarget : linkName
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
|
|
|
linkTarget = $(linkTarget:J=/) ;
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
AddSymlinkToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(directoryTokens) : $(linkTarget) : $(linkName) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule CopyDirectoryToPackage directoryTokens : sourceDirectory
|
2013-05-07 04:38:55 +04:00
|
|
|
: targetDirectoryName : excludePatterns : flags
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
CopyDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(directoryTokens) : $(sourceDirectory) : $(targetDirectoryName)
|
2013-05-07 04:38:55 +04:00
|
|
|
: $(excludePatterns) : $(flags) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-07 04:38:55 +04:00
|
|
|
rule AddHeaderDirectoryToPackage dirTokens : dirName : flags
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddHeaderDirectoryToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
2013-05-07 04:38:55 +04:00
|
|
|
: $(dirTokens) : $(dirName) : $(flags) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddWifiFirmwareToPackage driver : subDirToExtract : archive
|
2011-06-17 17:11:16 +04:00
|
|
|
: extract
|
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddWifiFirmwareToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(driver) : $(subDirToExtract) : $(archive) : $(extract) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-07 04:38:55 +04:00
|
|
|
rule ExtractArchiveToPackage dirTokens : archiveFile : flags : extractedSubDir
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
ExtractArchiveToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
2013-05-07 04:38:55 +04:00
|
|
|
: $(dirTokens) : $(archiveFile) : $(flags) : $(extractedSubDir) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddDriversToPackage relativeDirectoryTokens : targets
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddDriversToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddNewDriversToPackage relativeDirectoryTokens : targets
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddNewDriversToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(relativeDirectoryTokens) : $(targets) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddBootModuleSymlinksToPackage targets
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddBootModuleSymlinksToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(targets) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-06-18 04:19:53 +04:00
|
|
|
rule AddLibrariesToPackage directory : libs
|
2011-06-17 17:11:16 +04:00
|
|
|
{
|
2011-06-18 04:19:53 +04:00
|
|
|
AddLibrariesToContainer $(HAIKU_CURRENTLY_BUILT_HAIKU_PACKAGE)
|
|
|
|
: $(directory) : $(libs) ;
|
2011-06-17 17:11:16 +04:00
|
|
|
}
|
2013-05-19 03:48:53 +04:00
|
|
|
|
|
|
|
|
|
|
|
# default value for the package compression level
|
|
|
|
HAIKU_PACKAGE_COMPRESSION_LEVEL ?= 9 ;
|