Changed the way the zip archive with the alternative gcc libraries is built.

Now that's done like building the network boot archive, which gives us a lot
more flexibility for defining its contents.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30850 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-05-25 01:21:32 +00:00
parent 56d4690860
commit a474455132
5 changed files with 217 additions and 55 deletions
+74
View File
@@ -0,0 +1,74 @@
# This file defines what ends up in the alternative GCC archive and it executes
# the rules building the archive. Included by HaikuImage.
# system/lib libraries
local alternativeSystemLibs ;
local libTarget ;
for libTarget in [ FFilesInHaikuImageDirectory system lib ] {
alternativeSystemLibs += [ on $(libTarget) return $(TARGET) ] ;
}
AddFilesToAlternativeGCCArchive system lib $(HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR)
: $(alternativeSystemLibs) ;
# system/lib library symlinks
for libTarget in [ FSymlinksInHaikuImageDirectory system lib ] {
AddSymlinkToAlternativeGCCArchive
system lib $(HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR)
: [ on $(libTarget) return $(SYMLINK_TARGET) ] : $(libTarget:BS) ;
}
#pragma mark - Build The Archive
# archive target
HAIKU_ALTERNATIVE_GCC_ARCHIVE = alternative_system_libs.zip ;
MakeLocate $(HAIKU_ALTERNATIVE_GCC_ARCHIVE) : $(HAIKU_OUTPUT_DIR) ;
# the pseudo target all archive contents is attached to
NotFile $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) ;
# prepare the script that initializes the shell variables
local initVarsScript = <AlternativeGCCArchive>haiku-alternative-gcc-init-vars ;
local script = $(initVarsScript) ;
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
Always $(script) ;
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
AddVariableToScript $(script) : addBuildCompatibilityLibDir
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
AddTargetVariableToScript $(script) : <build>copyattr ;
AddTargetVariableToScript $(script) : <build>zip ;
if $(HOST_RM_ATTRS_TARGET) {
AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ;
} else {
AddVariableToScript $(script) : rmAttrs : rm ;
}
# create the other scripts
local makeDirsScript = <AlternativeGCCArchive>haiku-alternative-gcc-make-dirs ;
local copyFilesScript
= <AlternativeGCCArchive>haiku-alternative-gcc-copy-files ;
MakeLocate $(makeDirsScript) $(copyFilesScript) : $(HAIKU_OUTPUT_DIR) ;
CreateAlternativeGCCArchiveMakeDirectoriesScript $(makeDirsScript) ;
CreateAlternativeGCCArchiveCopyFilesScript $(copyFilesScript) ;
# build the archive
BuildAlternativeGCCArchive $(HAIKU_ALTERNATIVE_GCC_ARCHIVE) :
$(initVarsScript)
$(makeDirsScript)
$(copyFilesScript)
;
# remove the scripts we have generated
RmTemps $(HAIKU_ALTERNATIVE_GCC_ARCHIVE) :
$(initVarsScript)
$(makeDirsScript)
$(copyFilesScript)
;
NotFile haiku-alternative-gcc-archive ;
Depends haiku-alternative-gcc-archive : $(HAIKU_ALTERNATIVE_GCC_ARCHIVE) ;
+16
View File
@@ -29,6 +29,15 @@ HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME)
= HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ; = HAIKU_NET_BOOT_ARCHIVE_INSTALL_TARGETS ;
# alternative gcc archive
HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME
= haiku-alternative-gcc-archive-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME)
= AlternativeGCCArchive ;
# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported
HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME)
= HAIKU_ALTERNATIVE_GCC_ARCHIVE_INSTALL_TARGETS ;
# boot floppy # boot floppy
HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ; HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ;
HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME)
@@ -133,6 +142,13 @@ if $(HAIKU_GCC_VERSION[1]) = 2 {
HAIKU_GCC_HEADERS_DIR = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ; HAIKU_GCC_HEADERS_DIR = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ;
} }
# the subdirectory into which the alternative GCC libraries are to be installed
if $(HAIKU_GCC_VERSION[1]) = 2 {
HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR = gcc2 ;
} else {
HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR = gcc4 ;
}
# initial state for flags etc. # initial state for flags etc.
HAIKU_C++ ?= $(HAIKU_CC) ; HAIKU_C++ ?= $(HAIKU_CC) ;
HAIKU_LINK = $(HAIKU_CC) ; HAIKU_LINK = $(HAIKU_CC) ;
+6 -54
View File
@@ -36,7 +36,7 @@ SYSTEM_BIN = "[" addattr alert arp base64 basename bash bc beep bootman bzip2
factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode factor false fdinfo ffm filepanel find finddir fmt fold fortune frcode
ftp ftpd ftp ftpd
funzip fwcontrol funzip fwcontrol
gawk $(X86_ONLY)gdb getlimits grep groups gzip gzexe gawk $(X86_ONLY)gdb getlimits grep groups gzip gzexe
hd head hey hostname hd head hey hostname
id ident ideinfo idestatus ifconfig <bin>install installsound iroster id ident ideinfo idestatus ifconfig <bin>install installsound iroster
isvolume isvolume
@@ -534,48 +534,9 @@ CopyDirectoryToHaikuImage system data
#pragma mark - Alternative GCC Libraries #pragma mark - Alternative GCC Libraries
# build a zip file with the system libs # We build a zip archive containing the libraries built with the alternative
# (used by another jam that wants to build a Haiku with alternative GCC # GCC and unzip onto our image. Building the archive is done by a sub-jam.
# libraries included) include [ FDirName $(HAIKU_BUILD_RULES_DIR) AlternativeGCCArchive ] ;
rule ZipTargets zipFile : targets
{
Depends $(zipFile) : <build>zip $(targets) ;
ZipTargets1 $(zipFile) : <build>zip $(targets) ;
}
actions ZipTargets1
{
$(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
$(RM) "$(1)"
$(2[1]) -jy "$(1)" $(2[2-])
}
local alternativeSystemLibsZip = <image>alternative_system_libs.zip ;
MakeLocate $(alternativeSystemLibsZip) : $(HAIKU_OUTPUT_DIR) ;
# collect the targets we would install in the lib directory
local alternativeSystemLibs ;
local libTargets = [ FFilesInHaikuImageDirectory system lib ] ;
local libTarget ;
for libTarget in $(libTargets) {
alternativeSystemLibs += [ on $(libTarget) return $(TARGET) ] ;
}
# collect the symlinks we would install in the lib directory
libTargets = [ FSymlinksInHaikuImageDirectory system lib ] ;
local tmpAlternativeLibDir
= [ FDirName $(HAIKU_OUTPUT_DIR) tmp alternativeLibs ] ;
for libTarget in $(libTargets) {
# We need to create actual symlinks, we can zip later.
local symlinkTarget = <alternative-system-lib>$(libTarget:BS) ;
MakeLocate $(symlinkTarget) : $(tmpAlternativeLibDir) ;
SymLink $(symlinkTarget) : [ on $(libTarget) return $(SYMLINK_TARGET) ] ;
alternativeSystemLibs += $(symlinkTarget) ;
}
ZipTargets $(alternativeSystemLibsZip) : $(alternativeSystemLibs) ;
if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) { if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) {
# let another jam build a zip with the system libraries # let another jam build a zip with the system libraries
@@ -600,19 +561,10 @@ if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) {
InvokeSubJam $(otherAlternativeSystemLibsZip) InvokeSubJam $(otherAlternativeSystemLibsZip)
: $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) : $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR)
: "'<image>alternative_system_libs.zip'" ; : "haiku-alternative-gcc-archive" ;
local libSubDir ;
if $(HAIKU_GCC_VERSION[1]) = 2 {
libSubDir = gcc4 ;
} else {
libSubDir = gcc2 ;
}
# install the alternative libs in the right directory # install the alternative libs in the right directory
UnzipArchiveToHaikuImage system lib $(libSubDir) UnzipArchiveToHaikuImage : $(otherAlternativeSystemLibsZip) ;
: $(otherAlternativeSystemLibsZip) ;
} }
+59 -1
View File
@@ -946,7 +946,7 @@ rule CreateNetBootArchiveCopyFilesScript script
rule BuildNetBootArchive archive : scripts rule BuildNetBootArchive archive : scripts
{ {
# BuildHNetBootArchive <archive> : <scripts> ; # BuildNetBootArchive <archive> : <scripts> ;
local mainScript = build_tgz_archive ; local mainScript = build_tgz_archive ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ; SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
@@ -961,8 +961,66 @@ actions BuildNetBootArchive1
} }
#pragma mark - Alternative GCC Archive rules
rule AddDirectoryToAlternativeGCCArchive directoryTokens
{
# AddDirectoryToAlternativeGCCArchive <directoryTokens>
return [ AddDirectoryToContainer
$(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) : $(directoryTokens) ] ;
}
rule AddFilesToAlternativeGCCArchive directory : targets : destName
{
# AddFilesToAlternativeGCCArchive <directory> : <targets> [ : dest name ]
AddFilesToContainer $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME)
: $(directory) : $(targets) : $(destName) ;
}
rule AddSymlinkToAlternativeGCCArchive directoryTokens : linkTarget : linkName
{
# AddSymlinkToAlternativeGCCArchive <directory> : <link target>
# [ : <link name> ] ;
AddSymlinkToContainer $(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME)
: $(directoryTokens) : $(linkTarget) : $(linkName) ;
}
rule CreateAlternativeGCCArchiveMakeDirectoriesScript script
{
CreateContainerMakeDirectoriesScript
$(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) : $(script) ;
}
rule CreateAlternativeGCCArchiveCopyFilesScript script
{
CreateContainerCopyFilesScript
$(HAIKU_ALTERNATIVE_GCC_ARCHIVE_CONTAINER_NAME) : $(script) ;
}
rule BuildAlternativeGCCArchive archive : scripts
{
# BuildAlternativeGCCArchive <archive> : <scripts> ;
local mainScript = build_zip_archive ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
Depends $(archive) : $(mainScript) $(scripts) ;
BuildAlternativeGCCArchive1 $(archive) : $(mainScript) $(scripts) ;
}
actions BuildAlternativeGCCArchive1
{
$(2[1]) $(1) $(2[2-])
}
#pragma mark - Floppy Boot Archive rules #pragma mark - Floppy Boot Archive rules
rule AddDirectoryToFloppyBootArchive directoryTokens rule AddDirectoryToFloppyBootArchive directoryTokens
{ {
# AddDirectoryToFloppyBootArchive <directoryTokens> # AddDirectoryToFloppyBootArchive <directoryTokens>
+62
View File
@@ -0,0 +1,62 @@
#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: $0 <archive> <scripts> ..."
fi
# get the archive name
archive=$1
shift
# The second argument is the shell script that initializes the variables:
# tmpDir
# addBuildCompatibilityLibDir
#
# copyattr
# rmAttrs
# zip
#
. $1
shift
outputDir=$tmpDir/archive
# this adds the build library dir to LD_LIBRARY_PATH
eval "$addBuildCompatibilityLibDir"
# map the shell commands
sPrefix=
tPrefix="$outputDir/"
cd=cd
scd=:
cp="$copyattr -d"
ln=ln
mkdir=mkdir
rm=rm
# clear output dir
$rmAttrs -rf $outputDir
$mkdir $outputDir
# populate output dir
echo "Preparing contents of archive $archive ..."
while [ $# -gt 0 ]; do
. $1
shift
done
# get an absolute path for the archive
cwd=$(pwd)
cd $(dirname $archive)
archive=$(pwd)/$(basename $archive)
cd $cwd
# build the archive
echo "Building archive $archive ..."
$rm -f $archive
cd $outputDir
$zip -ryq $archive . || exit 1
cd $cwd
# clean up
$rmAttrs -rf $outputDir