diff --git a/Jamfile b/Jamfile index 3ea234bde4..c9562f5190 100644 --- a/Jamfile +++ b/Jamfile @@ -3,152 +3,45 @@ SubDir HAIKU_TOP ; NotFile doc_files ; Depends files : doc_files ; -# Pseudo-target to build the mail kit only -NotFile MailKit ; -Depends MailKit : - libmail.so - mail_daemon - E-mail - BeMail - - # mail_daemon addons - Inbox - Outbox - Message\ Parser - New\ Mail\ Notification - Match\ Header - R5\ Daemon\ Filter - IMAP - POP3 - SMTP - Fortune - Spam\ Filter - spamdbm -; - -# Pseudo-target to build the media stuffs only -# TODO: don't know how to make avcodec mp3_decoder mp3_reader ogg speex vorbis -NotFile MediaKit ; -Depends MediaKit : - libmedia.so - libgame.so - - # Servers - media_addon_server - media_server - - # Preference - Sounds - Media - - # Deskbar replicant - desklink - - # add-ons - mixer.media_addon - tone_producer_demo.media_addon - video_producer_demo.media_addon - legacy.media_addon - multi_audio.media_addon -# reader.media_addon -# writer.media_addon -# demultiplexer.media_addon - - # codecs - ac3_decoder - aiff_reader - au_reader - avcodec - avi_reader - matroska - mp3_decoder - mp3_reader - musepack - ogg - raw_decoder - speex - vorbis - wav_reader - mov_reader -; - -# Pseudo-target to build the input kit only -NotFile InputKit ; -Depends InputKit : - # Servers - input_server - - # Addons - keyboard - mouse - - # Apps - keymap - - # Preferences - Keymap - Keyboard - Mouse -; - -# Pseudo-target to build the OpenGL kit only -NotFile OpenGLKit ; -Depends OpenGLKit : - libGL.so - GLTeapot -# GLInfo -; - -# Pseudo-target to build the screensaver kit only -NotFile ScreenSaverKit ; -Depends ScreenSaverKit : - libscreensaver.so - screen_saver - screen_blanker - ScreenSaver - Haiku -; - -# Pseudo-target to build the locale kit only -# TODO: src/add-ons/locale/collators/GermanDIN-2.cpp does not compile -NotFile LocaleKit ; -Depends LocaleKit : - 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) : / ] ; -} - # Prepare the optional build features before parsing the Jamfile tree. -include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatures ] ; +local architectureObject ; +for architectureObject in [ MultiArchSubDirSetup ] { + on $(architectureObject) { + include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatures ] ; + } +} # Include packages that are required by all images. -AddOptionalHaikuImagePackages MandatoryPackages ; +if ! $(HAIKU_BOOTSTRAP_BUILD) { + # primary architecture + AddHaikuImagePackages + bzip2 ctags ffmpeg freetype glu grep icu jpeg libpng libsolv mesa sed + tar zlib + : + system + ; -# If enabled, make sure that OpenSSL is added to the image. -if $(HAIKU_BUILD_FEATURE_OPENSSL_ENABLED) { - AddOptionalHaikuImagePackages OpenSSL ; + # secondary architectures + local architectureObject ; + for architectureObject + in [ MultiArchSubDirSetup $(HAIKU_PACKAGING_ARCHS[2-]) ] { + on $(architectureObject) { + AddHaikuImagePackages + ffmpeg freetype glu icu jpeg libpng libsolv mesa zlib + : + system + ; + } + } } -AddOptionalHaikuImagePackages ICU ; +# If enabled, make sure that OpenSSL is added to the image. +if [ FIsBuildFeatureEnabled openssl ] { + AddHaikuImagePackages openssl ; +} -# Evaluate optional package dependencies -include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackageDependencies ] ; +# add additionally requested packages +AddHaikuImagePackages $(HAIKU_IMAGE_ADDITIONAL_PACKAGES) ; # Optionally we allow not to include the "src" subdirectory. if $(HAIKU_DONT_INCLUDE_SRC) { @@ -173,13 +66,17 @@ SubDir HAIKU_TOP ; UserBuildConfigRulePostBuildTargets ; # specify the Haiku image and network boot archive contents -include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuImage ] ; -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 ] ; -include [ FDirName $(HAIKU_BUILD_RULES_DIR) AnybootImage ] ; +if $(HAIKU_BOOTSTRAP_BUILD) { + include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuImageBootstrap ] ; +} else { + include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuImage ] ; +} +include [ FDirName $(HAIKU_BUILD_RULES_DIR) images NetBootArchive ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) images FloppyBootImage ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootImage ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootPPCImage ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuCD ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) images AnybootImage ] ; # Check whether all requested optional packages do actually exist. local package ; diff --git a/Jamrules b/Jamrules index 711d802298..2c5ed7bc48 100644 --- a/Jamrules +++ b/Jamrules @@ -29,6 +29,9 @@ if ! $(buildConfig) { LOCATE on BuildConfig = $(HAIKU_BUILD_OUTPUT_DIR) ; include BuildConfig ; +# set HAIKU_PACKAGING_ARCH, the primary packaging architecture +HAIKU_PACKAGING_ARCH = $(HAIKU_PACKAGING_ARCHS[1]) ; + # The build setup and rules are neatly organized in several files. Include # them now. Start with the side-effect-less rules, since they are the most # likely to be used in the top level context (i.e. not only in rules). @@ -36,7 +39,9 @@ include BuildConfig ; # optional user-defined UserBuildConfig is included thereafter. include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) ArchitectureRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatureRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) LocaleRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; @@ -51,8 +56,29 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) MainBuildRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) MiscRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) OverriddenJamRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) PackageRules ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) RepositoryRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) TestsRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildSetup ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) DefaultBuildProfiles ] ; + +# Include the repositories for this architecture. +local repositoriesDirectory + = [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories ] ; +local repositories = HaikuPorts ; +if $(HAIKU_BOOTSTRAP_BUILD) { + repositories = HaikuPortsCross ; +} + +local repository ; +for repository in $(repositories) { + local repositoryDirectory + = [ FDirName $(repositoriesDirectory) $(repository) ] ; + local file = [ Glob $(repositoryDirectory) : $(HAIKU_PACKAGING_ARCH) ] ; + if $(file) { + HAIKU_REPOSITORY_JAMFILE = $(file) ; + include $(file) ; + } +} # Declare no-op user-overridable build rules. rule UserBuildConfigRulePostBuildTargets { } @@ -75,18 +101,6 @@ if ! $(HAIKU_IGNORE_USER_BUILD_CONFIG) { } } -include [ FDirName $(HAIKU_BUILD_RULES_DIR) ReleaseBuildProfiles ] ; - -# If a build profile was specified on the command line, now is the time to -# check whether it is unknown or one of the default profiles. -if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) { - # define the obvious default profiles - if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image install - vmware-image { - DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ; - } else { - Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ; - } -} +DefineDefaultBuildProfiles ; PrepareConfigVariables ; diff --git a/build/config_headers/tracing_config.h b/build/config_headers/tracing_config.h index a38408752d..2cbab809a5 100644 --- a/build/config_headers/tracing_config.h +++ b/build/config_headers/tracing_config.h @@ -58,6 +58,8 @@ #define SYSCALL_TRACING_IGNORE_KTRACE_OUTPUT 1 #define TCP_TRACING 0 #define TEAM_TRACING 0 +#define TRANSLATION_MAP_TRACING 0 +#define TRANSLATION_MAP_TRACING_STACK_TRACE 0 /* stack trace depth */ #define USER_MALLOC_TRACING 0 #define VFS_PAGES_IO_TRACING 0 #define VM_CACHE_TRACING 0 diff --git a/build/jam/AlternativeGCCArchive b/build/jam/AlternativeGCCArchive deleted file mode 100644 index 5a7827f131..0000000000 --- a/build/jam/AlternativeGCCArchive +++ /dev/null @@ -1,63 +0,0 @@ -# This file defines what ends up in the alternative GCC archive and it executes -# the rules building the archive. Included by HaikuImage. - - -#sanity check - make sure the primary gcc is different than the alternative gcc -if $(HAIKU_PRIMARY_GCC) = $(HAIKU_GCC_VERSION[1]) { - Exit "Error: Your alternative gcc is the same as the main gcc!" - "You need to reconfigure your generated directories." ; -} - -#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 = 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) : copyattr ; -AddTargetVariableToScript $(script) : zip ; -if $(HOST_RM_ATTRS_TARGET) { - AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ; -} else { - AddVariableToScript $(script) : rmAttrs : rm ; -} - -# create the other scripts -local makeDirsScript = haiku-alternative-gcc-make-dirs ; -local copyFilesScript - = 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) ; diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules new file mode 100644 index 0000000000..513b5fa5ee --- /dev/null +++ b/build/jam/ArchitectureRules @@ -0,0 +1,785 @@ +rule ArchitectureSetup architecture +{ + # ArchitectureSetup ; + # + # Initializes all global packaging architecture dependent variables for the + # given packaging architecture. Also sets HAIKU_ARCH (to the primary + # architecture), if this is the first invocation of the rule, and adds + # the architecture to HAIKU_ARCHS, if not yet contained. + + # analyze GCC version + local gccVersion + = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION_$(architecture) ] ; + HAIKU_GCC_VERSION_$(architecture) = $(gccVersion) ; + + # enable GCC -pipe option, if requested + local gccBaseFlags ; + if $(HAIKU_USE_GCC_PIPE) = 1 { + gccBaseFlags = -pipe ; + } + + # disable strict aliasing on anything newer than gcc 2 as it may lead to + # unexpected results. also disable the tree-vrp (value range propagation) + # optimization for now as with the current gcc4 version we are using this + # results in some broken code. + # TODO: remove the -fno-strict-aliasing option when all code has been + # analyzed/fixed with regard to aliasing. + # TODO: retest/remove the -fno-tree-vrp option as soon as we have updated + # our gcc4 compiler. See this discussion on some issues: + # http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization + if $(gccVersion[1]) >= 3 { + gccBaseFlags += -fno-strict-aliasing -fno-tree-vrp ; + } + + # disable array bounds warnings on gcc 4.6 or newer since they trigger + # too many false positives. Coverity does a better job of this kind of + # analysis anyways. + if $(gccVersion[1]) >= 4 { + gccBaseFlags += -Wno-array-bounds ; + } + + local cpu = $(HAIKU_CPU_$(architecture)) ; + if $(cpu) = arm { + # For stackcrawls + gccBaseFlags += -mapcs-frame ; + } + + # activating graphite optimizations + if $(HAIKU_USE_GCC_GRAPHITE_$(architecture)) = 1 { + gccBaseFlags += -floop-interchange -ftree-loop-distribution + -floop-strip-mine -floop-block ; + } + HAIKU_GCC_BASE_FLAGS_$(architecture) = $(gccBaseFlags) ; + + # override gcc 2.95.3's header directory -- strictly necessary only when + # using the BeOS native compiler (since its headers are incompatible), but + # it doesn't harm for the cross-compiler either. + if $(gccVersion[1]) = 2 { + HAIKU_GCC_HEADERS_DIR_$(architecture) + = [ FDirName $(HAIKU_TOP) headers build gcc-2.95.3 ] ; + } + + # initial state for flags etc. + HAIKU_C++_$(architecture) ?= $(HAIKU_CC_$(architecture)) ; + HAIKU_LINK_$(architecture) = $(HAIKU_CC_$(architecture)) ; + HAIKU_LINKFLAGS_$(architecture) = $(gccBaseFlags) ; + + HAIKU_HDRS_$(architecture) = [ FStandardHeaders $(architecture) ] ; + HAIKU_CCFLAGS_$(architecture) += $(gccBaseFlags) -nostdinc ; + HAIKU_C++FLAGS_$(architecture) += $(gccBaseFlags) -nostdinc ; + + # strip is required + if ! $(HAIKU_STRIP_$(architecture)) { + Exit "HAIKU_STRIP_$(architecture) not set. Please re-run configure." ; + } + + HAIKU_ARCH_$(architecture) = $(cpu) ; + HAIKU_ARCH ?= $(cpu) ; + # Set only, if not set yet. This way HAIKU_ARCH is set to the primary + # architecture. + if ! $(cpu) in $(HAIKU_ARCHS) { + HAIKU_ARCHS += $(cpu) ; + } + HAIKU_DEFINES_$(architecture) += ARCH_$(cpu) ; + + # directories + HAIKU_ARCH_OBJECT_DIR_$(architecture) + = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(architecture) ] ; + HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture) + = [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) common ] ; + HAIKU_DEBUG_0_OBJECT_DIR_$(architecture) + = [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) release ] ; + + local level ; + for level in $(HAIKU_DEBUG_LEVELS[2-]) { + HAIKU_DEBUG_$(level)_OBJECT_DIR_$(architecture) + = [ FDirName $(HAIKU_ARCH_OBJECT_DIR_$(architecture)) + debug_$(level) ] ; + } + + # set variables for gcc header options + SetIncludePropertiesVariables HAIKU : _$(architecture) ; + + # assembler flags + HAIKU_ASFLAGS_$(architecture) = ; + + # C/C++ flags + if $(gccVersion[1]) >= 4 { + HAIKU_C++FLAGS_$(architecture) += -Wno-deprecated ; + } + + switch $(cpu) { + case x86* : + # Enable use of the gcc built-in atomic functions instead of + # atomic_*(). The former are inlined and have thus less overhead. + # They are not available with gcc 2, but the header will take care + # of that. + HAIKU_DEFINES_$(architecture) += B_USE_BUILTIN_ATOMIC_FUNCTIONS ; + } + + # warning flags + HAIKU_WARNING_CCFLAGS_$(architecture) + = -Wall -Wno-trigraphs -Wmissing-prototypes + -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ; + HAIKU_WARNING_C++FLAGS_$(architecture) = -Wall -Wno-trigraphs + -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align + -Wsign-compare -Wno-multichar ; + + # debug flags + local debugFlags = -ggdb ; + + # debug 0: suppress asserts + HAIKU_DEBUG_0_CCFLAGS_$(architecture) = [ FDefines NDEBUG=$(NDEBUG) ] ; + HAIKU_DEBUG_0_C++FLAGS_$(architecture) = [ FDefines NDEBUG=$(NDEBUG) ] ; + + local level ; + for level in $(HAIKU_DEBUG_LEVELS[2-]) { + local flags = $(debugFlags) [ FDefines DEBUG=$(level) ] ; + HAIKU_DEBUG_$(level)_CCFLAGS_$(architecture) = $(flags) ; + HAIKU_DEBUG_$(level)_C++FLAGS_$(architecture) = $(flags) ; + } + + if $(gccVersion[1]) >= 3 { + # TODO: Temporary work-around. Should be defined in the compiler specs + HAIKU_LINKFLAGS_$(architecture) += -Xlinker --no-undefined ; + } else { + HAIKU_DEFINES_$(architecture) += _BEOS_R5_COMPATIBLE_ ; + } + + # private shared kernel/libroot headers + HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture) + = [ PrivateHeaders $(DOT) system system/arch/$(cpu) ] ; + + # Add some grist to the libgcc objects + HAIKU_GCC_LIBGCC_OBJECTS_$(architecture) + = $(HAIKU_GCC_LIBGCC_OBJECTS_$(architecture):G=libgcc!$(architecture)) ; + + # the C++ standard library + HAIKU_BUILD_SHARED_LIBSTDC++_$(architecture) = ; + if $(HAIKU_SHARED_LIBSTDC++_$(architecture)) { + HAIKU_LIBSTDC++_$(architecture) + = $(HAIKU_SHARED_LIBSTDC++_$(architecture)) ; + } else { + # no shared library available with the compiler -- build it + if $(gccVersion[1]) = 2 { + HAIKU_LIBSTDC++_$(architecture) = libstdc++.r4.so ; + } else { + HAIKU_LIBSTDC++_$(architecture) = <$(architecture)>libstdc++.so ; + } + HAIKU_SHARED_LIBSTDC++_$(architecture) + = $(HAIKU_LIBSTDC++_$(architecture)) ; + HAIKU_BUILD_SHARED_LIBSTDC++_$(architecture) = 1 ; + } + + # the C++ support (runtime) library + HAIKU_BUILD_SHARED_LIBSUPC++_$(architecture) = ; + if $(HAIKU_SHARED_LIBSUPC++_$(architecture)) { + HAIKU_LIBSUPC++_$(architecture) + = $(HAIKU_SHARED_LIBSUPC++_$(architecture)) ; + } else { + # no shared library available with the compiler -- build it for gcc 4 + if $(gccVersion[1]) != 2 { + HAIKU_SHARED_LIBSUPC++_$(architecture) + = <$(architecture)>libsupc++.so ; + HAIKU_BUILD_SHARED_LIBSUPC++_$(architecture) = 1 ; + } + + HAIKU_LIBSUPC++_$(architecture) + = $(HAIKU_SHARED_LIBSUPC++_$(architecture)) ; + } + + # library and executable glue code + local commonGlueCode = + init_term_dyn.o + crti.o + crtn.o + ; + HAIKU_LIBRARY_BEGIN_GLUE_CODE_$(architecture) = + crti.o + <$(architecture)>crtbegin.o + init_term_dyn.o + ; + HAIKU_LIBRARY_END_GLUE_CODE_$(architecture) = + <$(architecture)>crtend.o + crtn.o + ; + HAIKU_EXECUTABLE_BEGIN_GLUE_CODE_$(architecture) = + crti.o + <$(architecture)>crtbegin.o + start_dyn.o + init_term_dyn.o + ; + HAIKU_EXECUTABLE_END_GLUE_CODE_$(architecture) + = $(HAIKU_LIBRARY_END_GLUE_CODE_$(architecture)) ; + + SEARCH on <$(architecture)>crtbegin.o <$(architecture)>crtend.o + = $(HAIKU_GCC_LIB_DIR_$(architecture)) ; + + # init library name map + local libraryGrist = "" ; + if $(architecture) != $(HAIKU_PACKAGING_ARCHS[1]) { + libraryGrist = $(architecture) ; + } + local i ; + for i in be bnetapi debug device game GL locale mail media midi midi2 + network opengl package root screensaver textencoding tracker + translation z { + local library = lib$(i).so ; + HAIKU_LIBRARY_NAME_MAP_$(architecture)_$(i) + = $(library:G=$(libraryGrist)) ; + } + HAIKU_LIBRARY_NAME_MAP_$(architecture)_libstdc++ + = $(HAIKU_LIBSTDC++_$(architecture)) ; + HAIKU_LIBRARY_NAME_MAP_$(architecture)_libsupc++ + = $(HAIKU_LIBSUPC++_$(architecture)) ; + HAIKU_LIBRARY_NAME_MAP_$(architecture)_localestub + = <$(architecture)>liblocalestub.a ; + if $(architecture) = $(HAIKU_PACKAGING_ARCHS[1]) { + HAIKU_LIBRARY_NAME_MAP_$(architecture)_input_server + = input_server ; + } else { + HAIKU_LIBRARY_NAME_MAP_$(architecture)_input_server + = <$(architecture)>input_server ; + } +} + + +rule KernelArchitectureSetup architecture +{ + # KernelArchitectureSetup ; + # + # Initializes the global kernel and boot loader related variables. Those + # don't have a packaging architecture suffix, since they are only set for + # the primary packaging architecture. is the primary + # packaging architecture (supplied for convenience). + + HAIKU_KERNEL_ARCH = $(HAIKU_ARCH) ; + + local gccVersion = $(HAIKU_GCC_VERSION_$(architecture)) ; + local cpu = $(HAIKU_CPU_$(architecture)) ; + + switch $(cpu) { + case ppc : + HAIKU_BOOT_PLATFORM ?= openfirmware ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet + + case arm : + HAIKU_BOOT_PLATFORM ?= u-boot ; + HAIKU_BOOT_BOARD ?= verdex ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; + # in kB (there is not really a floppy on the gumstix ;) ) + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet + + case x86 : + HAIKU_BOOT_PLATFORM = bios_ia32 ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB + + # yasm is required for target arch x86 + if ! $(HAIKU_YASM) { + Exit "HAIKU_YASM not set. Please re-run configure." ; + } + + case x86_64 : + # x86_64 completely shares the x86 bootloader. + HAIKU_BOOT_PLATFORM = bios_ia32 ; + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB + + # x86_64 kernel source is under arch/x86. + HAIKU_KERNEL_ARCH = x86 ; + + # yasm is required for target arch x86_64 + if ! $(HAIKU_YASM) { + Exit "HAIKU_YASM not set. Please re-run configure." ; + } + + case m68k : + HAIKU_BOOT_PLATFORM ?= atari_m68k ; + switch $(HAIKU_BOOT_PLATFORM) { + case atari_m68k : + { + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB + } + case amiga_m68k : + { + # for now we have trouble reading from double-sided images + HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 880 ; # in kB + } + } + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 260 ; # in kB + + case mipsel : + # RouterBOARD firmware (ELF image over TFTP) + HAIKU_BOOT_PLATFORM = routerboard_mipsel ; + # offset in floppy image (>= sizeof(haiku_loader)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB + + case * : + Exit "Currently unsupported target CPU:" $(cpu) ; + } + + # Include embedded board-specific file. + if $(HAIKU_BOOT_BOARD) { + include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD) + BoardSetup ] ; + } + + # private kernel headers to be used when compiling kernel code + HAIKU_PRIVATE_KERNEL_HEADERS = + [ PrivateHeaders $(DOT) kernel libroot shared + kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ] + [ ArchHeaders $(HAIKU_KERNEL_ARCH) ] + [ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR_$(architecture)) system + kernel ] + $(HAIKU_PRIVATE_SYSTEM_HEADERS_$(architecture)) + ; + + # C/C++ flags + local gccBaseFlags = $(HAIKU_GCC_BASE_FLAGS_$(architecture)) + -finline -fno-builtin ; + + if $(gccVersion[1]) >= 4 { + gccBaseFlags += -ffreestanding ; + } + + local g++BaseFlags = $(gccBaseFlags) -fno-exceptions ; + + if $(gccVersion[1]) >= 3 { + g++BaseFlags += -fno-use-cxa-atexit ; + } + + HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(gccBaseFlags) ; + HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(g++BaseFlags) ; + HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(gccBaseFlags) ; + HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(g++BaseFlags) ; + HAIKU_BOOT_LINKFLAGS = ; + + HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; + HAIKU_KERNEL_PIC_LINKFLAGS = ; + HAIKU_KERNEL_ADDON_LINKFLAGS = ; + + switch $(cpu) { + case ppc : + # Build a position independent PPC kernel. We need to be able to + # relocate the kernel, since the virtual address space layout at + # boot time is not fixed. + HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ; + HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; + + case m68k : + # We don't want to have to handle emulating missing FPU opcodes for + # 040 and 060 in the kernel. + HAIKU_KERNEL_CCFLAGS += -m68020-60 ; + HAIKU_KERNEL_C++FLAGS += -m68020-60 ; + + case x86 : + HAIKU_KERNEL_CCFLAGS += -march=pentium ; + HAIKU_KERNEL_C++FLAGS += -march=pentium ; + + case x86_64 : + # Kernel lives in the top 2GB of the address space, use kernel code + # model. + HAIKU_KERNEL_PIC_CCFLAGS += -mcmodel=kernel ; + + # Disable the red zone, which cannot be used in kernel code due to + # interrupts, and always enable the frame pointer so stack traces + # are correct. + HAIKU_KERNEL_CCFLAGS += -mno-red-zone -fno-omit-frame-pointer ; + HAIKU_KERNEL_C++FLAGS += -mno-red-zone -fno-omit-frame-pointer ; + HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ; + HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ; + + # Bootloader is 32-bit. + HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ; + HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ; + HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ; + } + + # warning flags + HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes + -Wno-multichar ; + HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ; + + # debug flags + local level ; + for level in $(HAIKU_DEBUG_LEVELS) { + local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; + HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS + = $(HAIKU_DEBUG_$(level)_CCFLAGS_$(architecture)) ; + HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS + = $(HAIKU_DEBUG_$(level)_C++FLAGS_$(architecture)) ; + } + + # defines + HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; + + HAIKU_DEFINES_$(architecture) + += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; + # TODO: That doesn't need to be a general define. It's just needed for + # compiling (part of) the boot loader. + + # kernel add-on glue code + HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = <$(architecture)>crtbegin.o + haiku_version_glue.o ; + HAIKU_KERNEL_ADDON_END_GLUE_CODE + = $(HAIKU_GCC_LIBGCC_$(architecture)) <$(architecture)>crtend.o ; +} + + +rule ArchitectureSetupWarnings architecture +{ + # ArchitectureSetupWarnings ; + # + # Sets up compiler warnings and error flags for various subdirectories for + # the given packaging architecture. + + local cpu = $(HAIKU_CPU_$(architecture)) ; + switch $(cpu) { + case arm : + return ; + # we use #warning as placeholders for things to write... + case m68k : + return ; + # we use #warning as placeholders for things to write... + case mipsel : + return ; + # we use #warning as placeholders for things to write... + } + + + # enable -Werror for certain parts of the source tree + HAIKU_WERRORFLAGS = ; + local gccVersion = $(HAIKU_GCC_VERSION_$(architecture)) ; + if $(gccVersion[1]) >= 4 { + # -Wuninitialized gives too many false positives. + HAIKU_WERRORFLAGS = -Wno-error=uninitialized ; + + # TODO: remove the -Wno-unused-but-set-variable option + HAIKU_WERRORFLAGS += -Wno-unused-but-set-variable ; + } + + HAIKU_WERROR_ARCH = $(architecture) ; + + rule EnableWerror dirTokens : scope { + AppendToConfigVar TARGET_WARNING_CCFLAGS_$(HAIKU_WERROR_ARCH) + : HAIKU_TOP $(dirTokens) + : -Werror $(HAIKU_WERRORFLAGS) : $(scope) ; + AppendToConfigVar TARGET_WARNING_C++FLAGS_$(HAIKU_WERROR_ARCH) + : HAIKU_TOP $(dirTokens) + : -Werror $(HAIKU_WERRORFLAGS) : $(scope) ; + } + + # Work-around for GCC 2 problem -- despite -Wno-multichar it reports + # multichar warnings in headers/private/kernel/debugger_keymaps.h included + # by src/system/kernel/arch/x86/arch_debug_console.cpp. + if $(gccVersion[1]) = 2 { + local file = arch_debug_console.o ; + TARGET_WARNING_C++FLAGS_$(architecture) on $(file) + = [ on $(file) return $(TARGET_WARNING_C++FLAGS_$(architecture)) ] ; + } + + EnableWerror src add-ons accelerants 3dfx ; + EnableWerror src add-ons accelerants ati ; + EnableWerror src add-ons accelerants common ; + EnableWerror src add-ons accelerants et6x00 ; +# EnableWerror src add-ons accelerants intel_extreme ; +# EnableWerror src add-ons accelerants matrox ; + EnableWerror src add-ons accelerants neomagic ; +# EnableWerror src add-ons accelerants nvidia ; + EnableWerror src add-ons accelerants nvidia_gpgpu ; +# EnableWerror src add-ons accelerants radeon ; +# EnableWerror src add-ons accelerants radeon_hd ; + EnableWerror src add-ons accelerants s3 ; + EnableWerror src add-ons accelerants skeleton ; + EnableWerror src add-ons accelerants vesa ; + EnableWerror src add-ons accelerants via ; + EnableWerror src add-ons accelerants vmware ; + EnableWerror src add-ons bluetooth ; + EnableWerror src add-ons decorators ; + EnableWerror src add-ons disk_systems ; + EnableWerror src add-ons input_server devices ; +# EnableWerror src add-ons input_server filters ; +# EnableWerror src add-ons input_server methods ; + EnableWerror src add-ons kernel bluetooth ; +# EnableWerror src add-ons kernel bus_managers acpi ; + EnableWerror src add-ons kernel bus_managers agp_gart ; + EnableWerror src add-ons kernel bus_managers ata ; + EnableWerror src add-ons kernel bus_managers config_manager ; +# EnableWerror src add-ons kernel bus_managers firewire ; + EnableWerror src add-ons kernel bus_managers isa ; + EnableWerror src add-ons kernel bus_managers pci ; +# EnableWerror src add-ons kernel bus_managers ps2 ; # gcc2 + EnableWerror src add-ons kernel bus_managers scsi ; + EnableWerror src add-ons kernel bus_managers usb ; + EnableWerror src add-ons kernel busses agp_gart ; + EnableWerror src add-ons kernel busses ata ; + EnableWerror src add-ons kernel busses scsi ; + EnableWerror src add-ons kernel busses usb ; + EnableWerror src add-ons kernel console ; + EnableWerror src add-ons kernel cpu ; +# EnableWerror src add-ons kernel debugger ; # gcc2 +# EnableWerror src add-ons kernel drivers audio ; + EnableWerror src add-ons kernel drivers bluetooth ; + EnableWerror src add-ons kernel drivers bus ; + EnableWerror src add-ons kernel drivers common ; + EnableWerror src add-ons kernel drivers disk ; + EnableWerror src add-ons kernel drivers dvb ; +# EnableWerror src add-ons kernel drivers graphics ; +# EnableWerror src add-ons kernel drivers input ; + EnableWerror src add-ons kernel drivers joystick ; + EnableWerror src add-ons kernel drivers midi ; + EnableWerror src add-ons kernel drivers misc ; +# EnableWerror src add-ons kernel drivers network ; + EnableWerror src add-ons kernel drivers ports ; +# EnableWerror src add-ons kernel drivers power ; + EnableWerror src add-ons kernel drivers printer ; + EnableWerror src add-ons kernel drivers random ; + EnableWerror src add-ons kernel drivers tty ; + EnableWerror src add-ons kernel drivers video ; + EnableWerror src add-ons kernel file_systems bfs ; + EnableWerror src add-ons kernel file_systems cdda ; +# EnableWerror src add-ons kernel file_systems ext2 ; +# EnableWerror src add-ons kernel file_systems fat ; +# EnableWerror src add-ons kernel file_systems googlefs ; + EnableWerror src add-ons kernel file_systems iso9660 ; + EnableWerror src add-ons kernel file_systems layers ; + EnableWerror src add-ons kernel file_systems netfs ; + EnableWerror src add-ons kernel file_systems nfs ; + EnableWerror src add-ons kernel file_systems nfs4 ; +# EnableWerror src add-ons kernel file_systems ntfs ; + EnableWerror src add-ons kernel file_systems packagefs ; + EnableWerror src add-ons kernel file_systems ramfs ; +# EnableWerror src add-ons kernel file_systems reiserfs ; + EnableWerror src add-ons kernel file_systems udf ; + EnableWerror src add-ons kernel file_systems userlandfs ; + EnableWerror src add-ons kernel generic ; +# EnableWerror src add-ons kernel network datalink_protocols ; + EnableWerror src add-ons kernel network devices ; + EnableWerror src add-ons kernel network dns_resolver ; + EnableWerror src add-ons kernel network notifications ; + EnableWerror src add-ons kernel network ppp ; + EnableWerror src add-ons kernel network protocols ; +# EnableWerror src add-ons kernel network stack ; + EnableWerror src add-ons kernel partitioning_systems ; + EnableWerror src add-ons locale ; + EnableWerror src add-ons mail_daemon ; + EnableWerror src add-ons media media-add-ons demultiplexer ; + EnableWerror src add-ons media media-add-ons dvb ; + EnableWerror src add-ons media media-add-ons esound_sink ; + EnableWerror src add-ons media media-add-ons finepix_webcam ; + EnableWerror src add-ons media media-add-ons firewire_dv ; + EnableWerror src add-ons media media-add-ons legacy ; + EnableWerror src add-ons media media-add-ons mixer ; + EnableWerror src add-ons media media-add-ons multi_audio ; + EnableWerror src add-ons media media-add-ons opensound ; + EnableWerror src add-ons media media-add-ons radeon ; + EnableWerror src add-ons media media-add-ons reader ; + EnableWerror src add-ons media media-add-ons tone_producer_demo ; + EnableWerror src add-ons media media-add-ons usb_vision ; +# EnableWerror src add-ons media media-add-ons usb_webcam ; + EnableWerror src add-ons media media-add-ons video_mixer ; +# EnableWerror src add-ons media media-add-ons video_producer_demo ; + EnableWerror src add-ons media media-add-ons videowindow ; + EnableWerror src add-ons media media-add-ons writer ; + EnableWerror src add-ons media plugins ac3_decoder ; + EnableWerror src add-ons media plugins aiff_reader ; + EnableWerror src add-ons media plugins ape_reader ; +# EnableWerror src add-ons media plugins asf_reader ; + EnableWerror src add-ons media plugins au_reader ; +# EnableWerror src add-ons media plugins avi_reader ; +# EnableWerror src add-ons media plugins ffmpeg ; +# EnableWerror src add-ons media plugins matroska ; +# EnableWerror src add-ons media plugins mov_reader ; + EnableWerror src add-ons media plugins mp3_decoder ; +# EnableWerror src add-ons media plugins mp3_reader ; + EnableWerror src add-ons media plugins mp4_reader ; + EnableWerror src add-ons media plugins musepack ; +# EnableWerror src add-ons media plugins ogg ; +# EnableWerror src add-ons media plugins raw_decoder ; +# EnableWerror src add-ons media plugins speex ; + EnableWerror src add-ons media plugins theora ; + EnableWerror src add-ons media plugins vorbis ; +# EnableWerror src add-ons media plugins wav_reader ; + EnableWerror src add-ons media plugins xvid_decoder ; + EnableWerror src add-ons opengl ; + EnableWerror src add-ons print ; + EnableWerror src add-ons screen_savers ; + EnableWerror src add-ons tracker ; + EnableWerror src add-ons translators bmp ; +# EnableWerror src add-ons translators exr ; + EnableWerror src add-ons translators gif ; +# EnableWerror src add-ons translators hpgs ; + EnableWerror src add-ons translators hvif ; + EnableWerror src add-ons translators ico ; +# EnableWerror src add-ons translators jpeg ; # gcc2 + EnableWerror src add-ons translators jpeg2000 ; + EnableWerror src add-ons translators pcx ; +# EnableWerror src add-ons translators png ; # gcc2 + EnableWerror src add-ons translators ppm ; + EnableWerror src add-ons translators raw ; + EnableWerror src add-ons translators rtf ; + EnableWerror src add-ons translators sgi ; + EnableWerror src add-ons translators shared ; +# EnableWerror src add-ons translators stxt ; + EnableWerror src add-ons translators tga ; + EnableWerror src add-ons translators tiff ; +# EnableWerror src add-ons translators wonderbrush ; + EnableWerror src add-ons print ; + EnableWerror src bin multiuser ; + EnableWerror src bin package ; + EnableWerror src bin package_repo ; + EnableWerror src bin pkgman ; + EnableWerror src apps ; + EnableWerror src kits ; + EnableWerror src preferences ; + EnableWerror src servers ; + EnableWerror src system kernel ; + EnableWerror src system libroot add-ons ; + EnableWerror src system libroot posix locale ; + EnableWerror src system libroot posix wchar ; + EnableWerror src system runtime_loader ; +} + + +rule MultiArchIfPrimary ifValue : elseValue : architecture +{ + # MultiArchIfPrimary : + # [ : = $(TARGET_PACKAGING_ARCH) ] ; + # + # Returns one of the two given values depending on whether + # is the primary packaging architecture. + + architecture ?= $(TARGET_PACKAGING_ARCH) ; + + if $(architecture) = $(TARGET_PACKAGING_ARCHS[1]) { + return $(ifValue) ; + } + return $(elseValue) ; +} + + +rule MultiArchConditionalGristFiles files : primaryGrist : secondaryGrist + : architecture +{ + # MultiArchConditionalGristFiles : + # : [ : = $(TARGET_PACKAGING_ARCH) ] ; + # + # Returns with their grist set to either or + # depending on whether is the primary + # packaging architecture. + + architecture ?= $(TARGET_PACKAGING_ARCH) ; + + local grist = [ MultiArchIfPrimary $(primaryGrist) : $(secondaryGrist) + : $(architecture) ] ; + return $(files:G=$(grist:E=)) ; +} + + +rule MultiArchDefaultGristFiles files : gristPrefix : architecture +{ + # MultiArchDefaultGristFiles : + # [ : = $(TARGET_PACKAGING_ARCH) ] ; + # + # Convenient shorthand for MultiArchConditionalGristFiles for the common + # case that for a secondary packaging architecture the packaging + # architecture name shall be appended to the grist while it shall be omitted + # for the primary packaging architecture. IOW, if architecture is the + # primary packaging architecture, are returned with their grist set + # to , otherwise are returned with their grist set to + # ! respectively (if + # is empty). + + architecture ?= $(TARGET_PACKAGING_ARCH) ; + + local secondaryGrist = $(gristPrefix)!$(architecture) ; + secondaryGrist ?= $(architecture) ; + + return [ MultiArchConditionalGristFiles $(files) : $(gristPrefix) : + $(secondaryGrist) : $(architecture) ] ; +} + + +rule MultiArchSubDirSetup architectures +{ + # MultiArchSubDirSetup ; + # + # For each of the given packaging architectures that are + # in the packaging architectures configured for the build (or all configured + # packaging architectures, if is empty) an object is + # prepared that can be used for an "on ... { ... }" block to set up subdir + # variables for the respective packaging architecture. Most notably + # TARGET_PACKAGING_ARCH, TARGET_ARCH, TARGET_LIBSUPC++, and TARGET_LIBSTDC++ + # are set to the values for the respective packaging architecture. The + # per-subdir variables SOURCE_GRIST, LOCATE_TARGET, LOCATE_SOURCE, + # SEARCH_SOURCE, *_LOCATE_TARGET, are reset. All SUBDIR* and config + # variables are set to the values they had when this rule was invoked. + + local result ; + architectures ?= $(TARGET_PACKAGING_ARCHS) ; + local architecture ; + for architecture in $(architectures) { + if ! $(architecture) in $(TARGET_PACKAGING_ARCHS) { + continue ; + } + + local architectureObject = $(architecture:G=) ; + result += $(architectureObject) ; + + # Set the variables that default to the values of the respective + # variables for the primary architecture. + TARGET_PACKAGING_ARCH on $(architectureObject) = $(architecture) ; + + local var ; + for var in TARGET_ARCH TARGET_LIBSUPC++ TARGET_LIBSTDC++ { + $(var) on $(architectureObject) = $($(var)_$(architecture)) ; + } + + # Clone the current config variable values and the variables SubDir + # resets. + for var in $(AUTO_SET_UP_CONFIG_VARIABLES) SUBDIR$(SUBDIRRESET) { + $(var) on $(architectureObject) = $($(var)) ; + } + + # adjust SOURCE_GRIST + SOURCE_GRIST on $(architectureObject) + = $(SOURCE_GRIST:E=)!$(architecture) ; + + # Adjust the subdir's object dirs that are architecture dependent. To + # avoid duplicating the code from SetupObjectsDir, we call it. Since it + # sets global variables, we set these variables on our object, call + # SetupObjectsDir in an "on" block, and grab the new variable values. + local hostTarget = HOST TARGET ; + local objectDirVars = + COMMON_ARCH COMMON_DEBUG DEBUG_$(HAIKU_DEBUG_LEVELS) + ; + objectDirVars = + COMMON_PLATFORM_LOCATE_TARGET + $(hostTarget)_$(objectDirVars)_LOCATE_TARGET + LOCATE_TARGET + LOCATE_SOURCE + SEARCH_SOURCE + ; + + for var in $(objectDirVars) { + $(var) on $(architectureObject) = ; + } + + on $(architectureObject) { + SetupObjectsDir ; + + for var in $(objectDirVars) { + $(var) on $(architectureObject) = $($(var)) ; + } + } + } + + return $(result) ; +} diff --git a/build/jam/BeOSRules b/build/jam/BeOSRules index 46b88025f3..17d3715fb7 100644 --- a/build/jam/BeOSRules +++ b/build/jam/BeOSRules @@ -149,34 +149,70 @@ actions SetVersion1 $(2[1]) "$(1)" -system $(HAIKU_BUILD_VERSION) -short "$(HAIKU_BUILD_DESCRIPTION)" ; } -rule SetType +rule SetType target : type { - # SetType + # SetType [ : ] + # Sets the MIME type on the target. If none is given, the executable MIME + # type is used. - Depends $(1) : settype ; - SetType1 $(1) : settype ; + TARGET_MIME_TYPE on $(target) = $(type:E=$(TARGET_EXECUTABLE_MIME_TYPE)) ; + + Depends $(target) : settype ; + SetType1 $(target) : settype ; } actions SetType1 { $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) - $(2[1]) -t $(TARGET_EXECUTABLE_MIME_TYPE) "$(1)" ; + $(2[1]) -t $(TARGET_MIME_TYPE) "$(1)" ; } -rule MimeSet +rule MimeSet target { - # MimeSet + # MimeSet ; - Depends $(1) : mimeset ; - MimeSet1 $(1) : mimeset ; + Depends $(target) : mimeset mime_db ; + MimeSet1 $(target) : mimeset mime_db ; } + actions MimeSet1 { $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) - $(2[1]) -f "$(1)" ; + $(2[1]) -f --mimedb "$(2[2])" "$(1)" } + +rule CreateAppMimeDBEntries target +{ + # MimeSetApp ; + # Create the app meta MIME DB entries for the given target. The + # HAIKU_MIME_DB_ENTRIES variable on is set to the generated + # resulting target directory that contains the MIME DB entries. + + local appGrist = $(target:G) ; + local appMimeDB = $(target:BS)_mimedb ; + appMimeDB = $(appMimeDB:G=mimedb-app-$(appGrist:E=)) ; + MakeLocateDebug $(appMimeDB) ; + Depends $(appMimeDB) : mimeset $(target) mime_db ; + CreateAppMimeDBEntries1 $(appMimeDB) + : mimeset $(target) mime_db ; + + HAIKU_MIME_DB_ENTRIES on $(target) = $(appMimeDB) ; +} + + +actions CreateAppMimeDBEntries1 +{ + $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) + + appMimeDB="$(1)" + $(RM) -rf "$appMimeDB" + $(MKDIR) "$appMimeDB" + $(2[1]) -f --apps --mimedb "$appMimeDB" --mimedb "$(2[3])" "$(2[2])" +} + + rule ResComp { # ResComp : ; @@ -196,9 +232,11 @@ rule ResComp cc = $(HOST_CC) ; localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ; } else { - defines += $(TARGET_DEFINES) ; - cc = $(TARGET_CC) ; - localIncludesOption = $(TARGET_LOCAL_INCLUDES_OPTION) ; + defines += $(TARGET_DEFINES_$(TARGET_PACKAGING_ARCH)) + $(TARGET_DEFINES) ; + cc = $(TARGET_CC_$(TARGET_PACKAGING_ARCH)) ; + localIncludesOption + = $(TARGET_LOCAL_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ; } } diff --git a/build/jam/BootRules b/build/jam/BootRules index fde7d54313..de5f677844 100644 --- a/build/jam/BootRules +++ b/build/jam/BootRules @@ -24,8 +24,9 @@ rule SetupBoot ASFLAGS on $(object) = $(TARGET_BOOT_CCFLAGS) ; # override warning flags - TARGET_WARNING_CCFLAGS on $(object) = $(TARGET_KERNEL_WARNING_CCFLAGS) ; - TARGET_WARNING_C++FLAGS on $(object) + TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object) + = $(TARGET_KERNEL_WARNING_CCFLAGS) ; + TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = $(TARGET_KERNEL_WARNING_C++FLAGS) ; } } @@ -40,7 +41,7 @@ rule BootLd { # BootLd : : : ; - LINK on $(1) = $(TARGET_LD) ; + LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ; LINKFLAGS on $(1) = $(4) ; if $(3) { LINKFLAGS on $(1) += --script=$(3) ; } @@ -125,5 +126,5 @@ actions BootStaticLibraryObjects # Force recreation of the archive to avoid build errors caused by # stale dependencies after renaming or deleting object files. $(RM) "$(1)" - $(HAIKU_AR) -r "$(1)" "$(2)" ; + $(HAIKU_AR_$(TARGET_PACKAGING_ARCH)) -r "$(1)" "$(2)" ; } diff --git a/build/jam/BuildFeatureRules b/build/jam/BuildFeatureRules new file mode 100644 index 0000000000..04673693e5 --- /dev/null +++ b/build/jam/BuildFeatureRules @@ -0,0 +1,455 @@ +rule FQualifiedBuildFeatureName features +{ + # FQualifiedBuildFeatureName + # + # Prepends the name of the current target packaging architecture to the + # given feature names. + + return $(TARGET_PACKAGING_ARCH):$(features) ; +} + + +rule FIsBuildFeatureEnabled feature +{ + # FIsBuildFeatureEnabled ; + # Returns whether the given build feature is enabled (if so: "1", + # if not: empty list). + # + # - The name of the build feature (all lower case). + + feature = [ FQualifiedBuildFeatureName $(feature) ] ; + return $(HAIKU_BUILD_FEATURE_$(feature:U)_ENABLED) ; +} + + +rule FMatchesBuildFeatures specification +{ + # FMatchesBuildFeatures ; + # Returns whether the given build feature specification + # holds. consists of positive and negative build feature + # conditions. Conditions can be individual list elements and multiple + # conditions can be joined, separated by ",", in a single list element. The + # effect is the same; they are considered as single set of conditions. + # A positive condition does not start with a "!". It holds when the build + # feature named by the element is enabled. + # A negative condition starts with a "!". It holds when the build feature + # named by the string resulting from removing the leading "!" is not + # enabled. + # holds when it is not empty and + # * none of the negative conditions it contains hold and + # * if it contains any positive conditions, at least one one of them holds. + # + # - The build feature specification. A list of individual + # conditions or conditions joined by ",". + + local splitSpecification ; + local element ; + for element in $(specification) { + splitSpecification += [ FSplitString $(element) : "," ] ; + } + return [ FConditionsHold $(splitSpecification) : FIsBuildFeatureEnabled ] ; +} + + +rule FFilterByBuildFeatures list +{ + # FFilterByBuildFeatures ; + # Filters the list annotated by build feature specifications and returns the + # resulting list. The list can be annotated in two different ways: + # * A single list element can be annotated by appending "@" + # to it, with being a build feature specification (a + # single comma-separated string). The element appears in the resulting + # list, only if holds. + # * A sublist can be annotated by enclosing it in " @{" (two + # separate list elements) and "}@", with being a build + # feature specification (a single comma-separated string). The enclosed + # sublist appears in the resulting list, only if holds. + # The sublist annotations can be nested. The annotations themselves don't + # appear in the resulting list. + # + # - A list annotated with build feature specifications. + + local filteredList ; + + # Since we must look ahead one element to be able to decide whether an + # element is a regular list element or a features specification for a + # subsequent "@{". Hence we always process an element other than "@{" and + # "}@" in the next iteration. We append a dummy element to the list so we + # don't need special handling for the last element. + local evaluationStack = 1 ; + local previousElement ; + local element ; + for element in $(list) dummy { + local stackTop = $(evaluationStack[1]) ; + local processElement = $(previousElement) ; + switch $(element) { + case }@ : + { + # Pop the topmost specification off the stack. + evaluationStack = $(evaluationStack[2-]) ; + if ! $(evaluationStack) { + Exit "FFilterByBuildFeatures: Unbalanced @( in: " $(list) ; + } + + processElement = $(previousElement) ; + previousElement = ; + } + case @{ : + { + if ! $(previousElement) { + Exit "FFilterByBuildFeatures: No feature specification" + "after )@ in: " $(list) ; + } + + if $(evaluationStack[1]) = 1 + && [ FMatchesBuildFeatures $(previousElement) ] { + evaluationStack = 1 $(evaluationStack) ; + } else { + evaluationStack = 0 $(evaluationStack) ; + } + + processElement = ; + previousElement = ; + } + case * : + { + processElement = $(previousElement) ; + previousElement = $(element) ; + } + } + + if $(processElement) && $(stackTop) = 1 { + local splitElement = [ Match "(.*)@([^@]*)" : $(processElement) ] ; + if $(splitElement) { + if [ FMatchesBuildFeatures $(splitElement[2]) ] { + filteredList += $(splitElement[1]) ; + } + } else { + filteredList += $(processElement) ; + } + } + } + + if $(evaluationStack[2-]) { + Exit "FFilterByBuildFeatures: Unbalanced )@ in: " $(list) ; + } + + return $(filteredList) ; +} + + +rule EnableBuildFeatures features : specification +{ + # EnableBuildFeatures : ; + # Enables the build features , if the build features specification + # holds. If is omitted, the features are + # enabled unconditionally. + # The rule enables a build feature by adding its given lower case name to + # the build variable HAIKU_BUILD_FEATURES and defining a build variable + # HAIKU_BUILD_FEATURE__ENABLED ( being the upper case name + # of the build feature) to "1". + # + # - A list of build feature names (lower case). + # - An optional build features specification (cf. + # FMatchesBuildFeatures). + + features = [ FQualifiedBuildFeatureName $(features) ] ; + + if ! $(HAIKU_BUILD_FEATURE_$(feature:U)_ENABLED) + && ( ! $(specification) + || [ FMatchesBuildFeatures $(specification) ] ) { + local feature ; + for feature in $(features) { + HAIKU_BUILD_FEATURES += $(feature) ; + HAIKU_BUILD_FEATURE_$(feature:U)_ENABLED = 1 ; + } + } +} + + +rule BuildFeatureObject feature +{ + # BuildFeatureObject ; + # Returns a unique object for the given build feature. It is used for + # attaching attribute values to it. + + feature = [ FQualifiedBuildFeatureName $(feature) ] ; + + local featureObject = $(HAIKU_BUILD_FEATURE_$(feature:U)) ; + if ! $(featureObject) { + featureObject = [ NewUniqueTarget ] ; + HAIKU_BUILD_FEATURE_$(feature:U) = $(featureObject) ; + } + + return $(featureObject) ; +} + + +rule SetBuildFeatureAttribute feature : attribute : values : package +{ + # SetBuildFeatureAttribute : : + # [ : ] ; + # Sets attribute of a build feature to value . + # If is specified, it names the package the attribute belongs to. + + local featureObject = [ BuildFeatureObject $(feature) ] ; + HAIKU_ATTRIBUTE_$(attribute) on $(featureObject) = $(values) ; + if $(package) { + HAIKU_ATTRIBUTE_$(attribute):package on $(featureObject) = $(package) ; + } +} + + +rule BuildFeatureAttribute feature : attribute : flags +{ + # BuildFeatureAttribute : [ : ] ; + # Returns the value of attribute of a build feature . + # Flags can be a list of flags which influence the returned value. Currently + # only flag "path" is defined, which will convert the attribute value -- + # which is assumed to be a list of (gristed) targets with a path relative to + # the extraction directory of the build feature archive files -- to paths. + # A typical example is the "headers" attribute, whose value can be used as + # dependency, but which must be converted to a path to be a valid headers + # search path. + + local featureObject = [ BuildFeatureObject $(feature) ] ; + local values + = [ on $(featureObject) return $(HAIKU_ATTRIBUTE_$(attribute)) ] ; + if path in $(flags) { + # get the attribute's package and the corresponding extraction dir + local package + = [ BuildFeatureAttribute $(feature) : $(attribute):package ] ; + local directory ; + if $(package) { + directory = [ BuildFeatureAttribute $(feature) + : $(package):directory ] ; + } + + # translate the values + local paths ; + local value ; + for value in $(values:G=) { + paths += [ FDirName $(directory) $(value) ] ; + } + values = $(paths) ; + } + + return $(values) ; +} + + +rule ExtractBuildFeatureArchivesExpandValue value : fileName +{ + if ! $(value) { + return $(value) ; + } + + # split the value + local splitValue ; + while $(value) { + local components = [ Match "([^%]*)(%[^%]*%)(.*)" : $(value) ] ; + if ! $(components) { + splitValue += $(value) ; + break ; + } + + if $(components[1]) { + splitValue += $(components[1]) ; + } + splitValue += $(components[2]) ; + value = $(components[3]) ; + } + + # reassemble the value, performing the substitutions + local %packageName% ; + local %portName% ; + local %packageFullVersion% ; + value = "" ; + while $(splitValue) { + local component = $(splitValue[1]) ; + splitValue = $(splitValue[2-]) ; + switch $(component) { + case %packageRevisionedName% : + splitValue = %packageName% "-" %packageFullVersion% + $(splitValue) ; + + case %portRevisionedName% : + splitValue = %portName% "-" %packageFullVersion% $(splitValue) ; + + case %*% : + if ! x$(%packageName%) { + # extract package name and version from file name + local splitName + = [ Match "([^-]*)-(.*).hpkg" : $(fileName) ] ; + if $(splitName) { + %packageName% = $(splitName[1]) ; + %packageFullVersion% + = [ Match "([^-]*-[^-]*)-.*" : $(splitName[2]) ] ; + if ! $(packageFullVersion%) { + packageFullVersion% = $(splitName[2]) ; + } + } else { + %packageName% = [ Match "(.*).hpkg" : $(fileName) ] ; + if ! $(%packageName%) { + %packageName% = $(fileName) ; + } + %packageFullVersion% = "" ; + } + + # get the port name from the package name + splitName = [ FSplitPackageName $(%packageName%) ] ; + %portName% = $(splitName[1]) ; + } + + value = "$(value)$($(component):E=)" ; + + case * : + value = "$(value)$(component)" ; + } + } + + return $(value) ; +} + + +rule ExtractBuildFeatureArchives feature : list +{ + # ExtractBuildFeatureArchives : ; + # Downloads and extracts one or more archives for build feature + # and sets attributes for the build feature to extracted entries. The syntax + # for is: + # "file:" + # : ... + # ... + # "file:" + # ... + # + # specifies a short name for the archive (e.g. "base" for the + # base package, "devel" for the development package, etc.), + # the unversioned name of the package (e.g. "libsolv_devel"). + # can be any name and any relative path in the + # extraction directory. The following placeholders in will be + # replaced with the respective value: + # * %packageName% is replaced with the name of the package as extracted from + # the package file name (may differ from the specified package name e.g. + # for bootstrap packages). + # * %portName% is replaced with the name of the port the package belongs to. + # That is %packageName% with any well-known package type suffix ("_devel", + # "_source", etc.) removed. + # * %packageFullVersion% is replaced with the the full version string of the + # package (i.e. including the revision) as extracted frmo the package file + # name. + # * %packageRevisionedName% is replaced with what + # %packageName%-%packageFullVersion% would be replaced. + # * %portRevisionedName% is replaced with what + # %portName%-%packageFullVersion% would be replaced. + # + # The attribute with the name "depends" will be handled specially. Its + # specifies the name of a package the current package depends on + # (e.g. "devel" typically depends on "base"). If such a dependency is + # specified the current package will be extracted to the same directory as + # the package it depends on. The "depends" attribute must precede any other + # attribute for the package. + # + # The rule also sets the build feature attribute ":directory" + # to the extraction directory for each package. + + local qualifiedFeature = [ FQualifiedBuildFeatureName $(feature) ] ; + list = [ FFilterByBuildFeatures $(list) ] ; + + while $(list) { + if $(list[1]) != file: { + Exit "ExtractBuildFeatureArchives: Expected \"file: ...\", got:" + $(list) ; + } + + local package = $(list[2]) ; + local file = [ FetchPackage $(list[3]) ] ; + local fileName = $(file:BS) ; + list = $(list[4-]) ; + + local directory = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) + $(fileName:B) ] ; + directory = $(directory:G=$(package)) ; + + while $(list) { + local attribute = [ Match "(.*):" : $(list[1]) ] ; + if ! $(attribute) { + Exit "ExtractBuildFeatureArchives: Expected attribute, got:" + $(list) ; + } + if $(attribute) = file { + break ; + } + + list = $(list[2-]) ; + + local values ; + + while $(list) { + switch $(list[1]) { + case *: : + { + break ; + } + case * : + { + values += [ ExtractBuildFeatureArchivesExpandValue + $(list[1]) : $(fileName) ] ; + list = $(list[2-]) ; + } + } + } + + if $(attribute) = depends { + # Inherit the extraction directory (with a different grist) and + # depend on the extraction directory of the base package. + local basePackage = $(values[1]) ; + local baseDirectory = [ BuildFeatureAttribute $(feature) + : $(basePackage):directory ] ; + directory = $(baseDirectory:G=$(package)) ; + Depends $(directory) : $(directory:G=$(basePackage)) ; + } else { + SetBuildFeatureAttribute $(feature) : $(attribute) + : [ ExtractArchive $(directory) + : $(values) : $(file) + : extracted-$(qualifiedFeature)-$(package) ] ; + SetBuildFeatureAttribute $(feature) : $(attribute):package + : $(package) ; + } + } + + SetBuildFeatureAttribute $(feature) : $(package):directory + : $(directory:G=) ; + } +} + + +rule InitArchitectureBuildFeatures architecture +{ + # InitArchitectureBuildFeatures ; + # + # Enable the build features that can be derived directly from the + # architecture. + + # The build feature rule use TARGET_PACKAGING_ARCH, so set that temporarily. + local savedArchitecture = $(TARGET_PACKAGING_ARCH) ; + TARGET_PACKAGING_ARCH = $(architecture) ; + + # Add the target architecture as a build feature. + EnableBuildFeatures $(TARGET_ARCH_$(architecture)) ; + + # For the primary architecture add the "primary" build feature. + if $(architecture) = $(TARGET_PACKAGING_ARCHS[1]) { + EnableBuildFeatures primary ; + } + + # Add all secondary architectures as build features (with prefix). + EnableBuildFeatures secondary_$(TARGET_PACKAGING_ARCHS[2-]) ; + + if $(TARGET_GCC_VERSION_$(architecture)[1]) = 2 { + EnableBuildFeatures gcc2 ; + } + + TARGET_PACKAGING_ARCH = $(savedArchitecture) ; +} diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures index ced5db210a..5e40740b77 100644 --- a/build/jam/BuildFeatures +++ b/build/jam/BuildFeatures @@ -1,75 +1,37 @@ -# This file contains setup for build features that are not available for all -# architectures/setups or that are optional for the build. For features that -# require downloading a zip file from somewhere it is likely the same file used -# for an optional package. +# This file contains setup for build features that require external packages. It +# is included once for each configured packaging architecture (with +# TARGET_PACKAGING_ARCH set accordingly). -# Add the target architecture as a build feature. -EnableBuildFeatures $(HAIKU_ARCH) ; - - -# Detect a hybrid GCC2/GCC4 image and disable the checks for unavailable GCC4 -# packages. (It does not matter if a package was built with either compiler, -# the system should have the respective other system libs.) -local isHybridBuild ; -if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1 - && $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) { - isHybridBuild = 1 ; -} - -local baseURL = http://www.haiku-files.org/files/optional-packages ; +local architecture = $(TARGET_PACKAGING_ARCH) ; +local secondaryArchSubDir = [ MultiArchIfPrimary "" : /$(architecture) ] ; +local developLibDir = develop/lib$(secondaryArchSubDir) ; +local developHeadersDir = develop/headers$(secondaryArchSubDir) ; # SSL -# Automatically enable the SSL feature, when the optional OpenSSL optional -# package is enabled. -if [ IsOptionalHaikuImagePackageAdded OpenSSL ] { +# Automatically enable the SSL feature, when the OpenSSL package is enabled. +if [ IsHaikuImagePackageAdded openssl ] { HAIKU_BUILD_FEATURE_SSL = 1 ; } -if $(HAIKU_GCC_VERSION[1]) >= 4 { - if $(TARGET_ARCH) = x86_64 { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86_64-2012-12-18.zip ; - } else { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-r1a4-x86-gcc4-2012-08-29.zip ; - } -} else { - HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-r1a4-x86-gcc2-2012-08-26.zip ; -} - -HAIKU_OPENSSL_URL = $(baseURL)/$(HAIKU_OPENSSL_PACKAGE) ; - if $(HAIKU_BUILD_FEATURE_SSL) { - if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 { - # Download the zip archive. - local zipFile = [ DownloadFile $(HAIKU_OPENSSL_PACKAGE) - : $(HAIKU_OPENSSL_URL) ] ; - - # zip file and output directory - HAIKU_OPENSSL_ZIP_FILE = $(zipFile) ; - HAIKU_OPENSSL_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_OPENSSL_PACKAGE:B) ] ; - - # extract headers and libraries - HAIKU_OPENSSL_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_OPENSSL_DIR) - : common/include/ : $(zipFile) : extracted-openssl - ] ; - - HAIKU_OPENSSL_LIBS = [ ExtractArchive $(HAIKU_OPENSSL_DIR) - : - common/lib/libcrypto.so - common/lib/libssl.so - : $(zipFile) - : extracted-openssl - ] ; - - HAIKU_OPENSSL_HEADERS - = [ FDirName $(HAIKU_OPENSSL_DIR) common include ] ; + if [ IsPackageAvailable openssl_devel ] { + ExtractBuildFeatureArchives openssl : + file: base openssl + runtime: lib + file: devel openssl_devel + depends: base + libraries: + $(developLibDir)/libcrypto.so + $(developLibDir)/libssl.so + headers: $(developHeadersDir) + ; EnableBuildFeatures openssl ; } else { - Echo "SSL build feature not available for $(TARGET_ARCH)" ; + Echo "SSL build feature not available for $(TARGET_PACKAGING_ARCH)" ; } } @@ -77,92 +39,37 @@ if $(HAIKU_BUILD_FEATURE_SSL) { # ICU # Note ICU isn't actually optional, but is still an external package -HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc2-2012-08-29.zip ; -HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc4-2012-08-29.zip ; -HAIKU_ICU_PPC_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ; -HAIKU_ICU_ARM_PACKAGE = icu-4.8.1.1-arm-2012-11-21.zip ; -HAIKU_ICU_X86_64_PACKAGE = icu-4.8.1.1-x86_64-2012-07-30.zip ; - -if $(TARGET_ARCH) in arm ppc x86 x86_64 { - local icu_package ; - if $(TARGET_ARCH) = ppc { - icu_package = $(HAIKU_ICU_PPC_PACKAGE) ; - HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-ppc-2011-12-19.zip ; - } else if $(TARGET_ARCH) = arm { - icu_package = $(HAIKU_ICU_ARM_PACKAGE) ; - HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-arm-2012-11-21.zip ; - } else if $(TARGET_ARCH) = x86_64 { - icu_package = $(HAIKU_ICU_X86_64_PACKAGE) ; - HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86_64-2012-07-30.zip ; - } else if $(HAIKU_GCC_VERSION[1]) = 2 { - icu_package = $(HAIKU_ICU_GCC_2_PACKAGE) ; - HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86-gcc2-2011-12-20.zip ; - } else { - icu_package = $(HAIKU_ICU_GCC_4_PACKAGE) ; - HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86-gcc4-2011-12-20.zip ; - } - local zipFile = [ DownloadFile $(icu_package) - : $(baseURL)/$(icu_package) ] ; - - # zip file and output directory - HAIKU_ICU_ZIP_FILE = $(zipFile) ; - HAIKU_ICU_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(icu_package:B) ] ; - - # extract libraries - if $(TARGET_ARCH) = ppc { - HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR) - : - libicudata.so.48.1 - libicui18n.so.48.1 - libicuio.so.48.1 - libicule.so.48.1 - libiculx.so.48.1 - libicutu.so.48.1 - libicuuc.so.48.1 - : $(zipFile) - : extracted-icu - ] ; - } else { - HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR) - : - libicudata.so.48.1.1 - libicui18n.so.48.1.1 - libicuio.so.48.1.1 - libicule.so.48.1.1 - libiculx.so.48.1.1 - libicutu.so.48.1.1 - libicuuc.so.48.1.1 - : $(zipFile) - : extracted-icu - ] ; - } - - # zip file and output directory - HAIKU_ICU_DEVEL_ZIP_FILE = [ DownloadFile $(HAIKU_ICU_DEVEL_PACKAGE) - : $(baseURL)/$(HAIKU_ICU_DEVEL_PACKAGE) ] ; - HAIKU_ICU_DEVEL_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_ICU_DEVEL_PACKAGE:B) ] ; - - # extract headers - HAIKU_ICU_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_ICU_DEVEL_DIR) - : develop/headers/3rdparty : $(HAIKU_ICU_DEVEL_ZIP_FILE) - : extracted-icu-devel ] ; - - HAIKU_ICU_HEADERS - = [ FDirName $(HAIKU_ICU_DEVEL_DIR) develop headers 3rdparty ] ; +if [ IsPackageAvailable icu_devel ] { + ExtractBuildFeatureArchives icu : + file: base icu + runtime: lib + file: devel icu_devel + depends: base + libraries: + $(developLibDir)/libicudata.so + $(developLibDir)/libicui18n.so + $(developLibDir)/libicuio.so + $(developLibDir)/libicule.so + $(developLibDir)/libiculx.so + $(developLibDir)/libicutu.so + $(developLibDir)/libicuuc.so + headers: $(developHeadersDir) + ; EnableBuildFeatures icu ; } else { - Echo "ICU not available for $(TARGET_ARCH)" ; + Echo "ICU not available for $(TARGET_PACKAGING_ARCH)" ; } # CLucene -# Automatically install the CLucene feature, when the optional CLucene optional -# package is enabled. -if [ IsOptionalHaikuImagePackageAdded CLucene ] { +# TODO: Update to packages! +if ! 1 { + +# Automatically install the CLucene feature, when the CLucene package is +# enabled. +if [ IsHaikuImagePackageAdded clucene ] { HAIKU_BUILD_FEATURE_CLUCENE = 1 ; } @@ -172,7 +79,8 @@ HAIKU_CLUCENE_URL = $(baseURL)/$(HAIKU_CLUCENE_PACKAGE) ; if $(HAIKU_BUILD_FEATURE_CLUCENE) { if $(TARGET_ARCH) != x86 { - Echo "CLucene build feature not available for $(TARGET_ARCH)" ; + Echo "CLucene build feature not available for" + "$(TARGET_PACKAGING_ARCH)" ; } else { # Download the zip archive. local zipFile = [ DownloadFile $(HAIKU_CLUCENE_PACKAGE) @@ -202,301 +110,226 @@ if $(HAIKU_BUILD_FEATURE_CLUCENE) { } } +} # ! 1 + + +# TODO: Update to packages! +if ! 1 { + +# LLVM +if $(TARGET_ARCH) = x86 { + if $(TARGET_GCC_VERSION_$(architecture)[1]) >= 4 { + HAIKU_LLVM_FILE = llvm-3.2-x86-gcc4-2012-12-21.zip ; + local zipFile = [ DownloadFile $(HAIKU_LLVM_FILE) + : $(baseURL)/$(HAIKU_LLVM_FILE) ] ; + + HAIKU_LLVM_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) + $(HAIKU_LLVM_FILE:B) ] ; + + HAIKU_LLVM_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LLVM_DIR) + : common/include/ : $(zipFile) : extracted-llvm ] ; + HAIKU_LLVM_HEADERS = [ FDirName $(HAIKU_LLVM_DIR) common include ] ; + + # We can't Glob these because they aren't extracted yet. + HAIKU_LLVM_LIBS = [ ExtractArchive $(HAIKU_LLVM_DIR) + : + common/lib/libLLVMAsmParser.a + common/lib/libLLVMInstrumentation.a + common/lib/libLLVMLinker.a + common/lib/libLLVMArchive.a + common/lib/libLLVMBitReader.a + common/lib/libLLVMDebugInfo.a + common/lib/libLLVMJIT.a + common/lib/libLLVMipo.a + common/lib/libLLVMVectorize.a + common/lib/libLLVMBitWriter.a + common/lib/libLLVMTableGen.a + #common/lib/libLLVMHexagonCodeGen.a + #common/lib/libLLVMHexagonAsmPrinter.a + #common/lib/libLLVMHexagonDesc.a + #common/lib/libLLVMHexagonInfo.a + #common/lib/libLLVMNVPTXCodeGen.a + #common/lib/libLLVMNVPTXDesc.a + #common/lib/libLLVMNVPTXInfo.a + #common/lib/libLLVMNVPTXAsmPrinter.a + #common/lib/libLLVMMBlazeCodeGen.a + #common/lib/libLLVMMBlazeAsmParser.a + #common/lib/libLLVMMBlazeDisassembler.a + #common/lib/libLLVMMBlazeDesc.a + #common/lib/libLLVMMBlazeInfo.a + #common/lib/libLLVMMBlazeAsmPrinter.a + common/lib/libLLVMCppBackendCodeGen.a + common/lib/libLLVMCppBackendInfo.a + #common/lib/libLLVMMSP430CodeGen.a + #common/lib/libLLVMMSP430Desc.a + #common/lib/libLLVMMSP430AsmPrinter.a + #common/lib/libLLVMMSP430Info.a + #common/lib/libLLVMXCoreCodeGen.a + #common/lib/libLLVMXCoreDesc.a + #common/lib/libLLVMXCoreInfo.a + #common/lib/libLLVMCellSPUCodeGen.a + #common/lib/libLLVMCellSPUDesc.a + #common/lib/libLLVMCellSPUInfo.a + #common/lib/libLLVMMipsAsmParser.a + #common/lib/libLLVMMipsCodeGen.a + #common/lib/libLLVMMipsDesc.a + #common/lib/libLLVMMipsAsmPrinter.a + #common/lib/libLLVMMipsDisassembler.a + #common/lib/libLLVMMipsInfo.a + #common/lib/libLLVMARMAsmParser.a + #common/lib/libLLVMARMCodeGen.a + #common/lib/libLLVMARMDisassembler.a + #common/lib/libLLVMARMDesc.a + #common/lib/libLLVMARMInfo.a + #common/lib/libLLVMARMAsmPrinter.a + #common/lib/libLLVMPowerPCCodeGen.a + #common/lib/libLLVMPowerPCDesc.a + #common/lib/libLLVMPowerPCInfo.a + #common/lib/libLLVMPowerPCAsmPrinter.a + #common/lib/libLLVMSparcCodeGen.a + #common/lib/libLLVMSparcDesc.a + #common/lib/libLLVMSparcInfo.a + common/lib/libLLVMX86AsmParser.a + common/lib/libLLVMX86CodeGen.a + common/lib/libLLVMSelectionDAG.a + common/lib/libLLVMAsmPrinter.a + common/lib/libLLVMX86Disassembler.a + common/lib/libLLVMX86Desc.a + common/lib/libLLVMX86Info.a + common/lib/libLLVMX86AsmPrinter.a + common/lib/libLLVMX86Utils.a + common/lib/libLLVMMCDisassembler.a + common/lib/libLLVMMCParser.a + common/lib/libLLVMInterpreter.a + common/lib/libLLVMCodeGen.a + common/lib/libLLVMScalarOpts.a + common/lib/libLLVMInstCombine.a + common/lib/libLLVMTransformUtils.a + common/lib/libLLVMipa.a + common/lib/libLLVMAnalysis.a + common/lib/libLLVMMCJIT.a + common/lib/libLLVMRuntimeDyld.a + common/lib/libLLVMExecutionEngine.a + common/lib/libLLVMTarget.a + common/lib/libLLVMMC.a + common/lib/libLLVMObject.a + common/lib/libLLVMCore.a + common/lib/libLLVMSupport.a + : $(zipFile) : extracted-llvm ] + ; + + EnableBuildFeatures llvm ; + } else { + # Nor will it ever be + Echo "LLVM not available on GCC2" ; + } +} else { + Echo "LLVM not yet available on $(TARGET_PACKAGING_ARCH)" ; +} + +} # ! 1 + # GLU (GL Utilities) -if $(TARGET_ARCH) = x86 { - if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_GLU_FILE = glu-9.0-x86-gcc4-2012-11-13.zip ; - } else { - HAIKU_GLU_FILE = glu-9.0-x86-gcc2-2012-11-13.zip ; - } - - local zipFile = [ DownloadFile $(HAIKU_GLU_FILE) - : $(baseURL)/lib/$(HAIKU_GLU_FILE) ] ; - - HAIKU_GLU_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_GLU_FILE:B) ] ; - HAIKU_GLU_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_GLU_DIR) - : develop/headers/os/opengl/GL : $(zipFile) : extracted-glu-headers ] ; - HAIKU_GLU_LIBS = [ ExtractArchive $(HAIKU_GLU_DIR) - : system/lib/libGLU.a : $(zipFile) : extracted-glu ] ; - HAIKU_GLU_HEADERS = [ FDirName $(HAIKU_GLU_DIR) develop headers os opengl ] ; +if [ IsPackageAvailable glu_devel ] { + ExtractBuildFeatureArchives glu : + file: base glu + runtime: lib + file: devel glu_devel + depends: base + library: $(developLibDir)/libGLU.so + headers: $(developHeadersDir) + ; EnableBuildFeatures glu ; } else { - Echo "GLU not yet available on $(TARGET_ARCH)" ; + Echo "GLU not yet available on $(TARGET_PACKAGING_ARCH)" ; } # Mesa -if $(TARGET_ARCH) = x86 { - local zipFile ; - if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_MESA_FILE = mesa-9.2.0-x86-gcc4-2013-08-28.zip ; - } else { - HAIKU_MESA_FILE = mesa-7.8.2-x86-gcc2-2013-04-28.zip ; - } +if [ IsPackageAvailable mesa_devel ] { + ExtractBuildFeatureArchives mesa : [ FFilterByBuildFeatures + file: devel mesa_devel + mesaLibrary: $(developLibDir)/libmesa.a + glapiLibrary: $(developLibDir)/libglapi.a + headers: $(developHeadersDir) + privateHeaders: $(developHeadersDir)/mesa_private - zipFile = [ DownloadFile $(HAIKU_MESA_FILE) - : $(baseURL)/$(HAIKU_MESA_FILE) ] ; + !gcc2 @{ + glslLibrary: $(developLibDir)/libglsl.a + galliumLibrary: $(developLibDir)/libgallium.a + llvm @{ + galliumLlvmpipeLibrary: $(developLibDir)/libllvmpipe.a + }@ + !llvm @{ + galliumSoftpipeLibrary: $(developLibDir)/libsoftpipe.a + }@ + }@ # !gcc2 + ] ; - HAIKU_MESA_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_MESA_FILE:B) ] ; - - HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ; - HAIKU_MESA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MESA_DIR) - : include/ : $(zipFile) : extracted-mesa ] ; - - # Base Mesa libraries - HAIKU_MESA_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libmesa.a - : $(zipFile) - : extracted-mesa ] ; - HAIKU_GLAPI_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libglapi.a - : $(zipFile) - : extracted-mesa ] ; - - Depends $(HAIKU_MESA_HEADERS_DEPENDENCY) : $(HAIKU_GLU_HEADERS_DEPENDENCY) ; - Depends $(HAIKU_GLAPI_LIBS) : $(HAIKU_GLU_LIBS) ; - - # Extended Mesa libraries for newer versions - if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_GLSL_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libglsl.a - : $(zipFile) - : extracted-mesa ] ; - HAIKU_GALLIUM_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/libgallium.a - : $(zipFile) - : extracted-mesa ] ; - HAIKU_GALLIUM_SWPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR) - : - lib.haiku/swpipe_bundle.a - : $(zipFile) - : extracted-mesa ] ; - } + Depends [ BuildFeatureAttribute mesa : galliumLlvmpipeLibrary ] + : $(HAIKU_LLVM_LIBS) ; EnableBuildFeatures mesa ; } else { - Echo "Mesa 3D rendering support not available on $(TARGET_ARCH)" ; + Echo "Mesa 3D rendering support not available on $(TARGET_PACKAGING_ARCH)" ; } # FFmpeg -local ffmpegBaseURL = $(baseURL)/lib ; -if $(TARGET_ARCH) = x86 { - if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-r1a4-x86-gcc4-2012-09-02.zip ; - HAIKU_SPEEX_FILE = speex-1.2rc1-r1a4-x86-gcc4-2012-09-02.zip ; - HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-r1a4-x86-gcc4-2012-09-02.zip ; - HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-r1a4-x86-gcc4-2012-09-02.zip ; - HAIKU_LIBOGG_FILE = libogg-1.3.0-r1a4-x86-gcc4-2012-09-02.zip ; - HAIKU_LIBVPX_FILE = libvpx-1.0.0-r1a4-x86-gcc4-2012-09-02.zip ; - } else { - HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30.zip ; - HAIKU_SPEEX_FILE = speex-1.2rc1-r1a4-x86-gcc2-2012-08-29.zip ; - HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-r1a4-x86-gcc2-2012-08-29.zip ; - HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-r1a4-x86-gcc2-2012-08-29.zip ; - HAIKU_LIBOGG_FILE = libogg-1.3.0-r1a4-x86-gcc2-2012-08-29.zip ; - HAIKU_LIBVPX_FILE = libvpx-1.0.0-r1a4-x86-gcc2-2012-08-29.zip ; +if [ IsPackageAvailable ffmpeg_devel ] { + local ffmpegLibs = libavformat.so libavcodec.so libavdevice.so + libavfilter.so libswscale.so libavutil.so ; + local speexLibs = libspeex.so ; + local libtheoraLibs = libtheora.so libtheoradec.so libtheoraenc.so ; + local libvorbisLibs = libvorbis.so libvorbisenc.so ; + local liboggLibs = libogg.so ; + local libvpxLibs = libvpx.so ; + + local feature ; + for feature in ffmpeg speex libtheora libvorbis libogg libvpx { + ExtractBuildFeatureArchives $(feature) : + file: base $(feature) + runtime: lib + file: devel $(feature)_devel + depends: base + libraries: $(developLibDir)/$($(feature)Libs) + headers: $(developHeadersDir) + ; + + EnableBuildFeatures $(feature) ; } - - local ffmpegZipFile = [ DownloadFile $(HAIKU_FFMPEG_FILE) - : $(ffmpegBaseURL)/$(HAIKU_FFMPEG_FILE) ] ; - local speexZipFile = [ DownloadFile $(HAIKU_SPEEX_FILE) - : $(ffmpegBaseURL)/$(HAIKU_SPEEX_FILE) ] ; - local libtheoraZipFile = [ DownloadFile $(HAIKU_LIBTHEORA_FILE) - : $(ffmpegBaseURL)/$(HAIKU_LIBTHEORA_FILE) ] ; - local libvorbisZipFile = [ DownloadFile $(HAIKU_LIBVORBIS_FILE) - : $(ffmpegBaseURL)/$(HAIKU_LIBVORBIS_FILE) ] ; - local liboggZipFile = [ DownloadFile $(HAIKU_LIBOGG_FILE) - : $(ffmpegBaseURL)/$(HAIKU_LIBOGG_FILE) ] ; - local libvpxZipFile = [ DownloadFile $(HAIKU_LIBVPX_FILE) - : $(ffmpegBaseURL)/$(HAIKU_LIBVPX_FILE) ] ; - - HAIKU_FFMPEG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_FFMPEG_FILE:B) ] ; - HAIKU_SPEEX_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_SPEEX_FILE:B) ] ; - HAIKU_LIBTHEORA_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_LIBTHEORA_FILE:B) ] ; - HAIKU_LIBVORBIS_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_LIBVORBIS_FILE:B) ] ; - HAIKU_LIBOGG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_LIBOGG_FILE:B) ] ; - HAIKU_LIBVPX_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_LIBVPX_FILE:B) ] ; - - HAIKU_FFMPEG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_FFMPEG_DIR) - : common/include/ : $(ffmpegZipFile) : extracted-ffmpeg ] ; - HAIKU_SPEEX_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_SPEEX_DIR) - : common/include/ : $(speexZipFile) : extracted-speex ] ; - HAIKU_LIBTHEORA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBTHEORA_DIR) - : common/include/ : $(libtheoraZipFile) : extracted-libtheora ] ; - HAIKU_LIBVORBIS_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBVORBIS_DIR) - : common/include/ : $(libvorbisZipFile) : extracted-libvorbis ] ; - HAIKU_LIBOGG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBOGG_DIR) - : common/include/ : $(liboggZipFile) : extracted-libogg ] ; - HAIKU_LIBVPX_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBVPX_DIR) - : common/include/ : $(libvpxZipFile) : extracted-libvpx ] ; - - HAIKU_FFMPEG_LIBS = [ ExtractArchive $(HAIKU_FFMPEG_DIR) - : - common/lib/libavformat.a - common/lib/libavcodec.a - common/lib/libavdevice.a - common/lib/libavfilter.a - common/lib/libswscale.a - common/lib/libavutil.a - : $(ffmpegZipFile) - : extracted-ffmpeg ] ; - Depends $(HAIKU_FFMPEG_LIBS) : $(HAIKU_FFMPEG_HEADERS_DEPENDENCY) ; - - HAIKU_SPEEX_LIBS = [ ExtractArchive $(HAIKU_SPEEX_DIR) - : - common/lib/libspeex.a - : $(speexZipFile) - : extracted-speex ] ; - Depends $(HAIKU_SPEEX_LIBS) : $(HAIKU_SPEEX_HEADERS_DEPENDENCY) ; - - HAIKU_LIBTHEORA_LIBS = [ ExtractArchive $(HAIKU_LIBTHEORA_DIR) - : - common/lib/libtheora.a - common/lib/libtheoradec.a - common/lib/libtheoraenc.a - : $(libtheoraZipFile) - : extracted-libtheora ] ; - Depends $(HAIKU_LIBTHEORA_LIBS) : $(HAIKU_LIBTHEORA_HEADERS_DEPENDENCY) ; - - - HAIKU_LIBVORBIS_LIBS = [ ExtractArchive $(HAIKU_LIBVORBIS_DIR) - : - common/lib/libvorbis.a - common/lib/libvorbisenc.a - : $(libvorbisZipFile) - : extracted-libvorbis ] ; - Depends $(HAIKU_LIBVORBIS_LIBS) : $(HAIKU_LIBVORBIS_HEADERS_DEPENDENCY) ; - - - HAIKU_LIBOGG_LIBS = [ ExtractArchive $(HAIKU_LIBOGG_DIR) - : - common/lib/libogg.a - : $(liboggZipFile) - : extracted-libogg ] ; - Depends $(HAIKU_LIBOGG_LIBS) : $(HAIKU_LIBOGG_HEADERS_DEPENDENCY) ; - - HAIKU_LIBVPX_LIBS = [ ExtractArchive $(HAIKU_LIBVPX_DIR) - : - common/lib/libvpx.a - : $(libvpxZipFile) - : extracted-libvpx ] ; - Depends $(HAIKU_LIBVPX_LIBS) : $(HAIKU_LIBVPX_HEADERS_DEPENDENCY) ; - - HAIKU_FFMPEG_HEADERS = [ FDirName $(HAIKU_FFMPEG_DIR) common include ] ; - HAIKU_SPEEX_HEADERS = [ FDirName $(HAIKU_SPEEX_DIR) common include ] ; - HAIKU_LIBTHEORA_HEADERS = [ FDirName $(HAIKU_LIBTHEORA_DIR) common include ] ; - HAIKU_LIBVORBIS_HEADERS = [ FDirName $(HAIKU_LIBVORBIS_DIR) common include ] ; - HAIKU_LIBOGG_HEADERS = [ FDirName $(HAIKU_LIBOGG_DIR) common include ] ; - HAIKU_LIBVPX_HEADERS = [ FDirName $(HAIKU_LIBVPX_DIR) common include ] ; - - EnableBuildFeatures ffmpeg ; } else { - Echo "FFMpeg support not available on $(TARGET_ARCH)" ; -} - - -# MikMod -local mikmodBaseURL = http://haiku-files.org/files/optional-packages/lib ; -if $(TARGET_ARCH) = x86 { - if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a4-x86-gcc4-2012-09-02.zip ; - } else { - HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a4-x86-gcc2-2012-08-29.zip ; - } - - local mikmodZipFile = [ DownloadFile $(HAIKU_MIKMOD_FILE) - : $(mikmodBaseURL)/$(HAIKU_MIKMOD_FILE) ] ; - - HAIKU_MIKMOD_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_MIKMOD_FILE:B) ] ; - - HAIKU_MIKMOD_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MIKMOD_DIR) - : common/include/ : $(mikmodZipFile) : extracted-mikmod ] ; - - HAIKU_MIKMOD_LIBS = [ ExtractArchive $(HAIKU_MIKMOD_DIR) - : - common/lib/libmikmod.a - : $(mikmodZipFile) - : extracted-ffmpeg ] ; - Depends $(HAIKU_MIKMOD_LIBS) : $(HAIKU_MIKMOD_HEADERS_DEPENDENCY) ; - - HAIKU_MIKMOD_HEADERS = [ FDirName $(HAIKU_MIKMOD_DIR) common include ] ; - - EnableBuildFeatures mikmod ; -} else { - Echo "MikMod support not available on $(TARGET_ARCH)" ; + Echo "FFMpeg support not available on $(TARGET_PACKAGING_ARCH)" ; } # Freetype -local freetypeBaseURL = $(baseURL)/lib ; -if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm { - if $(TARGET_ARCH) = arm { - HAIKU_FREETYPE_FILE = freetype-2.4.9-arm-2012-11-21.zip ; - } else if $(TARGET_ARCH) = ppc { - HAIKU_FREETYPE_FILE = freetype-2.4.9-ppc-gcc4-2012-06-26.zip ; - } else if $(TARGET_ARCH) = x86_64 { - HAIKU_FREETYPE_FILE = freetype-2.4.9-x86_64-2012-08-04.zip ; - } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc4-2012-09-02.zip ; - } else { - HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc2-2012-08-28.zip ; - } - - local freetypeZipFile = [ DownloadFile $(HAIKU_FREETYPE_FILE) - : $(freetypeBaseURL)/$(HAIKU_FREETYPE_FILE) ] ; - - HAIKU_FREETYPE_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_FREETYPE_FILE:B) ] ; - - HAIKU_FREETYPE_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_FREETYPE_DIR) - : develop/headers/3rdparty/freetype2 : $(freetypeZipFile) - : extracted-freetype ] ; - - HAIKU_FREETYPE_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR) - : - common/lib/libfreetype.so - : $(freetypeZipFile) - : extracted-freetype ] ; - HAIKU_FREETYPE_CURRENT_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR) - : - common/lib/libfreetype.so.6.8.1 - : $(freetypeZipFile) - : extracted-freetype ] ; - Depends $(HAIKU_FREETYPE_LIB) $(HAIKU_FREETYPE_CURRENT_LIB) : $(HAIKU_FREETYPE_HEADERS_DEPENDENCY) ; - - HAIKU_FREETYPE_CURRENT_LINK = libfreetype.so.6 ; - - HAIKU_FREETYPE_HEADERS = [ FDirName $(HAIKU_FREETYPE_DIR) develop - headers 3rdparty ] [ FDirName $(HAIKU_FREETYPE_DIR) develop - headers 3rdparty freetype2 ] ; +if [ IsPackageAvailable freetype_devel ] { + ExtractBuildFeatureArchives freetype : + file: base freetype + runtime: lib + file: devel freetype_devel + depends: base + library: $(developLibDir)/libfreetype.so + headers: $(developHeadersDir) $(developHeadersDir)/freetype2 + ; EnableBuildFeatures freetype ; } else { - Echo "Freetype support not available on $(TARGET_ARCH)" ; + Echo "Freetype support not available on $(TARGET_PACKAGING_ARCH)" ; } # TagLib +# TODO: Update to packages! +if ! 1 { + # Automatically install the TagLib feature, when the optional TagLib optional # package is enabled. -if [ IsOptionalHaikuImagePackageAdded TagLib ] { +if [ IsHaikuImagePackageAdded taglib ] { HAIKU_BUILD_FEATURE_TAGLIB = 1 ; } @@ -505,7 +338,7 @@ HAIKU_TAGLIB_URL = $(baseURL)/$(HAIKU_TAGLIB_PACKAGE) ; if $(HAIKU_BUILD_FEATURE_TAGLIB) { if $(TARGET_ARCH) != x86 { - Echo "TagLib build feature not available for $(TARGET_ARCH)" ; + Echo "TagLib build feature not available for $(TARGET_PACKAGING_ARCH)" ; } else { # Download the zip archive. local zipFile = [ DownloadFile $(HAIKU_TAGLIB_PACKAGE) @@ -536,190 +369,107 @@ if $(HAIKU_BUILD_FEATURE_TAGLIB) { } } +} # ! 1 + # WebKit -# Automatically install the WebKit feature, when the optional WebPositive -# optional package is enabled. -if [ IsOptionalHaikuImagePackageAdded WebPositive ] { - HAIKU_BUILD_FEATURE_WEBKIT = 1 ; +if [ IsPackageAvailable haikuwebkit_devel ] { + ExtractBuildFeatureArchives webkit : + file: base haikuwebkit + runtime: lib + file: devel haikuwebkit_devel + depends: base + libraries: + $(developLibDir)/libwtf.so + $(developLibDir)/libjavascriptcore.so + $(developLibDir)/libwebcore.so + $(developLibDir)/libwebkit.so + headers: $(developHeadersDir) + ; + + EnableBuildFeatures webkit ; +} else { + Echo "WebKit build feature not available for $(TARGET_PACKAGING_ARCH)" ; } -if $(TARGET_ARCH) = x86 { - HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-08-31a.zip ; -} else if $(TARGET_ARCH) = x86_64 { - HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86_64-gcc4-2012-12-22.zip ; -} -if $(HAIKU_BUILD_FEATURE_WEBKIT) { - if $(TARGET_ARCH) != x86 && $(TARGET_ARCH) != x86_64 { - Echo "WebKit support not available on $(TARGET_ARCH)" ; - } else if $(HAIKU_GCC_VERSION[1]) < 4 { - if ! $(isHybridBuild) { - Echo "WebKit support not available on gcc $(HAIKU_GCC_VERSION[1])" ; - } else { - Echo "WebKit to be utilized by gcc4 inside $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR)" ; - } - } else { - local zipFile = [ DownloadFile $(HAIKU_WEBKIT_FILE) - : $(baseURL)/$(HAIKU_WEBKIT_FILE) ] ; - - HAIKU_WEBKIT_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_WEBKIT_FILE:B) ] ; - - HAIKU_WEBKIT_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_WEBKIT_DIR) - : include/ : $(zipFile) : extracted-webkit ] ; - - HAIKU_WEBKIT_LIBS = [ ExtractArchive $(HAIKU_WEBKIT_DIR) - : - lib/libwtf.so - lib/libjavascriptcore.so - lib/libwebcore.so - lib/libwebkit.so - : $(zipFile) - : extracted-webkit - ] ; - - HAIKU_WEBKIT_HEADERS = [ FDirName $(HAIKU_WEBKIT_DIR) include ] ; - - EnableBuildFeatures webkit ; - } -} # libpng -local libpngBaseURL = $(baseURL)/lib ; -if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm { - if $(TARGET_ARCH) = arm { - HAIKU_LIBPNG_FILE = libpng-1.5.12-arm-2012-11-21.zip ; - } else if $(TARGET_ARCH) = ppc { - HAIKU_LIBPNG_FILE = libpng-1.5.12-ppc-gcc4-2012-08-27.zip ; - } else if $(TARGET_ARCH) = x86_64 { - HAIKU_LIBPNG_FILE = libpng-1.5.12-x86_64-2012-11-18.zip ; - } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc4-2012-08-23.zip ; - } else { - HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc2-2012-08-23.zip ; - } - - local libpngZipFile = [ DownloadFile $(HAIKU_LIBPNG_FILE) - : $(libpngBaseURL)/$(HAIKU_LIBPNG_FILE) ] ; - - HAIKU_LIBPNG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_LIBPNG_FILE:B) ] ; - - HAIKU_LIBPNG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBPNG_DIR) - : common/include : $(libpngZipFile) - : extracted-libpng ] ; - - HAIKU_LIBPNG_LIB = [ ExtractArchive $(HAIKU_LIBPNG_DIR) - : - common/lib/libpng.so - : $(libpngZipFile) - : extracted-libpng ] ; - HAIKU_LIBPNG_CURRENT_LIB = [ ExtractArchive $(HAIKU_LIBPNG_DIR) - : - common/lib/libpng15.so.15.12.0 - : $(libpngZipFile) - : extracted-libpng ] ; - Depends $(HAIKU_LIBPNG_LIB) $(HAIKU_LIBPNG_CURRENT_LIB) : $(HAIKU_LIBPNG_HEADERS_DEPENDENCY) ; - - HAIKU_LIBPNG_CURRENT_LINK = libpng15.so.15 ; - - HAIKU_LIBPNG_HEADERS = [ FDirName $(HAIKU_LIBPNG_DIR) common include ] ; +if [ IsPackageAvailable libpng_devel ] { + ExtractBuildFeatureArchives libpng : + file: base libpng + runtime: lib + file: devel libpng_devel + depends: base + library: $(developLibDir)/libpng.so + headers: $(developHeadersDir) + ; EnableBuildFeatures libpng ; } else { - Echo "libpng support not available on $(TARGET_ARCH)" ; + Echo "libpng support not available on $(TARGET_PACKAGING_ARCH)" ; } + # jpeg -local jpegBaseURL = $(baseURL)/lib ; -if $(TARGET_ARCH) in arm ppc x86 x86_64 { - if $(TARGET_ARCH) = arm { - HAIKU_JPEG_FILE = jpeg-8d-arm-2012-11-21.zip ; - } else if $(TARGET_ARCH) = ppc { - HAIKU_JPEG_FILE = jpeg-8d-ppc-gcc4-2012-08-27.zip ; - } else if $(TARGET_ARCH) = x86_64 { - HAIKU_JPEG_FILE = jpeg-8d-x86_64-2012-11-18.zip ; - } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_JPEG_FILE = jpeg-8d-x86-gcc4-2012-08-23.zip ; - } else { - HAIKU_JPEG_FILE = jpeg-8d-x86-gcc2-2012-08-23.zip ; - } +if [ IsPackageAvailable jpeg_devel ] { + ExtractBuildFeatureArchives jpeg : + file: base jpeg + runtime: lib + file: devel jpeg_devel + depends: base + library: $(developLibDir)/libjpeg.so + headers: $(developHeadersDir) + ; - local jpegZipFile = [ DownloadFile $(HAIKU_JPEG_FILE) - : $(jpegBaseURL)/$(HAIKU_JPEG_FILE) ] ; - - HAIKU_JPEG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_JPEG_FILE:B) ] ; - - HAIKU_JPEG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_JPEG_DIR) - : common/include : $(jpegZipFile) - : extracted-jpeg ] ; - - HAIKU_JPEG_LIB = [ ExtractArchive $(HAIKU_JPEG_DIR) - : - common/lib/libjpeg.so - : $(jpegZipFile) - : extracted-jpeg ] ; - HAIKU_JPEG_CURRENT_LIB = [ ExtractArchive $(HAIKU_JPEG_DIR) - : - common/lib/libjpeg.so.8.4.0 - : $(jpegZipFile) - : extracted-jpeg ] ; - Depends $(HAIKU_JPEG_LIB) $(HAIKU_JPEG_CURRENT_LIB) : $(HAIKU_JPEG_HEADERS_DEPENDENCY) ; - - HAIKU_JPEG_CURRENT_LINK = libjpeg.so.8 ; - - HAIKU_JPEG_HEADERS = [ FDirName $(HAIKU_JPEG_DIR) common include ] ; - - EnableBuildFeatures libjpeg ; + EnableBuildFeatures jpeg ; } else { - Echo "jpeg support not available on $(TARGET_ARCH)" ; + Echo "jpeg support not available on $(TARGET_PACKAGING_ARCH)" ; } + # zlib -local zlibBaseURL = $(baseURL)/lib ; -if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm { - if $(TARGET_ARCH) = arm { - HAIKU_ZLIB_FILE = zlib-1.2.7-arm-2012-11-21.zip ; - } else if $(TARGET_ARCH) = ppc { - HAIKU_ZLIB_FILE = zlib-1.2.7-ppc-gcc4-2012-10-30.zip ; - } else if $(TARGET_ARCH) = x86_64 { - HAIKU_ZLIB_FILE = zlib-1.2.7-x86_64-2012-11-18.zip ; - } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc4-2012-10-30.zip ; - } else { - HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc2-2012-10-30.zip ; - } - - local zlibZipFile = [ DownloadFile $(HAIKU_ZLIB_FILE) - : $(zlibBaseURL)/$(HAIKU_ZLIB_FILE) ] ; - - HAIKU_ZLIB_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR) - $(HAIKU_ZLIB_FILE:B) ] ; - - HAIKU_ZLIB_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_ZLIB_DIR) - : common/include : $(zlibZipFile) - : extracted-zlib ] ; - - HAIKU_ZLIB_LIB = [ ExtractArchive $(HAIKU_ZLIB_DIR) - : - common/lib/libz.so - : $(zlibZipFile) - : extracted-zlib ] ; - HAIKU_ZLIB_CURRENT_LIB = [ ExtractArchive $(HAIKU_ZLIB_DIR) - : - common/lib/libz.so.1.2.7 - : $(zlibZipFile) - : extracted-zlib ] ; - Depends $(HAIKU_ZLIB_LIB) $(HAIKU_ZLIB_CURRENT_LIB) : $(HAIKU_ZLIB_HEADERS_DEPENDENCY) ; - - HAIKU_ZLIB_CURRENT_LINK = libz.so.1 ; - - HAIKU_ZLIB_HEADERS = [ FDirName $(HAIKU_ZLIB_DIR) common include ] ; +if [ IsPackageAvailable zlib_devel ] { + ExtractBuildFeatureArchives zlib : + file: base zlib + runtime: lib + file: devel zlib_devel + depends: base + library: $(developLibDir)/libz.so + headers: $(developHeadersDir) + # sources are required for the primary architecture only + primary @{ + file: source zlib_source + sources: develop/sources/%portRevisionedName%/source + }@ + ; EnableBuildFeatures zlib ; } else { - Echo "zlib support not available on $(TARGET_ARCH)" ; + Echo "zlib support not available on $(TARGET_PACKAGING_ARCH)" ; +} + + +# libsolv +if [ IsPackageAvailable libsolv_devel ] { + ExtractBuildFeatureArchives libsolv : + file: base libsolv + runtime: lib + file: devel libsolv_devel + depends: base + libraries: + $(developLibDir)/libsolv.so + $(developLibDir)/libsolvext.so + headers: $(developHeadersDir) + # sources are required for the primary architecture only + primary @{ + file: source libsolv_source + sources: develop/sources/%portRevisionedName%/source + }@ + ; + + EnableBuildFeatures libsolv ; +} else { + Echo "libsolv package not available for $(TARGET_PACKAGING_ARCH)" ; } diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 6eb5b937aa..1abbfe47b7 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -20,6 +20,7 @@ HAIKU_INCLUDE_IN_CONTAINER_VAR on $(HAIKU_IMAGE_CONTAINER_NAME) = HAIKU_INCLUDE_IN_IMAGE ; HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_IMAGE_CONTAINER_NAME) = HAIKU_IMAGE_INSTALL_TARGETS ; +HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_IMAGE_CONTAINER_NAME) = system ; # network boot archive HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME = haiku-netboot-archive-container ; @@ -28,15 +29,8 @@ HAIKU_CONTAINER_GRIST on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) = 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 ; +HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) + = system ; # boot floppy HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-floppy-container ; @@ -45,6 +39,8 @@ HAIKU_CONTAINER_GRIST on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_FLOPPY_BOOT_IMAGE_INSTALL_TARGETS ; +HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) + = system ; # boot CD image HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME = haiku-boot-cd-container ; @@ -52,13 +48,18 @@ HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = CDBootImage ; # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ; +HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) + = system ; # boot CD for PPC image HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME = haiku-boot-cd-ppc-container ; -HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) = CDBootPPCImage ; +HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) + = CDBootPPCImage ; # HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) = HAIKU_CD_BOOT_PPC_IMAGE_INSTALL_TARGETS ; +HAIKU_CONTAINER_SYSTEM_DIR_TOKENS on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) + = system ; # Haiku image/install defaults HAIKU_DEFAULT_IMAGE_NAME = haiku.image ; @@ -82,23 +83,6 @@ HAIKU_DEFAULT_ANYBOOT_LABEL ?= Haiku ; ProcessCommandLineArguments ; -# include libgccObjects -{ - local libgccObjects = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : libgccObjects ] ; - - if ! $(libgccObjects) { - ECHO "No `libgccObjects' found in" - "$(HAIKU_BUILD_OUTPUT_DIR)!" ; - EXIT "Please run ./configure in the source tree's root directory" - "again!" ; - } - - LOCATE on libgccObjects = $(HAIKU_BUILD_OUTPUT_DIR) ; - - include libgccObjects ; -} - - # supported debug levels HAIKU_DEBUG_LEVELS = 0 1 2 3 4 5 ; @@ -113,418 +97,61 @@ HAIKU_CONFIG_HEADERS = [ FDirName $(HAIKU_TOP) build user_config_headers ] [ FDirName $(HAIKU_TOP) build config_headers ] ; -#pragma mark - +# object directories common to all architectures +HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ; +HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ; -# haiku target platform settings -# analyze GCC version -HAIKU_GCC_VERSION = [ FAnalyzeGCCVersion HAIKU_GCC_RAW_VERSION ] ; +#pragma mark - haiku target platform settings -# enable GCC -pipe option, if requested -if $(HAIKU_USE_GCC_PIPE) = 1 { - HAIKU_GCC_BASE_FLAGS = -pipe ; + +local architecture ; +for architecture in $(HAIKU_PACKAGING_ARCHS) { + ArchitectureSetup $(architecture) ; } -# disable strict aliasing on anything newer than gcc 2 as it may lead to -# unexpected results. also disable the tree-vrp (value range propagation) -# optimization for now as with the current gcc4 version we are using this -# results in some broken code. -# TODO: remove the -fno-strict-aliasing option when all code has been -# analyzed/fixed with regard to aliasing. -# TODO: retest/remove the -fno-tree-vrp option as soon as we have updated our -# gcc4 compiler. See this discussion on some issues: -# http://www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization -if $(HAIKU_GCC_VERSION[1]) >= 3 { - HAIKU_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; +# TODO: Might not be needed anymore. +if $(HAIKU_HOST_BUILD_ONLY) = 1 { + HAIKU_GCC_VERSION = 0 0 0 ; } -# disable array bounds warnings on gcc 4.6 or newer since they trigger -# too many false positives. Coverity does a better job of this kind of analysis -# anyways. -if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_GCC_BASE_FLAGS += -Wno-array-bounds ; +if $(HAIKU_PACKAGING_ARCH) { + KernelArchitectureSetup $(HAIKU_PACKAGING_ARCH) ; } -# activating graphite optimizations -if $(HAIKU_USE_GCC_GRAPHITE) = 1 { - HAIKU_GCC_BASE_FLAGS += -floop-interchange -ftree-loop-distribution - -floop-strip-mine -floop-block ; -} - -if $(HOST_GCC_VERSION[1]) >= 3 { - HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; -} - -# override gcc 2.95.3's header directory -- strictly necessary only when using -# the BeOS native compiler (since its headers are incompatible), but it doesn't -# harm for the cross-compiler either. -if $(HAIKU_GCC_VERSION[1]) = 2 { - 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. -HAIKU_C++ ?= $(HAIKU_CC) ; -HAIKU_LINK = $(HAIKU_CC) ; -HAIKU_LINKFLAGS = $(HAIKU_GCC_BASE_FLAGS) ; -HAIKU_BOOT_LINKFLAGS = ; - -HAIKU_HDRS = [ FStandardHeaders ] ; -HAIKU_KERNEL_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ; -HAIKU_KERNEL_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ; -HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS) $(HAIKU_GCC_BASE_FLAGS) ; -HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS) $(HAIKU_GCC_BASE_FLAGS) ; -HAIKU_CCFLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; -HAIKU_C++FLAGS += $(HAIKU_GCC_BASE_FLAGS) -nostdinc ; HAIKU_DEFINES = __HAIKU__ ; -HAIKU_NO_WERROR ?= 0 ; +HAIKU_LIBSUPC++ = $(HAIKU_LIBSUPC++_$(HAIKU_PACKAGING_ARCH)) ; +HAIKU_LIBSTDC++ = $(HAIKU_LIBSTDC++_$(HAIKU_PACKAGING_ARCH)) ; + # distro compatibility level defines HAIKU_DISTRO_COMPATIBILITY ?= "default" ; switch $(HAIKU_DISTRO_COMPATIBILITY) { - case official : { + case official : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_OFFICIAL ; HAIKU_INCLUDE_TRADEMARKS = "" ; - } - case compatible : { + case compatible : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_COMPATIBLE ; HAIKU_INCLUDE_TRADEMARKS = "" ; - } - case "default" : { + case "default" : HAIKU_DEFINES += HAIKU_DISTRO_COMPATIBILITY_DEFAULT ; HAIKU_INCLUDE_TRADEMARKS = ; - } - case * : Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:" - $(HAIKU_DISTRO_COMPATIBILITY) ; -} - -# analyze the gcc machine spec to determine HAIKU_CPU -switch $(HAIKU_GCC_MACHINE) { - case i?86-* : HAIKU_CPU = x86 ; - case x86_64-* : HAIKU_CPU = x86_64 ; - case powerpc-* : HAIKU_CPU = ppc ; - case m68k-* : HAIKU_CPU = m68k ; - case mipsel-* : HAIKU_CPU = mipsel ; - case arm-* : HAIKU_CPU = arm ; - case * : Exit "Unsupported gcc target machine:" - $(HAIKU_GCC_MACHINE) ; -} - -# determine the endianness of the host -switch $(HOST_GCC_MACHINE) { - case amd64-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; - case i?86-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; - case powerpc-* : HAIKU_HOST_IS_BIG_ENDIAN = 1 ; - case x86_64-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; - - # the following are rather unlikely as hosts ... - case arm-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; - case m68k-* : HAIKU_HOST_IS_BIG_ENDIAN = 1 ; - case mipsel-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; - case * : Exit "Unsupported gcc host machine:" $(HOST_GCC_MACHINE) ; -} - -switch $(HAIKU_CPU) { - case ppc : - { - HAIKU_DEFINES += __POWERPC__ ; - HAIKU_BOOT_PLATFORM ?= openfirmware ; - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB - # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet - } - case arm : - { - HAIKU_DEFINES += __ARM__ ; - HAIKU_CCFLAGS += -mapcs-frame ; # For stackcrawls - HAIKU_C++FLAGS += -mapcs-frame ; - HAIKU_BOOT_PLATFORM ?= u-boot ; - HAIKU_BOOT_BOARD ?= verdex ; - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; - # in kB (there is not really a floppy on the gumstix ;) ) - # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet - HAIKU_NO_WERROR = 1 ; - # we use #warning as placeholders for things to write... - } - case x86 : - { - HAIKU_DEFINES += __INTEL__ ; - HAIKU_BOOT_PLATFORM = bios_ia32 ; - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB - # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB - - # yasm is required for target arch x86 - if ! $(HAIKU_YASM) { - Exit "HAIKU_YASM not set. Please re-run configure." ; - } - } - case x86_64 : - { - # x86_64 completely shares the x86 bootloader. - HAIKU_BOOT_PLATFORM = bios_ia32 ; - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB - # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 300 ; # in kB - - # x86_64 kernel source is under arch/x86. - HAIKU_KERNEL_ARCH = x86 ; - - # yasm is required for target arch x86_64 - if ! $(HAIKU_YASM) { - Exit "HAIKU_YASM not set. Please re-run configure." ; - } - } - case m68k : - { - HAIKU_DEFINES += __M68K__ ; - HAIKU_BOOT_PLATFORM ?= atari_m68k ; - switch $(HAIKU_BOOT_PLATFORM) { - case atari_m68k : - { - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB - } - case amiga_m68k : - { - # for now we have trouble reading from double-sided images - HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 880 ; # in kB - } - } - # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 260 ; # in kB - HAIKU_NO_WERROR = 1 ; - # we use #warning as placeholders for things to write... - } - case mipsel : - { - HAIKU_DEFINES += __MIPSEL__ ; - # RouterBOARD firmware (ELF image over TFTP) - HAIKU_BOOT_PLATFORM = routerboard_mipsel ; - # offset in floppy image (>= sizeof(haiku_loader)) - HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - HAIKU_NO_WERROR = 1 ; - # we use #warning as placeholders for things to write... - } case * : - Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; + Exit "Invalid value for HAIKU_DISTRO_COMPATIBILITY:" + $(HAIKU_DISTRO_COMPATIBILITY) ; } -# strip is required -if ! $(HAIKU_STRIP) { - Exit "HAIKU_STRIP not set. Please re-run configure." ; -} - -# Include embedded board-specific file. -if $(HAIKU_BOOT_BOARD) { - include [ FDirName $(HAIKU_BUILD_RULES_DIR) board $(HAIKU_BOOT_BOARD) - BoardSetup ] ; -} - -HAIKU_ARCH ?= $(HAIKU_CPU) ; -HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ; -HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ; -HAIKU_DEFINES += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; -HAIKU_KERNEL_ARCH ?= $(HAIKU_ARCH) ; -HAIKU_ATA_STACK ?= 1 ; - -# directories -HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ; -HAIKU_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) common ] ; -HAIKU_ARCH_OBJECT_DIR = [ FDirName $(HAIKU_OBJECT_BASE_DIR) $(HAIKU_ARCH) ] ; -HAIKU_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) common ] ; -HAIKU_DEBUG_0_OBJECT_DIR = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) release ] ; - -local level ; -for level in $(HAIKU_DEBUG_LEVELS[2-]) { - HAIKU_DEBUG_$(level)_OBJECT_DIR - = [ FDirName $(HAIKU_ARCH_OBJECT_DIR) debug_$(level) ] ; -} - -# set variables for gcc header options -SetIncludePropertiesVariables HAIKU ; - -# assembler flags -HAIKU_ASFLAGS = ; - -# C/C++ flags -HAIKU_KERNEL_CCFLAGS += -finline -fno-builtin ; -HAIKU_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions ; -HAIKU_KERNEL_DEFINES += _KERNEL_MODE ; -HAIKU_BOOT_CCFLAGS += -finline -fno-builtin ; -HAIKU_BOOT_C++FLAGS += -finline -fno-builtin -fno-exceptions ; - -if $(HAIKU_GCC_VERSION[1]) >= 3 { - HAIKU_BOOT_C++FLAGS += -fno-use-cxa-atexit ; - HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ; -} - -if $(HAIKU_GCC_VERSION[1]) >= 4 { - HAIKU_C++FLAGS += -Wno-deprecated ; - - HAIKU_KERNEL_CCFLAGS += -ffreestanding ; - HAIKU_KERNEL_C++FLAGS += -ffreestanding ; - HAIKU_BOOT_CCFLAGS += -ffreestanding ; - HAIKU_BOOT_C++FLAGS += -ffreestanding ; -} - -HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ; -HAIKU_KERNEL_PIC_LINKFLAGS = ; -HAIKU_KERNEL_ADDON_LINKFLAGS = ; - -switch $(HAIKU_ARCH) { - case ppc : - { - # Build a position independent PPC kernel. We need to be able to - # relocate the kernel, since the virtual address space layout at boot - # time is not fixed. - HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ; - HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ; - } - - case m68k : - { - # We don't want to have to handle emulating missing FPU opcodes for 040 - # and 060 in the kernel. - HAIKU_KERNEL_CCFLAGS += -m68020-60 ; - HAIKU_KERNEL_C++FLAGS += -m68020-60 ; - } - case x86 : - { - HAIKU_CCFLAGS += -march=pentium ; - HAIKU_C++FLAGS += -march=pentium ; - HAIKU_KERNEL_CCFLAGS += -march=pentium ; - HAIKU_KERNEL_C++FLAGS += -march=pentium ; - - # Enable use of the gcc built-in atomic functions instead of atomic_*(). - # The former are inlined and have thus less overhead. They are not - # available with gcc 2, but the header will take care of that. - HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ; - } - case x86_64 : - { - # Kernel lives in the top 2GB of the address space, use kernel code - # model. - HAIKU_KERNEL_PIC_CCFLAGS += -mcmodel=kernel ; - - # Disable the red zone, which cannot be used in kernel code due to - # interrupts, and always enable the frame pointer so stack traces are - # correct. - HAIKU_KERNEL_CCFLAGS += -mno-red-zone -fno-omit-frame-pointer ; - HAIKU_KERNEL_C++FLAGS += -mno-red-zone -fno-omit-frame-pointer ; - HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ; - HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ; - - # Bootloader is 32-bit. - HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ; - HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ; - HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ; - - # Enable use of the gcc built-in atomic functions instead of atomic_*(). - # The former are inlined and have thus less overhead. - HAIKU_DEFINES += B_USE_BUILTIN_ATOMIC_FUNCTIONS ; - } -} - -# If the environment variable HAIKU_INCLUDE_PATENTED_CODE is defined, we -# define an equally named macro to the variable value. Some components use the -# macro to allow compilation of code known to implemented patented ideas and/or -# techniques, for example the Freetype bytecode hinter or sub-pixel rendering -# as well as some problematic media codecs. +# If the environment variable HAIKU_INCLUDE_PATENTED_CODE is defined, we define +# an equally named macro to the variable value. Some components use the macro +# to allow compilation of code known to implemented patented ideas and/or +# techniques, for example the Freetype bytecode hinter or sub-pixel rendering as +# well as some problematic media codecs. if $(HAIKU_INCLUDE_PATENTED_CODE) { HAIKU_DEFINES += HAIKU_INCLUDE_PATENTED_CODE=$(HAIKU_INCLUDE_PATENTED_CODE) ; } -# warning flags -HAIKU_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes - -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar ; -HAIKU_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy - -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare - -Wno-multichar ; - -HAIKU_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes - -Wno-multichar ; -HAIKU_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs -Wno-multichar ; - -# debug flags -HAIKU_DEBUG_FLAGS ?= -ggdb ; - -# debug 0: suppress asserts -HAIKU_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; -HAIKU_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; - -HAIKU_KERNEL_DEBUG_0_CCFLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; -HAIKU_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; - -local level ; -for level in $(HAIKU_DEBUG_LEVELS[2-]) { - local flags = $(HAIKU_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; - HAIKU_DEBUG_$(level)_CCFLAGS = $(flags) ; - HAIKU_DEBUG_$(level)_C++FLAGS = $(flags) ; - HAIKU_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; - HAIKU_KERNEL_DEBUG_$(level)_C++FLAGS = $(flags) ; -} - -if $(HAIKU_GCC_VERSION[1]) >= 3 { - # TODO: Temporary work-around. Should be defined in the compiler specs - HAIKU_LINKFLAGS += -Xlinker --no-undefined ; -} else { - HAIKU_DEFINES += _BEOS_R5_COMPATIBLE_ ; -} - -# private shared kernel/libroot headers -HAIKU_PRIVATE_SYSTEM_HEADERS = - [ PrivateHeaders $(DOT) system system/arch/$(HAIKU_ARCH) ] -; - -# private kernel headers to be used when compiling kernel code -HAIKU_PRIVATE_KERNEL_HEADERS = - [ PrivateHeaders $(DOT) kernel libroot shared - kernel/boot/platform/$(HAIKU_BOOT_PLATFORM) ] - [ ArchHeaders $(HAIKU_KERNEL_ARCH) ] - [ FDirName $(HAIKU_COMMON_DEBUG_OBJECT_DIR) system kernel ] - $(HAIKU_PRIVATE_SYSTEM_HEADERS) -; - -# Add some grist to the libgcc objects -HAIKU_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS:G=libgcc) ; - -# the C++ standard library -HAIKU_BUILD_SHARED_LIBSTDC++ = ; -if $(HAIKU_SHARED_LIBSTDC++) { - HAIKU_LIBSTDC++ = $(HAIKU_SHARED_LIBSTDC++) ; -} else { - # no shared library available with the compiler -- build it - if $(HAIKU_GCC_VERSION[1]) = 2 { - HAIKU_LIBSTDC++ = libstdc++.r4.so ; - } else { - HAIKU_LIBSTDC++ = libstdc++.so ; - } - HAIKU_SHARED_LIBSTDC++ = $(HAIKU_LIBSTDC++) ; - HAIKU_BUILD_SHARED_LIBSTDC++ = 1 ; -} - -# the C++ support (runtime) library -HAIKU_BUILD_SHARED_LIBSUPC++ = ; -if $(HAIKU_SHARED_LIBSUPC++) { - HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ; -} else { - # no shared library available with the compiler -- build it for gcc 4 - if $(HAIKU_GCC_VERSION[1]) != 2 { - HAIKU_SHARED_LIBSUPC++ = libsupc++.so ; - HAIKU_BUILD_SHARED_LIBSUPC++ = 1 ; - } - - HAIKU_LIBSUPC++ = $(HAIKU_SHARED_LIBSUPC++) ; -} - +HAIKU_ATA_STACK ?= 1 ; # network libraries HAIKU_NETWORK_LIBS = network ; @@ -532,38 +159,6 @@ HAIKU_NETAPI_LIB = bnetapi ; HAIKU_SELECT_UNAME_ETC_LIB = ; # libroot, against which we link anyway -# locale libraries -HAIKU_LOCALE_LIBS = liblocalestub.a ; - - -# library and executable glue code -local commonGlueCode = - init_term_dyn.o - crti.o - crtn.o -; -HAIKU_LIBRARY_BEGIN_GLUE_CODE = - crti.o - crtbegin.o - init_term_dyn.o -; -HAIKU_LIBRARY_END_GLUE_CODE = - crtend.o - crtn.o -; -HAIKU_EXECUTABLE_BEGIN_GLUE_CODE = - crti.o - crtbegin.o - start_dyn.o - init_term_dyn.o -; -HAIKU_EXECUTABLE_END_GLUE_CODE = $(HAIKU_LIBRARY_END_GLUE_CODE) ; -HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = crtbegin.o - haiku_version_glue.o ; -HAIKU_KERNEL_ADDON_END_GLUE_CODE = $(HAIKU_GCC_LIBGCC) crtend.o ; - -SEARCH on crtbegin.o crtend.o = $(HAIKU_GCC_LIB_DIR) ; - HAIKU_EXECUTABLE_MIME_TYPE = "application/x-vnd.Be-elfexecutable" ; # TODO: The version stuff should probably go into a separate file and be made @@ -578,24 +173,24 @@ if ! $(HAIKU_BUILD_VERSION) { # an unknown build. HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ; -# init library name map -{ - local i ; - for i in be bnetapi debug device game GL locale mail media midi midi2 - network opengl package root screensaver textencoding tracker - translation z { - HAIKU_LIBRARY_NAME_MAP_$(i) = lib$(i).so ; - } - HAIKU_LIBRARY_NAME_MAP_libstdc++ = $(HAIKU_LIBSTDC++) ; - HAIKU_LIBRARY_NAME_MAP_libsupc++ = $(HAIKU_LIBSUPC++) ; - HAIKU_LIBRARY_NAME_MAP_input_server = input_server ; + +#pragma mark - host platform settings + + +# determine the endianness of the host +switch $(HOST_GCC_MACHINE) { + case amd64-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; + case i?86-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; + case powerpc-* : HAIKU_HOST_IS_BIG_ENDIAN = 1 ; + case x86_64-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; + + # the following are rather unlikely as hosts ... + case arm-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; + case m68k-* : HAIKU_HOST_IS_BIG_ENDIAN = 1 ; + case mipsel-* : HAIKU_HOST_IS_BIG_ENDIAN = 0 ; + case * : Exit "Unsupported gcc host machine:" $(HOST_GCC_MACHINE) ; } - -#pragma mark - - -# host platform settings - # analyze the host gcc machine spec to find out about 64-bitness HOST_PLATFORM_IS_64_BIT = ; switch $(HOST_GCC_MACHINE) { @@ -648,6 +243,7 @@ HOST_UNARFLAGS ?= x ; # check the host platform compatibility SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host : linux openbsd freebsd darwin sunos cygwin ; +HOST_PLATFORM_(host)_COMPATIBLE = 1 ; if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin @@ -670,21 +266,32 @@ if $(HOST_PLATFORM) = cygwin { --enable-auto-import ; } -HOST_CPU ?= $(OSPLAT:L) ; +HOST_CPU ?= $(OSPLAT:L) ; # Jam doesn't know x86_64, so override HOST_CPU, if 64 bit. if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) { HOST_CPU = x86_64 ; } -HOST_ARCH ?= $(HOST_CPU) ; -HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ; +HOST_ARCH ?= $(HOST_CPU) ; +HOST_ARCHS = $(HOST_ARCH) ; +HOST_KERNEL_ARCH = host ; +# analyze GCC version +HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ; + +# set packaging architecture +HOST_PACKAGING_ARCH ?= $(HOST_CPU) ; +if $(HOST_PACKAGING_ARCH) = x86 && $(HOST_GCC_VERSION[1]) = 2 { + HOST_PACKAGING_ARCH = x86_gcc2 ; +} +HOST_PACKAGING_ARCHS = $(HOST_PACKAGING_ARCH) ; # directories HOST_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) $(HOST_PLATFORM) ] ; HOST_COMMON_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) common ] ; -HOST_ARCH_OBJECT_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_ARCH) ] ; +HOST_ARCH_OBJECT_DIR + = [ FDirName $(HOST_OBJECT_BASE_DIR) $(HOST_PACKAGING_ARCH) ] ; HOST_COMMON_DEBUG_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) common ] ; HOST_DEBUG_0_OBJECT_DIR = [ FDirName $(HOST_ARCH_OBJECT_DIR) release ] ; @@ -694,9 +301,6 @@ for level in $(HAIKU_DEBUG_LEVELS[2-]) { = [ FDirName $(HOST_ARCH_OBJECT_DIR) debug_$(level) ] ; } -# analyze GCC version -HOST_GCC_VERSION = [ FAnalyzeGCCVersion HOST_GCC_RAW_VERSION ] ; - # set variables for gcc header options SetIncludePropertiesVariables HOST ; @@ -712,6 +316,10 @@ if $(HOST_PLATFORM) != cygwin { HOST_PIC_C++FLAGS += -fPIC ; } +if $(HOST_GCC_VERSION[1]) >= 3 { + HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; +} + HOST_KERNEL_CCFLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin -D_KERNEL_MODE ; HOST_KERNEL_C++FLAGS += $(HOST_GCC_BASE_FLAGS) -finline -fno-builtin @@ -751,13 +359,14 @@ HOST_KERNEL_WARNING_CCFLAGS = -Wall -Wno-trigraphs -Wmissing-prototypes ; HOST_KERNEL_WARNING_C++FLAGS = -Wall -Wno-trigraphs ; # debug flags +local hostDebugFlags ; switch $(HOST_PLATFORM) { - case haiku : HOST_DEBUG_FLAGS ?= -ggdb ; - case haiku_host : HOST_DEBUG_FLAGS ?= -ggdb ; - case linux : HOST_DEBUG_FLAGS ?= -ggdb ; - case freebsd : HOST_DEBUG_FLAGS ?= -ggdb ; - case darwin : HOST_DEBUG_FLAGS ?= -ggdb ; - case * : HOST_DEBUG_FLAGS ?= -g ; + case haiku : hostDebugFlags ?= -ggdb ; + case haiku_host : hostDebugFlags ?= -ggdb ; + case linux : hostDebugFlags ?= -ggdb ; + case freebsd : hostDebugFlags ?= -ggdb ; + case darwin : hostDebugFlags ?= -ggdb ; + case * : hostDebugFlags ?= -g ; } # debug 0: suppress asserts @@ -769,7 +378,7 @@ HOST_KERNEL_DEBUG_0_C++FLAGS = [ FDefines NDEBUG=$(NDEBUG) ] ; local level ; for level in $(HAIKU_DEBUG_LEVELS[2-]) { - local flags = $(HOST_DEBUG_FLAGS) [ FDefines DEBUG=$(level) ] ; + local flags = $(hostDebugFlags) [ FDefines DEBUG=$(level) ] ; HOST_DEBUG_$(level)_CCFLAGS = $(flags) ; HOST_DEBUG_$(level)_C++FLAGS = $(flags) ; HOST_KERNEL_DEBUG_$(level)_CCFLAGS = $(flags) ; @@ -793,16 +402,9 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) CP = copyattr --data ; } -HOST_DEFINES += $(HOST_ARCH_MACRO_DEFINE) ; +HOST_DEFINES += ARCH_$(HOST_CPU) ; HOST_DEFINES += _NO_INLINE_ASM ; -if $(HOST_PLATFORM_BEOS_COMPATIBLE) { - # TODO: That's obviously not correct, but in the way the COMPILE_FOR_R5 - # macro is used, it actually seems to mean r5/bone/dano. - # TODO: Deprecated. Remove! - HOST_DEFINES += COMPILE_FOR_R5 ; -} - # for builds of tools in the current environment HOST_BUILD_COMPATIBILITY_LIB_DIR = [ FDirName $(HOST_OBJECT_BASE_DIR) lib ] ; @@ -822,8 +424,9 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) { HOST_LIBROOT = root ; HOST_STATIC_LIBROOT = $(HOST_LIBROOT) ; - HOST_LIBBE = be ; - HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR = "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; + HOST_LIBBE = libbe_build.so ; + HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR + = "export LIBRARY_PATH=$LIBRARY_PATH:$(HOST_BUILD_COMPATIBILITY_LIB_DIR)" ; HOST_LIBRARY_NAME_MAP_input_server = /system/servers/input_server ; HOST_DEFINES += __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS ; @@ -918,6 +521,11 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) { tools rm_attrs ] -f ; # assumes that rm_attrs is built with debugging disabled HOST_RM_ATTRS_TARGET = rm_attrs ; + + # If specified, use xattr support to tag files with unique IDs. + if $(HAIKU_HOST_USE_XATTR_REF) = 1 { + HOST_DEFINES += HAIKU_HOST_USE_XATTR_REF ; + } } } @@ -959,37 +567,31 @@ HOST_BE_API_HEADERS = ; HOST_BE_API_CCFLAGS = ; HOST_BE_API_C++FLAGS = ; -if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { - HOST_BE_API_HEADERS = - [ FDirName $(HAIKU_TOP) headers build ] - [ FDirName $(HAIKU_TOP) headers build os ] - [ FDirName $(HAIKU_TOP) headers build os app ] - [ FDirName $(HAIKU_TOP) headers build os drivers ] - [ FDirName $(HAIKU_TOP) headers build os kernel ] - [ FDirName $(HAIKU_TOP) headers build os interface ] - [ FDirName $(HAIKU_TOP) headers build os locale ] - [ FDirName $(HAIKU_TOP) headers build os opengl ] - [ FDirName $(HAIKU_TOP) headers build os storage ] - [ FDirName $(HAIKU_TOP) headers build os support ] - [ FDirName $(HAIKU_TOP) headers build private ] - ; - HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ; - HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ; -} - # Add directory with system headers we need when building something for the host # platform, e.g. containing missing POSIX/GNU headers. HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host $(HOST_PLATFORM) ] ; -# For all versions of BeOS also add the common beos directory. -if $(HOST_PLATFORM) in r5 bone dano { - HOST_HDRS += [ FDirName $(HAIKU_TOP) headers build host beos_common ] ; +HOST_BE_API_HEADERS = + [ FDirName $(HAIKU_TOP) headers build ] + [ FDirName $(HAIKU_TOP) headers build os ] + [ FDirName $(HAIKU_TOP) headers build os app ] + [ FDirName $(HAIKU_TOP) headers build os drivers ] + [ FDirName $(HAIKU_TOP) headers build os kernel ] + [ FDirName $(HAIKU_TOP) headers build os interface ] + [ FDirName $(HAIKU_TOP) headers build os locale ] + [ FDirName $(HAIKU_TOP) headers build os opengl ] + [ FDirName $(HAIKU_TOP) headers build os storage ] + [ FDirName $(HAIKU_TOP) headers build os support ] + [ FDirName $(HAIKU_TOP) headers build private ] +; +if ! $(HOST_PLATFORM_BEOS_COMPATIBLE) { + HOST_BE_API_CCFLAGS = -include BeOSBuildCompatibility.h ; + HOST_BE_API_C++FLAGS = $(HOST_BE_API_CCFLAGS) ; } -#pragma mark - +#pragma mark - target platform settings -# target platform settings # check the target platform compatibility SetPlatformCompatibilityFlagVariables TARGET_PLATFORM : TARGET : target ; @@ -1003,46 +605,59 @@ if $(TARGET_PLATFORM) != haiku { } # Set TARGET_* variables either from HAIKU_* or HOST_* depending on the -# specified TARGET_PLATFORM. +# specified TARGET_PLATFORM. Some variables are package architecture dependent +# and their name gets a respective suffix. A few variables exist both with and +# without suffix. The latter is either equivalent to the variable with the +# primary architecture suffix (e.g. TARGET_ARCH) or is (additionally) applicable +# for all architectures (e.g. TARGET_DEFINES). local buildVars = - ARCH CPU GCC_VERSION KERNEL_ARCH + ARCH ARCHS KERNEL_ARCH PACKAGING_ARCH PACKAGING_ARCHS - AR CC C++ LD OBJCOPY RANLIB ELFEDIT - - INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION - - HDRS CPPFLAGS CCFLAGS C++FLAGS LDFLAGS LINK LINKFLAGS DEFINES - ARFLAGS UNARFLAGS + DEFINES KERNEL_DEFINES KERNEL_CCFLAGS KERNEL_C++FLAGS KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS - WARNING_CCFLAGS WARNING_C++FLAGS KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS - DEBUG_FLAGS - - DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS - KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS KERNEL_DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS PRIVATE_KERNEL_HEADERS - PRIVATE_SYSTEM_HEADERS LIBSTDC++ LIBSUPC++ - STATIC_LIBSTDC++ STATIC_LIBSUPC++ NETWORK_LIBS NETAPI_LIB SELECT_UNAME_ETC_LIB - ARCH_MACRO_DEFINE EXECUTABLE_MIME_TYPE + EXECUTABLE_MIME_TYPE - OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR + OBJECT_BASE_DIR COMMON_ARCH_OBJECT_DIR + ; + +local archDependentBuildVars = + ARCH CPU GCC_VERSION + + AR CC C++ ELFEDIT LD OBJCOPY RANLIB STRIP + + ARFLAGS ASFLAGS UNARFLAGS CPPFLAGS CCFLAGS C++FLAGS HDRS LDFLAGS + LINK LINKFLAGS + + WARNING_CCFLAGS WARNING_C++FLAGS + + DEBUG_$(HAIKU_DEBUG_LEVELS)_CCFLAGS DEBUG_$(HAIKU_DEBUG_LEVELS)_C++FLAGS + + INCLUDES_SEPARATOR LOCAL_INCLUDES_OPTION SYSTEM_INCLUDES_OPTION + + PRIVATE_SYSTEM_HEADERS + + LIBSTDC++ LIBSUPC++ + + ARCH_OBJECT_DIR COMMON_DEBUG_OBJECT_DIR DEBUG_$(HAIKU_DEBUG_LEVELS)_OBJECT_DIR -; + ; if $(TARGET_PLATFORM) = haiku { local var ; @@ -1050,31 +665,37 @@ if $(TARGET_PLATFORM) = haiku { TARGET_$(var) = $(HAIKU_$(var)) ; } - TARGET_GCC_LIB_DIR = $(HAIKU_GCC_LIB_DIR) ; - TARGET_GCC_HEADERS_DIR = $(HAIKU_GCC_HEADERS_DIR) ; - TARGET_GCC_LIBGCC = $(HAIKU_GCC_LIBGCC) ; - TARGET_GCC_LIBGCC_OBJECTS = $(HAIKU_GCC_LIBGCC_OBJECTS) ; + for var in $(archDependentBuildVars)_$(TARGET_PACKAGING_ARCHS) { + TARGET_$(var) = $(HAIKU_$(var)) ; + } - TARGET_KERNEL_LIBGCC = $(HAIKU_KERNEL_LIBGCC) ; - TARGET_KERNEL_LIBSUPC++ = $(HAIKU_KERNEL_LIBSUPC++) ; - TARGET_BOOT_LIBGCC = $(HAIKU_BOOT_LIBGCC) ; - TARGET_BOOT_LIBSUPC++ = $(HAIKU_BOOT_LIBSUPC++) ; + TARGET_KERNEL_LIBGCC + = $(HAIKU_KERNEL_LIBGCC_$(TARGET_PACKAGING_ARCH)) ; + TARGET_KERNEL_LIBSUPC++ + = $(HAIKU_KERNEL_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ; + TARGET_BOOT_LIBGCC + = $(HAIKU_BOOT_LIBGCC_$(TARGET_PACKAGING_ARCH)) ; + TARGET_BOOT_LIBSUPC++ + = $(HAIKU_BOOT_LIBSUPC++_$(TARGET_PACKAGING_ARCH)) ; TARGET_BOOT_PLATFORM ?= $(HAIKU_BOOT_PLATFORM) ; TARGET_BOOT_BOARD ?= $(HAIKU_BOOT_BOARD) ; - TARGET_LIBRARY_NAME_MAP = HAIKU_LIBRARY_NAME_MAP ; - + local architecture ; + for architecture in $(TARGET_PACKAGING_ARCHS) { + TARGET_DEFINES_$(architecture) = $(HAIKU_DEFINES_$(architecture)) ; + TARGET_LIBRARY_NAME_MAP_$(architecture) + = HAIKU_LIBRARY_NAME_MAP_$(architecture) ; + } } else { local var ; for var in $(buildVars) { TARGET_$(var) = $(HOST_$(var)) ; } - TARGET_GCC_LIB_DIR = ; - TARGET_GCC_HEADERS_DIR = ; - TARGET_GCC_LIBGCC = ; - TARGET_GCC_LIBGCC_OBJECTS = ; + for var in $(archDependentBuildVars) { + TARGET_$(var)_$(TARGET_PACKAGING_ARCH) = $(HOST_$(var)) ; + } TARGET_KERNEL_LIBGCC = ; TARGET_KERNEL_LIBSUPC++ = ; @@ -1084,7 +705,10 @@ if $(TARGET_PLATFORM) = haiku { TARGET_BOOT_PLATFORM = ; TARGET_BOOT_BOARD = ; - TARGET_LIBRARY_NAME_MAP = HOST_LIBRARY_NAME_MAP ; + TARGET_DEFINES_$(TARGET_PACKAGING_ARCH) = ; + # all flags are in TARGET_DEFINES + + TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH) = HOST_LIBRARY_NAME_MAP ; } # define macro, for identifying the platform @@ -1120,6 +744,10 @@ if $(HOST_PLATFORM_IS_64_BIT) { HOST_DEFINES += HAIKU_HOST_PLATFORM_64_BIT ; } +# define Haiku packaging architecture macro for host build +HOST_DEFINES += HAIKU_PACKAGING_ARCH=\\\"$(HAIKU_PACKAGING_ARCH)\\\" ; + + #pragma mark - # In case we build for a BeOS compatible platform, but not for Haiku, we @@ -1130,8 +758,8 @@ if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { # headers and flags local compatibilityHeader = -include [ FDirName $(HAIKU_TOP) headers build HaikuBuildCompatibility.h ] ; - TARGET_CCFLAGS += $(compatibilityHeader) ; - TARGET_C++FLAGS += $(compatibilityHeader) ; + TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH) += $(compatibilityHeader) ; + TARGET_C++FLAGS_$(TARGET_PACKAGING_ARCH) += $(compatibilityHeader) ; # compatibility library TARGET_HAIKU_COMPATIBILITY_LIBS = libhaikucompat.a ; @@ -1141,13 +769,13 @@ if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) && $(TARGET_PLATFORM_BEOS_COMPATIBLE) { if $(TARGET_PLATFORM) = libbe_test { # headers and flags - TARGET_HDRS += + TARGET_HDRS_$(TARGET_PACKAGING_ARCH) += [ PublicHeaders $(DOT) app drivers game interface kernel locale storage support ] [ PrivateHeaders $(DOT) ] ; TARGET_DEFINES += __HAIKU__ ; - TARGET_PRIVATE_SYSTEM_HEADERS = + TARGET_PRIVATE_SYSTEM_HEADERS_$(TARGET_PACKAGING_ARCH) = [ PrivateHeaders $(DOT) system system/arch/$(TARGET_ARCH) ] ; # directories @@ -1155,28 +783,30 @@ if $(TARGET_PLATFORM) = libbe_test { = [ FDirName $(HAIKU_OBJECT_DIR) $(TARGET_PLATFORM) ] ; TARGET_COMMON_ARCH_OBJECT_DIR = [ FDirName $(TARGET_OBJECT_BASE_DIR) common ] ; - TARGET_ARCH_OBJECT_DIR + TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) = [ FDirName $(TARGET_OBJECT_BASE_DIR) $(TARGET_ARCH) ] ; - TARGET_COMMON_DEBUG_OBJECT_DIR - = [ FDirName $(TARGET_ARCH_OBJECT_DIR) common ] ; - TARGET_DEBUG_0_OBJECT_DIR - = [ FDirName $(TARGET_ARCH_OBJECT_DIR) release ] ; + TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) + = [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) + common ] ; + TARGET_DEBUG_0_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) + = [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) + release ] ; local level ; for level in $(HAIKU_DEBUG_LEVELS[2-]) { - TARGET_DEBUG_$(level)_OBJECT_DIR - = [ FDirName $(TARGET_ARCH_OBJECT_DIR) debug_$(level) ] ; + TARGET_DEBUG_$(level)_OBJECT_DIR_$(TARGET_PACKAGING_ARCH) + = [ FDirName $(TARGET_ARCH_OBJECT_DIR_$(TARGET_PACKAGING_ARCH)) + debug_$(level) ] ; } # library name map - TARGET_LIBRARY_NAME_MAP = LIBBE_LIBRARY_NAME_MAP ; + TARGET_LIBRARY_NAME_MAP_$(TARGET_PACKAGING_ARCH) = LIBBE_LIBRARY_NAME_MAP ; LIBBE_LIBRARY_NAME_MAP_be = libbe_test.so ; } -#pragma mark - +#pragma mark - common stuff -# common stuff # start with a clean state CCFLAGS = ; @@ -1189,13 +819,6 @@ CC = bad-cc ; C++ = bad-c++ ; LINK = bad-link ; -# Allow compiling unit tests on Zeta. Instead of fixing the PostMessage() -# issues, they deprecated that nice function. This will enable it again: -C++FLAGS += -D_ZETA_USING_DEPRECATED_API_=1 ; -# Same for buggy find_directory threadsafety fixes -C++FLAGS += -D_ZETA_TS_FIND_DIR_=1 ; - # TODO: Doesn't really belong here. - # Defaults for warnings, optimization, and debugging. # @@ -1236,8 +859,20 @@ HAIKU_APP_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) apps ] ; HAIKU_APP_TEST_LIB_DIR ?= [ FDirName $(HAIKU_APP_TEST_DIR) lib ] ; HAIKU_TMP_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) tmp ] ; -HAIKU_PACKAGE_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) packages ] ; -HAIKU_PACKAGE_OBJECT_DIR ?= [ FDirName $(HAIKU_OBJECT_DIR) packages ] ; +local architecture ; +for architecture in $(HAIKU_PACKAGING_ARCHS) { + local baseDir + = [ FDirName $(TARGET_OBJECT_BASE_DIR) $(architecture) packaging ] ; + HAIKU_PACKAGES_DIR_$(architecture) = [ FDirName $(baseDir) packages ] ; + HAIKU_PACKAGES_BUILD_DIR_$(architecture) + = [ FDirName $(baseDir) packages_build ] ; + HAIKU_PACKAGE_REPOSITORIES_DIR_$(architecture) + = [ FDirName $(baseDir) repositories ] ; +} + + +HAIKU_PACKAGE_INFOS_DIR = [ FDirName $(HAIKU_TOP) src data + package_infos ] ; TARGET_TEST_DIR ?= [ FDirName $(HAIKU_TEST_DIR) $(TARGET_PLATFORM) ] ; @@ -1252,197 +887,27 @@ SUBDIRRULES += SetupObjectsDir ; # with imported sources. AUTO_SET_UP_CONFIG_VARIABLES += HOST_WARNING_CCFLAGS HOST_WARNING_C++FLAGS - TARGET_WARNING_CCFLAGS TARGET_WARNING_C++FLAGS + TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCHS) + TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCHS) + ; - # also add PLATFORM and SUPPORTED_PLATFORMS - PLATFORM SUPPORTED_PLATFORMS -; +# also add PLATFORM and SUPPORTED_PLATFORMS +AUTO_SET_UP_CONFIG_VARIABLES += PLATFORM SUPPORTED_PLATFORMS ; -# enable -Werror for certain parts of the source tree -HAIKU_WERRORFLAGS = ; -if $(HAIKU_GCC_VERSION[1]) >= 4 { - # -Wuninitialized gives too many false positives. - HAIKU_WERRORFLAGS = -Wno-error=uninitialized ; - - # TODO: remove the -Wno-unused-but-set-variable option - HAIKU_WERRORFLAGS += -Wno-unused-but-set-variable ; +# set up warnings +local architecture ; +for architecture in $(TARGET_PACKAGING_ARCHS) { + ArchitectureSetupWarnings $(architecture) ; } -rule EnableWerror dirTokens : scope { - AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) - : -Werror $(HAIKU_WERRORFLAGS) : $(scope) ; - AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) - : -Werror $(HAIKU_WERRORFLAGS) : $(scope) ; + +# set up architecture build features +local architecture ; +for architecture in $(TARGET_PACKAGING_ARCHS) { + InitArchitectureBuildFeatures $(architecture) ; } -# Work-around for GCC 2 problem -- despite -Wno-multichar it reports -# multichar warnings in headers/private/kernel/debugger_keymaps.h included by -# src/system/kernel/arch/x86/arch_debug_console.cpp. -if $(HAIKU_GCC_VERSION[1]) = 2 { - local file = arch_debug_console.o ; - C++FLAGS on $(file) = [ on $(file) return $(C++FLAGS) ] ; -} - -if $(HAIKU_NO_WERROR) != 1 { - EnableWerror src add-ons accelerants 3dfx ; - EnableWerror src add-ons accelerants ati ; - EnableWerror src add-ons accelerants common ; - EnableWerror src add-ons accelerants et6x00 ; -# EnableWerror src add-ons accelerants intel_extreme ; -# EnableWerror src add-ons accelerants matrox ; - EnableWerror src add-ons accelerants neomagic ; -# EnableWerror src add-ons accelerants nvidia ; - EnableWerror src add-ons accelerants nvidia_gpgpu ; -# EnableWerror src add-ons accelerants radeon ; -# EnableWerror src add-ons accelerants radeon_hd ; - EnableWerror src add-ons accelerants s3 ; - EnableWerror src add-ons accelerants skeleton ; - EnableWerror src add-ons accelerants vesa ; - EnableWerror src add-ons accelerants via ; - EnableWerror src add-ons accelerants vmware ; - EnableWerror src add-ons bluetooth ; - EnableWerror src add-ons decorators ; - EnableWerror src add-ons disk_systems ; - EnableWerror src add-ons input_server devices ; -# EnableWerror src add-ons input_server filters ; -# EnableWerror src add-ons input_server methods ; - EnableWerror src add-ons kernel bluetooth ; -# EnableWerror src add-ons kernel bus_managers acpi ; - EnableWerror src add-ons kernel bus_managers agp_gart ; - EnableWerror src add-ons kernel bus_managers ata ; - EnableWerror src add-ons kernel bus_managers config_manager ; -# EnableWerror src add-ons kernel bus_managers firewire ; - EnableWerror src add-ons kernel bus_managers isa ; - EnableWerror src add-ons kernel bus_managers pci ; -# EnableWerror src add-ons kernel bus_managers ps2 ; # gcc2 - EnableWerror src add-ons kernel bus_managers scsi ; - EnableWerror src add-ons kernel bus_managers usb ; - EnableWerror src add-ons kernel busses agp_gart ; - EnableWerror src add-ons kernel busses ata ; - EnableWerror src add-ons kernel busses scsi ; - EnableWerror src add-ons kernel busses usb ; - EnableWerror src add-ons kernel console ; - EnableWerror src add-ons kernel cpu ; -# EnableWerror src add-ons kernel debugger ; # gcc2 -# EnableWerror src add-ons kernel drivers audio ; - EnableWerror src add-ons kernel drivers bluetooth ; - EnableWerror src add-ons kernel drivers bus ; - EnableWerror src add-ons kernel drivers common ; - EnableWerror src add-ons kernel drivers disk ; - EnableWerror src add-ons kernel drivers dvb ; -# EnableWerror src add-ons kernel drivers graphics ; -# EnableWerror src add-ons kernel drivers input ; - EnableWerror src add-ons kernel drivers joystick ; - EnableWerror src add-ons kernel drivers midi ; - EnableWerror src add-ons kernel drivers misc ; -# EnableWerror src add-ons kernel drivers network ; - EnableWerror src add-ons kernel drivers ports ; -# EnableWerror src add-ons kernel drivers power ; - EnableWerror src add-ons kernel drivers printer ; - EnableWerror src add-ons kernel drivers random ; - EnableWerror src add-ons kernel drivers tty ; - EnableWerror src add-ons kernel drivers video ; - EnableWerror src add-ons kernel file_systems bfs ; - EnableWerror src add-ons kernel file_systems cdda ; -# EnableWerror src add-ons kernel file_systems ext2 ; -# EnableWerror src add-ons kernel file_systems fat ; -# EnableWerror src add-ons kernel file_systems googlefs ; - EnableWerror src add-ons kernel file_systems iso9660 ; - EnableWerror src add-ons kernel file_systems layers ; - EnableWerror src add-ons kernel file_systems netfs ; - EnableWerror src add-ons kernel file_systems nfs ; - EnableWerror src add-ons kernel file_systems nfs4 ; -# EnableWerror src add-ons kernel file_systems ntfs ; - EnableWerror src add-ons kernel file_systems packagefs ; - EnableWerror src add-ons kernel file_systems ramfs ; -# EnableWerror src add-ons kernel file_systems reiserfs ; - EnableWerror src add-ons kernel file_systems udf ; - EnableWerror src add-ons kernel file_systems userlandfs ; - EnableWerror src add-ons kernel generic ; -# EnableWerror src add-ons kernel network datalink_protocols ; - EnableWerror src add-ons kernel network devices ; - EnableWerror src add-ons kernel network dns_resolver ; - EnableWerror src add-ons kernel network notifications ; - EnableWerror src add-ons kernel network ppp ; - EnableWerror src add-ons kernel network protocols ; -# EnableWerror src add-ons kernel network stack ; - EnableWerror src add-ons kernel partitioning_systems ; - EnableWerror src add-ons locale ; - EnableWerror src add-ons mail_daemon ; - EnableWerror src add-ons media media-add-ons demultiplexer ; - EnableWerror src add-ons media media-add-ons dvb ; - EnableWerror src add-ons media media-add-ons esound_sink ; - EnableWerror src add-ons media media-add-ons finepix_webcam ; - EnableWerror src add-ons media media-add-ons firewire_dv ; - EnableWerror src add-ons media media-add-ons legacy ; - EnableWerror src add-ons media media-add-ons mixer ; - EnableWerror src add-ons media media-add-ons multi_audio ; - EnableWerror src add-ons media media-add-ons opensound ; - EnableWerror src add-ons media media-add-ons radeon ; - EnableWerror src add-ons media media-add-ons reader ; - EnableWerror src add-ons media media-add-ons tone_producer_demo ; - EnableWerror src add-ons media media-add-ons usb_vision ; -# EnableWerror src add-ons media media-add-ons usb_webcam ; - EnableWerror src add-ons media media-add-ons video_mixer ; -# EnableWerror src add-ons media media-add-ons video_producer_demo ; - EnableWerror src add-ons media media-add-ons videowindow ; - EnableWerror src add-ons media media-add-ons writer ; - EnableWerror src add-ons media plugins ac3_decoder ; - EnableWerror src add-ons media plugins aiff_reader ; - EnableWerror src add-ons media plugins ape_reader ; -# EnableWerror src add-ons media plugins asf_reader ; - EnableWerror src add-ons media plugins au_reader ; -# EnableWerror src add-ons media plugins avi_reader ; -# EnableWerror src add-ons media plugins ffmpeg ; -# EnableWerror src add-ons media plugins matroska ; -# EnableWerror src add-ons media plugins mov_reader ; - EnableWerror src add-ons media plugins mp3_decoder ; -# EnableWerror src add-ons media plugins mp3_reader ; - EnableWerror src add-ons media plugins mp4_reader ; - EnableWerror src add-ons media plugins musepack ; -# EnableWerror src add-ons media plugins ogg ; -# EnableWerror src add-ons media plugins raw_decoder ; -# EnableWerror src add-ons media plugins speex ; - EnableWerror src add-ons media plugins theora ; - EnableWerror src add-ons media plugins vorbis ; -# EnableWerror src add-ons media plugins wav_reader ; - EnableWerror src add-ons media plugins xvid_decoder ; - EnableWerror src add-ons opengl ; - EnableWerror src add-ons print ; - EnableWerror src add-ons screen_savers ; - EnableWerror src add-ons tracker ; - EnableWerror src add-ons translators bmp ; -# EnableWerror src add-ons translators exr ; - EnableWerror src add-ons translators gif ; -# EnableWerror src add-ons translators hpgs ; - EnableWerror src add-ons translators hvif ; - EnableWerror src add-ons translators ico ; -# EnableWerror src add-ons translators jpeg ; # gcc2 - EnableWerror src add-ons translators jpeg2000 ; - EnableWerror src add-ons translators pcx ; -# EnableWerror src add-ons translators png ; # gcc2 - EnableWerror src add-ons translators ppm ; - EnableWerror src add-ons translators raw ; - EnableWerror src add-ons translators rtf ; - EnableWerror src add-ons translators sgi ; - EnableWerror src add-ons translators shared ; -# EnableWerror src add-ons translators stxt ; - EnableWerror src add-ons translators tga ; - EnableWerror src add-ons translators tiff ; -# EnableWerror src add-ons translators wonderbrush ; - EnableWerror src add-ons print ; - EnableWerror src bin package ; - EnableWerror src apps ; - EnableWerror src kits ; - EnableWerror src preferences ; - EnableWerror src servers ; - EnableWerror src system kernel ; - EnableWerror src system libroot add-ons ; - EnableWerror src system libroot posix locale ; - EnableWerror src system libroot posix wchar ; - EnableWerror src system runtime_loader ; -} # The following directories cannot currently be compiled with DEBUG=1 SetConfigVar DEBUG : HAIKU_TOP src add-ons disk_systems bfs : 0 : local ; diff --git a/build/jam/CommandLineArguments b/build/jam/CommandLineArguments index 84d9d633a3..bb0aab796b 100644 --- a/build/jam/CommandLineArguments +++ b/build/jam/CommandLineArguments @@ -66,6 +66,16 @@ rule ProcessCommandLineArguments } } + # Copy the given set of local package files to the remote repository + # and create a new version of that remote repository. + case build-remote-repository : { + BuildRemoteHaikuPortsRepository $(JAM_TARGETS[1]) + : $(JAM_TARGETS[2-]) ; + JAM_TARGETS = $(JAM_TARGETS[1]) ; + NotFile $(JAM_TARGETS) ; + Always $(JAM_TARGETS) ; + } + # A target starting with "@" is a build profile. case @* : { HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ; @@ -81,7 +91,9 @@ rule ProcessCommandLineArguments if $(JAM_TARGETS[1]) in update-image update-vmware-image update-install { SetUpdateHaikuImageOnly 1 ; + HAIKU_PACKAGES_UPDATE_ONLY = 1 ; HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; + HAIKU_INCLUDE_IN_PACKAGES on $(JAM_TARGETS[2-]) = 1 ; if $(JAM_TARGETS[1]) = update-image { JAM_TARGETS = haiku-image ; diff --git a/build/jam/DefaultBuildProfiles b/build/jam/DefaultBuildProfiles new file mode 100644 index 0000000000..55605404c8 --- /dev/null +++ b/build/jam/DefaultBuildProfiles @@ -0,0 +1,201 @@ +# set HAIKU_BOOTSTRAP_BUILD early, if building a bootstrap Haiku image +switch $(HAIKU_BUILD_PROFILE) { + case "bootstrap-*" : + HAIKU_BOOTSTRAP_BUILD = 1 ; +} + + +rule DefineDefaultBuildProfiles +{ + # alpha release profiles + DefineBuildProfile alpha-raw : image : "haiku-alpha.image" ; + DefineBuildProfile alpha-vmware : vmware-image : "haiku-alpha.vmdk" ; + DefineBuildProfile alpha-cd : cd-image : "haiku-alpha.iso" ; + DefineBuildProfile alpha-anyboot : anyboot-image + : "haiku-alpha-anyboot.image" ; + + # nightly profiles + DefineBuildProfile nightly-raw : image : "haiku-nightly.image" ; + DefineBuildProfile nightly-vmware : vmware-image : "haiku-nightly.vmdk" ; + DefineBuildProfile nightly-cd : cd-image : "haiku-nightly.iso" ; + DefineBuildProfile nightly-anyboot : anyboot-image + : "haiku-nightly-anyboot.image" ; + + # bootstrap profiles + DefineBuildProfile bootstrap-raw : image : "haiku-bootstrap.image" ; + DefineBuildProfile bootstrap-vmware : vmware-image + : "haiku-bootstrap.vmdk" ; + + switch $(HAIKU_BUILD_PROFILE) { + case "alpha-*" : { + Echo Building Haiku R1/alpha ; + HAIKU_ROOT_USER_NAME = user ; + HAIKU_ROOT_USER_REAL_NAME = "Yourself" ; + AddGroupToHaikuImage party : 101 : user sshd ; + HAIKU_IMAGE_HOST_NAME = shredder ; + HAIKU_IMAGE_SIZE = 800 ; + + AddHaikuImagePackages + wpa_supplicant + : + system + ; + + AddHaikuImagePackages + bepdf + cvs + keymapswitcher + man + mercurial + nano + openssh + p7zip + pe + python + subversion + timgmsoundfont + vision + wonderbrush + wqy_microhei + xz_utils@!gcc2 + ; + + # xz_utils can't be built with gcc2, so a mere gcc2 system doesn't + # have it. However, xz_utils does exist for the secondary (gcc4) + # architecture of a gcc2 hybrid. + if $(HAIKU_PACKAGING_ARCHS) != x86_gcc2 { + AddHaikuImagePackages + xz_utils_x86@gcc2 + ; + } + + local architectureObject ; + for architectureObject in [ MultiArchSubDirSetup ] { + on $(architectureObject) { + AddHaikuImagePackages openssl : system ; + } + } + + AddOptionalHaikuImagePackages BeBook Development Git WebPositive + Welcome ; + } + + case "beta-*" : { + Echo You wish. ; + } + + case "nightly-*" : { + Echo Building Haiku Nightly ; + HAIKU_ROOT_USER_NAME = user ; + HAIKU_ROOT_USER_REAL_NAME = "Yourself" ; + AddGroupToHaikuImage party : 101 : user sshd ; + HAIKU_IMAGE_HOST_NAME = shredder ; + HAIKU_IMAGE_SIZE = 600 ; + + AddHaikuImagePackages + openssl + wpa_supplicant + : + system + ; + + AddHaikuImagePackages + man + nano + openssh + p7zip + pe + vision + xz_utils + ; + + AddOptionalHaikuImagePackages Development Git WebPositive ; + } + + case "bootstrap-*" : { + Echo Building Haiku Bootstrap ; + HAIKU_IMAGE_HOST_NAME = shredder ; + HAIKU_IMAGE_SIZE = 20000 ; + + AddHaikuImagePackages + freetype + freetype_devel + grep + icu + libsolv + ncurses + ncurses_devel + sed + zlib + zlib_devel + : + system + ; + + AddHaikuImagePackages + autoconf + automake + binutils + bison + flex + gcc + haikuporter +# jam + libtool + libtool_libltdl + m4 + make +# makeinfo +# mkdepend +# perl + python +# texinfo + ; + + # secondary architecture packages + local architectureObject ; + for architectureObject + in [ MultiArchSubDirSetup $(TARGET_PACKAGING_ARCHS[2-]) ] { + on $(architectureObject) { + AddHaikuImagePackages + freetype + freetype_devel + icu + libsolv + ncurses + ncurses_devel + zlib + zlib_devel + : + system + ; + + AddHaikuImagePackages + binutils + gcc + ; + } + } + + AddOptionalHaikuImagePackages DevelopmentMin ; + } + } + + + # Uncomment in official release branch. + #HAIKU_DEFINES += HAIKU_OFFICIAL_RELEASE ; + #TARGET_DEFINES += HAIKU_OFFICIAL_RELEASE ; + + + # If a build profile was specified on the command line, now is the time to + # check whether it is unknown or one of the default profiles. + if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) { + # define the obvious default profiles + if $(HAIKU_BUILD_PROFILE) in anyboot-image cd-image image install + vmware-image { + DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ; + } else { + Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ; + } + } +} diff --git a/build/jam/FileRules b/build/jam/FileRules index 86fbe8b2c6..6a4b02e98e 100644 --- a/build/jam/FileRules +++ b/build/jam/FileRules @@ -1,3 +1,20 @@ +rule Copy +{ + if $(2) { + SEARCH on $(2) += $(SEARCH_SOURCE) ; + Depends $(1) : copyattr $(2) ; + Copy1 $(1) : copyattr $(2) ; + } +} + + +actions Copy1 +{ + $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) + "$(2[1])" -d "$(2[2-])" "$(1)" +} + + rule SymLink { # SymLink : : ; @@ -186,7 +203,8 @@ rule UnarchiveObjects actions UnarchiveObjects { - ( cd $(1[1]:D) && $(TARGET_AR) $(TARGET_UNARFLAGS) "$(2)" $(1:BS) ) + ( cd $(1[1]:D) && $(TARGET_AR_$(TARGET_PACKAGING_ARCH)) \ + $(TARGET_UNARFLAGS_$(TARGET_PACKAGING_ARCH)) "$(2)" $(1:BS) ) } @@ -220,7 +238,7 @@ rule ExtractArchive directory : entries : archiveFile : grist targets += $(target) ; } - LOCATE on $(targets) = $(directory) ; + LOCATE on $(targets) = $(directory:G=) ; Depends $(targets) : $(directory) $(archiveFile) ; NoUpdate $(targets) ; @@ -235,40 +253,53 @@ rule ExtractArchive directory : entries : archiveFile : grist Depends $(directory) : $(archiveFile) ; switch $(archiveFile:S) { - case .zip : ExtractZipArchive1 $(targets) : $(directory) - $(archiveFile) ; - case .tgz : ExtractTarArchive1 $(targets) : $(directory) - $(archiveFile) ; - case "" : Exit "ExtractArchive: No archive passed" ; - case * : Exit "ExtractArchive: Unhandled archive extension: - $(archiveFile:S)" ; + case .zip : + ExtractZipArchive1 $(directory) : $(archiveFile) ; + + case .tgz : + ExtractTarArchive1 $(directory) : $(archiveFile) ; + + case .hpkg : + Depends $(directory) : package ; + ExtractHPKGArchive1 $(directory) + : package $(archiveFile) ; + + case "" : + Exit "ExtractArchive: No archive passed" ; + + case * : + Exit "ExtractArchive: Unhandled archive extension:" + "$(archiveFile:S)" ; } INITIALIZED on $(directory) = 1 ; } - # Use a dummy rule so that it looks to jam like the targets are actually - # built from the directory target. - ExtractArchiveDummy $(targets) : $(directory) ; - return $(targets) ; } + actions ExtractZipArchive1 { - mkdir -p $(2[1]) - unzip -q -u -o -d $(2[1]) $(2[2]) + mkdir -p $(1) + unzip -q -u -o -d $(1) $(2) } + actions ExtractTarArchive1 { - mkdir -p $(2[1]) - tar -C $(2[1]) -xf $(2[2]) + mkdir -p $(1) + tar -C $(1) -xf $(2) } -actions ExtractArchiveDummy + +actions ExtractHPKGArchive1 { + mkdir -p "$(1)" + $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) + $(2[1]) extract -C "$(1)" "$(2[2])" } + rule ObjectReference { # ObjectReference : @@ -297,52 +328,63 @@ rule ObjectReferences } } + rule CopySetHaikuRevision target : source { # CopySetHaikuRevision : # - # Copy to , writing the SVN revision of the working root + # Copy to , writing the Git revision of the working # directory into the haiku revision section of . # # - Output file target. Gristed and located target. # - ELF object to be copied. Gristed and located target. - # If existent, make the target depend on the .svn/entries file in the + # If existing, make the target depend on the .git/index file in the # root directory, so it gets updated when the revision changes due to - # "svn up". - if [ Glob [ FDirName $(HAIKU_TOP) .svn ] : entries ] { - local svnEntries = entries ; - SEARCH on $(svnEntries) = [ FDirName $(HAIKU_TOP) .svn ] ; - Depends $(target) : $(svnEntries) ; - } else if [ Glob [ FDirName $(HAIKU_TOP) .git ] : index ] { - local gitIndex = index ; - SEARCH on $(gitIndex) = [ FDirName $(HAIKU_TOP) .git ] ; - Depends $(target) : $(gitIndex) ; - } else if [ Glob [ FDirName $(HAIKU_TOP) .hg ] : store ] { - local hgStore = store ; - SEARCH on $(hgStore) = [ FDirName $(HAIKU_TOP) .hg ] ; - Depends $(target) : $(hgStore) ; + # commits or merges. + local gitIndex = index ; + local revisionFile = haiku-revision ; + if ! [ on $(gitIndex) return $(HAIKU_GIT_REVISION_DETERMINED) ] { + if [ Glob [ FDirName $(HAIKU_TOP) .git ] : index ] { + HAIKU_GIT_REVISION_DETERMINED on $(gitIndex) = 1 ; + SEARCH on $(gitIndex) = [ FDirName $(HAIKU_TOP) .git ] ; + MakeLocate $(revisionFile) : $(HAIKU_BUILD_OUTPUT_DIR) ; + Depends $(revisionFile) : $(gitIndex) ; + DetermineHaikuRevision $(revisionFile) : $(gitIndex) ; + } else { + revisionFile = ; + } } - HAIKU_INCLUDE_IN_IMAGE on $(target) - = [ on $(source) return $(HAIKU_INCLUDE_IN_IMAGE) ] ; + PropagateContainerUpdateTargetFlags $(target) : $(source) ; - Depends $(target) : copyattr set_haiku_revision $(source) ; + Depends $(target) + : copyattr set_haiku_revision $(source) $(revisionFile) ; CopySetHaikuRevision1 $(target) - : copyattr set_haiku_revision $(source) ; + : copyattr set_haiku_revision $(source) $(revisionFile) ; } + actions CopySetHaikuRevision1 { $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) - . $(HAIKU_TOP)/build/scripts/determine_haiku_revision - determineHaikuRevision $(HAIKU_TOP) $(HAIKU_BUILD_OUTPUT_DIR) + $(2[1]) --data $(2[3]) $(1) || exit 1 - $(2[1]) --data $(2[3]) $(1) && - $(2[2]) $(1) ${revision} + revision=0 + if [ -n "$(2[4]:E=)" ]; then + revision="`cat $(2[4]:E=)`" + fi + $(2[2]) $(1) "$revision" } + +actions DetermineHaikuRevision +{ + $(HAIKU_TOP)/build/scripts/determine_haiku_revision $(HAIKU_TOP) $(1) +} + + rule DataFileToSourceFile sourceFile : dataFile : dataVariable : sizeVariable { sourceFile = [ FGristFiles $(sourceFile) ] ; @@ -364,20 +406,36 @@ actions DataFileToSourceFile1 $(2[1]) $(DATA_VARIABLE) $(SIZE_VARIABLE) $(2[2]) $(1) } -rule DownloadLocatedFile target : url +rule DownloadLocatedFile target : url : source { + # DownloadLocatedFile : [ : ] ; + # + # is an optional target that will be made dependent on. + # Its resolved path can be used in via '$source'. + URL on $(target) = $(url) ; - DownloadLocatedFile1 $(target) ; + if $(source) { + Depends $(target) : $(source) ; + } + + DownloadLocatedFile1 $(target) : $(source) ; } actions DownloadLocatedFile1 { - wget -O "$(1)" $(URL) + source="$(2)" + wget -O "$(1)" $(URL) || exit 1 + touch "$(1)" } -rule DownloadFile file : url +rule DownloadFile file : url : source { + # DownloadFile : [ : ] ; + # + # is an optional target that the target will be made dependent on. + # Its resolved path can be used in via '$source'. + file = $(file:G=download) ; # Request the download only once. @@ -388,8 +446,15 @@ rule DownloadFile file : url HAIKU_FILE_DOWNLOAD on $(file) = 1 ; MakeLocate $(file) : $(HAIKU_DOWNLOAD_DIR) ; - DownloadLocatedFile $(file) : $(url) ; + DownloadLocatedFile $(file) : $(url) : $(source) ; return $(file) ; } + +actions ChecksumFileSHA256 +{ + $(HOST_SHA256) $(2) | sed -r 's,([^[:space:]]*).*,\1,' > $(1) + # The sed part is only necessary for sha256sum, but it doesn't harm for + # sha256 either. +} diff --git a/build/jam/HaikuPackages b/build/jam/HaikuPackages new file mode 100644 index 0000000000..836c2933dd --- /dev/null +++ b/build/jam/HaikuPackages @@ -0,0 +1,60 @@ +# The packages we build. Each is defined in its own file in the packages/ +# subdirectory. +local packages = + HaikuDevel + HaikuLoader + HaikuUserguide + HaikuWelcome + MakefileEngine + ; + +if $(HAIKU_BOOTSTRAP_BUILD) { + packages += HaikuBootstrap ; +} else { + packages += Haiku ; +} + +local archDependentPackages = + HaikuCrossDevel + WebPositive + ; + +local secondaryArchPackages = + HaikuDevelSecondary + ; +if $(HAIKU_BOOTSTRAP_BUILD) { + secondaryArchPackages += HaikuSecondaryBootstrap ; +} else { + secondaryArchPackages += HaikuSecondary ; +} + + +packages = $(packages:G=package-rules) ; +archDependentPackages = $(archDependentPackages:G=package-rules) ; +secondaryArchPackages = $(secondaryArchPackages:G=package-rules) ; +SEARCH on $(packages) $(archDependentPackages) $(secondaryArchPackages) + = [ FDirName $(HAIKU_BUILD_RULES_DIR) packages ] ; + +local package ; +for package in $(packages) { + include $(package) ; +} + +for package in $(archDependentPackages) { + local architectureObject ; + for architectureObject in [ MultiArchSubDirSetup ] { + on $(architectureObject) { + include $(package) ; + } + } +} + +for package in $(secondaryArchPackages) { + local architectureObject ; + for architectureObject in + [ MultiArchSubDirSetup $(TARGET_PACKAGING_ARCHS[2-]) ] { + on $(architectureObject) { + include $(package) ; + } + } +} diff --git a/build/jam/HeadersRules b/build/jam/HeadersRules index b111dcba81..bad637f052 100644 --- a/build/jam/HeadersRules +++ b/build/jam/HeadersRules @@ -71,11 +71,13 @@ rule ObjectSysHdrs [ FSysIncludes $(sysHeaders) : $(HOST_SYSTEM_INCLUDES_OPTION) ] ; } else { + local architecture = $(TARGET_PACKAGING_ARCH) ; fileHeaders = - [ FIncludes $(HDRS) : $(TARGET_LOCAL_INCLUDES_OPTION) ] - $(TARGET_INCLUDES_SEPARATOR) + [ FIncludes $(HDRS) + : $(TARGET_LOCAL_INCLUDES_OPTION_$(architecture)) ] + $(TARGET_INCLUDES_SEPARATOR_$(architecture)) [ FSysIncludes $(sysHeaders) - : $(TARGET_SYSTEM_INCLUDES_OPTION) ] ; + : $(TARGET_SYSTEM_INCLUDES_OPTION_$(architecture)) ] ; } ASHDRS on $(file) = $(fileHeaders) ; @@ -408,7 +410,22 @@ rule UsePrivateKernelHeaders rule UsePrivateSystemHeaders { - UseHeaders $(TARGET_PRIVATE_SYSTEM_HEADERS) : true ; + UseHeaders $(TARGET_PRIVATE_SYSTEM_HEADERS_$(TARGET_PACKAGING_ARCH)) + : true ; +} + + +rule UseBuildFeatureHeaders feature : attribute +{ + # UseBuildFeatureHeaders : [ ] ; + # A shorthand for + # UseHeaders [ BuildFeatureAttribute : ] : true ; + # Moreover the default value for is "headers", which usually + # allows the rule to be called with the feature name as the only parameter. + + local headers = [ BuildFeatureAttribute $(feature) : $(attribute:E=headers) + : path ] ; + UseHeaders $(headers) : true ; } @@ -426,7 +443,7 @@ rule FStandardOSHeaders } -rule FStandardHeaders +rule FStandardHeaders architecture { local osIncludes = add-ons add-ons/file_system add-ons/graphics add-ons/input_server add-ons/registrar @@ -439,14 +456,14 @@ rule FStandardHeaders # The C++ headers. If specified, we use the compiler headers, otherwise # the ones that come with our libstdc++. - if $(HAIKU_C++_HEADERS_DIR) { - headers += $(HAIKU_C++_HEADERS_DIR) ; + if $(HAIKU_C++_HEADERS_DIR_$(architecture)) { + headers += $(HAIKU_C++_HEADERS_DIR_$(architecture)) ; } else { headers += [ FDirName $(HAIKU_TOP) headers cpp ] ; } # GCC headers - headers += $(HAIKU_GCC_HEADERS_DIR) ; + headers += $(HAIKU_GCC_HEADERS_DIR_$(architecture)) ; # Use headers directory, to allow to do things like include headers += [ FDirName $(HAIKU_TOP) headers ] ; diff --git a/build/jam/HelperRules b/build/jam/HelperRules index 5cce26dc7d..31d05f2e43 100644 --- a/build/jam/HelperRules +++ b/build/jam/HelperRules @@ -97,26 +97,28 @@ rule FSplitPath } -rule FSetConditionsHold conditions : set +rule FConditionsHold conditions : predicate { - # FSetConditionsHold : ; - # Checks whether the conditions are satisfied by the list of - # elements and returns a respective result (if so: "1", if not: empty - # list). The conditions are satisfied when is not empty and + # FConditionsHold : ; + # Checks whether the conditions are satisfied by the predicate + # rule and returns a respective result (if so: "1", if not: + # empty list). The conditions are satisfied when is not empty + # and # * none of the negative conditions it contains hold and - # * if contains any positive conditions, at least one one of - # those holds. + # * if contains any positive conditions, at least one of those + # holds. # A positive condition is an element not starting with a "!". It holds when - # the element is contained in . + # the predicate rule returns true for the element. # A negative condition is an element that starts with a "!". It holds when - # the string resulting from removing the leading "!" is not contained in - # . + # the predicate rule returns true for the string resulting from + # removing the leading "!". # # - The list of conditions. - # - The elements against which the conditions are tested. + # - The predicate rule invoked to test the elements. # # Examples: - # For set { a b c } the following conditions hold: + # For a predicate that holds for the elements of the set { a b c } the + # following conditions hold: # { a }, { a d }, { !d }, { !d !e }, { a !d }, { b !e !f } # The following conditions don't hold: # { }, { d }, { d e }, { !a }, { !a b }, { !d e } { a b !c !d } @@ -131,14 +133,14 @@ rule FSetConditionsHold conditions : set { hasNegative = 1 ; condition = [ Match "!(.*)" : $(condition) ] ; - if $(condition) in $(set) { + if [ $(predicate) $(condition) ] { return ; } } case * : { hasPositive = 1 ; - if $(condition) in $(set) { + if [ $(predicate) $(condition) ] { positiveMatch = 1 ; } } @@ -205,6 +207,9 @@ rule SetPlatformCompatibilityFlagVariables $(varPrefix)_PLATFORM_HAIKU_COMPATIBLE = true ; } + case host : + # not compatible to anything + case * : { if ! ( $(platform) in $(otherPlatforms) ) { @@ -267,19 +272,19 @@ rule FAnalyzeGCCVersion return $(version) ; } -rule SetIncludePropertiesVariables +rule SetIncludePropertiesVariables prefix : suffix { - # SetIncludePropertiesVariables ; + # SetIncludePropertiesVariables : ; # - local prefix = $(1) ; - if $($(prefix)_GCC_VERSION[1]) < 4 { - $(prefix)_INCLUDES_SEPARATOR = -I- ; - $(prefix)_LOCAL_INCLUDES_OPTION = -I ; - $(prefix)_SYSTEM_INCLUDES_OPTION = -I ; + suffix = $(suffix:E=) ; + if $($(prefix)_GCC_VERSION$(suffix)[1]) < 4 { + $(prefix)_INCLUDES_SEPARATOR$(suffix) = -I- ; + $(prefix)_LOCAL_INCLUDES_OPTION$(suffix) = -I ; + $(prefix)_SYSTEM_INCLUDES_OPTION$(suffix) = -I ; } else { - $(prefix)_INCLUDES_SEPARATOR = ; - $(prefix)_LOCAL_INCLUDES_OPTION = "-iquote " ; - $(prefix)_SYSTEM_INCLUDES_OPTION = "-I " ; + $(prefix)_INCLUDES_SEPARATOR$(suffix) = ; + $(prefix)_LOCAL_INCLUDES_OPTION$(suffix) = "-iquote " ; + $(prefix)_SYSTEM_INCLUDES_OPTION$(suffix) = "-I " ; } } diff --git a/build/jam/ImageRules b/build/jam/ImageRules index dea629be2f..9589468d71 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -70,36 +70,55 @@ actions together AddVariableToScript1 $(VARIABLE_DEFS)$(1); } -rule AddTargetVariableToScript + +rule AddTargetVariableToScript script : targets : variable { - # AddTargetVariableToScript