xref: /haiku/Jamfile (revision 8547d09e97f8f27852bfdcb312d0ca4652297d01)
1if ! [ Match "(.*)-haiku-(.*)" : $(JAMVERSION) ] {
2	Exit "You can only build Haiku with Haiku's Jam, not Perforce Jam or"
3		"some other variant (you are using $(JAMVERSION))." ;
4}
5
6SubDir HAIKU_TOP ;
7
8NotFile doc_files ;
9Depends files : doc_files ;
10
11# Prepare the optional build features before parsing the Jamfile tree.
12local architectureObject ;
13for architectureObject in [ MultiArchSubDirSetup ] {
14	on $(architectureObject) {
15		include [ FDirName $(HAIKU_BUILD_RULES_DIR) BuildFeatures ] ;
16
17		# Let the target platform depend on the external header directories such
18		# that those will be unpacked before anything is built for the target
19		# platform.
20		Depends $(TARGET_PLATFORM) : [
21			BuildFeatureAttribute gcc_syslibs_devel : c++-headers
22		] [
23			BuildFeatureAttribute gcc_syslibs_devel : gcc-headers
24		] ;
25	}
26}
27
28# Include required packages:
29# primary architecture
30AddHaikuImagePackages [ FFilterByBuildFeatures
31	bash bc coreutils curl freetype icu libsolv zlib zstd
32
33	regular_image @{
34		bzip2 ctags diffutils expat ffmpeg findutils gawk glu grep gutenprint
35		gzip ilmbase jasper jpeg
36		less libedit libicns libpcap libpng16 libwebp
37		mesa mesa_devel mesa_swpipe@!gcc2 mesa_swrast@gcc2
38		netcat openexr
39		sed sharutils
40		tar tcpdump unzip wget which zip
41	}@
42] ;
43AddHaikuImageSourcePackages [ FFilterByBuildFeatures
44	bash bc coreutils
45
46	regular_image @{
47		ctags expat ffmpeg findutils gawk grep gutenprint
48		gzip
49		less libicns
50		sed sharutils
51		tar wget which
52	}@
53] ;
54if $(HAIKU_PACKAGING_ARCHS[1]) != x86_gcc2 {
55	AddHaikuImagePackages [ FFilterByBuildFeatures gcc_syslibs ] ;
56}
57
58if $(HAIKU_PACKAGING_ARCHS[2]) {
59	# secondary architectures
60	local architectureObject ;
61	for architectureObject
62			in [ MultiArchSubDirSetup $(HAIKU_PACKAGING_ARCHS[2-]) ] {
63		on $(architectureObject) {
64			AddHaikuImagePackages [ FFilterByBuildFeatures
65				curl freetype icu libsolv zlib
66
67				regular_image @{
68					ffmpeg glu jasper jpeg libicns libpng16 libwebp mesa
69				}@
70			] ;
71			if $(TARGET_PACKAGING_ARCH) != x86_gcc2 {
72				AddHaikuImagePackages [ FFilterByBuildFeatures gcc_syslibs
73					mesa_swpipe ] ;
74			}
75		}
76	}
77}
78
79# If enabled, make sure that OpenSSL is added to the image.
80if [ FIsBuildFeatureEnabled openssl ] {
81	AddHaikuImagePackages openssl ;
82}
83
84# add additionally requested packages
85AddHaikuImagePackages $(HAIKU_IMAGE_ADDITIONAL_PACKAGES) ;
86
87# Optionally we allow not to include the "src" subdirectory.
88if $(HAIKU_DONT_INCLUDE_SRC) {
89	# Don't include "src", but at least include the stuff needed for the
90	# build.
91	SubInclude HAIKU_TOP src build ;
92	SubInclude HAIKU_TOP src tools ;
93} else {
94	SubInclude HAIKU_TOP src ;
95}
96if $(HAIKU_INCLUDE_3RDPARTY) {
97	SubInclude HAIKU_TOP 3rdparty ;
98}
99
100# Perform deferred SubIncludes.
101ExecuteDeferredSubIncludes ;
102
103# reset subdir
104SubDir HAIKU_TOP ;
105
106# Execute post-build-target user config rules.
107UserBuildConfigRulePostBuildTargets	;
108
109# specify the Haiku repository contents
110include [ FDirName $(HAIKU_BUILD_RULES_DIR) repositories Haiku ] ;
111
112# specify the actual Haiku image contents
113include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuImage ] ;
114
115# specify the additional image contents one for each boot type
116include [ FDirName $(HAIKU_BUILD_RULES_DIR) images NetBootArchive ] ;
117include [ FDirName $(HAIKU_BUILD_RULES_DIR) images FloppyBootImage ] ;
118include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootImage ] ;
119include [ FDirName $(HAIKU_BUILD_RULES_DIR) images CDBootPPCImage ] ;
120include [ FDirName $(HAIKU_BUILD_RULES_DIR) images HaikuCD ] ;
121include [ FDirName $(HAIKU_BUILD_RULES_DIR) images AnybootImage ] ;
122
123# Check whether all requested optional packages do actually exist.
124local package ;
125local packageError ;
126for package in $(HAIKU_ADDED_OPTIONAL_PACKAGES) {
127	if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_EXISTS) ] {
128		Echo "ERROR: Requested optional package \"$(package)\" does not"
129			"exist." ;
130		packageError = 1 ;
131	}
132}
133if $(packageError) {
134	Exit ;
135}
136
137# Pseudo-target to build all targets that are localized.
138NotFile LocalizedTargets ;
139Depends LocalizedTargets : $(HAIKU_LOCALIZED_TARGETS) ;
140
141NotFile catalogs ;
142Depends catalogs : $(HAIKU_LOCALE_CATALOGS) ;
143
144NotFile catkeys ;
145Depends catkeys : $(HAIKU_LOCALE_OUTPUT_CATKEYS) ;
146