Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom LLVM #1971

Merged
merged 4 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions programs/bpf/c/sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/criterion-*
/llvm/native-*
17 changes: 5 additions & 12 deletions programs/bpf/c/sdk/bpf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,21 @@ TEST_DIR ?= ./test
OUT_DIR ?= ./out

ifeq ($(DOCKER),1)
LLVM_DIR = $(LOCAL_PATH)llvm/llvm-docker
LLVM_DIR = $(LOCAL_PATH)llvm/docker
else
OS=$(shell uname)
ifeq ($(OS),Darwin)
LLVM_DIR ?= $(shell brew --prefix llvm)
endif
LLVM_DIR = $(LOCAL_PATH)llvm/native-v0.0.1
endif

ifdef LLVM_DIR
CC := $(LLVM_DIR)/bin/clang
CXX := $(LLVM_DIR)/bin/clang++
LLC := $(LLVM_DIR)/bin/llc
OBJ_DUMP := $(LLVM_DIR)/bin/llvm-objdump
else
CC := clang-7
CXX := clang++-7
LLC := llc-7
OBJ_DUMP := llvm-objdump-7
endif

SYSTEM_INC_DIRS := $(LOCAL_PATH)inc
SYSTEM_INC_DIRS := \
$(LOCAL_PATH)inc \
$(LLVM_DIR)lib/clang/8.0.0/include \

C_FLAGS := \
-Werror \
Expand Down Expand Up @@ -110,7 +104,6 @@ help:
@echo ' - Show commands while building: V=1'
@echo ' V=$(V)'
@echo ' - Use LLVM from docker: DOCKER=1'
@echo ' Docker image must be pulled first: docker pull solanalabs/llvm'
@echo ' DOCKER=$(DOCKER)'
@echo ' - List of include directories:'
@echo ' INC_DIRS=$(INC_DIRS)'
Expand Down
55 changes: 43 additions & 12 deletions programs/bpf/c/sdk/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,52 @@
cd "$(dirname "$0")"/..

# Install Criterion for all supported platforms
# if changing version here must also change in bpf.mk
version=v2.3.2
(
[[ ! -d criterion-$version ]] || exit 0
set -ex
wget https://github.com/Snaipe/Criterion/releases/download/$version/criterion-$version-osx-x86_64.tar.bz2
wget https://github.com/Snaipe/Criterion/releases/download/$version/criterion-$version-linux-x86_64.tar.bz2
tar jxf criterion-$version-osx-x86_64.tar.bz2
tar jxf criterion-$version-linux-x86_64.tar.bz2
rm -rf criterion-$version-osx-x86_64.tar.bz2 criterion-$version-linux-x86_64.tar.bz2
if [[ ! -d criterion-$version ]]; then
(
[[ ! -d criterion-$version ]] || exit 0
set -ex
wget https://github.com/Snaipe/Criterion/releases/download/$version/criterion-$version-osx-x86_64.tar.bz2
wget https://github.com/Snaipe/Criterion/releases/download/$version/criterion-$version-linux-x86_64.tar.bz2
tar jxf criterion-$version-osx-x86_64.tar.bz2
tar jxf criterion-$version-linux-x86_64.tar.bz2
rm -rf criterion-$version-osx-x86_64.tar.bz2 criterion-$version-linux-x86_64.tar.bz2

[[ ! -f criterion-$version/README.md ]]
echo "https://github.com/Snaipe/Criterion/releases/tag/$version" > criterion-$version/README.md
)
[[ ! -f criterion-$version/README.md ]]
echo "https://github.com/Snaipe/Criterion/releases/tag/$version" > criterion-$version/README.md
)
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
rm -rf criterion-$version*
exit 1
fi
fi

# Install LLVM
# if changing version here must also change in bpf.mk
version=v0.0.1
if [ "$(uname)" == "Darwin" ]; then
machine=macos
else
machine=linux
fi
if [[ ! -d llvm/native-$version ]]; then
(
set -ex
mkdir -p llvm/native-$version
cd llvm/native-$version
wget https://github.com/solana-labs/llvm-builder/releases/download/$version/solana-llvm-$machine.tgz
tar xzf solana-llvm-$machine.tgz
rm -rf solana-llvm-$machine.tgz

[[ ! -f llvm/native-$version/README.md ]]
echo "https://github.com/solana-labs/solana-web3.js/releases/tag/$version" > README.md
)
fi
# shellcheck disable=SC2181
if [[ $? -ne 0 ]]; then
rm -rf criterion-$version*
rm -rf llvm/native-$version
exit 1
fi

3 changes: 1 addition & 2 deletions programs/bpf/c/sdk/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ mkdir bpf-sdk/
git rev-parse HEAD
) > bpf-sdk/version.txt

"$SOLANA_ROOT"/programs/bpf/c/sdk/scripts/install.sh
cp -ra "$SOLANA_ROOT"/programs/bpf/c/sdk/* bpf-sdk/
rm -rf bpf-sdk/scripts/
rm -rf bpf-sdk/scripts/package.sh

tar jvcf bpf-sdk.tar.bz2 bpf-sdk/
68 changes: 0 additions & 68 deletions sdk/docker-llvm/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions sdk/docker-llvm/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions sdk/docker-llvm/build.sh

This file was deleted.