1# This package is like the HaikuDevel package, but it is meant for cross 2# development, i.e. it assumes that a specific cross compiler is installed 3# on the Haiku system where this package is being used. 4# The main use of this package is to provide HaikuPorter with a development 5# environment for a cross-build Haiku platform. 6 7local primaryArchitecture = $(HAIKU_PACKAGING_ARCHS[1]) ; 8local architecture = $(TARGET_PACKAGING_ARCH) ; 9local isPrimaryArchitecture = [ MultiArchIfPrimary 1 : ] ; 10 11local packageNameSuffix = $(primaryArchitecture) ; 12local architectureSubDir ; 13if ! $(isPrimaryArchitecture) { 14 packageNameSuffix = $(primaryArchitecture)_$(architecture) ; 15 architectureSubDir = $(architecture) ; 16} 17 18local additionalLibraries_stage1 ; 19local additionalLibraries 20 = [ MultiArchDefaultGristFiles libbe.so libnetwork.so libpackage.so ] ; 21 22local stage ; 23for stage in _stage0 _stage1 "" { 24 # first create the actual cross development package 25 26 local haikuCrossDevelSysrootPackage 27 = haiku_cross_devel_sysroot$(stage)_$(packageNameSuffix).hpkg ; 28 HaikuPackage $(haikuCrossDevelSysrootPackage) ; 29 30 local developCrossLibDirTokens = develop lib $(architectureSubDir) ; 31 32 if $(stage) = _stage0 { 33 # glue code 34 AddFilesToPackage $(developCrossLibDirTokens) : 35 <bootstrap!src!system!glue!arch!$(TARGET_ARCH)!$(architecture)>crti.o 36 <bootstrap!src!system!glue!arch!$(TARGET_ARCH)!$(architecture)>crtn.o 37 <bootstrap!src!system!glue!$(architecture)>init_term_dyn.o 38 <bootstrap!src!system!glue!$(architecture)>start_dyn.o 39 <bootstrap!src!system!glue!$(architecture)>haiku_version_glue.o 40 ; 41 42 # libraries 43 AddLibrariesToPackage $(developCrossLibDirTokens) : 44 [ MultiArchDefaultGristFiles libroot.so : stubbed ] 45 ; 46 } else { 47 # glue code 48 AddFilesToPackage $(developCrossLibDirTokens) : 49 <src!system!glue!arch!$(TARGET_ARCH)!$(architecture)>crti.o 50 <src!system!glue!arch!$(TARGET_ARCH)!$(architecture)>crtn.o 51 <src!system!glue!$(architecture)>init_term_dyn.o 52 <src!system!glue!$(architecture)>start_dyn.o 53 <src!system!glue!$(architecture)>haiku_version_glue.o 54 ; 55 56 # kernel 57 if $(isPrimaryArchitecture) { 58 AddFilesToPackage $(developCrossLibDirTokens) : kernel.so : _KERNEL_ ; 59 } 60 61 # libraries 62 AddLibrariesToPackage $(developCrossLibDirTokens) : 63 [ MultiArchDefaultGristFiles libbsd.so ] 64 [ MultiArchDefaultGristFiles libroot.so : revisioned ] 65 [ MultiArchDefaultGristFiles libnetwork.so ] 66 [ TargetLibstdc++ ] 67 [ TargetLibsupc++ ] 68 $(additionalLibraries$(stage)) 69 ; 70 71 # static libraries 72 AddFilesToPackage $(developCrossLibDirTokens) 73 : <$(architecture)>liblocalestub.a ; 74 75 # the POSIX error code mapper library 76 AddFilesToPackage $(developCrossLibDirTokens) 77 : [ MultiArchDefaultGristFiles libposix_error_mapper.a ] ; 78 } 79 80 # headers 81 local developCrossHeadersDirTokens = develop headers ; 82 local headerDir ; 83 for headerDir in config glibc os posix { 84 CopyDirectoryToPackage $(developCrossHeadersDirTokens) 85 : [ FDirName $(HAIKU_TOP) headers $(headerDir) ] ; 86 } 87 88 # BSD and GNU compatibility headers 89 for headerDir in bsd gnu { 90 CopyDirectoryToPackage $(developCrossHeadersDirTokens) 91 : [ FDirName $(HAIKU_TOP) headers compatibility $(headerDir) ] ; 92 } 93 94 if $(stage) != _stage0 { 95 # cpp headers 96 if $(HAIKU_GCC_VERSION_$(architecture)[1]) = 2 { 97 # GCC 2 only -- for GCC 4 they come with the DevelopmentBase package 98 CopyDirectoryToPackage $(developCrossHeadersDirTokens) c++ 99 : [ FDirName $(HAIKU_TOP) headers cpp ] : 2.95.3 ; 100 } 101 } 102 103 BuildHaikuPackage $(haikuCrossDevelSysrootPackage) 104 : haiku_cross_devel_sysroot ; 105 106 # Now create a wrapper package which just contains the actual cross 107 # development package. This wrapper package can safely be installed into the 108 # system hierarchy of the target system, from where haikuporter will fetch 109 # it when needed. 110 111 local haikuCrossDevelPackage 112 = haiku_cross_devel$(stage)_$(packageNameSuffix).hpkg ; 113 HaikuPackage $(haikuCrossDevelPackage) ; 114 115 # add the wrapped package 116 local developCrossDirTokens = develop cross ; 117 AddFilesToPackage $(developCrossDirTokens) 118 : $(haikuCrossDevelSysrootPackage) ; 119 120 BuildHaikuPackage $(haikuCrossDevelPackage) : haiku_cross_devel ; 121} 122