SUMMARY="Modular and reuseable compiler and toolchain technologies"
DESCRIPTION="The LLVM Project is a collection of modular and reusable compiler \
and toolchain technologies. Despite its name, LLVM has little to do with \
traditional virtual machines, though it does provide helpful libraries that \
can be used to build them. The name \"LLVM\" itself is not an acronym; it is \
the full name of the project.

LLVM began as a research project at the University of Illinois, with the goal \
of providing a modern, SSA-based compilation strategy capable of supporting \
both static and dynamic compilation of arbitrary programming languages. Since \
then, LLVM has grown to be an umbrella project consisting of a number of \
subprojects, many of which are being used in production by a wide variety of \
commercial and open source projects as well as being widely used in academic \
research. Code in the LLVM project is licensed under the \"UIUC\" BSD-Style \
license.

The primary sub-projects of LLVM are:

The LLVM Core libraries provide a modern source- and target-independent \
optimizer, along with code generation support for many popular CPUs (as well \
as some less common ones!) These libraries are built around a well specified \
code representation known as the LLVM intermediate representation (\"LLVM \
IR\"). The LLVM Core libraries are well documented, and it is particularly \
easy to invent your own language (or port an existing compiler) to use LLVM as \
an optimizer and code generator.

Clang is an \"LLVM native\" C/C++/Objective-C compiler, which aims to deliver \
amazingly fast compiles (e.g. about 3x faster than GCC when compiling \
Objective-C code in a debug configuration), extremely useful error and warning \
messages and to provide a platform for building great source level tools. The \
Clang Static Analyzer is a tool that automatically finds bugs in your code, \
and is a great example of the sort of tool that can be built using the Clang \
frontend as a library to parse C/C++ code.

dragonegg integrates the LLVM optimizers and code generator with the GCC \
parsers. This allows LLVM to compile Ada, Fortran, and other languages \
supported by the GCC compiler frontends, and access to C features not \
supported by Clang (such as OpenMP).

The LLDB project builds on libraries provided by LLVM and Clang to provide a \
great native debugger. It uses the Clang ASTs and expression parser, LLVM JIT, \
LLVM disassembler, etc so that it provides an experience that \"just works\". \
It is also blazing fast and much more memory efficient than GDB at loading \
symbols.

The libc++ and libc++ ABI projects provide a standard conformant and high-\
performance implementation of the C++ Standard Library, including full support \
for C++11.

The compiler-rt project provides highly tuned implementations of the low-level \
code generator support routines like \"__fixunsdfdi\" and other calls \
generated when a target doesn't have a short sequence of native instructions \
to implement a core IR operation.

The vmkit project is an implementation of the Java and .NET Virtual Machines \
that is built on LLVM technologies.

The polly project implements a suite of cache-locality optimizations as well \
as auto-parallelism and vectorization using a polyhedral model.

The libclc project aims to implement the OpenCL standard library.

The klee project implements a \"symbolic virtual machine\" which uses a \
theorem prover to try to evaluate all dynamic paths through a program in an \
effort to find bugs and to prove properties of functions. A major feature of \
klee is that it can produce a testcase in the event that it detects a bug.

The SAFECode project is a memory safety compiler for C/C++ programs. It \
instruments code with run-time checks to detect memory safety errors (e.g., \
buffer overflows) at run-time. It can be used to protect software from \
security attacks and can also be used as a memory safety error debugging tool \
like Valgrind.

In addition to official subprojects of LLVM, there are a broad variety of \
other projects that use components of LLVM for various tasks. Through these \
external projects you can use LLVM to compile Ruby, Python, Haskell, Java, D, \
PHP, Pure, Lua, and a number of other languages. A major strength of LLVM is \
its versatility, flexibility, and reusability, which is why it is being used \
for such a wide variety of different tasks: everything from doing light-weight \
JIT compiles of embedded languages like Lua to compiling Fortran code for \
massive super computers."
HOMEPAGE="http://www.llvm.org/"
LICENSE="UIUC"
REVISION="1"

ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

SOURCE_URI="http://llvm.org/releases/3.0/llvm-3.0.tar.gz"
CHECKSUM_SHA256="519eb11d3499ce99c6ffdb8718651fc91425ed7690eac91c8d6853474f7c0477"
COPYRIGHT="2003-2011 University of Illinois at Urbana-Champaign"
SOURCE_DIR="llvm-$portVersion.src"

PROVIDES="
	llvm$secondaryArchSuffix = $portVersion compat >= 3
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
#	cmd:autoconf
#	cmd:flex
	cmd:groff
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
#	cmd:makeinfo
	cmd:perl
#	cmd:sed
#	cmd:strip
#	cmd:tar
	"

#POLICY WARNING: Invalid top-level package entry "docs"
#POLICY WARNING: Invalid top-level package entry "include"
#POLICY WARNING: Invalid top-level package entry "share"
#POLICY WARNING: no matching provides "cmd:bugpoint" for "bin/bugpoint"
#POLICY WARNING: no matching provides "cmd:llc" for "bin/llc"
#POLICY WARNING: no matching provides "cmd:lli" for "bin/lli"
#POLICY WARNING: no matching provides "cmd:llvm_ar" for "bin/llvm-ar"
#POLICY WARNING: no matching provides "cmd:llvm_as" for "bin/llvm-as"
#POLICY WARNING: no matching provides "cmd:llvm_bcanalyzer" for "bin/llvm-bcanalyzer"
#POLICY WARNING: no matching provides "cmd:llvm_config" for "bin/llvm-config"
#POLICY WARNING: no matching provides "cmd:llvm_cov" for "bin/llvm-cov"
#POLICY WARNING: no matching provides "cmd:llvm_diff" for "bin/llvm-diff"
#POLICY WARNING: no matching provides "cmd:llvm_dis" for "bin/llvm-dis"
#POLICY WARNING: no matching provides "cmd:llvm_dwarfdump" for "bin/llvm-dwarfdump"
#POLICY WARNING: no matching provides "cmd:llvm_extract" for "bin/llvm-extract"
#POLICY WARNING: no matching provides "cmd:llvm_ld" for "bin/llvm-ld"
#POLICY WARNING: no matching provides "cmd:llvm_link" for "bin/llvm-link"
#POLICY WARNING: no matching provides "cmd:llvm_mc" for "bin/llvm-mc"
#POLICY WARNING: no matching provides "cmd:llvm_nm" for "bin/llvm-nm"
#POLICY WARNING: no matching provides "cmd:llvm_objdump" for "bin/llvm-objdump"
#POLICY WARNING: no matching provides "cmd:llvm_prof" for "bin/llvm-prof"
#POLICY WARNING: no matching provides "cmd:llvm_ranlib" for "bin/llvm-ranlib"
#POLICY WARNING: no matching provides "cmd:llvm_rtdyld" for "bin/llvm-rtdyld"
#POLICY WARNING: no matching provides "cmd:llvm_size" for "bin/llvm-size"
#POLICY WARNING: no matching provides "cmd:llvm_stub" for "bin/llvm-stub"
#POLICY WARNING: no matching provides "cmd:llvm_tblgen" for "bin/llvm-tblgen"
#POLICY WARNING: no matching provides "cmd:macho_dump" for "bin/macho-dump"
#POLICY WARNING: no matching provides "cmd:opt" for "bin/opt"

BUILD()
{
	runConfigure ./configure --enable-optimized
	make $jobArgs
}

INSTALL()
{
	make install
}
