mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
Preliminary support for building ISO only Haiku CDs. Not working completely
clean yet. Provides a haiku-cd target and creates a bootable image using mkisofs. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29203 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
bea22f6240
commit
e2c3dec923
1
Jamfile
1
Jamfile
@ -160,3 +160,4 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) NetBootArchive ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) FloppyBootImage ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootImage ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootPPCImage ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuCD ] ;
|
||||
|
1
Jamrules
1
Jamrules
@ -38,6 +38,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) FreetypeRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) HeadersRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) KernelRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) ImageRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ;
|
||||
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ;
|
||||
|
@ -59,6 +59,11 @@ HAIKU_DEFAULT_INSTALL_DIR = /Haiku ;
|
||||
HAIKU_DEFAULT_IMAGE_SIZE ?= 128 ; # 128 MB
|
||||
HAIKU_DEFAULT_IMAGE_LABEL ?= Haiku ;
|
||||
|
||||
# Haiku CD defaults
|
||||
HAIKU_DEFAULT_CD_NAME = haiku-cd.iso ;
|
||||
HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ;
|
||||
HAIKU_DEFAULT_CD_LABEL = Haiku ;
|
||||
|
||||
# analyze an optionally replace jam's target parameters
|
||||
HAIKU_ORIGINAL_JAM_TARGETS = $(JAM_TARGETS) ;
|
||||
HAIKU_BUILD_PROFILE = ;
|
||||
|
18
build/jam/CDRules
Normal file
18
build/jam/CDRules
Normal file
@ -0,0 +1,18 @@
|
||||
rule BuildHaikuCD haikuCD : bootFloppy : scripts
|
||||
{
|
||||
# BuildHaikuCD <haiku cd> : <bootFloppy> : <scripts> ;
|
||||
|
||||
local mainScript = build_haiku_cd ;
|
||||
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
||||
|
||||
Depends $(haikuCD) : $(mainScript) $(scripts) ;
|
||||
Depends $(haikuCD) : $(bootFloppy) ;
|
||||
BuildHaikuCD1 $(haikuCD) : $(bootFloppy) $(mainScript) $(scripts) ;
|
||||
}
|
||||
|
||||
actions BuildHaikuCD1
|
||||
{
|
||||
export cdImagePath="$(1)"
|
||||
export cdBootFloppy="$(2[1])"
|
||||
$(2[2]) $(2[3-])
|
||||
}
|
84
build/jam/HaikuCD
Normal file
84
build/jam/HaikuCD
Normal file
@ -0,0 +1,84 @@
|
||||
# Execute pre-image user config rules.
|
||||
UserBuildConfigRulePreImage ;
|
||||
|
||||
# Set cd file name and directory defaults and locate the cd file.
|
||||
HAIKU_CD_NAME ?= $(HAIKU_DEFAULT_CD_NAME) ;
|
||||
HAIKU_CD_DIR ?= $(HAIKU_DEFAULT_CD_DIR) ;
|
||||
HAIKU_CD = $(HAIKU_CD_NAME) ;
|
||||
HAIKU_CD_LABEL ?= $(HAIKU_DEFAULT_CD_LABEL) ;
|
||||
MakeLocate $(HAIKU_CD) : $(HAIKU_CD_DIR) ;
|
||||
|
||||
# prepare the script that initializes the shell variables
|
||||
HAIKU_CD_INIT_VARIABLES_SCRIPT = <HaikuCD>haiku.cd-init-vars ;
|
||||
local script = $(HAIKU_CD_INIT_VARIABLES_SCRIPT) ;
|
||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||
Always $(script) ;
|
||||
|
||||
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
|
||||
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
|
||||
AddVariableToScript $(script) : cdLabel : $(HAIKU_CD_LABEL) ;
|
||||
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
||||
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
||||
AddTargetVariableToScript $(script) : <build>addattr ;
|
||||
AddTargetVariableToScript $(script) : <build>copyattr ;
|
||||
AddTargetVariableToScript $(script) : <build>rc ;
|
||||
AddTargetVariableToScript $(script) : <build>resattr ;
|
||||
AddTargetVariableToScript $(script) : <build>unzip ;
|
||||
AddTargetVariableToScript $(script) : <build>generate_attribute_stores ;
|
||||
if $(HOST_RM_ATTRS_TARGET) {
|
||||
AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ;
|
||||
} else {
|
||||
AddVariableToScript $(script) : rmAttrs : rm ;
|
||||
}
|
||||
if $(optionalPackageDescriptions) {
|
||||
AddTargetVariableToScript $(script) : $(optionalPackageDescriptions)
|
||||
: optionalPackageDescriptions ;
|
||||
}
|
||||
|
||||
|
||||
# create the other scripts
|
||||
HAIKU_CD_MAKE_DIRS_SCRIPT = <HaikuCD>haiku.cd-make-dirs ;
|
||||
HAIKU_CD_COPY_FILES_SCRIPT = <HaikuCD>haiku.cd-copy-files ;
|
||||
HAIKU_CD_UNZIP_FILES_SCRIPT = <HaikuCD>haiku.cd-unzip-files ;
|
||||
MakeLocate $(HAIKU_CD_MAKE_DIRS_SCRIPT) $(HAIKU_CD_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_CD_UNZIP_FILES_SCRIPT) : $(HAIKU_OUTPUT_DIR) ;
|
||||
|
||||
CreateHaikuImageMakeDirectoriesScript $(HAIKU_CD_MAKE_DIRS_SCRIPT) ;
|
||||
CreateHaikuImageCopyFilesScript $(HAIKU_CD_COPY_FILES_SCRIPT) ;
|
||||
CreateHaikuImageUnzipFilesScript $(HAIKU_CD_UNZIP_FILES_SCRIPT) ;
|
||||
|
||||
# Convenience wrapper rule around BuildHaikuCD.
|
||||
rule _BuildHaikuCD haikuCD : bootFloppy
|
||||
{
|
||||
# _BuildHaikuCD <cd target> : <bootFloppy> ;
|
||||
#
|
||||
|
||||
# build the cd
|
||||
# HAIKU_CD_EARLY_USER_SCRIPTS, HAIKU_CD_LATE_USER_SCRIPTS can be
|
||||
# specified by the user.
|
||||
BuildHaikuCD $(haikuCD) : $(bootFloppy) :
|
||||
$(HAIKU_CD_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_CD_EARLY_USER_SCRIPTS)
|
||||
$(HAIKU_CD_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_CD_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_CD_UNZIP_FILES_SCRIPT)
|
||||
$(HAIKU_CD_LATE_USER_SCRIPTS)
|
||||
;
|
||||
|
||||
# remove the scripts we have generated
|
||||
RmTemps $(haikuCD) :
|
||||
$(HAIKU_CD_INIT_VARIABLES_SCRIPT)
|
||||
$(HAIKU_CD_MAKE_DIRS_SCRIPT)
|
||||
$(HAIKU_CD_COPY_FILES_SCRIPT)
|
||||
$(HAIKU_CD_UNZIP_FILES_SCRIPT)
|
||||
;
|
||||
}
|
||||
|
||||
# build the cd
|
||||
_BuildHaikuCD $(HAIKU_CD) : $(HAIKU_BOOT_FLOPPY) ;
|
||||
NotFile haiku-cd ;
|
||||
Depends haiku-cd : $(HAIKU_CD) ;
|
||||
|
||||
# Execute post-image user config rules.
|
||||
UserBuildConfigRulePostImage ;
|
153
build/scripts/build_haiku_cd
Executable file
153
build/scripts/build_haiku_cd
Executable file
@ -0,0 +1,153 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The first argument is the shell script that initializes the variables:
|
||||
# sourceDir
|
||||
# outputDir
|
||||
# tmpDir
|
||||
# addBuildCompatibilityLibDir
|
||||
#
|
||||
# addattr
|
||||
# copyattr
|
||||
# resattr
|
||||
# rc
|
||||
# rmAttrs
|
||||
# unzip
|
||||
# generate_attribute_stores
|
||||
#
|
||||
if [ $# -gt 0 ]; then
|
||||
. $1
|
||||
shift
|
||||
fi
|
||||
|
||||
# this adds the build library dir to LD_LIBRARY_PATH
|
||||
eval "$addBuildCompatibilityLibDir"
|
||||
|
||||
outputDir=$tmpDir/cdsource
|
||||
|
||||
sPrefix=
|
||||
tPrefix="$outputDir/"
|
||||
cd=cd
|
||||
scd=:
|
||||
cp="$copyattr -d"
|
||||
copyAttrs="$copyattr"
|
||||
ln=ln
|
||||
mkdir=mkdir
|
||||
rm=rm
|
||||
|
||||
|
||||
unzipFile()
|
||||
{
|
||||
# unzipFile <archive> <directory>
|
||||
zipFile=$1
|
||||
targetUnzipDir=$2
|
||||
|
||||
echo "Unzipping $zipFile ..."
|
||||
|
||||
unzipDir=$tmpDir/unzip
|
||||
$rmAttrs -rf "$unzipDir"
|
||||
mkdir -p "$unzipDir"
|
||||
|
||||
$unzip -q -d "$unzipDir" "$zipFile"
|
||||
|
||||
if [ -f $unzipDir/.OptionalPackageDescription ]; then
|
||||
cat $unzipDir/.OptionalPackageDescription >> $copyrightsFile
|
||||
echo >> $copyrightsFile
|
||||
rm $unzipDir/.OptionalPackageDescription
|
||||
fi
|
||||
|
||||
$cp -r "$unzipDir/." "${tPrefix}$targetUnzipDir"
|
||||
|
||||
$rmAttrs -rf "$unzipDir"
|
||||
}
|
||||
|
||||
|
||||
mkdir -p $tmpDir
|
||||
copyrightsFile=$tmpDir/copyrights
|
||||
$rmAttrs -f $copyrightsFile
|
||||
if [ "$optionalPackageDescriptions" ]; then
|
||||
cp "$optionalPackageDescriptions" $copyrightsFile
|
||||
fi
|
||||
|
||||
# setup output dir
|
||||
$rmAttrs -rf "$outputDir"
|
||||
mkdir -p "$outputDir"
|
||||
|
||||
echo "Populating CD ..."
|
||||
while [ $# -gt 0 ]; do
|
||||
. $1
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# install MIME database
|
||||
# TODO: It should be possible to do that in the build system too.
|
||||
|
||||
mimeDBSource=$sourceDir/src/data/beos_mime
|
||||
mimeDBDest=${tPrefix}home/config/settings/beos_mime
|
||||
|
||||
$rm -rf $mimeDBDest
|
||||
$mkdir -p $mimeDBDest
|
||||
mimeTmpDir=$tmpDir/mime
|
||||
mimeDBTmpDir=$tmpDir/mime/db
|
||||
mimeTmpIndex=0
|
||||
mimeTmpFile=$mimeTmpDir/mimedb$$.rsrc
|
||||
|
||||
# create tmp dir for the MIME conversion stuff
|
||||
mkdir -p $mimeDBTmpDir
|
||||
|
||||
echo "Installing MIME database ..."
|
||||
|
||||
for inSuperFile in $mimeDBSource/*.super; do
|
||||
superType=$(basename $inSuperFile .super)
|
||||
tmpSuperDir=$mimeDBTmpDir/$superType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
$rc -o $mimeTmpFile $inSuperFile
|
||||
mkdir -p $tmpSuperDir
|
||||
$resattr -O -o $tmpSuperDir $mimeTmpFile
|
||||
$rmAttrs $mimeTmpFile
|
||||
|
||||
# iterate through the sub types
|
||||
for inSubFile in $mimeDBSource/$superType/*; do
|
||||
# check, if the type exists
|
||||
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
||||
subType=$(basename $inSubFile)
|
||||
tmpSubFile=$mimeDBTmpDir/$superType/$subType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
$rc -o $mimeTmpFile $inSubFile
|
||||
$resattr -O -o $tmpSubFile $mimeTmpFile
|
||||
$rmAttrs $mimeTmpFile
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
$cp -r $mimeDBTmpDir/. $mimeDBDest
|
||||
|
||||
# cleanup tmp dir
|
||||
$rmAttrs -rf $mimeTmpDir
|
||||
|
||||
|
||||
# add the concatenated copyrights as an attribute to AboutSystem
|
||||
|
||||
if [ -f $copyrightsFile ]; then
|
||||
copyrightAttrs=$tmpDir/copyrightAttrs
|
||||
$rmAttrs -f $copyrightAttrs
|
||||
touch $copyrightAttrs
|
||||
$addattr -f $copyrightsFile COPYRIGHTS $copyrightAttrs
|
||||
$copyAttrs $copyrightAttrs ${tPrefix}beos/apps/AboutSystem
|
||||
fi
|
||||
|
||||
# generate the attribute stores
|
||||
echo "Generating attribute stores ..."
|
||||
$generate_attribute_stores "$tPrefix"
|
||||
|
||||
echo "Copying boot image ..."
|
||||
$cp "$cdBootFloppy" "$outputDir"
|
||||
|
||||
# build the iso image
|
||||
echo "Building CD image ..."
|
||||
mkisofs -b `basename $cdBootFloppy` -U -R -V "$cdLabel" -o "$cdImagePath" "$tPrefix"
|
||||
|
||||
# cleanup output dir
|
||||
#$rmAttrs -rf "$outputDir"
|
Loading…
Reference in New Issue
Block a user