├── .gitmodules ├── README.md ├── build.sh ├── deb.sh ├── docker └── dockerfile └── setup-env.sh /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tapir"] 2 | path = tapir 3 | url = https://github.com/wsmoses/Tapir-LLVM 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tapir-Meta 2 | 3 | This is the top-level meta-repository for downloading and building the Tapir/LLVM compiler and PClang front end. 4 | 5 | ## Building Tapir/LLVM and PClang 6 | 7 | To build Tapir/LLVM and PClang (debug-mode), execute the following commands: 8 | 9 | git clone --recursive https://github.com/wsmoses/Tapir-Meta.git 10 | cd Tapir-Meta/ 11 | ./build.sh 12 | source ./setup-env.sh 13 | 14 | This produces **very** large, slow binaries. 15 | 16 | Alternatively, you can get the smaller, faster release binaries using: 17 | 18 | ./build.sh release 19 | 20 | Or, you can get something in between (optimized, but with debug information): 21 | 22 | ./build.sh debinfo 23 | 24 | Building Tapir/LLVM and PClang can take a long time to complete, depending on the computational resources of the machine you are building on. 25 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Top-level source directory 4 | LLVM_SRC=$PWD/tapir 5 | # Build directory 6 | LLVM_BUILD=$LLVM_SRC/build 7 | 8 | # Die if anything produces an error 9 | set -e 10 | 11 | if [ -z $1 ]; then 12 | MODE=-DCMAKE_BUILD_TYPE=Debug 13 | else 14 | case $1 in 15 | debug) 16 | MODE=-DCMAKE_BUILD_TYPE=Debug 17 | ;; 18 | release) 19 | MODE=-DCMAKE_BUILD_TYPE=Release 20 | ;; 21 | debinfo) 22 | MODE=-DCMAKE_BUILD_TYPE=RelWithDebInfo 23 | ;; 24 | minsize) 25 | MODE=-DCMAKE_BUILD_TYPE=MinSizeRel 26 | ;; 27 | *) 28 | echo Unknown build mode: $1 29 | echo 'Try: debug|release|debinfo|minsize' 30 | echo Or no argument for debug. 31 | exit 32 | ;; 33 | esac 34 | fi 35 | 36 | if [ -z $TAPIR_NOUPDATE ]; then 37 | # Update the Tapir/LLVM and PClang repositories 38 | echo "$0: git submodule update --init --recursive" 39 | git submodule update --init --recursive 40 | fi 41 | 42 | # Create the build directory if necessary 43 | if [ ! -d $LLVM_BUILD ]; then 44 | echo "$0: mkdir $LLVM_BUILD" 45 | mkdir $LLVM_BUILD 46 | fi 47 | 48 | # Enter the build directory 49 | echo "$0: cd $LLVM_BUILD" 50 | cd $LLVM_BUILD 51 | 52 | # Configure the build 53 | echo "$0: cmake $MODE -DLLVM_TARGETS_TO_BUILD=host $LLVM_SRC" 54 | cmake $MODE -DLLVM_TARGETS_TO_BUILD=host $LLVM_SRC 55 | 56 | # Get hardware thread count 57 | HThreadCount=$(lscpu -p | egrep -v '^#' | wc -l) 58 | 59 | # Build the compiler 60 | echo "$0: cmake --build . -- -j$HThreadCount" 61 | cmake --build . -- -j$HThreadCount 62 | 63 | echo "Installation successful" 64 | cd ../.. 65 | 66 | if [[ $* == *--deb* ]] 67 | then 68 | echo "Building Debian file" 69 | ./deb.sh 70 | fi 71 | -------------------------------------------------------------------------------- /deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export NAME=tapir 3 | export VERSION=1.0 4 | export DEBVERSION=${VERSION}-0 5 | export DIRNAME=tapir-${VERSION}-x86_64-linux-gnu-ubuntu-16.04 6 | export FILENAME=${DIRNAME}.tar.xz 7 | rm -rf $DIRNAME 8 | ln -s tapir/build $DIRNAME 9 | cd $DIRNAME 10 | 11 | rm -rf debian 12 | mkdir -p debian 13 | #Use the LICENSE file from nodejs as copying file 14 | touch debian/copying 15 | #Create the changelog (no messages needed) 16 | dch --create -v $DEBVERSION --package $NAME "" 17 | #Create control file 18 | echo "Source: $NAME" > debian/control 19 | echo "Maintainer: William S. Moses " >> debian/control 20 | echo "Section: misc" >> debian/control 21 | echo "Priority: optional" >> debian/control 22 | echo "Standards-Version: 3.9.2" >> debian/control 23 | echo "Build-Depends: debhelper (>= 8)" >> debian/control 24 | echo "" >> debian/control 25 | #Library package 26 | echo "Package: $NAME" >> debian/control 27 | echo "Architecture: amd64" >> debian/control 28 | echo "Provides: llvm, clang, libllvm-tp, clang, clang-tp, clang-format, clang-format-tp" >> debian/control 29 | echo "Depends: ${shlibs:Depends}, ${misc:Depends}, libcilkrts5, libc6, libc6-dev, binutils, libgcc1, libgcc-5-dev, libomp5" >> debian/control 30 | echo "Conflicts: llvm, clang, clang-format" >> debian/control 31 | echo "Replaces: llvm, clang, clang-format" >> debian/control 32 | echo "Description: Tapir LLVM + Clang distribution" >> debian/control 33 | echo "" >> debian/control 34 | #Dev package 35 | echo "Package: ${NAME}-dev" >> debian/control 36 | echo "Architecture: any" >> debian/control 37 | echo "Provides: llvm-tp-dev, llvm-dev, libllvm-tp-dev, libclang-dev, clang-dev, libclang-tp-dev" >> debian/control 38 | echo "Depends: ${shlibs:Depends}, ${misc:Depends}, $NAME (= $DEBVERSION)" >> debian/control 39 | echo "Description: Tapir LLVM + Clang distribution (development files)" >> debian/control 40 | #Create rules file 41 | echo '#!/usr/bin/make -f' > debian/rules 42 | echo '%:' >> debian/rules 43 | echo -e '\tdh $@' >> debian/rules 44 | echo 'override_dh_auto_configure:' >> debian/rules 45 | echo -e '\t' >> debian/rules 46 | echo 'override_dh_auto_build:' >> debian/rules 47 | echo -e '\t' >> debian/rules 48 | echo 'override_dh_auto_clean:' >> debian/rules 49 | echo -e '\t' >> debian/rules 50 | echo 'override_dh_auto_test:' >> debian/rules 51 | echo -e '\t' >> debian/rules 52 | echo 'override_dh_auto_install:' >> debian/rules 53 | echo -e "\tmkdir -p debian/$NAME/usr debian/$NAME-dev/usr/" >> debian/rules 54 | echo -e "\tcp -r lib bin share debian/$NAME/usr" >> debian/rules 55 | echo -e "\tcp -r include debian/$NAME-dev/usr/" >> debian/rules 56 | #Numba compatibility 57 | echo -e "\tcp ./include/llvm/IR/Intrinsics.gen debian/$NAME-dev/usr/include/llvm" >> debian/rules 58 | #Create some misc files 59 | echo "8" > debian/compat 60 | mkdir -p debian/source 61 | echo "3.0 (quilt)" > debian/source/format 62 | #Build the package 63 | debuild -us -uc -b 64 | -------------------------------------------------------------------------------- /docker/dockerfile: -------------------------------------------------------------------------------- 1 | FROM library/ubuntu:16.04 2 | RUN apt-get update 3 | RUN apt-get install -y --no-install-recommends wget 4 | RUN apt-get install -y --no-install-recommends clang-format 5 | 6 | RUN wget --quiet http://cilk.mit.edu/tapir_1.0-2_amd64.deb 7 | RUN apt-get install -y --no-install-recommends ./tapir_1.0-2_amd64.deb 8 | RUN rm tapir_1.0-2_amd64.deb 9 | 10 | 11 | RUN wget --quiet http://f.wsmoses.com/fib.c 12 | RUN apt-get install -y libomp5 13 | RUN clang fib.c -fcilkplus -ftapir=openmp -fopenmp 14 | RUN ./a.out 15 | -------------------------------------------------------------------------------- /setup-env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | LLVM_BUILD=$PWD/tapir/build 4 | export PATH=$LLVM_BUILD/bin:$PATH 5 | --------------------------------------------------------------------------------