diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index fa906c6eee..a12fddedb9 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -119,7 +119,11 @@ HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ] # haiku target platform settings # analyze GCC version -HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ; +if $(HAIKU_HOST_BUILD_ONLY) = 1 { + HAIKU_GCC_VERSION = 0 0 0 ; +} else { + HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ; +} # enable GCC -pipe option, if requested if $(HAIKU_USE_GCC_PIPE) = 1 { diff --git a/build/scripts/host_build_only b/build/scripts/host_build_only new file mode 100755 index 0000000000..dd9f2d6f96 --- /dev/null +++ b/build/scripts/host_build_only @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "Error: The build has been configured for building the build host tools" \ + "only." >&2 +exit 1 + diff --git a/configure b/configure index f7903d84c5..76b2efe06a 100755 --- a/configure +++ b/configure @@ -41,6 +41,9 @@ options: default -- any other distro (default value). --enable-multiuser Enable experimental multiuser support. --help Prints out this help. + --host-only Configure for building tools for the build host + only. Haiku cannot be built when configured like + this. --include-gpl-addons Include GPL licensed add-ons. --include-patented-code Enable code that is known to implemented patented ideas and techniques. If this option is not @@ -349,6 +352,7 @@ HAIKU_USE_GCC_GRAPHITE=0 HAIKU_HOST_USE_32BIT=0 HAIKU_HOST_USE_XATTR=0 HAIKU_HOST_USE_XATTR_REF=0 +HAIKU_HOST_BUILD_ONLY=0 HOST_GCC_LD=`gcc -print-prog-name=ld` HOST_GCC_OBJCOPY=`gcc -print-prog-name=objcopy` SFDISK_BINARY=sfdisk @@ -444,6 +448,7 @@ while [ $# -gt 0 ] ; do ;; --enable-multiuser) HAIKU_ENABLE_MULTIUSER=1; shift 1;; --help | -h) usage; exit 0;; + --host-only) HAIKU_HOST_BUILD_ONLY=1; shift 1;; --include-gpl-addons) HAIKU_INCLUDE_GPL_ADDONS=1; shift 1;; --include-patented-code) HAIKU_INCLUDE_PATENTED_CODE=1; shift 1;; --include-sources) HAIKU_INCLUDE_SOURCES=1; shift 1;; @@ -511,47 +516,59 @@ fi # create output directory mkdir -p "$buildOutputDir" || exit 1 -# build cross tools from sources -if [ -n "$buildCrossTools" ]; then - export HAIKU_USE_GCC_GRAPHITE - "$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \ - "$buildCrossTools" "$outputDir" $buildCrossToolsJobs || exit 1 - crossToolsPrefix="$outputDir/cross-tools/bin/${HAIKU_GCC_MACHINE}-" -fi +if [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then + invalidCommand=$sourceDir/build/scripts/host_build_only + HAIKU_AR=$invalidCommand + HAIKU_CC=$invalidCommand + HAIKU_LD=$invalidCommand + HAIKU_OBJCOPY=$invalidCommand + HAIKU_RANLIB=$invalidCommand + HAIKU_ELFEDIT=$invalidCommand + HAIKU_YASM=$invalidCommand + HAIKU_STRIP=$invalidCommand +else + # build cross tools from sources + if [ -n "$buildCrossTools" ]; then + export HAIKU_USE_GCC_GRAPHITE + "$buildCrossToolsScript" $buildCrossToolsMachine "$sourceDir" \ + "$buildCrossTools" "$outputDir" $buildCrossToolsJobs || exit 1 + crossToolsPrefix="$outputDir/cross-tools/bin/${HAIKU_GCC_MACHINE}-" + fi -# cross tools -if [ -n "$crossToolsPrefix" ]; then - get_build_tool_path AR ar - get_build_tool_path CC gcc - get_build_tool_path LD ld - get_build_tool_path OBJCOPY objcopy - get_build_tool_path RANLIB ranlib - get_build_tool_path STRIP strip -fi + # cross tools + if [ -n "$crossToolsPrefix" ]; then + get_build_tool_path AR ar + get_build_tool_path CC gcc + get_build_tool_path LD ld + get_build_tool_path OBJCOPY objcopy + get_build_tool_path RANLIB ranlib + get_build_tool_path STRIP strip + fi -# prepare gcc settings -standard_gcc_settings + # prepare gcc settings + standard_gcc_settings -# cross tools for gcc4 builds -if [ -n "$crossToolsPrefix" ]; then - case $HAIKU_GCC_RAW_VERSION in - 4.*) - get_build_tool_path ELFEDIT elfedit - ;; + # cross tools for gcc4 builds + if [ -n "$crossToolsPrefix" ]; then + case $HAIKU_GCC_RAW_VERSION in + 4.*) + get_build_tool_path ELFEDIT elfedit + ;; + esac + fi + + # check whether the Haiku compiler really targets Haiku or BeOS + case "$HAIKU_GCC_MACHINE" in + *-*-haiku) ;; + *-*-beos) ;; + *) echo The compiler specified as Haiku target compiler is not a valid \ + Haiku cross-compiler. Please see ReadMe.cross-compile. >&2 + echo compiler: $HAIKU_CC + echo compiler is configured for target: $HAIKU_GCC_MACHINE + exit 1 ;; esac fi -# check whether the Haiku compiler really targets Haiku or BeOS -case "$HAIKU_GCC_MACHINE" in - *-*-haiku) ;; - *-*-beos) ;; - *) echo The compiler specified as Haiku target compiler is not a valid \ - Haiku cross-compiler. Please see ReadMe.cross-compile. >&2 - echo compiler: $HAIKU_CC - echo compiler is configured for target: $HAIKU_GCC_MACHINE - exit 1 ;; -esac - # Generate BuildConfig cat << EOF > "$buildConfigFile" # BuildConfig @@ -573,6 +590,7 @@ HAIKU_USE_GCC_GRAPHITE ?= "${HAIKU_USE_GCC_GRAPHITE}" ; HAIKU_HOST_USE_32BIT ?= "${HAIKU_HOST_USE_32BIT}" ; HAIKU_HOST_USE_XATTR ?= "${HAIKU_HOST_USE_XATTR}" ; HAIKU_HOST_USE_XATTR_REF ?= "${HAIKU_HOST_USE_XATTR_REF}" ; +HAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ; HAIKU_GCC_RAW_VERSION ?= ${HAIKU_GCC_RAW_VERSION} ; HAIKU_GCC_MACHINE ?= ${HAIKU_GCC_MACHINE} ;