diff options
| author | Ingo Weinhold <ingo_weinhold@gmx.de> | 2008-05-17 23:47:39 (GMT) |
|---|---|---|
| committer | Ingo Weinhold <ingo_weinhold@gmx.de> | 2008-05-17 23:47:39 (GMT) |
| commit | 9b0dd52858e2b0e79ccc1f9a9319d90dd91e5f39 (patch) | |
| tree | 60a5020668d613a584718afa23810d17293e51de | |
| parent | 3c504a317e513522eacb2e6ad7fad4630b8fac21 (diff) | |
Support for adding libraries compiled with the alternative gcc (2 vs.hrev25536
4). One has to have a (fully configured) "generated" directory for the
alternative gcc and specify it using the new option
"--alternative-gcc-output-dir" when configuring the main build.
Additionally the build variable HAIKU_ADD_ALTERNATIVE_GCC_LIBS has to be
set to "1".
If that has been done, when building the image a sub-jam is invoked that
generates the alternative libs and zips them. The main-jam unzips them
into the correct directory in the image. Note that the JAM build
variable has to be set when using a jam executable not invoked by "jam".
Tested with gcc 2 NetPositive, Pe, and FireFox under gcc 4 Haiku, and
with a few of the standard gcc 4 Haiku apps under gcc 2 Haiku. Seems to
work fine so far.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25536 a95241bf-73f2-0310-859d-f6bbb57e9c96
| -rw-r--r-- | build/jam/HaikuImage | 85 | ||||
| -rw-r--r-- | build/jam/UserBuildConfig.ReadMe | 7 | ||||
| -rw-r--r-- | build/jam/UserBuildConfig.sample | 3 | ||||
| -rwxr-xr-x | configure | 93 |
4 files changed, 151 insertions, 37 deletions
diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index 6220ee0..95dc0d3 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -425,6 +425,91 @@ CopyDirectoryToHaikuImage beos etc : licenses : -x .svn ; +#pragma mark - Alternative GCC Libraries + + +# build a zip file with the system libs +# (used by another jam that wants to build a Haiku with alternative GCC +# libraries included) + +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 beos 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 beos 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) { + # 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) + : "'<image>alternative_system_libs.zip'" ; + + local libSubDir ; + + if $(HAIKU_GCC_VERSION[1]) = 2 { + libSubDir = gcc4 ; + } else { + libSubDir = gcc2 ; + } + + # install the alternative libs in the right directory + UnzipArchiveToHaikuImage beos system lib $(libSubDir) + : $(otherAlternativeSystemLibsZip) ; +} + + #pragma mark - Optional Packages diff --git a/build/jam/UserBuildConfig.ReadMe b/build/jam/UserBuildConfig.ReadMe index bf785d0..52ed5d6 100644 --- a/build/jam/UserBuildConfig.ReadMe +++ b/build/jam/UserBuildConfig.ReadMe @@ -128,6 +128,13 @@ AddOptionalHaikuImagePackages WonderBrush ; # Add all available optional packages. HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ; +# Add the libraries built with the alternative gcc version. The alternative +# gcc generated directory must have specified via the configure option +# --alternative-gcc-output-dir. Note, that a sub-jam will be executed. When +# using a jam that is not simply invoked by "jam", set the JAM build variable +# accordingly. +HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 1 ; + # Specify scripts that shall be run when populating the image/installation # directory. The "early" script is run before anything has been copied onto # the image/into the installation directory. The "late" script is run after diff --git a/build/jam/UserBuildConfig.sample b/build/jam/UserBuildConfig.sample index b7ff4dd..376ed7c 100644 --- a/build/jam/UserBuildConfig.sample +++ b/build/jam/UserBuildConfig.sample @@ -32,3 +32,6 @@ # Add all available optional packages. #HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ; + +# Add the libraries built with the alternative gcc version. +#HAIKU_ADD_ALTERNATIVE_GCC_LIBS = 1 ; @@ -27,6 +27,13 @@ options: will not be binary compatible with BeOS R5. <arch> specifies the target architecture, either "x86" or "ppc". + --alternative-gcc-output-dir <dir> + Build a Haiku installation that supports running + executables built with a gcc version incompatible + with the primary gcc (e.g. gcc 2 executables under + a gcc 4 Haiku or vice versa). <dir> specifies the + output directory of the other gcc. The directory + must already be fully configured. --cross-tools-prefix <prefix> Assume cross compilation. <prefix> should be a path to the directory where the cross @@ -231,6 +238,7 @@ crossToolsPrefix= buildCrossTools= buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools" buildCrossToolsMachine= +alternativeGCCOutputDir= haikuRequiredLegacyGCCVersion="2.95.3-haiku-080323" export haikuRequiredLegacyGCCVersion @@ -254,33 +262,49 @@ while [ $# -gt 0 ] ; do case "$1" in --bochs-debug) bochs_debug=1; shift 1;; --build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;; - --build-cross-tools-gcc4) assertparams "$1" 2 $#; buildCrossTools=$3; - buildCrossToolsScript="${buildCrossToolsScript}_gcc4"; - case "$2" in - x86) haikuGCCMachine=i586-pc-haiku;; - ppc) haikuGCCMachine=powerpc-apple-haiku;; - m68k) haikuGCCMachine=m68k-unknown-haiku;; - *) echo "Unsupported target architecture: $2" - exit 1;; - esac - buildCrossToolsMachine=$haikuGCCMachine - shift 3;; - --cross-tools-prefix) assertparam "$1" $#; crossToolsPrefix=$2; shift 2;; + --build-cross-tools-gcc4) + assertparams "$1" 2 $# + buildCrossTools=$3 + buildCrossToolsScript="${buildCrossToolsScript}_gcc4" + case "$2" in + x86) haikuGCCMachine=i586-pc-haiku;; + ppc) haikuGCCMachine=powerpc-apple-haiku;; + m68k) haikuGCCMachine=m68k-unknown-haiku;; + *) echo "Unsupported target architecture: $2" + exit 1;; + esac + buildCrossToolsMachine=$haikuGCCMachine + shift 3 + ;; + --alternative-gcc-output-dir) + assertparam "$1" $# + cd $2 || exit 1 + alternativeGCCOutputDir=`pwd` + cd $currentDir + shift 2 + ;; + --cross-tools-prefix) + assertparam "$1" $# + crossToolsPrefix=$2 + shift 2 + ;; --help | -h) usage; exit 0;; --include-gpl-addons) include_gpl_addons=1; shift 1;; --include-3rdparty) include_3rdparty=1; shift 1;; --enable-multiuser) enable_multiuser=1; shift 1;; --distro-compatibility) - assertparam "$1" $#; distroCompatibility=$2; - case "$distroCompatibility" in - official) ;; - compatible) ;; - default) ;; - *) echo "Invalid distro compatibility" \ - "level: $distroCompatibility" - exit 1;; - esac - shift 2;; + assertparam "$1" $# + distroCompatibility=$2 + case "$distroCompatibility" in + official) ;; + compatible) ;; + default) ;; + *) echo "Invalid distro compatibility" \ + "level: $distroCompatibility" + exit 1;; + esac + shift 2 + ;; --target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;; --use-gcc-pipe) use_gcc_pipe=1; shift 1;; --use-32bit) use_32bit=1; shift 1;; @@ -358,14 +382,15 @@ cat << EOF > "$buildOutputDir/BuildConfig" TARGET_PLATFORM ?= "${target}" ; HOST_PLATFORM ?= "${buildPlatform}" ; -BOCHS_DEBUG_HACK ?= "${bochs_debug}" ; -INCLUDE_GPL_ADDONS ?= "${include_gpl_addons}" ; -HAIKU_INCLUDE_3RDPARTY ?= "${include_3rdparty}" ; -HAIKU_ENABLE_MULTIUSER ?= "${enable_multiuser}" ; -HAIKU_DISTRO_COMPATIBILITY ?= "${distroCompatibility}" ; -HAIKU_USE_GCC_PIPE ?= "${use_gcc_pipe}" ; -HAIKU_HOST_USE_32BIT ?= "${use_32bit}" ; -HAIKU_HOST_USE_XATTR ?= "${use_xattr}" ; +BOCHS_DEBUG_HACK ?= "${bochs_debug}" ; +INCLUDE_GPL_ADDONS ?= "${include_gpl_addons}" ; +HAIKU_INCLUDE_3RDPARTY ?= "${include_3rdparty}" ; +HAIKU_ENABLE_MULTIUSER ?= "${enable_multiuser}" ; +HAIKU_DISTRO_COMPATIBILITY ?= "${distroCompatibility}" ; +HAIKU_USE_GCC_PIPE ?= "${use_gcc_pipe}" ; +HAIKU_HOST_USE_32BIT ?= "${use_32bit}" ; +HAIKU_HOST_USE_XATTR ?= "${use_xattr}" ; +HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR ?= ${alternativeGCCOutputDir} ; HAIKU_GCC_RAW_VERSION ?= ${haikuGCCVersion} ; HAIKU_GCC_MACHINE ?= ${haikuGCCMachine} ; @@ -429,10 +454,7 @@ TZ_OBJECTS on <timezone-source>${source} ?= $TZOBJECTS ; EOF done -# Generate a boot strap Jamfile in the output directory, if it is not in -# the source dir. - -if [ "$currentDir" != "$sourceDir" ]; then +# Generate a boot strap Jamfile in the output directory. cat << EOF > $outputDir/Jamfile # automatically generated Jamfile @@ -443,6 +465,3 @@ HAIKU_OUTPUT_DIR = ${outputDir} ; include [ FDirName \$(HAIKU_TOP) Jamfile ] ; EOF - -fi - |
