xref: /haiku/build/jam/BuildFeatures (revision 14b32de1d5efe99b4c6d4ef8c25df47eb009cf0f)
1# This file contains setup for build features that are not available for all
2# architectures/setups or that are optional for the build. For features that
3# require downloading a zip file from somewhere it is likely the same file used
4# for an optional package.
5
6
7# Add the target architecture as a build feature.
8EnableBuildFeatures $(HAIKU_ARCH) ;
9
10
11# Detect a hybrid GCC2/GCC4 image and disable the checks for unavailable GCC4
12# packages. (It does not matter if a package was built with either compiler,
13# the system should have the respective other system libs.)
14local isHybridBuild ;
15if $(HAIKU_ADD_ALTERNATIVE_GCC_LIBS) = 1
16		&& $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR) {
17	isHybridBuild = 1 ;
18}
19
20local baseURL = http://www.haiku-files.org/files/optional-packages ;
21
22
23# SSL
24
25# Automatically enable the SSL feature, when the optional OpenSSL optional
26# package is enabled.
27if [ IsOptionalHaikuImagePackageAdded OpenSSL ] {
28	HAIKU_BUILD_FEATURE_SSL = 1 ;
29}
30
31if $(HAIKU_GCC_VERSION[1]) >= 4 {
32	if $(TARGET_ARCH) = x86_64 {
33		HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-x86_64-2012-12-18.zip ;
34	} else {
35		HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-r1a4-x86-gcc4-2012-08-29.zip ;
36	}
37} else {
38	HAIKU_OPENSSL_PACKAGE = openssl-1.0.0j-r1a4-x86-gcc2-2012-08-26.zip ;
39}
40
41HAIKU_OPENSSL_URL = $(baseURL)/$(HAIKU_OPENSSL_PACKAGE) ;
42
43if $(HAIKU_BUILD_FEATURE_SSL) {
44	if $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 {
45		# Download the zip archive.
46		local zipFile = [ DownloadFile $(HAIKU_OPENSSL_PACKAGE)
47			: $(HAIKU_OPENSSL_URL) ] ;
48
49		# zip file and output directory
50		HAIKU_OPENSSL_ZIP_FILE = $(zipFile) ;
51		HAIKU_OPENSSL_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
52			$(HAIKU_OPENSSL_PACKAGE:B) ] ;
53
54		# extract headers and libraries
55		HAIKU_OPENSSL_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_OPENSSL_DIR)
56			: common/include/ : $(zipFile) : extracted-openssl
57		] ;
58
59		HAIKU_OPENSSL_LIBS = [ ExtractArchive $(HAIKU_OPENSSL_DIR)
60			:
61			common/lib/libcrypto.so
62			common/lib/libssl.so
63			: $(zipFile)
64			: extracted-openssl
65		] ;
66
67		HAIKU_OPENSSL_HEADERS
68			= [ FDirName $(HAIKU_OPENSSL_DIR) common include ] ;
69
70		EnableBuildFeatures openssl ;
71	} else {
72		Echo "SSL build feature not available for $(TARGET_ARCH)" ;
73	}
74}
75
76
77# ICU
78
79# Note ICU isn't actually optional, but is still an external package
80HAIKU_ICU_GCC_2_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc2-2012-08-29.zip ;
81HAIKU_ICU_GCC_4_PACKAGE = icu-4.8.1.1-r1a4-x86-gcc4-2012-08-29.zip ;
82HAIKU_ICU_PPC_PACKAGE = icu-4.8.1-ppc-2011-08-20.zip ;
83HAIKU_ICU_ARM_PACKAGE = icu-4.8.1.1-arm-2012-11-21.zip ;
84HAIKU_ICU_X86_64_PACKAGE = icu-4.8.1.1-x86_64-2012-07-30.zip ;
85
86if $(TARGET_ARCH) in arm ppc x86 x86_64 {
87	local icu_package ;
88	if $(TARGET_ARCH) = ppc {
89		icu_package = $(HAIKU_ICU_PPC_PACKAGE) ;
90		HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1-ppc-2011-12-19.zip ;
91	} else if $(TARGET_ARCH) = arm {
92		icu_package = $(HAIKU_ICU_ARM_PACKAGE) ;
93		HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-arm-2012-11-21.zip ;
94	} else if $(TARGET_ARCH) = x86_64 {
95		icu_package = $(HAIKU_ICU_X86_64_PACKAGE) ;
96		HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86_64-2012-07-30.zip ;
97	} else if $(HAIKU_GCC_VERSION[1]) = 2 {
98		icu_package = $(HAIKU_ICU_GCC_2_PACKAGE) ;
99		HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86-gcc2-2011-12-20.zip ;
100	} else {
101		icu_package = $(HAIKU_ICU_GCC_4_PACKAGE) ;
102		HAIKU_ICU_DEVEL_PACKAGE = icu-devel-4.8.1.1-x86-gcc4-2011-12-20.zip ;
103	}
104	local zipFile = [ DownloadFile $(icu_package)
105		: $(baseURL)/$(icu_package) ] ;
106
107	# zip file and output directory
108	HAIKU_ICU_ZIP_FILE = $(zipFile) ;
109	HAIKU_ICU_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
110		$(icu_package:B) ] ;
111
112	# extract libraries
113	if $(TARGET_ARCH) = ppc {
114		HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR)
115			:
116			libicudata.so.48.1
117			libicui18n.so.48.1
118			libicuio.so.48.1
119			libicule.so.48.1
120			libiculx.so.48.1
121			libicutu.so.48.1
122			libicuuc.so.48.1
123			: $(zipFile)
124			: extracted-icu
125		] ;
126	} else {
127		HAIKU_ICU_LIBS = [ ExtractArchive $(HAIKU_ICU_DIR)
128			:
129			libicudata.so.48.1.1
130			libicui18n.so.48.1.1
131			libicuio.so.48.1.1
132			libicule.so.48.1.1
133			libiculx.so.48.1.1
134			libicutu.so.48.1.1
135			libicuuc.so.48.1.1
136			: $(zipFile)
137			: extracted-icu
138		] ;
139	}
140
141	# zip file and output directory
142	HAIKU_ICU_DEVEL_ZIP_FILE = [ DownloadFile $(HAIKU_ICU_DEVEL_PACKAGE)
143			: $(baseURL)/$(HAIKU_ICU_DEVEL_PACKAGE) ] ;
144	HAIKU_ICU_DEVEL_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
145		$(HAIKU_ICU_DEVEL_PACKAGE:B) ] ;
146
147	# extract headers
148	HAIKU_ICU_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_ICU_DEVEL_DIR)
149		: develop/headers/3rdparty : $(HAIKU_ICU_DEVEL_ZIP_FILE)
150		: extracted-icu-devel ] ;
151
152	HAIKU_ICU_HEADERS
153		= [ FDirName $(HAIKU_ICU_DEVEL_DIR) develop headers 3rdparty ] ;
154
155	EnableBuildFeatures icu ;
156} else  {
157	Echo "ICU not available for $(TARGET_ARCH)" ;
158}
159
160
161# CLucene
162
163# Automatically install the CLucene feature, when the optional CLucene optional
164# package is enabled.
165if [ IsOptionalHaikuImagePackageAdded CLucene ] {
166	HAIKU_BUILD_FEATURE_CLUCENE = 1 ;
167}
168
169
170HAIKU_CLUCENE_PACKAGE = clucene-0.9.21-x86-gcc4-haiku-2009-08-11.zip ;
171HAIKU_CLUCENE_URL = $(baseURL)/$(HAIKU_CLUCENE_PACKAGE) ;
172
173if $(HAIKU_BUILD_FEATURE_CLUCENE) {
174	if $(TARGET_ARCH) != x86 {
175		Echo "CLucene build feature not available for $(TARGET_ARCH)" ;
176	} else {
177		# Download the zip archive.
178		local zipFile = [ DownloadFile $(HAIKU_CLUCENE_PACKAGE)
179			: $(HAIKU_CLUCENE_URL) ] ;
180
181		# zip file and output directory
182		HAIKU_CLUCENE_ZIP_FILE = $(zipFile) ;
183		HAIKU_CLUCENE_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
184			$(HAIKU_CLUCENE_PACKAGE:B) ] ;
185
186		# extract headers and libraries
187		HAIKU_CLUCENE_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_CLUCENE_DIR)
188			: common/include/ : $(zipFile) : extracted-clucene
189		] ;
190
191		HAIKU_CLUCENE_LIBS = [ ExtractArchive $(HAIKU_CLUCENE_DIR)
192			:
193			common/lib/libclucene.a
194			: $(zipFile)
195			 : extracted-clucene
196		] ;
197
198		HAIKU_CLUCENE_HEADERS
199			= [ FDirName $(HAIKU_CLUCENE_DIR) common include ] ;
200
201		EnableBuildFeatures clucene ;
202	}
203}
204
205
206# LLVM
207if $(TARGET_ARCH) = x86 {
208	if $(HAIKU_GCC_VERSION[1]) >= 4 {
209		HAIKU_LLVM_FILE = llvm-3.2-x86-gcc4-2012-12-21.zip ;
210		local zipFile = [ DownloadFile $(HAIKU_LLVM_FILE)
211			: $(baseURL)/$(HAIKU_LLVM_FILE) ] ;
212
213		HAIKU_LLVM_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
214			$(HAIKU_LLVM_FILE:B) ] ;
215
216		HAIKU_LLVM_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LLVM_DIR)
217			: common/include/ : $(zipFile) : extracted-llvm ] ;
218		HAIKU_LLVM_HEADERS = [ FDirName $(HAIKU_LLVM_DIR) common include ] ;
219
220		# We can't Glob these because they aren't extracted yet.
221		HAIKU_LLVM_LIBS = [ ExtractArchive $(HAIKU_LLVM_DIR)
222			:
223			common/lib/libLLVMAsmParser.a
224			common/lib/libLLVMInstrumentation.a
225			common/lib/libLLVMLinker.a
226			common/lib/libLLVMArchive.a
227			common/lib/libLLVMBitReader.a
228			common/lib/libLLVMDebugInfo.a
229			common/lib/libLLVMJIT.a
230			common/lib/libLLVMipo.a
231			common/lib/libLLVMVectorize.a
232			common/lib/libLLVMBitWriter.a
233			common/lib/libLLVMTableGen.a
234			#common/lib/libLLVMHexagonCodeGen.a
235			#common/lib/libLLVMHexagonAsmPrinter.a
236			#common/lib/libLLVMHexagonDesc.a
237			#common/lib/libLLVMHexagonInfo.a
238			#common/lib/libLLVMNVPTXCodeGen.a
239			#common/lib/libLLVMNVPTXDesc.a
240			#common/lib/libLLVMNVPTXInfo.a
241			#common/lib/libLLVMNVPTXAsmPrinter.a
242			#common/lib/libLLVMMBlazeCodeGen.a
243			#common/lib/libLLVMMBlazeAsmParser.a
244			#common/lib/libLLVMMBlazeDisassembler.a
245			#common/lib/libLLVMMBlazeDesc.a
246			#common/lib/libLLVMMBlazeInfo.a
247			#common/lib/libLLVMMBlazeAsmPrinter.a
248			common/lib/libLLVMCppBackendCodeGen.a
249			common/lib/libLLVMCppBackendInfo.a
250			#common/lib/libLLVMMSP430CodeGen.a
251			#common/lib/libLLVMMSP430Desc.a
252			#common/lib/libLLVMMSP430AsmPrinter.a
253			#common/lib/libLLVMMSP430Info.a
254			#common/lib/libLLVMXCoreCodeGen.a
255			#common/lib/libLLVMXCoreDesc.a
256			#common/lib/libLLVMXCoreInfo.a
257			#common/lib/libLLVMCellSPUCodeGen.a
258			#common/lib/libLLVMCellSPUDesc.a
259			#common/lib/libLLVMCellSPUInfo.a
260			#common/lib/libLLVMMipsAsmParser.a
261			#common/lib/libLLVMMipsCodeGen.a
262			#common/lib/libLLVMMipsDesc.a
263			#common/lib/libLLVMMipsAsmPrinter.a
264			#common/lib/libLLVMMipsDisassembler.a
265			#common/lib/libLLVMMipsInfo.a
266			#common/lib/libLLVMARMAsmParser.a
267			#common/lib/libLLVMARMCodeGen.a
268			#common/lib/libLLVMARMDisassembler.a
269			#common/lib/libLLVMARMDesc.a
270			#common/lib/libLLVMARMInfo.a
271			#common/lib/libLLVMARMAsmPrinter.a
272			#common/lib/libLLVMPowerPCCodeGen.a
273			#common/lib/libLLVMPowerPCDesc.a
274			#common/lib/libLLVMPowerPCInfo.a
275			#common/lib/libLLVMPowerPCAsmPrinter.a
276			#common/lib/libLLVMSparcCodeGen.a
277			#common/lib/libLLVMSparcDesc.a
278			#common/lib/libLLVMSparcInfo.a
279			common/lib/libLLVMX86AsmParser.a
280			common/lib/libLLVMX86CodeGen.a
281			common/lib/libLLVMSelectionDAG.a
282			common/lib/libLLVMAsmPrinter.a
283			common/lib/libLLVMX86Disassembler.a
284			common/lib/libLLVMX86Desc.a
285			common/lib/libLLVMX86Info.a
286			common/lib/libLLVMX86AsmPrinter.a
287			common/lib/libLLVMX86Utils.a
288			common/lib/libLLVMMCDisassembler.a
289			common/lib/libLLVMMCParser.a
290			common/lib/libLLVMInterpreter.a
291			common/lib/libLLVMCodeGen.a
292			common/lib/libLLVMScalarOpts.a
293			common/lib/libLLVMInstCombine.a
294			common/lib/libLLVMTransformUtils.a
295			common/lib/libLLVMipa.a
296			common/lib/libLLVMAnalysis.a
297			common/lib/libLLVMMCJIT.a
298			common/lib/libLLVMRuntimeDyld.a
299			common/lib/libLLVMExecutionEngine.a
300			common/lib/libLLVMTarget.a
301			common/lib/libLLVMMC.a
302			common/lib/libLLVMObject.a
303			common/lib/libLLVMCore.a
304			common/lib/libLLVMSupport.a
305			: $(zipFile) : extracted-llvm ]
306		;
307
308		EnableBuildFeatures llvm ;
309	} else {
310		# Nor will it ever be
311		Echo "LLVM not available on GCC2" ;
312	}
313} else {
314	Echo "LLVM not yet available on $(TARGET_ARCH)" ;
315}
316
317
318# GLU (GL Utilities)
319if $(TARGET_ARCH) = x86 {
320	if $(HAIKU_GCC_VERSION[1]) >= 4 {
321		HAIKU_GLU_FILE = glu-9.0-x86-gcc4-2012-11-13.zip ;
322	} else {
323		HAIKU_GLU_FILE = glu-9.0-x86-gcc2-2012-11-13.zip ;
324	}
325
326	local zipFile = [ DownloadFile $(HAIKU_GLU_FILE)
327		: $(baseURL)/lib/$(HAIKU_GLU_FILE) ] ;
328
329	HAIKU_GLU_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
330		$(HAIKU_GLU_FILE:B) ] ;
331	HAIKU_GLU_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_GLU_DIR)
332		: develop/headers/os/opengl/GL : $(zipFile) : extracted-glu-headers ] ;
333	HAIKU_GLU_LIBS = [ ExtractArchive $(HAIKU_GLU_DIR)
334		: system/lib/libGLU.a : $(zipFile) : extracted-glu ] ;
335	HAIKU_GLU_HEADERS = [ FDirName $(HAIKU_GLU_DIR) develop headers os opengl ] ;
336
337	EnableBuildFeatures glu ;
338} else {
339	Echo "GLU not yet available on $(TARGET_ARCH)" ;
340}
341
342
343# Mesa
344if $(TARGET_ARCH) = x86 {
345	local zipFile ;
346	if $(HAIKU_GCC_VERSION[1]) >= 4 {
347		HAIKU_MESA_FILE = mesa-9.1.1-x86-gcc4-2013-04-27.zip ;
348	} else {
349		HAIKU_MESA_FILE = mesa-7.8.2-x86-gcc2-2013-04-28.zip ;
350	}
351
352	zipFile = [ DownloadFile $(HAIKU_MESA_FILE)
353		: $(baseURL)/$(HAIKU_MESA_FILE) ] ;
354
355	HAIKU_MESA_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
356		$(HAIKU_MESA_FILE:B) ] ;
357
358	HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ;
359	HAIKU_MESA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MESA_DIR)
360		: include/ : $(zipFile) : extracted-mesa ] ;
361
362	# Base Mesa libraries
363	HAIKU_MESA_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
364		:
365		lib.haiku/libmesa.a
366		: $(zipFile)
367		: extracted-mesa ] ;
368	HAIKU_GLAPI_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
369		:
370		lib.haiku/libglapi.a
371		: $(zipFile)
372		: extracted-mesa ] ;
373
374	Depends $(HAIKU_MESA_HEADERS_DEPENDENCY) : $(HAIKU_GLU_HEADERS_DEPENDENCY) ;
375	Depends $(HAIKU_GLAPI_LIBS) : $(HAIKU_GLU_LIBS) ;
376
377	# Extended Mesa libraries for newer versions
378	if $(HAIKU_GCC_VERSION[1]) >= 4 {
379		HAIKU_GLSL_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
380			:
381			lib.haiku/libglsl.a
382			: $(zipFile)
383			: extracted-mesa ] ;
384		HAIKU_GALLIUM_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
385			:
386			lib.haiku/libgallium.a
387			: $(zipFile)
388			: extracted-mesa ] ;
389
390		if FIsBuildFeatureEnabled(llvm) {
391			HAIKU_GALLIUM_LLVMPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
392				:
393				lib.haiku/libllvmpipe.a
394				: $(zipFile)
395				: extracted-mesa ] ;
396			Depends $(HAIKU_GALLIUM_LLVMPIPE_LIB) : $(HAIKU_LLVM_LIBS) ;
397		} else {
398			HAIKU_GALLIUM_SOFTPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
399				:
400				lib.haiku/libsoftpipe.a
401				: $(zipFile)
402				: extracted-mesa ] ;
403		}
404	}
405
406	EnableBuildFeatures mesa ;
407} else {
408	Echo "Mesa 3D rendering support not available on $(TARGET_ARCH)" ;
409}
410
411
412# FFmpeg
413local ffmpegBaseURL = $(baseURL)/lib ;
414if $(TARGET_ARCH) = x86 {
415	if $(HAIKU_GCC_VERSION[1]) >= 4 {
416		HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-r1a4-x86-gcc4-2012-09-02.zip ;
417		HAIKU_SPEEX_FILE = speex-1.2rc1-r1a4-x86-gcc4-2012-09-02.zip ;
418		HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-r1a4-x86-gcc4-2012-09-02.zip ;
419		HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-r1a4-x86-gcc4-2012-09-02.zip ;
420		HAIKU_LIBOGG_FILE = libogg-1.3.0-r1a4-x86-gcc4-2012-09-02.zip ;
421		HAIKU_LIBVPX_FILE = libvpx-1.0.0-r1a4-x86-gcc4-2012-09-02.zip ;
422	} else {
423		HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30.zip ;
424		HAIKU_SPEEX_FILE = speex-1.2rc1-r1a4-x86-gcc2-2012-08-29.zip ;
425		HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-r1a4-x86-gcc2-2012-08-29.zip ;
426		HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-r1a4-x86-gcc2-2012-08-29.zip ;
427		HAIKU_LIBOGG_FILE = libogg-1.3.0-r1a4-x86-gcc2-2012-08-29.zip ;
428		HAIKU_LIBVPX_FILE = libvpx-1.0.0-r1a4-x86-gcc2-2012-08-29.zip ;
429	}
430
431	local ffmpegZipFile = [ DownloadFile $(HAIKU_FFMPEG_FILE)
432		: $(ffmpegBaseURL)/$(HAIKU_FFMPEG_FILE) ] ;
433	local speexZipFile = [ DownloadFile $(HAIKU_SPEEX_FILE)
434		: $(ffmpegBaseURL)/$(HAIKU_SPEEX_FILE) ] ;
435	local libtheoraZipFile = [ DownloadFile $(HAIKU_LIBTHEORA_FILE)
436		: $(ffmpegBaseURL)/$(HAIKU_LIBTHEORA_FILE) ] ;
437	local libvorbisZipFile = [ DownloadFile $(HAIKU_LIBVORBIS_FILE)
438		: $(ffmpegBaseURL)/$(HAIKU_LIBVORBIS_FILE) ] ;
439	local liboggZipFile = [ DownloadFile $(HAIKU_LIBOGG_FILE)
440		: $(ffmpegBaseURL)/$(HAIKU_LIBOGG_FILE) ] ;
441	local libvpxZipFile = [ DownloadFile $(HAIKU_LIBVPX_FILE)
442		: $(ffmpegBaseURL)/$(HAIKU_LIBVPX_FILE) ] ;
443
444	HAIKU_FFMPEG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
445		$(HAIKU_FFMPEG_FILE:B) ] ;
446	HAIKU_SPEEX_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
447		$(HAIKU_SPEEX_FILE:B) ] ;
448	HAIKU_LIBTHEORA_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
449		$(HAIKU_LIBTHEORA_FILE:B) ] ;
450	HAIKU_LIBVORBIS_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
451		$(HAIKU_LIBVORBIS_FILE:B) ] ;
452	HAIKU_LIBOGG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
453		$(HAIKU_LIBOGG_FILE:B) ] ;
454	HAIKU_LIBVPX_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
455		$(HAIKU_LIBVPX_FILE:B) ] ;
456
457	HAIKU_FFMPEG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_FFMPEG_DIR)
458		: common/include/ : $(ffmpegZipFile) : extracted-ffmpeg ] ;
459	HAIKU_SPEEX_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_SPEEX_DIR)
460		: common/include/ : $(speexZipFile) : extracted-speex ] ;
461	HAIKU_LIBTHEORA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBTHEORA_DIR)
462		: common/include/ : $(libtheoraZipFile) : extracted-libtheora ] ;
463	HAIKU_LIBVORBIS_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBVORBIS_DIR)
464		: common/include/ : $(libvorbisZipFile) : extracted-libvorbis ] ;
465	HAIKU_LIBOGG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBOGG_DIR)
466		: common/include/ : $(liboggZipFile) : extracted-libogg ] ;
467	HAIKU_LIBVPX_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBVPX_DIR)
468		: common/include/ : $(libvpxZipFile) : extracted-libvpx ] ;
469
470	HAIKU_FFMPEG_LIBS = [ ExtractArchive $(HAIKU_FFMPEG_DIR)
471		:
472		common/lib/libavformat.a
473		common/lib/libavcodec.a
474		common/lib/libavdevice.a
475		common/lib/libavfilter.a
476		common/lib/libswscale.a
477		common/lib/libavutil.a
478		: $(ffmpegZipFile)
479		: extracted-ffmpeg ] ;
480	Depends $(HAIKU_FFMPEG_LIBS) : $(HAIKU_FFMPEG_HEADERS_DEPENDENCY) ;
481
482	HAIKU_SPEEX_LIBS = [ ExtractArchive $(HAIKU_SPEEX_DIR)
483		:
484		common/lib/libspeex.a
485		: $(speexZipFile)
486		: extracted-speex ] ;
487	Depends $(HAIKU_SPEEX_LIBS) : $(HAIKU_SPEEX_HEADERS_DEPENDENCY) ;
488
489	HAIKU_LIBTHEORA_LIBS = [ ExtractArchive $(HAIKU_LIBTHEORA_DIR)
490		:
491		common/lib/libtheora.a
492		common/lib/libtheoradec.a
493		common/lib/libtheoraenc.a
494		: $(libtheoraZipFile)
495		: extracted-libtheora ] ;
496	Depends $(HAIKU_LIBTHEORA_LIBS) : $(HAIKU_LIBTHEORA_HEADERS_DEPENDENCY) ;
497
498
499	HAIKU_LIBVORBIS_LIBS = [ ExtractArchive $(HAIKU_LIBVORBIS_DIR)
500		:
501		common/lib/libvorbis.a
502		common/lib/libvorbisenc.a
503		: $(libvorbisZipFile)
504		: extracted-libvorbis ] ;
505	Depends $(HAIKU_LIBVORBIS_LIBS) : $(HAIKU_LIBVORBIS_HEADERS_DEPENDENCY) ;
506
507
508	HAIKU_LIBOGG_LIBS = [ ExtractArchive $(HAIKU_LIBOGG_DIR)
509		:
510		common/lib/libogg.a
511		: $(liboggZipFile)
512		: extracted-libogg ] ;
513	Depends $(HAIKU_LIBOGG_LIBS) : $(HAIKU_LIBOGG_HEADERS_DEPENDENCY) ;
514
515	HAIKU_LIBVPX_LIBS = [ ExtractArchive $(HAIKU_LIBVPX_DIR)
516		:
517		common/lib/libvpx.a
518		: $(libvpxZipFile)
519		: extracted-libvpx ] ;
520	Depends $(HAIKU_LIBVPX_LIBS) : $(HAIKU_LIBVPX_HEADERS_DEPENDENCY) ;
521
522	HAIKU_FFMPEG_HEADERS = [ FDirName $(HAIKU_FFMPEG_DIR) common include ] ;
523	HAIKU_SPEEX_HEADERS = [ FDirName $(HAIKU_SPEEX_DIR) common include ] ;
524	HAIKU_LIBTHEORA_HEADERS = [ FDirName $(HAIKU_LIBTHEORA_DIR) common include ] ;
525	HAIKU_LIBVORBIS_HEADERS = [ FDirName $(HAIKU_LIBVORBIS_DIR) common include ] ;
526	HAIKU_LIBOGG_HEADERS = [ FDirName $(HAIKU_LIBOGG_DIR) common include ] ;
527	HAIKU_LIBVPX_HEADERS = [ FDirName $(HAIKU_LIBVPX_DIR) common include ] ;
528
529	EnableBuildFeatures ffmpeg ;
530} else {
531	Echo "FFMpeg support not available on $(TARGET_ARCH)" ;
532}
533
534
535# MikMod
536local mikmodBaseURL = http://haiku-files.org/files/optional-packages/lib ;
537if $(TARGET_ARCH) = x86 {
538	if $(HAIKU_GCC_VERSION[1]) >= 4 {
539		HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a4-x86-gcc4-2012-09-02.zip ;
540	} else {
541		HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a4-x86-gcc2-2012-08-29.zip ;
542	}
543
544	local mikmodZipFile = [ DownloadFile $(HAIKU_MIKMOD_FILE)
545		: $(mikmodBaseURL)/$(HAIKU_MIKMOD_FILE) ] ;
546
547	HAIKU_MIKMOD_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
548		$(HAIKU_MIKMOD_FILE:B) ] ;
549
550	HAIKU_MIKMOD_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MIKMOD_DIR)
551		: common/include/ : $(mikmodZipFile) : extracted-mikmod ] ;
552
553	HAIKU_MIKMOD_LIBS = [ ExtractArchive $(HAIKU_MIKMOD_DIR)
554		:
555		common/lib/libmikmod.a
556		: $(mikmodZipFile)
557		: extracted-ffmpeg ] ;
558	Depends $(HAIKU_MIKMOD_LIBS) : $(HAIKU_MIKMOD_HEADERS_DEPENDENCY) ;
559
560	HAIKU_MIKMOD_HEADERS = [ FDirName $(HAIKU_MIKMOD_DIR) common include ] ;
561
562	EnableBuildFeatures mikmod ;
563} else {
564	Echo "MikMod support not available on $(TARGET_ARCH)" ;
565}
566
567
568# Freetype
569local freetypeBaseURL = $(baseURL)/lib ;
570if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm {
571	if $(TARGET_ARCH) = arm {
572		HAIKU_FREETYPE_FILE = freetype-2.4.9-arm-2012-11-21.zip ;
573	} else if $(TARGET_ARCH) = ppc {
574		HAIKU_FREETYPE_FILE = freetype-2.4.9-ppc-gcc4-2012-06-26.zip ;
575	} else if $(TARGET_ARCH) = x86_64 {
576		HAIKU_FREETYPE_FILE = freetype-2.4.9-x86_64-2012-08-04.zip ;
577	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
578		HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc4-2012-09-02.zip ;
579	} else {
580		HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc2-2012-08-28.zip ;
581	}
582
583	local freetypeZipFile = [ DownloadFile $(HAIKU_FREETYPE_FILE)
584		: $(freetypeBaseURL)/$(HAIKU_FREETYPE_FILE) ] ;
585
586	HAIKU_FREETYPE_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
587		$(HAIKU_FREETYPE_FILE:B) ] ;
588
589	HAIKU_FREETYPE_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
590		: develop/headers/3rdparty/freetype2 : $(freetypeZipFile)
591		: extracted-freetype ] ;
592
593	HAIKU_FREETYPE_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
594		:
595		common/lib/libfreetype.so
596		: $(freetypeZipFile)
597		: extracted-freetype ] ;
598	HAIKU_FREETYPE_CURRENT_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
599		:
600		common/lib/libfreetype.so.6.8.1
601		: $(freetypeZipFile)
602		: extracted-freetype ] ;
603	Depends $(HAIKU_FREETYPE_LIB) $(HAIKU_FREETYPE_CURRENT_LIB) : $(HAIKU_FREETYPE_HEADERS_DEPENDENCY) ;
604
605	HAIKU_FREETYPE_CURRENT_LINK = libfreetype.so.6 ;
606
607	HAIKU_FREETYPE_HEADERS = [ FDirName $(HAIKU_FREETYPE_DIR) develop
608		headers 3rdparty ] [ FDirName $(HAIKU_FREETYPE_DIR) develop
609		headers 3rdparty freetype2 ] ;
610
611	EnableBuildFeatures freetype ;
612} else {
613	Echo "Freetype support not available on $(TARGET_ARCH)" ;
614}
615
616
617# TagLib
618
619# Automatically install the TagLib feature, when the optional TagLib optional
620# package is enabled.
621if [ IsOptionalHaikuImagePackageAdded TagLib ] {
622	HAIKU_BUILD_FEATURE_TAGLIB = 1 ;
623}
624
625HAIKU_TAGLIB_PACKAGE = taglib-1.6.3-r1a4-x86-gcc2-2012-09-03.zip ;
626HAIKU_TAGLIB_URL = $(baseURL)/$(HAIKU_TAGLIB_PACKAGE) ;
627
628if $(HAIKU_BUILD_FEATURE_TAGLIB) {
629	if $(TARGET_ARCH) != x86 {
630		Echo "TagLib build feature not available for $(TARGET_ARCH)" ;
631	} else {
632		# Download the zip archive.
633		local zipFile = [ DownloadFile $(HAIKU_TAGLIB_PACKAGE)
634			: $(HAIKU_TAGLIB_URL) ] ;
635
636		# zip file and output directory
637		HAIKU_TAGLIB_ZIP_FILE = $(zipFile) ;
638		HAIKU_TAGLIB_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
639			$(HAIKU_TAGLIB_PACKAGE:B) ] ;
640
641		# extract headers and libraries
642		HAIKU_TAGLIB_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_TAGLIB_DIR)
643			: common/include/ : $(zipFile) : extracted-taglib
644		] ;
645
646		HAIKU_TAGLIB_LIBS = [ ExtractArchive $(HAIKU_TAGLIB_DIR)
647			:
648			common/lib/libtag.so
649			common/lib/libtag_c.so
650			: $(zipFile)
651			: extracted-taglib
652		] ;
653
654		HAIKU_TAGLIB_HEADERS
655			= [ FDirName $(HAIKU_TAGLIB_DIR) common include taglib ] ;
656
657		EnableBuildFeatures taglib ;
658	}
659}
660
661
662# WebKit
663# Automatically install the WebKit feature, when the optional WebPositive
664# optional package is enabled.
665if [ IsOptionalHaikuImagePackageAdded WebPositive ] {
666	HAIKU_BUILD_FEATURE_WEBKIT = 1 ;
667}
668
669if $(TARGET_ARCH) = x86 {
670	HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-08-31a.zip ;
671} else if $(TARGET_ARCH) = x86_64 {
672	HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86_64-gcc4-2012-12-22.zip ;
673}
674if $(HAIKU_BUILD_FEATURE_WEBKIT) {
675	if $(TARGET_ARCH) != x86 && $(TARGET_ARCH) != x86_64 {
676		Echo "WebKit support not available on $(TARGET_ARCH)" ;
677	} else if $(HAIKU_GCC_VERSION[1]) < 4 {
678		if ! $(isHybridBuild) {
679			Echo "WebKit support not available on gcc $(HAIKU_GCC_VERSION[1])" ;
680		} else {
681			Echo "WebKit to be utilized by gcc4 inside $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR)" ;
682		}
683	} else {
684		local zipFile = [ DownloadFile $(HAIKU_WEBKIT_FILE)
685			: $(baseURL)/$(HAIKU_WEBKIT_FILE) ] ;
686
687		HAIKU_WEBKIT_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
688			$(HAIKU_WEBKIT_FILE:B) ] ;
689
690		HAIKU_WEBKIT_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_WEBKIT_DIR)
691			: include/ : $(zipFile) : extracted-webkit ] ;
692
693		HAIKU_WEBKIT_LIBS = [ ExtractArchive $(HAIKU_WEBKIT_DIR)
694			:
695			lib/libwtf.so
696			lib/libjavascriptcore.so
697			lib/libwebcore.so
698			lib/libwebkit.so
699			: $(zipFile)
700			: extracted-webkit
701		] ;
702
703		HAIKU_WEBKIT_HEADERS = [ FDirName $(HAIKU_WEBKIT_DIR) include ] ;
704
705		EnableBuildFeatures webkit ;
706	}
707}
708
709# libpng
710local libpngBaseURL = $(baseURL)/lib ;
711if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm {
712	if $(TARGET_ARCH) = arm {
713		HAIKU_LIBPNG_FILE = libpng-1.5.12-arm-2012-11-21.zip ;
714	} else if $(TARGET_ARCH) = ppc {
715		HAIKU_LIBPNG_FILE = libpng-1.5.12-ppc-gcc4-2012-08-27.zip ;
716	} else if $(TARGET_ARCH) = x86_64 {
717		HAIKU_LIBPNG_FILE = libpng-1.5.12-x86_64-2012-11-18.zip ;
718	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
719		HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc4-2012-08-23.zip ;
720	} else {
721		HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc2-2012-08-23.zip ;
722	}
723
724	local libpngZipFile = [ DownloadFile $(HAIKU_LIBPNG_FILE)
725		: $(libpngBaseURL)/$(HAIKU_LIBPNG_FILE) ] ;
726
727	HAIKU_LIBPNG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
728		$(HAIKU_LIBPNG_FILE:B) ] ;
729
730	HAIKU_LIBPNG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBPNG_DIR)
731		: common/include : $(libpngZipFile)
732		: extracted-libpng ] ;
733
734	HAIKU_LIBPNG_LIB = [ ExtractArchive $(HAIKU_LIBPNG_DIR)
735		:
736		common/lib/libpng.so
737		: $(libpngZipFile)
738		: extracted-libpng ] ;
739	HAIKU_LIBPNG_CURRENT_LIB = [ ExtractArchive $(HAIKU_LIBPNG_DIR)
740		:
741		common/lib/libpng15.so.15.12.0
742		: $(libpngZipFile)
743		: extracted-libpng ] ;
744	Depends $(HAIKU_LIBPNG_LIB) $(HAIKU_LIBPNG_CURRENT_LIB) : $(HAIKU_LIBPNG_HEADERS_DEPENDENCY) ;
745
746	HAIKU_LIBPNG_CURRENT_LINK = libpng15.so.15 ;
747
748	HAIKU_LIBPNG_HEADERS = [ FDirName $(HAIKU_LIBPNG_DIR) common include ] ;
749
750	EnableBuildFeatures libpng ;
751} else {
752	Echo "libpng support not available on $(TARGET_ARCH)" ;
753}
754
755# jpeg
756local jpegBaseURL = $(baseURL)/lib ;
757if $(TARGET_ARCH) in arm ppc x86 x86_64 {
758	if $(TARGET_ARCH) = arm {
759		HAIKU_JPEG_FILE = jpeg-8d-arm-2012-11-21.zip ;
760	} else if $(TARGET_ARCH) = ppc {
761		HAIKU_JPEG_FILE = jpeg-8d-ppc-gcc4-2012-08-27.zip ;
762	} else if $(TARGET_ARCH) = x86_64 {
763		HAIKU_JPEG_FILE = jpeg-8d-x86_64-2012-11-18.zip ;
764	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
765		HAIKU_JPEG_FILE = jpeg-8d-x86-gcc4-2012-08-23.zip ;
766	} else {
767		HAIKU_JPEG_FILE = jpeg-8d-x86-gcc2-2012-08-23.zip ;
768	}
769
770	local jpegZipFile = [ DownloadFile $(HAIKU_JPEG_FILE)
771		: $(jpegBaseURL)/$(HAIKU_JPEG_FILE) ] ;
772
773	HAIKU_JPEG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
774		$(HAIKU_JPEG_FILE:B) ] ;
775
776	HAIKU_JPEG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_JPEG_DIR)
777		: common/include : $(jpegZipFile)
778		: extracted-jpeg ] ;
779
780	HAIKU_JPEG_LIB = [ ExtractArchive $(HAIKU_JPEG_DIR)
781		:
782		common/lib/libjpeg.so
783		: $(jpegZipFile)
784		: extracted-jpeg ] ;
785	HAIKU_JPEG_CURRENT_LIB = [ ExtractArchive $(HAIKU_JPEG_DIR)
786		:
787		common/lib/libjpeg.so.8.4.0
788		: $(jpegZipFile)
789		: extracted-jpeg ] ;
790	Depends $(HAIKU_JPEG_LIB) $(HAIKU_JPEG_CURRENT_LIB) : $(HAIKU_JPEG_HEADERS_DEPENDENCY) ;
791
792	HAIKU_JPEG_CURRENT_LINK = libjpeg.so.8 ;
793
794	HAIKU_JPEG_HEADERS = [ FDirName $(HAIKU_JPEG_DIR) common include ] ;
795
796	EnableBuildFeatures libjpeg ;
797} else {
798	Echo "jpeg support not available on $(TARGET_ARCH)" ;
799}
800
801# zlib
802local zlibBaseURL = $(baseURL)/lib ;
803if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm {
804	if $(TARGET_ARCH) = arm {
805		HAIKU_ZLIB_FILE = zlib-1.2.7-arm-2012-11-21.zip ;
806	} else if $(TARGET_ARCH) = ppc {
807		HAIKU_ZLIB_FILE = zlib-1.2.7-ppc-gcc4-2012-10-30.zip ;
808	} else if $(TARGET_ARCH) = x86_64 {
809		HAIKU_ZLIB_FILE = zlib-1.2.7-x86_64-2012-11-18.zip ;
810	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
811		HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc4-2012-10-30.zip ;
812	} else {
813		HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc2-2012-10-30.zip ;
814	}
815
816	local zlibZipFile = [ DownloadFile $(HAIKU_ZLIB_FILE)
817		: $(zlibBaseURL)/$(HAIKU_ZLIB_FILE) ] ;
818
819	HAIKU_ZLIB_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
820		$(HAIKU_ZLIB_FILE:B) ] ;
821
822	HAIKU_ZLIB_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_ZLIB_DIR)
823		: common/include : $(zlibZipFile)
824		: extracted-zlib ] ;
825
826	HAIKU_ZLIB_LIB = [ ExtractArchive $(HAIKU_ZLIB_DIR)
827		:
828		common/lib/libz.so
829		: $(zlibZipFile)
830		: extracted-zlib ] ;
831	HAIKU_ZLIB_CURRENT_LIB = [ ExtractArchive $(HAIKU_ZLIB_DIR)
832		:
833		common/lib/libz.so.1.2.7
834		: $(zlibZipFile)
835		: extracted-zlib ] ;
836	Depends $(HAIKU_ZLIB_LIB) $(HAIKU_ZLIB_CURRENT_LIB) : $(HAIKU_ZLIB_HEADERS_DEPENDENCY) ;
837
838	HAIKU_ZLIB_CURRENT_LINK = libz.so.1 ;
839
840	HAIKU_ZLIB_HEADERS = [ FDirName $(HAIKU_ZLIB_DIR) common include ] ;
841
842	EnableBuildFeatures zlib ;
843} else {
844	Echo "zlib support not available on $(TARGET_ARCH)" ;
845}
846
847
848# GPL add-ons
849if $(HAIKU_INCLUDE_GPL_ADDONS) = 1 {
850	EnableBuildFeatures gpl ;
851}
852
853
854# ATA vs. IDE
855#HACK: remove when old ide code is removed!
856if $(HAIKU_ATA_STACK) = 1 {
857	EnableBuildFeatures ata ;
858} else {
859	EnableBuildFeatures ide ;
860}
861