xref: /haiku/build/jam/packages/HaikuCrossDevel (revision 1149fa6ece3567c466008a04ae8a830a63bafdaa)
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 _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	# glue code
33	AddFilesToPackage $(developCrossLibDirTokens) :
34		<src!system!glue!arch!$(TARGET_ARCH)!$(architecture)>crti.o
35		<src!system!glue!arch!$(TARGET_ARCH)!$(architecture)>crtn.o
36		<src!system!glue!$(architecture)>init_term_dyn.o
37		<src!system!glue!$(architecture)>start_dyn.o
38		<src!system!glue!$(architecture)>haiku_version_glue.o
39		;
40
41	# kernel
42	if $(isPrimaryArchitecture) {
43		AddFilesToPackage $(developCrossLibDirTokens) : kernel.so : _KERNEL_ ;
44	}
45
46	# libraries
47	AddLibrariesToPackage $(developCrossLibDirTokens) :
48		[ MultiArchDefaultGristFiles libbsd.so ]
49		[ MultiArchDefaultGristFiles libroot.so : revisioned ]
50		$(HAIKU_SHARED_LIBSTDC++_$(architecture))
51		$(HAIKU_SHARED_LIBSUPC++_$(architecture))
52		$(additionalLibraries$(stage))
53		;
54
55	# static libraries
56	AddFilesToPackage $(developCrossLibDirTokens)
57		: <$(architecture)>liblocalestub.a ;
58
59	# the POSIX error code mapper library
60	AddFilesToPackage $(developCrossLibDirTokens)
61		: [ MultiArchDefaultGristFiles libposix_error_mapper.a ] ;
62
63	# headers
64	local developCrossHeadersDirTokens = develop headers ;
65	local headerDir ;
66	for headerDir in config glibc os posix {
67		CopyDirectoryToPackage $(developCrossHeadersDirTokens)
68			: [ FDirName $(HAIKU_TOP) headers $(headerDir) ] ;
69	}
70
71	# BSD and GNU compatibility headers
72	for headerDir in bsd gnu {
73		CopyDirectoryToPackage $(developCrossHeadersDirTokens)
74			: [ FDirName $(HAIKU_TOP) headers compatibility $(headerDir) ] ;
75	}
76
77	# cpp headers
78	if $(HAIKU_GCC_VERSION_$(architecture)[1]) = 2 {
79		# GCC 2 only -- for GCC 4 they come with the DevelopmentBase package
80		CopyDirectoryToPackage $(developCrossHeadersDirTokens) c++
81			: [ FDirName $(HAIKU_TOP) headers cpp ] : 2.95.3 ;
82	}
83
84	BuildHaikuPackage $(haikuCrossDevelSysrootPackage)
85		: haiku_cross_devel_sysroot ;
86
87	# Now create a wrapper package which just contains the actual cross
88	# development package. This wrapper package can safely be installed into the
89	# system hierarchy of the target system, from where haikuporter will fetch
90	# it when needed.
91
92	local haikuCrossDevelPackage
93		= haiku_cross_devel$(stage)_$(packageNameSuffix).hpkg ;
94	HaikuPackage $(haikuCrossDevelPackage) ;
95
96	# add the wrapped package
97	local developCrossDirTokens = develop cross ;
98	AddFilesToPackage $(developCrossDirTokens)
99		: $(haikuCrossDevelSysrootPackage) ;
100
101	BuildHaikuPackage $(haikuCrossDevelPackage) : haiku_cross_devel ;
102}
103