* Use the new Add{Files,Symlink}ToHaikuHybridImage rules in HaikuImage and

OptionalPackages. This makes the content definition part in
  AlternativeGCCArchive superfluous.
* Moved the cc and c++ wrapper scripts from src/bin to data/bin.
* Added build variable HAIKU_ADD_OPTIONAL_PACKAGES to add optional packages
  -- the list can be separated by slashes to allow easier passing through
  the shell.
* When invoking the sub-jam that builds the alternative GCC archive, we force
  it to ignore the UserBuildConfigs and we enable the optional packages
  enabled in the main jam.
* Reorganized /boot/develop:
  - There's now an "abi" subdirectory containing a <arch>/<gcc>/ subdirectory
    for each installed ABI-incompatible gcc version and a "current" symlink
    pointed to the currently selected one.
  - All ABI-dependent directories under /boot/develop/ (lib/x86, headers/cpp,
    tools/gnupro) symlink into /boot/develop/abi/current.
  - Changed BELIBRARIES to contain
    /boot/develop/abi/current/library-paths/common instead of /boot/common/lib.
    The former is a symlink to either /boot/common/lib or
    /boot/common/lib/<gccVersion>. There's also a respective "home" symlink.
  - Repackaged the optional binutils+gcc 2/4 packages accordingly. Also fixed
    the obsolete /boot/beos/system/lib/libstdc++.so symlink in the gcc 4
    package.
  - The new structure allows to switch between compilers by changing the
    /boot/develop/abi/current symlink. Added script setgcc to do that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30875 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-05-27 01:12:34 +00:00
parent a4a52ab2ae
commit de49044796
9 changed files with 235 additions and 101 deletions

12
Jamfile
View File

@ -137,20 +137,26 @@ NotFile LocaleKit ;
Depends LocaleKit :
liblocale.so
Locale
# binaries for building localized software on haiku
collectcatkeys
dumpcatalog
linkcatkeys
# addons
LocaleKitCollatorAddons
LocaleKitCatalogAddons
# tests
LocaleKitTests
;
# Add optional packages given via HAIKU_ADD_OPTIONAL_PACKAGES.
if $(HAIKU_ADD_OPTIONAL_PACKAGES) {
AddOptionalHaikuImagePackages
[ FSplitString $(HAIKU_ADD_OPTIONAL_PACKAGES) : / ] ;
}
# Evaluate optional package dependencies and prepare the optional build
# features before parsing the Jamfile tree.
include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ;

View File

@ -2,28 +2,6 @@
# 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) ;
}
# translators
AddFilesToAlternativeGCCArchive
system add-ons Translators $(HAIKU_ALTERNATIVE_GCC_LIB_SUBDIR)
: $(SYSTEM_ADD_ONS_TRANSLATORS) ;
#pragma mark - Build The Archive

View File

@ -229,7 +229,7 @@ AddDriversToHaikuImage net : $(SYSTEM_ADD_ONS_DRIVERS_NET) ;
AddFilesToHaikuImage system : <revisioned>kernel_$(TARGET_ARCH) ;
# libs
AddFilesToHaikuImage system lib : $(SYSTEM_LIBS) ;
AddFilesToHaikuHybridImage system lib : $(SYSTEM_LIBS) : : true ;
# libnetwork.so replaces quite a few libraries
SYSTEM_LIBS_LIBNETWORK_ALIASES
@ -237,20 +237,20 @@ SYSTEM_LIBS_LIBNETWORK_ALIASES
local lib ;
for lib in $(SYSTEM_LIBS_LIBNETWORK_ALIASES) {
AddSymlinkToHaikuImage system lib : libnetwork.so : $(lib) ;
AddFilesToHaikuHybridImage system lib : libnetwork.so : $(lib) : true ;
}
AddSymlinkToHaikuImage system lib : libbnetapi.so : libnetapi.so ;
AddFilesToHaikuHybridImage system lib : libbnetapi.so : libnetapi.so : true ;
# libGL.so has GLU (like BeOS) *and* GLUT API built-in
SYSTEM_LIBS_LIBGL_ALIASES
= libGLU.so libglut.so ;
if $(TARGET_ARCH) = x86 {
local lib ;
for lib in $(SYSTEM_LIBS_LIBGL_ALIASES) {
AddSymlinkToHaikuImage system lib : libGL.so : $(lib) ;
}
local lib ;
for lib in $(SYSTEM_LIBS_LIBGL_ALIASES) {
AddFilesToHaikuHybridImage system lib : libGL.so : $(lib) : true ;
}
}
# servers
@ -453,8 +453,8 @@ AddFilesToHaikuImage system add-ons accelerants
: $(SYSTEM_ADD_ONS_ACCELERANTS) ;
AddFilesToHaikuImage system add-ons opengl
: Mesa\ Software\ Renderer ;
AddFilesToHaikuImage system add-ons Translators
: $(SYSTEM_ADD_ONS_TRANSLATORS) ;
AddFilesToHaikuHybridImage system add-ons Translators
: $(SYSTEM_ADD_ONS_TRANSLATORS) : : true ;
AddFilesToHaikuImage system add-ons mail_daemon inbound_protocols : POP3 IMAP ;
AddFilesToHaikuImage system add-ons mail_daemon outbound_protocols : SMTP ;
AddFilesToHaikuImage system add-ons mail_daemon inbound_filters : Match\ Header Spam\ Filter R5\ Daemon\ Filter ;
@ -531,43 +531,6 @@ CopyDirectoryToHaikuImage system data
: licenses : -x .svn ;
#pragma mark - Alternative GCC Libraries
# We build a zip archive containing the libraries built with the alternative
# GCC and unzip onto our image. Building the archive is done by a sub-jam.
include [ FDirName $(HAIKU_BUILD_RULES_DIR) AlternativeGCCArchive ] ;
if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) {
# let another jam build a zip with the system libraries
rule InvokeSubJam target : directory : jamLine
{
DIRECTORY on $(target) = $(directory) ;
COMMAND_LINE on $(target) = $(jamLine) ;
Always $(target) ;
InvokeSubJam1 $(target) ;
}
actions InvokeSubJam1
{
cd $(DIRECTORY)
$(JAM:E=jam) -q $(COMMAND_LINE) ;
}
local otherAlternativeSystemLibsZip
= <other-image>alternative_system_libs.zip ;
MakeLocate $(otherAlternativeSystemLibsZip)
: $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) ;
InvokeSubJam $(otherAlternativeSystemLibsZip)
: $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR)
: "haiku-alternative-gcc-archive" ;
# install the alternative libs in the right directory
UnzipArchiveToHaikuImage : $(otherAlternativeSystemLibsZip) ;
}
#pragma mark - Optional Packages
@ -595,6 +558,47 @@ if $(HAIKU_IMAGE_OPTIONAL_PACKAGE_DESCRIPTIONS) {
}
#pragma mark - Alternative GCC Libraries
# We build a zip archive containing the libraries built with the alternative
# GCC and unzip onto our image. Building the archive is done by a sub-jam.
include [ FDirName $(HAIKU_BUILD_RULES_DIR) AlternativeGCCArchive ] ;
if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) {
# let another jam build a zip with the system libraries
rule InvokeSubJam target : directory : jamLine
{
DIRECTORY on $(target) = $(directory) ;
COMMAND_LINE on $(target) = $(jamLine) ;
local optionalPackages = $(HAIKU_ADDED_OPTIONAL_PACKAGES:J=/) ;
OPTIONAL_PACKAGES on $(target) = $(optionalPackages:E="") ;
Always $(target) ;
InvokeSubJam1 $(target) ;
}
actions InvokeSubJam1
{
cd $(DIRECTORY)
export HAIKU_IGNORE_USER_BUILD_CONFIG=1
export HAIKU_ADD_OPTIONAL_PACKAGES=$(OPTIONAL_PACKAGES)
$(JAM:E=jam) -q $(COMMAND_LINE) ;
}
local otherAlternativeSystemLibsZip
= <other-image>alternative_system_libs.zip ;
MakeLocate $(otherAlternativeSystemLibsZip)
: $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) ;
InvokeSubJam $(otherAlternativeSystemLibsZip)
: $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR)
: "haiku-alternative-gcc-archive" ;
# install the alternative libs in the right directory
UnzipArchiveToHaikuImage : $(otherAlternativeSystemLibsZip) ;
}
#pragma mark - User/Group Setup

View File

@ -169,8 +169,12 @@ if [ IsOptionalHaikuImagePackageAdded Bluetooth ] {
AddFilesToHaikuImage system bin : bt_dev_info bt_discovery ;
AddSymlinkToHaikuImage home config be Preferences
: /boot/system/preferences/Bluetooth ;
if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] {
AddSymlinkToHaikuImage develop lib x86 : /system/lib/libbluetooth.so ;
if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ]
&& $(HAIKU_GCC_VERSION[1]) in 2 4 {
local arch = $(TARGET_ARCH) ;
local abi = gcc$(HAIKU_GCC_VERSION[1]) ;
AddSymlinkToHaikuHybridImage develop abi $(arch) $(abi) lib
: /system/lib libbluetooth.so : : true ;
}
}
@ -208,18 +212,30 @@ if [ IsOptionalHaikuImagePackageAdded Development ] && $(TARGET_ARCH) = x86 {
if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ]
&& $(TARGET_ARCH) = x86 {
# gcc and binutils
if $(HAIKU_GCC_VERSION[1]) = 2 {
if $(HAIKU_GCC_VERSION[1]) = 2 || $(isHybridBuild) {
local baseURL = http://haiku-files.org/files/optional-packages ;
InstallOptionalHaikuImagePackage gcc-2.95.3-haiku-081024
: $(baseURL)/gcc-2.95.3-haiku-081024.zip ;
} else if $(HAIKU_GCC_VERSION[1]) = 4 {
local baseURL = http://haiku.mlotz.ch ;
InstallOptionalHaikuImagePackage gcc-4.3.3-haiku-090313
: $(baseURL)/gcc-4.3.3-haiku-090313.zip ;
InstallOptionalHaikuImagePackage gcc-2.95.3-haiku-081024-1
: $(baseURL)/gcc-2.95.3-haiku-081024-1.zip ;
}
if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) {
local baseURL = http://haiku-files.org/files/optional-packages ;
InstallOptionalHaikuImagePackage gcc-4.3.3-haiku-090313-1
: $(baseURL)/gcc-4.3.3-haiku-090313-1.zip ;
# symlink cpp to g++'s headers
AddSymlinkToHaikuImage develop headers
: /boot/develop/tools/gnupro/include/g++ : cpp ;
AddSymlinkToHaikuImage develop abi x86 gcc4 headers
: ../tools/current/include/g++ : cpp ;
}
if $(HAIKU_GCC_VERSION[1]) = 4 {
# symlink to libstdc++.so
# TODO: This needs to be solved differently! I.e. the build system
# (configure) should already produce libstdc++.so.
AddSymlinkToHaikuImage system lib
: /boot/develop/abi/x86/gcc4/tools/current/lib/libstdc++.so ;
AddSymlinkToAlternativeGCCArchive system lib gcc4
: /boot/develop/abi/x86/gcc4/tools/current/lib/libstdc++.so ;
}
# other commonly used tools
@ -237,30 +253,59 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentBase ]
# DevelopmentMin
if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] && $(TARGET_ARCH) = x86 {
if ! ( $(HAIKU_GCC_VERSION[1]) in 2 4 ) {
Exit "Optional package DevelopmentMin: Unsupported GCC version:"
$(HAIKU_GCC_VERSION[1]) ;
}
local arch = $(TARGET_ARCH) ;
local abi = gcc$(HAIKU_GCC_VERSION[1]) ;
local abiDirTokens = develop abi $(arch) $(abi) ;
# glue code
AddFilesToHaikuImage develop lib x86 :
<src!system!glue!arch!x86>crti.o <src!system!glue!arch!x86>crtn.o
<src!system!glue>init_term_dyn.o <src!system!glue>start_dyn.o
AddFilesToHaikuHybridImage $(abiDirTokens) lib :
<src!system!glue!arch!$(arch)>crti.o
<src!system!glue!arch!$(arch)>crtn.o
<src!system!glue>init_term_dyn.o
<src!system!glue>start_dyn.o
<src!system!glue>haiku_version_glue.o
;
# kernel
AddFilesToHaikuImage develop lib x86 : kernel.so : _KERNEL_ ;
AddFilesToHaikuHybridImage $(abiDirTokens) lib : kernel.so : _KERNEL_ ;
# library symlinks
local lib ;
for lib in $(SYSTEM_LIBS) libglut.so {
AddSymlinkToHaikuImage develop lib x86 : /system/lib/$(lib:BS) ;
AddSymlinkToHaikuHybridImage $(abiDirTokens) lib
: /system/lib $(lib:BS) : : true ;
}
# static libraries
AddFilesToHaikuImage develop lib x86 : libncurses.a ;
AddFilesToHaikuHybridImage $(abiDirTokens) lib : libncurses.a ;
# the POSIX error code mapper library
AddFilesToHaikuImage develop lib x86 : libposix_error_mapper.a ;
AddFilesToHaikuHybridImage $(abiDirTokens) lib : libposix_error_mapper.a ;
# cc and c++ wrapper scripts
AddFilesToHaikuImage system bin : cc c++ ;
# symlinks for ABI abstraction
AddSymlinkToHaikuImage develop abi : $(arch)/$(abi) : current ;
AddSymlinkToHaikuImage develop lib : /boot/develop/abi/current/lib
: $(arch) ;
AddSymlinkToHaikuImage develop tools
: /boot/develop/abi/current/tools/current : gnupro ;
AddSymlinkToHaikuImage develop headers
: /boot/develop/abi/current/headers/cpp ;
AddSymlinkToHaikuHybridImage $(abiDirTokens) library-paths
: /boot/common/lib : common : true ;
AddSymlinkToHaikuHybridImage $(abiDirTokens) library-paths
: /boot/home/config/lib : home : true ;
# ABI independent stuff
# scripts: cc and c++ wrapper, setgcc
local scripts = cc c++ setgcc ;
SEARCH on $(scripts) = [ FDirName $(HAIKU_TOP) data bin ] ;
AddFilesToHaikuImage system bin : $(scripts) ;
# make and mkdepend build tool, which are part of the Haiku source tree
# TODO: Both should be removed from the tree, made download packages
@ -274,8 +319,7 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] && $(TARGET_ARCH) = x86 {
;
SEARCH on $(makefileEngineFiles)
= [ FDirName $(HAIKU_TOP) data develop ] ;
AddFilesToHaikuImage develop etc
: $(makefileEngineFiles) ;
AddFilesToHaikuImage develop etc : $(makefileEngineFiles) ;
# headers
AddHeaderDirectoryToHaikuImage gnu : 3rdparty ;
@ -299,8 +343,13 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] && $(TARGET_ARCH) = x86 {
AddHeaderDirectoryToHaikuImage libs png : 3rdparty ;
AddHeaderDirectoryToHaikuImage libs zlib : 3rdparty ;
# cpp headers
if $(HAIKU_GCC_VERSION[1]) = 2 {
AddHeaderDirectoryToHaikuImage cpp ;
# GCC 2 only -- for GCC 4 they come with the DevelopmentBase package
CopyDirectoryToHaikuImage $(abiDirTokens) headers
: [ FDirName $(HAIKU_TOP) headers cpp ] : : -x .svn ;
CopyDirectoryToAlternativeGCCArchive $(abiDirTokens) headers
: [ FDirName $(HAIKU_TOP) headers cpp ] : : -x .svn ;
}
}
@ -416,7 +465,7 @@ if [ IsOptionalHaikuImagePackageAdded OpenSSH ] {
if $(TARGET_ARCH) != x86 {
Echo "No optional package OpenSSH available for $(TARGET_ARCH)" ;
} else {
if ! $(HAIKU_IMAGE_HOST_NAME) {
if ! $(HAIKU_IMAGE_HOST_NAME) && ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) {
Exit "Optional package OpenSSH requires the HAIKU_IMAGE_HOST_NAME"
"variable to be set!" ;
}
@ -554,6 +603,9 @@ if [ IsOptionalHaikuImagePackageAdded Tar ] {
# UserlandFS
if [ IsOptionalHaikuImagePackageAdded UserlandFS ] {
local arch = $(TARGET_ARCH) ;
local abi = gcc$(HAIKU_GCC_VERSION[1]) ;
# kernel module
AddFilesToHaikuImage system add-ons kernel file_systems : userlandfs ;
@ -566,14 +618,22 @@ if [ IsOptionalHaikuImagePackageAdded UserlandFS ] {
libuserlandfs_haiku_kernel.so
libuserlandfs_fuse.so
;
AddFilesToHaikuImage system lib : $(userlandfsLibs) ;
AddFilesToHaikuHybridImage system lib : $(userlandfsLibs) : : true ;
# development goodies
if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] {
if ! ( $(HAIKU_GCC_VERSION[1]) in 2 4 ) {
Exit "Optional package UserlandFS: Unsupported GCC version:"
$(HAIKU_GCC_VERSION[1]) ;
}
# library symlinks
local lib ;
for lib in $(userlandfsLibs) {
AddSymlinkToHaikuImage develop lib x86 : /system/lib/$(lib:BS) ;
AddSymlinkToHaikuImage develop abi $(arch) $(abi) lib
: /system/lib/$(lib:BS) ;
AddSymlinkToAlternativeGCCArchive develop abi $(arch) $(abi) lib
: /system/lib/$(arch)/$(lib:BS) ;
}
# FUSE headers

89
data/bin/setgcc Executable file
View File

@ -0,0 +1,89 @@
#!/bin/sh
#
# setgcc [ <arch> ] [ <gcc> ]
abiDir=/boot/develop/abi/
abiLink=$abiDir/current
usage()
{
cat << EOF
Usage: $0 [ <arch> ] [ <gcc> ]
Sets the current gcc version, respectively prints it, if no arguments are
given.
<arch> - The architecture to set. Supported values: "x86".
<gcc> - The major gcc version to set. Supported values: "gcc2", "gcc4".
EOF
}
if [ $# -gt 2 ]; then
usage
exit 1
fi
if [ $# -eq 0 ]; then
if [ -h $abiLink ]; then
abi=$(readlink $abiLink 2> /dev/null) || {
echo "Failed to read GCC symlink." >&2
exit 1
}
echo "Current GCC: $abi"
exit
else
echo "GCC symlink not installed." >&2
exit 1
fi
fi
arch=
gcc=
# parse the args
while [ $# -gt 0 ]; do
case $1 in
-h,--help) usage; exit;;
x86) arch=$1;;
gcc2|gcc4) gcc=$1;;
*) usage; exit 1;;
esac
shift
done
# use the native arch, if not given
if [ -z "$arch" ]; then
case $(uname -m) in
BePC) arch=x86;;
*) echo "Can't guess native architecture. Please specify!" >&2
exit 1;;
esac
fi
# guess the native gcc version, if not given
if [ -z "$gcc" ]; then
if [ -e /system/lib/gcc2 ]; then
gcc=gcc4
elif [ -e /system/lib/gcc4 ]; then
gcc=gcc2
elif [ -e /system/lib/libstdc++.r4.so ]; then
gcc=gcc2
else
echo "Can't guess native GCC version. Please specify!" >&2
exit 1
fi
fi
# check whether the gcc exits
if [ ! -e $abiDir/$arch/$gcc/tools/current/bin/gcc ]; then
echo "Can't set GCC $arch/$gcc -- not installed." >&2
exit 1
fi
# create the symlink
( rm $abiLink && ln -sf $arch/$gcc $abiLink ) || {
echo "Failed to set GCC $arch/$gcc." >&2
exit 1
}

View File

@ -22,7 +22,7 @@ BeMac|BeBox)
BE_HOST_CPU=unknown
esac
BELIBRARIES="/boot/common/lib:$BUILDHOME/lib/$BE_HOST_CPU"
BELIBRARIES="$BUILDHOME/abi/current/library-paths/common:$BUILDHOME/lib/$BE_HOST_CPU"
BH=$BUILDHOME/headers
BEINCLUDES="$BH;$BH/be;$BH/be/precompiled;$BH/be/bone;$BH/posix;$BH/cpp;$BH/be/app;$BH/be/device;$BH/be/interface;$BH/be/media;$BH/be/midi;$BH/be/midi2;$BH/be/net;$BH/be/kernel;$BH/be/storage;$BH/be/support;$BH/be/game;$BH/be/opengl;$BH/be/drivers;$BH/gnu;$BH/be/mail;$BH/be/translation;$BH/be/devel;$BH/be/add-ons/graphics;$BH/be/be_apps/Deskbar;$BH/be/be_apps/NetPositive;$BH/be/be_apps/Tracker"

View File

@ -170,9 +170,6 @@ StdBinCommands
filepanel.cpp
: be tracker : $(haiku-utils_rsrc) ;
# cc and c++ wrapper scripts
SEARCH on cc c++ = $(SUBDIR) ;
SubInclude HAIKU_TOP src bin addattr ;
SubInclude HAIKU_TOP src bin bash ;
SubInclude HAIKU_TOP src bin bc ;