xref: /haiku/build/jam/BuildFeatures (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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.0.1-x86-gcc4-2012-12-21.zip ;
348	} else {
349		HAIKU_MESA_FILE = mesa-7.8.2-x86-gcc2-2012-01-17.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_DEPENDENCY = [ ExtractArchive $(HAIKU_MESA_DIR)
359		: include/ : $(zipFile) : extracted-mesa ] ;
360
361	HAIKU_GLAPI_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
362		:
363		lib.haiku/libglapi.a
364		: $(zipFile)
365		: extracted-mesa ] ;
366	HAIKU_GLSL_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
367		:
368		lib.haiku/libglsl.a
369		: $(zipFile)
370		: extracted-mesa ] ;
371	HAIKU_MESA_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
372		:
373		lib.haiku/libmesa.a
374		: $(zipFile)
375		: extracted-mesa ] ;
376	HAIKU_GALLIUM_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
377		:
378		lib.haiku/libgallium.a
379		: $(zipFile)
380		: extracted-mesa ] ;
381
382	if FIsBuildFeatureEnabled(llvm) {
383		HAIKU_GALLIUM_LLVMPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
384			:
385			lib.haiku/libllvmpipe.a
386			: $(zipFile)
387			: extracted-mesa ] ;
388		Depends $(HAIKU_GALLIUM_LLVMPIPE_LIB) : $(HAIKU_LLVM_LIBS) ;
389	} else {
390		HAIKU_GALLIUM_SOFTPIPE_LIB = [ ExtractArchive $(HAIKU_MESA_DIR)
391			:
392			lib.haiku/libsoftpipe.a
393			: $(zipFile)
394			: extracted-mesa ] ;
395	}
396
397	HAIKU_MESA_HEADERS = [ FDirName $(HAIKU_MESA_DIR) include ] ;
398
399	Depends $(HAIKU_MESA_HEADERS_DEPENDENCY) : $(HAIKU_GLU_HEADERS_DEPENDENCY) ;
400	Depends $(HAIKU_GLAPI_LIBS) : $(HAIKU_GLU_LIBS) ;
401
402	EnableBuildFeatures mesa ;
403} else {
404	Echo "Mesa 3D rendering support not available on $(TARGET_ARCH)" ;
405}
406
407
408# FFmpeg
409local ffmpegBaseURL = $(baseURL)/lib ;
410if $(TARGET_ARCH) = x86 {
411	if $(HAIKU_GCC_VERSION[1]) >= 4 {
412		HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-r1a4-x86-gcc4-2012-09-02.zip ;
413		HAIKU_SPEEX_FILE = speex-1.2rc1-r1a4-x86-gcc4-2012-09-02.zip ;
414		HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-r1a4-x86-gcc4-2012-09-02.zip ;
415		HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-r1a4-x86-gcc4-2012-09-02.zip ;
416		HAIKU_LIBOGG_FILE = libogg-1.3.0-r1a4-x86-gcc4-2012-09-02.zip ;
417		HAIKU_LIBVPX_FILE = libvpx-1.0.0-r1a4-x86-gcc4-2012-09-02.zip ;
418	} else {
419		HAIKU_FFMPEG_FILE = ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30.zip ;
420		HAIKU_SPEEX_FILE = speex-1.2rc1-r1a4-x86-gcc2-2012-08-29.zip ;
421		HAIKU_LIBTHEORA_FILE = libtheora-1.1.1-r1a4-x86-gcc2-2012-08-29.zip ;
422		HAIKU_LIBVORBIS_FILE = libvorbis-1.3.2-r1a4-x86-gcc2-2012-08-29.zip ;
423		HAIKU_LIBOGG_FILE = libogg-1.3.0-r1a4-x86-gcc2-2012-08-29.zip ;
424		HAIKU_LIBVPX_FILE = libvpx-1.0.0-r1a4-x86-gcc2-2012-08-29.zip ;
425	}
426
427	local ffmpegZipFile = [ DownloadFile $(HAIKU_FFMPEG_FILE)
428		: $(ffmpegBaseURL)/$(HAIKU_FFMPEG_FILE) ] ;
429	local speexZipFile = [ DownloadFile $(HAIKU_SPEEX_FILE)
430		: $(ffmpegBaseURL)/$(HAIKU_SPEEX_FILE) ] ;
431	local libtheoraZipFile = [ DownloadFile $(HAIKU_LIBTHEORA_FILE)
432		: $(ffmpegBaseURL)/$(HAIKU_LIBTHEORA_FILE) ] ;
433	local libvorbisZipFile = [ DownloadFile $(HAIKU_LIBVORBIS_FILE)
434		: $(ffmpegBaseURL)/$(HAIKU_LIBVORBIS_FILE) ] ;
435	local liboggZipFile = [ DownloadFile $(HAIKU_LIBOGG_FILE)
436		: $(ffmpegBaseURL)/$(HAIKU_LIBOGG_FILE) ] ;
437	local libvpxZipFile = [ DownloadFile $(HAIKU_LIBVPX_FILE)
438		: $(ffmpegBaseURL)/$(HAIKU_LIBVPX_FILE) ] ;
439
440	HAIKU_FFMPEG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
441		$(HAIKU_FFMPEG_FILE:B) ] ;
442	HAIKU_SPEEX_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
443		$(HAIKU_SPEEX_FILE:B) ] ;
444	HAIKU_LIBTHEORA_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
445		$(HAIKU_LIBTHEORA_FILE:B) ] ;
446	HAIKU_LIBVORBIS_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
447		$(HAIKU_LIBVORBIS_FILE:B) ] ;
448	HAIKU_LIBOGG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
449		$(HAIKU_LIBOGG_FILE:B) ] ;
450	HAIKU_LIBVPX_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
451		$(HAIKU_LIBVPX_FILE:B) ] ;
452
453	HAIKU_FFMPEG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_FFMPEG_DIR)
454		: common/include/ : $(ffmpegZipFile) : extracted-ffmpeg ] ;
455	HAIKU_SPEEX_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_SPEEX_DIR)
456		: common/include/ : $(speexZipFile) : extracted-speex ] ;
457	HAIKU_LIBTHEORA_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBTHEORA_DIR)
458		: common/include/ : $(libtheoraZipFile) : extracted-libtheora ] ;
459	HAIKU_LIBVORBIS_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBVORBIS_DIR)
460		: common/include/ : $(libvorbisZipFile) : extracted-libvorbis ] ;
461	HAIKU_LIBOGG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBOGG_DIR)
462		: common/include/ : $(liboggZipFile) : extracted-libogg ] ;
463	HAIKU_LIBVPX_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBVPX_DIR)
464		: common/include/ : $(libvpxZipFile) : extracted-libvpx ] ;
465
466	HAIKU_FFMPEG_LIBS = [ ExtractArchive $(HAIKU_FFMPEG_DIR)
467		:
468		common/lib/libavformat.a
469		common/lib/libavcodec.a
470		common/lib/libavdevice.a
471		common/lib/libavfilter.a
472		common/lib/libswscale.a
473		common/lib/libavutil.a
474		: $(ffmpegZipFile)
475		: extracted-ffmpeg ] ;
476	Depends $(HAIKU_FFMPEG_LIBS) : $(HAIKU_FFMPEG_HEADERS_DEPENDENCY) ;
477
478	HAIKU_SPEEX_LIBS = [ ExtractArchive $(HAIKU_SPEEX_DIR)
479		:
480		common/lib/libspeex.a
481		: $(speexZipFile)
482		: extracted-speex ] ;
483	Depends $(HAIKU_SPEEX_LIBS) : $(HAIKU_SPEEX_HEADERS_DEPENDENCY) ;
484
485	HAIKU_LIBTHEORA_LIBS = [ ExtractArchive $(HAIKU_LIBTHEORA_DIR)
486		:
487		common/lib/libtheora.a
488		common/lib/libtheoradec.a
489		common/lib/libtheoraenc.a
490		: $(libtheoraZipFile)
491		: extracted-libtheora ] ;
492	Depends $(HAIKU_LIBTHEORA_LIBS) : $(HAIKU_LIBTHEORA_HEADERS_DEPENDENCY) ;
493
494
495	HAIKU_LIBVORBIS_LIBS = [ ExtractArchive $(HAIKU_LIBVORBIS_DIR)
496		:
497		common/lib/libvorbis.a
498		common/lib/libvorbisenc.a
499		: $(libvorbisZipFile)
500		: extracted-libvorbis ] ;
501	Depends $(HAIKU_LIBVORBIS_LIBS) : $(HAIKU_LIBVORBIS_HEADERS_DEPENDENCY) ;
502
503
504	HAIKU_LIBOGG_LIBS = [ ExtractArchive $(HAIKU_LIBOGG_DIR)
505		:
506		common/lib/libogg.a
507		: $(liboggZipFile)
508		: extracted-libogg ] ;
509	Depends $(HAIKU_LIBOGG_LIBS) : $(HAIKU_LIBOGG_HEADERS_DEPENDENCY) ;
510
511	HAIKU_LIBVPX_LIBS = [ ExtractArchive $(HAIKU_LIBVPX_DIR)
512		:
513		common/lib/libvpx.a
514		: $(libvpxZipFile)
515		: extracted-libvpx ] ;
516	Depends $(HAIKU_LIBVPX_LIBS) : $(HAIKU_LIBVPX_HEADERS_DEPENDENCY) ;
517
518	HAIKU_FFMPEG_HEADERS = [ FDirName $(HAIKU_FFMPEG_DIR) common include ] ;
519	HAIKU_SPEEX_HEADERS = [ FDirName $(HAIKU_SPEEX_DIR) common include ] ;
520	HAIKU_LIBTHEORA_HEADERS = [ FDirName $(HAIKU_LIBTHEORA_DIR) common include ] ;
521	HAIKU_LIBVORBIS_HEADERS = [ FDirName $(HAIKU_LIBVORBIS_DIR) common include ] ;
522	HAIKU_LIBOGG_HEADERS = [ FDirName $(HAIKU_LIBOGG_DIR) common include ] ;
523	HAIKU_LIBVPX_HEADERS = [ FDirName $(HAIKU_LIBVPX_DIR) common include ] ;
524
525	EnableBuildFeatures ffmpeg ;
526} else {
527	Echo "FFMpeg support not available on $(TARGET_ARCH)" ;
528}
529
530
531# MikMod
532local mikmodBaseURL = http://haiku-files.org/files/optional-packages/lib ;
533if $(TARGET_ARCH) = x86 {
534	if $(HAIKU_GCC_VERSION[1]) >= 4 {
535		HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a4-x86-gcc4-2012-09-02.zip ;
536	} else {
537		HAIKU_MIKMOD_FILE = libmikmod-3.1.11-r1a4-x86-gcc2-2012-08-29.zip ;
538	}
539
540	local mikmodZipFile = [ DownloadFile $(HAIKU_MIKMOD_FILE)
541		: $(mikmodBaseURL)/$(HAIKU_MIKMOD_FILE) ] ;
542
543	HAIKU_MIKMOD_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
544		$(HAIKU_MIKMOD_FILE:B) ] ;
545
546	HAIKU_MIKMOD_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_MIKMOD_DIR)
547		: common/include/ : $(mikmodZipFile) : extracted-mikmod ] ;
548
549	HAIKU_MIKMOD_LIBS = [ ExtractArchive $(HAIKU_MIKMOD_DIR)
550		:
551		common/lib/libmikmod.a
552		: $(mikmodZipFile)
553		: extracted-ffmpeg ] ;
554	Depends $(HAIKU_MIKMOD_LIBS) : $(HAIKU_MIKMOD_HEADERS_DEPENDENCY) ;
555
556	HAIKU_MIKMOD_HEADERS = [ FDirName $(HAIKU_MIKMOD_DIR) common include ] ;
557
558	EnableBuildFeatures mikmod ;
559} else {
560	Echo "MikMod support not available on $(TARGET_ARCH)" ;
561}
562
563
564# Freetype
565local freetypeBaseURL = $(baseURL)/lib ;
566if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm {
567	if $(TARGET_ARCH) = arm {
568		HAIKU_FREETYPE_FILE = freetype-2.4.9-arm-2012-11-21.zip ;
569	} else if $(TARGET_ARCH) = ppc {
570		HAIKU_FREETYPE_FILE = freetype-2.4.9-ppc-gcc4-2012-06-26.zip ;
571	} else if $(TARGET_ARCH) = x86_64 {
572		HAIKU_FREETYPE_FILE = freetype-2.4.9-x86_64-2012-08-04.zip ;
573	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
574		HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc4-2012-09-02.zip ;
575	} else {
576		HAIKU_FREETYPE_FILE = freetype-2.4.9-r1a4-x86-gcc2-2012-08-28.zip ;
577	}
578
579	local freetypeZipFile = [ DownloadFile $(HAIKU_FREETYPE_FILE)
580		: $(freetypeBaseURL)/$(HAIKU_FREETYPE_FILE) ] ;
581
582	HAIKU_FREETYPE_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
583		$(HAIKU_FREETYPE_FILE:B) ] ;
584
585	HAIKU_FREETYPE_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
586		: develop/headers/3rdparty/freetype2 : $(freetypeZipFile)
587		: extracted-freetype ] ;
588
589	HAIKU_FREETYPE_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
590		:
591		common/lib/libfreetype.so
592		: $(freetypeZipFile)
593		: extracted-freetype ] ;
594	HAIKU_FREETYPE_CURRENT_LIB = [ ExtractArchive $(HAIKU_FREETYPE_DIR)
595		:
596		common/lib/libfreetype.so.6.8.1
597		: $(freetypeZipFile)
598		: extracted-freetype ] ;
599	Depends $(HAIKU_FREETYPE_LIB) $(HAIKU_FREETYPE_CURRENT_LIB) : $(HAIKU_FREETYPE_HEADERS_DEPENDENCY) ;
600
601	HAIKU_FREETYPE_CURRENT_LINK = libfreetype.so.6 ;
602
603	HAIKU_FREETYPE_HEADERS = [ FDirName $(HAIKU_FREETYPE_DIR) develop
604		headers 3rdparty ] [ FDirName $(HAIKU_FREETYPE_DIR) develop
605		headers 3rdparty freetype2 ] ;
606
607	EnableBuildFeatures freetype ;
608} else {
609	Echo "Freetype support not available on $(TARGET_ARCH)" ;
610}
611
612
613# TagLib
614
615# Automatically install the TagLib feature, when the optional TagLib optional
616# package is enabled.
617if [ IsOptionalHaikuImagePackageAdded TagLib ] {
618	HAIKU_BUILD_FEATURE_TAGLIB = 1 ;
619}
620
621HAIKU_TAGLIB_PACKAGE = taglib-1.6.3-r1a4-x86-gcc2-2012-09-03.zip ;
622HAIKU_TAGLIB_URL = $(baseURL)/$(HAIKU_TAGLIB_PACKAGE) ;
623
624if $(HAIKU_BUILD_FEATURE_TAGLIB) {
625	if $(TARGET_ARCH) != x86 {
626		Echo "TagLib build feature not available for $(TARGET_ARCH)" ;
627	} else {
628		# Download the zip archive.
629		local zipFile = [ DownloadFile $(HAIKU_TAGLIB_PACKAGE)
630			: $(HAIKU_TAGLIB_URL) ] ;
631
632		# zip file and output directory
633		HAIKU_TAGLIB_ZIP_FILE = $(zipFile) ;
634		HAIKU_TAGLIB_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
635			$(HAIKU_TAGLIB_PACKAGE:B) ] ;
636
637		# extract headers and libraries
638		HAIKU_TAGLIB_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_TAGLIB_DIR)
639			: common/include/ : $(zipFile) : extracted-taglib
640		] ;
641
642		HAIKU_TAGLIB_LIBS = [ ExtractArchive $(HAIKU_TAGLIB_DIR)
643			:
644			common/lib/libtag.so
645			common/lib/libtag_c.so
646			: $(zipFile)
647			: extracted-taglib
648		] ;
649
650		HAIKU_TAGLIB_HEADERS
651			= [ FDirName $(HAIKU_TAGLIB_DIR) common include taglib ] ;
652
653		EnableBuildFeatures taglib ;
654	}
655}
656
657
658# WebKit
659# Automatically install the WebKit feature, when the optional WebPositive
660# optional package is enabled.
661if [ IsOptionalHaikuImagePackageAdded WebPositive ] {
662	HAIKU_BUILD_FEATURE_WEBKIT = 1 ;
663}
664
665if $(TARGET_ARCH) = x86 {
666	HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86-gcc4-2012-08-31a.zip ;
667} else if $(TARGET_ARCH) = x86_64 {
668	HAIKU_WEBKIT_FILE = haikuwebkit-1.1.3-x86_64-gcc4-2012-12-22.zip ;
669}
670if $(HAIKU_BUILD_FEATURE_WEBKIT) {
671	if $(TARGET_ARCH) != x86 && $(TARGET_ARCH) != x86_64 {
672		Echo "WebKit support not available on $(TARGET_ARCH)" ;
673	} else if $(HAIKU_GCC_VERSION[1]) < 4 {
674		if ! $(isHybridBuild) {
675			Echo "WebKit support not available on gcc $(HAIKU_GCC_VERSION[1])" ;
676		} else {
677			Echo "WebKit to be utilized by gcc4 inside $(HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR)" ;
678		}
679	} else {
680		local zipFile = [ DownloadFile $(HAIKU_WEBKIT_FILE)
681			: $(baseURL)/$(HAIKU_WEBKIT_FILE) ] ;
682
683		HAIKU_WEBKIT_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
684			$(HAIKU_WEBKIT_FILE:B) ] ;
685
686		HAIKU_WEBKIT_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_WEBKIT_DIR)
687			: include/ : $(zipFile) : extracted-webkit ] ;
688
689		HAIKU_WEBKIT_LIBS = [ ExtractArchive $(HAIKU_WEBKIT_DIR)
690			:
691			lib/libwtf.so
692			lib/libjavascriptcore.so
693			lib/libwebcore.so
694			lib/libwebkit.so
695			: $(zipFile)
696			: extracted-webkit
697		] ;
698
699		HAIKU_WEBKIT_HEADERS = [ FDirName $(HAIKU_WEBKIT_DIR) include ] ;
700
701		EnableBuildFeatures webkit ;
702	}
703}
704
705# libpng
706local libpngBaseURL = $(baseURL)/lib ;
707if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm {
708	if $(TARGET_ARCH) = arm {
709		HAIKU_LIBPNG_FILE = libpng-1.5.12-arm-2012-11-21.zip ;
710	} else if $(TARGET_ARCH) = ppc {
711		HAIKU_LIBPNG_FILE = libpng-1.5.12-ppc-gcc4-2012-08-27.zip ;
712	} else if $(TARGET_ARCH) = x86_64 {
713		HAIKU_LIBPNG_FILE = libpng-1.5.12-x86_64-2012-11-18.zip ;
714	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
715		HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc4-2012-08-23.zip ;
716	} else {
717		HAIKU_LIBPNG_FILE = libpng-1.5.12-x86-gcc2-2012-08-23.zip ;
718	}
719
720	local libpngZipFile = [ DownloadFile $(HAIKU_LIBPNG_FILE)
721		: $(libpngBaseURL)/$(HAIKU_LIBPNG_FILE) ] ;
722
723	HAIKU_LIBPNG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
724		$(HAIKU_LIBPNG_FILE:B) ] ;
725
726	HAIKU_LIBPNG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_LIBPNG_DIR)
727		: common/include : $(libpngZipFile)
728		: extracted-libpng ] ;
729
730	HAIKU_LIBPNG_LIB = [ ExtractArchive $(HAIKU_LIBPNG_DIR)
731		:
732		common/lib/libpng.so
733		: $(libpngZipFile)
734		: extracted-libpng ] ;
735	HAIKU_LIBPNG_CURRENT_LIB = [ ExtractArchive $(HAIKU_LIBPNG_DIR)
736		:
737		common/lib/libpng15.so.15.12.0
738		: $(libpngZipFile)
739		: extracted-libpng ] ;
740	Depends $(HAIKU_LIBPNG_LIB) $(HAIKU_LIBPNG_CURRENT_LIB) : $(HAIKU_LIBPNG_HEADERS_DEPENDENCY) ;
741
742	HAIKU_LIBPNG_CURRENT_LINK = libpng15.so.15 ;
743
744	HAIKU_LIBPNG_HEADERS = [ FDirName $(HAIKU_LIBPNG_DIR) common include ] ;
745
746	EnableBuildFeatures libpng ;
747} else {
748	Echo "libpng support not available on $(TARGET_ARCH)" ;
749}
750
751# jpeg
752local jpegBaseURL = $(baseURL)/lib ;
753if $(TARGET_ARCH) in arm ppc x86 x86_64 {
754	if $(TARGET_ARCH) = arm {
755		HAIKU_JPEG_FILE = jpeg-8d-arm-2012-11-21.zip ;
756	} else if $(TARGET_ARCH) = ppc {
757		HAIKU_JPEG_FILE = jpeg-8d-ppc-gcc4-2012-08-27.zip ;
758	} else if $(TARGET_ARCH) = x86_64 {
759		HAIKU_JPEG_FILE = jpeg-8d-x86_64-2012-11-18.zip ;
760	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
761		HAIKU_JPEG_FILE = jpeg-8d-x86-gcc4-2012-08-23.zip ;
762	} else {
763		HAIKU_JPEG_FILE = jpeg-8d-x86-gcc2-2012-08-23.zip ;
764	}
765
766	local jpegZipFile = [ DownloadFile $(HAIKU_JPEG_FILE)
767		: $(jpegBaseURL)/$(HAIKU_JPEG_FILE) ] ;
768
769	HAIKU_JPEG_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
770		$(HAIKU_JPEG_FILE:B) ] ;
771
772	HAIKU_JPEG_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_JPEG_DIR)
773		: common/include : $(jpegZipFile)
774		: extracted-jpeg ] ;
775
776	HAIKU_JPEG_LIB = [ ExtractArchive $(HAIKU_JPEG_DIR)
777		:
778		common/lib/libjpeg.so
779		: $(jpegZipFile)
780		: extracted-jpeg ] ;
781	HAIKU_JPEG_CURRENT_LIB = [ ExtractArchive $(HAIKU_JPEG_DIR)
782		:
783		common/lib/libjpeg.so.8.4.0
784		: $(jpegZipFile)
785		: extracted-jpeg ] ;
786	Depends $(HAIKU_JPEG_LIB) $(HAIKU_JPEG_CURRENT_LIB) : $(HAIKU_JPEG_HEADERS_DEPENDENCY) ;
787
788	HAIKU_JPEG_CURRENT_LINK = libjpeg.so.8 ;
789
790	HAIKU_JPEG_HEADERS = [ FDirName $(HAIKU_JPEG_DIR) common include ] ;
791
792	EnableBuildFeatures libjpeg ;
793} else {
794	Echo "jpeg support not available on $(TARGET_ARCH)" ;
795}
796
797# zlib
798local zlibBaseURL = $(baseURL)/lib ;
799if $(TARGET_ARCH) = ppc || $(TARGET_ARCH) = x86 || $(TARGET_ARCH) = x86_64 || $(TARGET_ARCH) = arm {
800	if $(TARGET_ARCH) = arm {
801		HAIKU_ZLIB_FILE = zlib-1.2.7-arm-2012-11-21.zip ;
802	} else if $(TARGET_ARCH) = ppc {
803		HAIKU_ZLIB_FILE = zlib-1.2.7-ppc-gcc4-2012-10-30.zip ;
804	} else if $(TARGET_ARCH) = x86_64 {
805		HAIKU_ZLIB_FILE = zlib-1.2.7-x86_64-2012-11-18.zip ;
806	} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
807		HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc4-2012-10-30.zip ;
808	} else {
809		HAIKU_ZLIB_FILE = zlib-1.2.7-x86-gcc2-2012-10-30.zip ;
810	}
811
812	local zlibZipFile = [ DownloadFile $(HAIKU_ZLIB_FILE)
813		: $(zlibBaseURL)/$(HAIKU_ZLIB_FILE) ] ;
814
815	HAIKU_ZLIB_DIR = [ FDirName $(HAIKU_OPTIONAL_BUILD_PACKAGES_DIR)
816		$(HAIKU_ZLIB_FILE:B) ] ;
817
818	HAIKU_ZLIB_HEADERS_DEPENDENCY = [ ExtractArchive $(HAIKU_ZLIB_DIR)
819		: common/include : $(zlibZipFile)
820		: extracted-zlib ] ;
821
822	HAIKU_ZLIB_LIB = [ ExtractArchive $(HAIKU_ZLIB_DIR)
823		:
824		common/lib/libz.so
825		: $(zlibZipFile)
826		: extracted-zlib ] ;
827	HAIKU_ZLIB_CURRENT_LIB = [ ExtractArchive $(HAIKU_ZLIB_DIR)
828		:
829		common/lib/libz.so.1.2.7
830		: $(zlibZipFile)
831		: extracted-zlib ] ;
832	Depends $(HAIKU_ZLIB_LIB) $(HAIKU_ZLIB_CURRENT_LIB) : $(HAIKU_ZLIB_HEADERS_DEPENDENCY) ;
833
834	HAIKU_ZLIB_CURRENT_LINK = libz.so.1 ;
835
836	HAIKU_ZLIB_HEADERS = [ FDirName $(HAIKU_ZLIB_DIR) common include ] ;
837
838	EnableBuildFeatures zlib ;
839} else {
840	Echo "zlib support not available on $(TARGET_ARCH)" ;
841}
842
843
844# GPL add-ons
845if $(HAIKU_INCLUDE_GPL_ADDONS) = 1 {
846	EnableBuildFeatures gpl ;
847}
848
849
850# ATA vs. IDE
851#HACK: remove when old ide code is removed!
852if $(HAIKU_ATA_STACK) = 1 {
853	EnableBuildFeatures ata ;
854} else {
855	EnableBuildFeatures ide ;
856}
857