Update of /cvsroot/fink/dists/10.4/stable/main/finkinfo/10.4-EOL/languages
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16591

Modified Files:
        llvm32.info llvm32.patch 
Log Message:
sync. w/ experimental: -O2! and various backports from trunk and 
powerpc-darwin8 branch


Index: llvm32.patch
===================================================================
RCS file: 
/cvsroot/fink/dists/10.4/stable/main/finkinfo/10.4-EOL/languages/llvm32.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- llvm32.patch        10 Jan 2013 18:02:02 -0000      1.2
+++ llvm32.patch        7 Jun 2013 18:22:35 -0000       1.3
@@ -1,3 +1,45 @@
+Index: autoconf/configure.ac
+===================================================================
+--- autoconf/configure.ac
++++ autoconf/configure.ac
+@@ -1693,7 +1693,7 @@ AC_LINK_IFELSE(
+   AC_LANG_POP([C++])
+   AC_MSG_RESULT(yes)
+-  AC_DEFINE(LLVM_HAS_ATOMICS, 1, Has gcc/MSVC atomic intrinsics),
++  AC_DEFINE([LLVM_HAS_ATOMICS], [1], [Has gcc/MSVC/Apple atomic intrinsics]),
+   AC_MSG_RESULT(no)
+-  AC_DEFINE(LLVM_HAS_ATOMICS, 0, Has gcc/MSVC atomic intrinsics)
++  AC_DEFINE([LLVM_HAS_ATOMICS], [0], [Has gcc/MSVC/Apple atomic intrinsics])
+   AC_MSG_WARN([LLVM will be built thread-unsafe because atomic builtins are 
missing]))
+ 
+Index: cmake/modules/CheckAtomic.cmake
+===================================================================
+--- cmake/modules/CheckAtomic.cmake
++++ cmake/modules/CheckAtomic.cmake
+@@ -6,6 +6,10 @@ CHECK_CXX_SOURCE_COMPILES("
+ #ifdef _MSC_VER
+ #include <windows.h>
+ #endif
++#define        NEED_DARWIN_ATOMICS (defined(__APPLE__) && defined(__GNUC__) 
&& (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)))
++#if NEED_DARWIN_ATOMICS
++#include <libkern/OSAtomic.h>
++#endif
+ int main() {
+ #ifdef _MSC_VER
+         volatile LONG val = 1;
+@@ -13,6 +17,12 @@ int main() {
+         InterlockedCompareExchange(&val, 0, 1);
+         InterlockedIncrement(&val);
+         InterlockedDecrement(&val);
++#elif NEED_DARWIN_ATOMICS
++      int32_t val = 1;
++      OSMemoryBarrier();
++      OSAtomicCompareAndSwap32Barrier(1, 0, &val);
++      OSAtomicIncrement32(&val);
++      OSAtomicDecrement32(&val);
+ #else
+         volatile unsigned long val = 1;
+         __sync_synchronize();
 Index: lib/ExecutionEngine/MCJIT/CMakeLists.txt
 ===================================================================
 --- lib/ExecutionEngine/MCJIT/CMakeLists.txt   (revision 156555)
@@ -39,6 +81,29 @@
 +  endif()
 +endforeach(t)
 +
+Index: include/llvm/Support/Atomic.h
+===================================================================
+--- include/llvm/Support/Atomic.h
++++ include/llvm/Support/Atomic.h
+@@ -16,12 +16,18 @@
+ 
+ #include "llvm/Support/DataTypes.h"
+ 
++// convenience macro, to force use of darwin atomic functions
++// stage 1 with gcc-4.0 needs this, but maybe not stage 2?
++#define        USE_DARWIN_ATOMICS      (defined(__APPLE__) && 
defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)))
++
+ namespace llvm {
+   namespace sys {
+     void MemoryFence();
+ 
+ #ifdef _MSC_VER
+     typedef long cas_flag;
++#elif USE_DARWIN_ATOMICS
++    typedef int32_t cas_flag;
+ #else
+     typedef uint32_t cas_flag;
+ #endif
 Index: include/llvm/Support/Compiler.h
 ===================================================================
 --- include/llvm/Support/Compiler.h     (revision 170308)
@@ -93,6 +158,130 @@
 +#if defined(__APPLE__) && defined(MACH_EXCEPTION_CODES) && 
defined(EXC_MASK_CRASH)
    // Environment variable to disable any kind of crash dialog.
    if (getenv("LLVM_DISABLE_CRASH_REPORT")) 
+Index: lib/Support/Atomic.cpp
+===================================================================
+--- lib/Support/Atomic.cpp
++++ lib/Support/Atomic.cpp
+@@ -21,21 +21,68 @@ using namespace llvm;
+ #undef MemoryFence
+ #endif
+ 
++// USE_DARWIN_ATOMICS conditionally defined in Atomics.h
++#if USE_DARWIN_ATOMICS
++#include <libkern/OSAtomic.h>
++// __APPLE__ should take precedence over __GNUC__
++// sys::cas_flag is int32_t from Support/Atomic.h, so use '32' variants
++// prototypes lack the 'volatile' qualifier, so we need to cast them away
++template <class T>
++static inline
++T* vcast(volatile T* ptr) { return const_cast<T*>(ptr); }
++
++// note on weakly-ordered architectures (PPC):
++/**
++DESCRIPTION
++     These functions are thread and multiprocessor safe.  For each function,
++     there is a version that does and another that does not incorporate a
++     memory barrier.  Barriers strictly order memory access on a weakly-
++     ordered architecture such as PPC.  All loads and stores executed in
++     sequential program order before the barrier will complete before any load
++     or store executed after the barrier.  On a uniprocessor, the barrier
++     operation is typically a nop.  On a multiprocessor, the barrier can be
++     quite expensive.
++
++     Most code will want to use the barrier functions to insure that memory
++     shared between threads is properly synchronized.  For example, if you
++     want to initialize a shared data structure and then atomically increment
++     a variable to indicate that the initialization is complete, then you MUST
++     use OSAtomicIncrement32Barrier() to ensure that the stores to your data
++     structure complete before the atomic add.  Likewise, the consumer of that
++     data structure MUST use OSAtomicDecrement32Barrier(), in order to ensure
++     that their loads of the structure are not executed before the atomic
++     decrement.  On the other hand, if you are simply incrementing a global
++     counter, then it is safe and potentially much faster to use OSAtomicIn-
++     crement32().  If you are unsure which version to use, prefer the barrier
++     variants as they are safer.
++
++RETURN VALUES
++     The arithmetic and logical operations return the new value, after the
++     operation has been performed.  The compare-and-swap operations return
++     true if the comparison was equal, ie if the swap occured.  The bit test
++     and set/clear operations return the original value of the bit.
++
++      -- man 3 atomic (BSD Library Functions Manual)
++**/
++#endif
++
+ #if defined(__GNUC__) || (defined(__IBMCPP__) && __IBMCPP__ >= 1210)
++#if !USE_DARWIN_ATOMICS
+ #define GNU_ATOMICS
+ #endif
++#endif
+ 
+ void sys::MemoryFence() {
+ #if LLVM_HAS_ATOMICS == 0
+   return;
+-#else
+-#  if defined(GNU_ATOMICS)
++#elif defined(GNU_ATOMICS)
+   __sync_synchronize();
+-#  elif defined(_MSC_VER)
++#elif USE_DARWIN_ATOMICS
++  OSMemoryBarrier();
++#elif defined(_MSC_VER)
+   MemoryBarrier();
+-#  else
++#else
+ # error No memory fence implementation for your platform!
+-#  endif
+ #endif
+ }
+ 
+@@ -49,6 +96,18 @@ sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* 
ptr,
+   return result;
+ #elif defined(GNU_ATOMICS)
+   return __sync_val_compare_and_swap(ptr, old_value, new_value);
++/**
++These builtins perform an atomic compare and swap.
++That is, if the current value of *ptr is oldval, then write newval into *ptr.
++The bool version returns true if the comparison is successful and newval 
++was written. The val version returns the contents of *ptr before the 
operation. 
++      -- http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
++**/
++#elif USE_DARWIN_ATOMICS
++  const sys::cas_flag prev = *ptr;
++  // returns new value, but we don't want it
++  OSAtomicCompareAndSwap32Barrier(old_value, new_value, vcast(ptr));
++  return prev;                // return the previous value at *ptr
+ #elif defined(_MSC_VER)
+   return InterlockedCompareExchange(ptr, new_value, old_value);
+ #else
+@@ -62,6 +121,8 @@ sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* 
ptr) {
+   return *ptr;
+ #elif defined(GNU_ATOMICS)
+   return __sync_add_and_fetch(ptr, 1);
++#elif USE_DARWIN_ATOMICS
++  return OSAtomicIncrement32Barrier(vcast(ptr));      // return new value
+ #elif defined(_MSC_VER)
+   return InterlockedIncrement(ptr);
+ #else
+@@ -75,6 +136,8 @@ sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* 
ptr) {
+   return *ptr;
+ #elif defined(GNU_ATOMICS)
+   return __sync_sub_and_fetch(ptr, 1);
++#elif USE_DARWIN_ATOMICS
++  return OSAtomicDecrement32Barrier(vcast(ptr));      // return new value
+ #elif defined(_MSC_VER)
+   return InterlockedDecrement(ptr);
+ #else
+@@ -88,6 +151,8 @@ sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, 
sys::cas_flag val) {
+   return *ptr;
+ #elif defined(GNU_ATOMICS)
+   return __sync_add_and_fetch(ptr, val);
++#elif USE_DARWIN_ATOMICS
++  return OSAtomicAdd32Barrier(val, vcast(ptr));               // return new 
value
+ #elif defined(_MSC_VER)
+   return InterlockedExchangeAdd(ptr, val) + val;
+ #else
 Index: lib/Target/TargetInstrInfo.cpp
 ===================================================================
 --- lib/Target/TargetInstrInfo.cpp      (revision 167609)
@@ -321,6 +510,28 @@
    CmdArgs.push_back(Args.MakeArgString(ArchName));
 
    // FIXME: Is this needed anymore?
+--- tools/clang/test/Tooling/auto-detect-from-source-parent-of-cwd.cpp
++++ tools/clang/test/Tooling/auto-detect-from-source-parent-of-cwd.cpp
+@@ -2,7 +2,7 @@
+ // RUN: mkdir -p %t/abc/def/ijk/qwe
+ // RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c 
%t/abc/def/ijk/qwe/test.cpp\",\"file\":\"%t/abc/def/ijk/qwe/test.cpp\"}]" | sed 
-e 's/\\/\\\\/g' > %t/compile_commands.json
+ // RUN: cp "%s" "%t/abc/def/ijk/qwe/test.cpp"
+-// RUN: PWD="%t/abc/def" clang-check "ijk/qwe/test.cpp" 2>&1 | FileCheck %s
++// RUN: env PWD="%t/abc/def" clang-check "ijk/qwe/test.cpp" 2>&1 | FileCheck 
%s
+ 
+ // CHECK: C++ requires
+ invalid;
+--- tools/clang/test/Tooling/clang-check-pwd.cpp
++++ tools/clang/test/Tooling/clang-check-pwd.cpp
+@@ -2,7 +2,7 @@
+ // RUN: mkdir %t
+ // RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c 
%t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > 
%t/compile_commands.json
+ // RUN: cp "%s" "%t/test.cpp"
+-// RUN: PWD="%t" clang-check -p "%t" "test.cpp" 2>&1|FileCheck %s
++// RUN: env PWD="%t" clang-check -p "%t" "test.cpp" 2>&1|FileCheck %s
+ // FIXME: Make the above easier.
+ 
+ // CHECK: C++ requires
 Index: tools/polly/lib/CMakeLists.txt
 ===================================================================
 --- tools/polly/lib/CMakeLists.txt     2013-01-07 14:31:36.000000000 -0800

Index: llvm32.info
===================================================================
RCS file: 
/cvsroot/fink/dists/10.4/stable/main/finkinfo/10.4-EOL/languages/llvm32.info,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- llvm32.info 10 Jan 2013 18:02:02 -0000      1.2
+++ llvm32.info 7 Jun 2013 18:22:35 -0000       1.3
@@ -1,21 +1,25 @@
 Info3: <<
 Package: llvm32
 Version: 3.2
-Revision: 4
+Revision: 6
 Description: Modular and reusable compiler
 License: BSD
 Maintainer: David Fang <fang...@users.sourceforge.net>
 
-# ccache is only temporary, for accelerating rebuilds
-# some cyclic dependency checker script needs python
 BuildDepends: <<
        fink (>= 0.28), 
-       cmake (>= 2.8.2-1), 
+       cmake (>= 2.8.10.2-1), 
+# ccache is optional, for accelerating rebuilds
 #      ccache,
+# polly plug-in needs isl,cloog,gmp
        isl (>=0.11.1), 
        cloog-org2 (>= 0.18), 
        gmp5,
-       python27
+# build scripts need python2.7
+       python27,
+# xml and lzma are used to build an uninstalled bin/c-index-test, so bdep-only
+       libxml2,
+       liblzma5
 <<
 Depends: <<
        isl-shlibs (>=0.11.1), 
@@ -34,7 +38,7 @@
 Source4-MD5: e9d21be41b1fc26d9a54e563f0e260b8
 # Source5: http://llvm.org/releases/%v/test-suite-%v.src.tar.gz
 # Source5-MD5: d8e16facb5ce65bd36dc9ff49e3243e5
-# libcxxabi is not recommended, lib++ is not ready yet
+# libcxxabi is not recommended, libc++ is not ready yet
 
 SourceDirectory: llvm-%v.src
 # may eventually split out development files
@@ -42,7 +46,7 @@
 UseMaxBuildJobs: true
 
 PatchFile: %n.patch
-PatchFile-MD5: 07b21f06db7ae5a7185f84560ffd330e
+PatchFile-MD5: 4cbbc6d340c05dacfd9159bb215781e3
 PatchScript: <<
        #!/bin/sh -ev
        # relocated a few auxiliary directories where they are expected
@@ -58,6 +62,11 @@
 #      %{default_script}
        sed -e 's|@FINK_PREFIX@|%p|g' %{PatchFile} | patch -p0
 
+       # Do not want -DNDEBUG, cause linker errors (undef symbols)
+       # LLVM_ENABLE_ASSERTIONS:ON should have removed -DNDEBUG
+       # but it doesn't, so hack it out of cmake file
+       sed -i.orig -e '/-DNDEBUG/s|.*|#&|' 
cmake/modules/HandleLLVMOptions.cmake
+
        # point hard-coded paths to system g++-4.0.1's C++ includes
        # remove references to g++-4.2.1, never existed in Xcode 2.5
        darwin_vers=`uname -r | cut -d. -f1`
@@ -95,17 +104,10 @@
 #      cp lib/Support/CMakeLists.txt{,.orig}
 #      echo "SET_TARGET_PROPERTIES(LLVMSupport PROPERTIES LINK_FLAGS 
-Wl,-bind_at_load)" >> lib/Support/CMakeLists.txt
 
-# needed for gcc-4.6 only
+# needed for gcc-fsf-4.x only
 #      sed -i.orig2 -e 's|compatibility_version|dylib_&|' 
tools/clang/tools/libclang/CMakeLists.txt
 
-       # test suite requires newer bash than /bin/bash 2.0 for pipefail
-       # test the pipefail option of this shell first
-       set -o pipefail || {
-       sed -i.orig -e "/bashPath = None/s|None|'%p/bin/bash'|" 
utils/lit/lit/LitConfig.py
-       test -x %p/bin/bash || { echo "Error: Fink-built bash >= 3.0 required 
for pipefail!" ; exit 1; }
-       }
-       # force time limit per test (prefix each command-line)
-       sed -i.orig -e "/script\.append/s|ln|'gtimeout 5m '+&|" 
utils/lit/lit/TestRunner.py
+
        # projects/test-suite expects built llvm/clang to have been configured
        # but sadly, we used cmake; don't include $llvmobjdir/Makefile.config
        # TODO: replace cmake build with autoconf'd build
@@ -115,14 +117,16 @@
        #!/bin/sh -ev
        # just always build these archs
        case "%m" in
-       powerpc*) CMAKE_OPTIONS="-DLLVM_TARGETS_TO_BUILD=PowerPC" ;;
-       ppc*) CMAKE_OPTIONS="-DLLVM_TARGETS_TO_BUILD=PowerPC" ;;
-       i386*) CMAKE_OPTIONS="-DLLVM_TARGETS_TO_BUILD=X86" ;;
-       x86*) CMAKE_OPTIONS="-DLLVM_TARGETS_TO_BUILD=X86" ;;
+       powerpc*) TARGET_ARCHS="-DLLVM_TARGETS_TO_BUILD=PowerPC" ;;
+       ppc*) TARGET_ARCHS="-DLLVM_TARGETS_TO_BUILD=PowerPC" ;;
+       i386*) TARGET_ARCHS="-DLLVM_TARGETS_TO_BUILD=X86" ;;
+       x86*) TARGET_ARCHS="-DLLVM_TARGETS_TO_BUILD=X86" ;;
        esac
-       echo "Target option: $CMAKE_OPTIONS"
-       # to enable cross-compiling to other archs, uncomment the following 
line:
-       # CMAKE_OPTIONS="-DLLVM_TARGETS_TO_BUILD=X86;PowerPC;ARM"
+       echo "Target option: $TARGET_ARCHS"
+       # to enable cross-compiling to other archs, uncomment the following:
+       # TARGET_ARCHS="-DLLVM_TARGETS_TO_BUILD=X86;PowerPC;ARM"
+       # TARGET_ARCHS="-DLLVM_TARGETS_TO_BUILD=all"
+       CMAKE_OPTIONS="$TARGET_ARCHS"
 
        # automatically use ccache if detected
        # ccache recommended, but not required
@@ -130,7 +134,8 @@
        test -x $p/bin/ccache && CCACHE=ccache || CCACHE=
        export CCACHE
 
-       # set up some possible bootstrapping compilers
+       # set up some possible stage-1 compilers
+       fsfgccv=4.6
        # wrap ccache into single cmd b/c cmake can't handle "ccache g++"
        mkdir ../opt-bin
        pushd ../opt-bin
@@ -138,8 +143,8 @@
        { echo "#!/bin/sh" ; echo 'exec $CCACHE g++ "$@"' ; } > ccg++
        { echo "#!/bin/sh" ; echo 'exec $CCACHE gcc-4.2 "$@"' ; } > ccgcc-4.2
        { echo "#!/bin/sh" ; echo 'exec $CCACHE g++-4.2 "$@"' ; } > ccg++-4.2
-#      { echo "#!/bin/sh" ; echo 'exec $CCACHE gcc-fsf-4.6 "$@"' ; } > 
ccgcc-4.6
-#      { echo "#!/bin/sh" ; echo 'exec $CCACHE g++-fsf-4.6 "$@"' ; } > 
ccg++-4.6
+#      { echo "#!/bin/sh" ; echo 'exec $CCACHE 'gcc-fsf-$fsfgccv' "$@"' ; } > 
ccgcc-$fsfgccv
+#      { echo "#!/bin/sh" ; echo 'exec $CCACHE 'g++-fsf-$fsfgccv' "$@"' ; } > 
ccg++-$fsfgccv
        # also setup bootstrap stage compilers
        # yes, ccache 3.1 supports compiler binary hashing
        { echo "#!/bin/sh" ; echo 'exec $CCACHE st1-clang "$@"' ; } > 
cc-st1-clang
@@ -160,8 +165,8 @@
        8)
          export CC=ccgcc
          export CXX=ccg++
-#        export CC=ccgcc-4.6
-#        export CXX=ccg++-4.6
+#        export CC=ccgcc-$fsfgccv
+#        export CXX=ccg++-$fsfgccv
          ;;
        9)
          export CC=ccgcc-4.2
@@ -174,17 +179,71 @@
        # on darwin11+, fink redirects gcc/g++ to clang/clang++ via PATH
        esac
 
-       build_type=Release
-       CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX=%p/opt/llvm-%v 
-DCMAKE_BUILD_TYPE=$build_type -DLLVM_LIT_ARGS:STRING=-v 
-DLLVM_ENABLE_ASSERTIONS=ON"
+       abssrcdir=%b
+       relsrcdir=../../llvm-%v.src
+       # gcc-4.0.1 workaround for units failing -O1 and higher, fallback to -O0
+       compile_lib_unit() {
+       builddir=$PWD
+       # $1 = source file path
+       # $2 = lib name
+       subdir=`dirname $1`
+       fbase=`basename $1`
+       target=CMakeFiles/LLVM$2.dir/$fbase.o
+       echo "Compiling $1 to $target"
+       pushd $builddir/$subdir
+       $CXX \
+       -DLLVMAnalysis_EXPORTS -D_DEBUG \
+       -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS \
+       -fno-common -fPIC \
+       -fvisibility-inlines-hidden \
+       -Wall -W -Wno-unused-parameter -Wwrite-strings 
-Wno-missing-field-initializers \
+       -pedantic -Wno-long-long -Wno-uninitialized -Wnon-virtual-dtor 
-fno-rtti \
+       -g -fPIC \
+       -I$builddir/$subdir \
+       -I$abssrcdir/$subdir \
+       -I$builddir/include \
+       -I$abssrcdir/include \
+       -fno-exceptions \
+       -o $target \
+       -c $abssrcdir/$1
+       popd
+       }
+
+       # more of the same workaround
+       recompile_known_units() {
+       echo "Recompiling known problematic units with -O0."
+       for f in \
+       lib/Analysis/ScalarEvolution{,Expander}.cpp:Analysis \
+       lib/Transforms/Utils/{BreakCriticalEdges,LoopUnroll}.cpp:TransformUtils 
\
+       
lib/Transforms/Scalar/{LoopInstSimplify,LoopRotation,LoopUnswitch}.cpp:ScalarOpts
 \
+       
lib/CodeGen/{MachineBasicBlock,MachineBlockPlacement,MachineTraceMetrics,PHIElimination}.cpp:CodeGen
 \
+
+       do
+       saveIFS=$IFS
+       IFS=:
+       set -- $f
+       src=$1
+       lib=$2
+       IFS=$saveIFS
+       # echo "$src -> $lib"
+       compile_lib_unit $src $lib
+       done
+       }
+
+#      build_type=Release
+       build_type=RelWithDebInfo
+       # do not let cmake auto-detect OSX_SYSROOT
+       CMAKE_OPTIONS="$CMAKE_OPTIONS 
-DCMAKE_INSTALL_PREFIX:PATH=%p/opt/llvm-%v 
-DCMAKE_BUILD_TYPE:STRING=$build_type -DLLVM_LIT_ARGS:STRING=-v 
-DLLVM_ENABLE_ASSERTIONS:BOOL=ON -DPYTHON_EXECUTABLE:FILEPATH=%p/bin/python2.7 
-DCMAKE_OSX_SYSROOT:STRING=/ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="
 
 #      the --max-time option applies to aggregate test time, not individual :(
 #      CMAKE_OPTIONS="$CMAKE_OPTIONS -DLLVM_LIT_ARGS="-s -v --max-time=14400"
 
        # trying to disable optimization flags on non-trustworthy compilers
-       ccvers=`$CXX -v 2>&1 | tail -n 1 | cut -d\  -f3`
-       if test $ccvers = 4.0.1
-       then STAGE1_CMAKE_OPTIONS='-DCMAKE_C_FLAGS_RELEASE:STRING=-O0 
-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O0'
-       fi
+       # worked around in recompile_known_units(), and now using RelWithDebInfo
+#      ccvers=`$CXX -v 2>&1 | tail -n 1 | cut -d\  -f3`
+#      if test $ccvers = 4.0.1
+#      then STAGE1_CMAKE_OPTIONS='-DCMAKE_C_FLAGS_RELEASE:STRING=-O0 
-DCMAKE_CXX_FLAGS_RELEASE:STRING=-O0'
+#      fi
 
        echo "######## START of BOOTSTRAP STAGE 1: building llvm/clang with the 
system compiler"
        # wd: %b
@@ -192,9 +251,12 @@
        pushd ../build/stage1
        echo "CMAKE_OPTIONS=$CMAKE_OPTIONS $STAGE1_CMAKE_OPTIONS"
        # Technically, we only need the native back-end in stage 1...
-       cmake $CMAKE_OPTIONS $STAGE1_CMAKE_OPTIONS ../../llvm-%v.src
+       cmake $CMAKE_OPTIONS $STAGE1_CMAKE_OPTIONS $relsrcdir
+       # kill -DNDEBUG with fire
+       sed -i.orig -e 's| -DNDEBUG||g' CMakeCache.txt
+
        # first make fails, but we have to run it first and then fix some deps
-       make -k || make VERBOSE=1
+       make -k || recompile_known_units && make || make VERBOSE=1
        cd ..
        ln -s stage1 last
        popd
@@ -211,15 +273,9 @@
        done
        echo "######## END of BOOTSTRAP STAGE 1: built llvm/clang with the 
system compiler"
 
-
        # don't bootstrap on powerpc-darwinX, codegen issues
-       if test "%m" = "powerpc"
-       then exit
-       fi
-       if test "$darwin_vers" = 8
-       then exit
-       fi
-
+       test "%m" != "powerpc" || exit 0
+       test "$darwin_vers" != 8 || exit 0
 #      If you do not wish to bootstrap, just uncomment the next line:
 #      exit
 
@@ -231,7 +287,7 @@
        export CXX=cc-st1-clang++
        mkdir -p ../build/stage2
        pushd ../build/stage2
-       cmake $CMAKE_OPTIONS ../../llvm-%v.src
+       cmake $CMAKE_OPTIONS $relsrcdir
        make -k || make VERBOSE=1
        cd ..
        rm -f last
@@ -254,7 +310,7 @@
        export CCACHE_DISABLE=1
        mkdir -p ../build/stage3
        pushd ../build/stage3
-       cmake $CMAKE_OPTIONS ../../llvm-%v.src
+       cmake $CMAKE_OPTIONS $relsrcdir
        make -k || make VERBOSE=1
        cd ..
        rm -f last
@@ -310,7 +366,6 @@
        test -z "$err"
        echo "######## 3-STAGE BOOTSTRAP of llvm/clang PASSED!"
        popd
-
 <<
 InfoTest: <<
 # need bash because /bin/sh 2.0 on darwin8 is missing support for pipefail
@@ -321,6 +376,16 @@
        <<
        TestScript: <<
        #!/bin/sh -ev
+
+       # test suite requires newer bash than /bin/bash 2.0 for pipefail
+       # test the pipefail option of this shell first
+       set -o pipefail || {
+       sed -i.orig -e "/bashPath = None/s|None|'%p/bin/bash'|" 
utils/lit/lit/LitConfig.py
+       test -x %p/bin/bash || { echo "Error: Fink-built bash >= 3.0 required 
for pipefail!" ; exit 1; }
+       }
+       # force time limit per test (prefix each command-line)
+       sed -i.orig -e "/script\.append/s|ln|'gtimeout 5m '+&|" 
utils/lit/lit/TestRunner.py
+
        # need path to bootstrapping compiler
        pushd ../opt-bin
        export PATH=`pwd`:$PATH
@@ -332,10 +397,11 @@
        { make -k TESTARGS=-v check 2>&1 || : ;} | tee llvm-%v-check.log
        echo "******** Running included clang tests ... ********"
        { make -k TESTARGS=-v check-clang 2>&1 || : ;} | tee clang-%v-check.log
-#      echo "******** Running massive test-suite ... ********"
-#      ( cd projects/test-suite ; make -k 2>&1 || : ;) | tee 
test-suite-%v-check.log
        echo "******** Running included polly tests ... ********"
        ( cd tools/polly/test ; make -k TESTARGS=-v polly-test 2>&1 || : ;) | 
tee polly-%v-check.log
+       # TODO: compiler-rt tests
+#      echo "******** Running massive test-suite ... ********"
+#      ( cd projects/test-suite ; make -k 2>&1 || : ;) | tee 
test-suite-%v-check.log
        <<
        TestSuiteSize: medium
 <<
@@ -348,25 +414,31 @@
        popd
 
        # boilerplate script for fixing post-cmake-install install_names
-       pushd $iprefix/lib
-       for f in *.dylib *.so
+       # expect to find in lib/
+       pushd $iprefix
+       for f in `find . -name '*.dylib'` `find . -name '*.so'`
        do
                if test ! -L $f
                then
-               install_name_tool -id "$prefix/lib/$f" "$f"
+               dir=`dirname $f | sed -e 's|^\.\/||'`
+                b=`basename $f`
+               pushd $dir 2> /dev/null
+               install_name_tool -id "$prefix/$dir/$b" "$b"
                case $f in
                *.dylib) filt="sed 1,2d" ;;
                *.so) filt="sed 1d" ;;
                esac
-               deplibs=`otool -L $f | $filt | awk '{print $1;}' | tr '\n' ' '`
+               deplibs=`otool -L $b | $filt | awk '{print $1;}' | tr '\n' ' '`
                for d in $deplibs
                do
                # prefix absolute paths to llvm/clang's lib installation
+               # caution: assumes dependent libraries are in same dir
                case $d in
                /*) ;;
-               *) install_name_tool -change "$d" "$prefix/lib/$d" $f ;;
+               *) install_name_tool -change "$d" "$prefix/lib/$d" $b ;;
                esac
                done
+               popd 2> /dev/null
                fi
        done
        popd
@@ -390,6 +462,11 @@
        done
        popd
 
+       # need symlink /usr/bin/ld so libLTO.dylib can be found relative to 
@executable_path
+       pushd $iprefix/bin
+       test -x /usr/bin/ld && ln -s /usr/bin/ld .
+       popd
+
        # documentation
        docdir=$prefix/share/doc
        idocdir=$iprefix/share/doc


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to