Skip to content

Instantly share code, notes, and snippets.

@geoff-nixon
Created August 4, 2013 08:56
Show Gist options
  • Save geoff-nixon/6149771 to your computer and use it in GitHub Desktop.
Save geoff-nixon/6149771 to your computer and use it in GitHub Desktop.
LLVM-based battery life test.
#!/bin/bash -vx
killall Finder
export PATH=$PWD/install/bin:$PWD/usr/bin:$PWD/usr/sbin:$PATH
export CC=clang
export CXX=clang++
export MAKEFFLAGS=$(sysctl -n hw.availcpu)
export CFLAGS='-O4 -fslp-vectorize -fslp-vectorize-aggressive -march=native '
export CFLAGS+='-DNDEBUG -g0 -mmacosx-version-min=10.8 -Qunused-arguments'
export CXXFLAGS="$CFLAGS -std=c++11 -stdlib=libc++"
CMAKE='http://www.cmake.org/files/v2.8/cmake-2.8.11.2-Darwin64-universal.tar.gz'
CLTBASE='http://devimages.apple.com/downloads/xcode/'
CLTDMG='command_line_tools_for_xcode_os_x_mountain_lion_april_2013.dmg'
CLTURL=$CLTBASE$CLTDMG
cd ~; mkdir build; cd Downloads
curl $CLTURL > clt.dmg; hdiutil mount clt.dmg; cp /Volumes/*/Packages/* .
curl $CMAKE > cmake.tgz; tar -xf cmake.tgz; umount /Volumes/Command*
xar -xf DevSDK.pkg; cd ..; tar -xf Downloads/Payload; cd Downloads
xar -xf DeveloperToolsCLI.pkg; cd ..; tar -xf Downloads/Payload
mv Downloads/cmake*/CMake*/bin/* usr/bin; rm -rf Downloads/*
git clone http://llvm.org/git/llvm
git clone http://llvm.org/git/compiler-rt llvm/projects/compiler-rt
git clone http://llvm.org/git/libcxx llvm/projects/libcxx
git clone http://llvm.org/git/clang llvm/tools/clang
while [ apples == oranges ]; do
cd build; rm -rf ./*; cmake ../llvm -DCMAKE_INSTALL_PREFIX=$HOME/install
make check; rm -rf ../install/*; make install/strip
install_name_tool -change @executable_path/../lib/libLTO.dylib \
$HOME/install/lib/libLTO.dylib $HOME/usr/bin/ld; ld -v; clang -v
cd ../llvm/procjects/compiler-rt; git pull; cd ../libcxx; git pull
cd ../../tools/clang; git pull; cd ../..; git pull
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment