Skip to content

Makefile: fix LLVM tools detection for wasi-libc #928

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

Merged
merged 1 commit into from
Feb 28, 2020
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
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ commands:
steps:
- restore_cache:
keys:
- wasi-libc-sysroot-v0
- wasi-libc-sysroot-v1
- run:
name: "Build wasi-libc"
command: make wasi-libc CLANG=$PWD/llvm-build/bin/clang LLVM_AR=$PWD/llvm-build/bin/llvm-ar LLVM_NM=$PWD/llvm-build/bin/llvm-nm
command: make wasi-libc
- save_cache:
key: wasi-libc-sysroot-v0
key: wasi-libc-sysroot-v1
paths:
- lib/wasi-libc/sysroot
test-linux:
Expand Down Expand Up @@ -266,12 +266,12 @@ commands:
llvm-build
- restore_cache:
keys:
- wasi-libc-sysroot-macos-v0
- wasi-libc-sysroot-macos-v1
- run:
name: "Build wasi-libc"
command: make wasi-libc CLANG=$PWD/llvm-build/bin/clang LLVM_AR=$PWD/llvm-build/bin/llvm-ar LLVM_NM=$PWD/llvm-build/bin/llvm-nm
command: make wasi-libc
- save_cache:
key: wasi-libc-sysroot-macos-v0
key: wasi-libc-sysroot-macos-v1
paths:
- lib/wasi-libc/sysroot
- run:
Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ LLVM_BUILDDIR ?= llvm-build
CLANG_SRC ?= llvm-project/clang
LLD_SRC ?= llvm-project/lld

# Default tool selection.
CLANG ?= clang-9

# Try to autodetect llvm-ar and llvm-nm
ifneq (, $(shell command -v llvm-ar-9 2> /dev/null))
# Try to autodetect LLVM build tools.
ifneq (, $(shell command -v llvm-build/bin/clang 2> /dev/null))
CLANG ?= $(abspath llvm-build/bin/clang)
else
CLANG ?= clang-9
endif
ifneq (, $(shell command -v llvm-build/bin/llvm-ar 2> /dev/null))
LLVM_AR ?= $(abspath llvm-build/bin/llvm-ar)
else ifneq (, $(shell command -v llvm-ar-9 2> /dev/null))
LLVM_AR ?= llvm-ar-9
else ifneq (, $(shell command -v llvm-ar 2> /dev/null))
else
LLVM_AR ?= llvm-ar
endif
ifneq (, $(shell command -v llvm-nm-9 2> /dev/null))
ifneq (, $(shell command -v llvm-build/bin/llvm-nm 2> /dev/null))
LLVM_NM ?= $(abspath llvm-build/bin/llvm-nm)
else ifneq (, $(shell command -v llvm-nm-9 2> /dev/null))
LLVM_NM ?= llvm-nm-9
else ifneq (, $(shell command -v llvm-nm 2> /dev/null))
else
LLVM_NM ?= llvm-nm
endif
ifndef LLVM_AR
$(warning llvm-ar not found)
endif
ifndef LLVM_NM
$(warning llvm-nm not found)
endif

# Go binary and GOROOT to select
GO ?= go
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ jobs:
- task: CacheBeta@0
displayName: Cache wasi-libc sysroot
inputs:
key: wasi-libc-sysroot-v0
key: wasi-libc-sysroot-v1
path: lib/wasi-libc/sysroot
- task: Bash@3
displayName: Build wasi-libc
inputs:
targetType: inline
script: PATH=/usr/bin:$PATH make wasi-libc CLANG=$PWD/llvm-build/bin/clang LLVM_AR=$PWD/llvm-build/bin/llvm-ar LLVM_NM=$PWD/llvm-build/bin/llvm-nm
script: PATH=/usr/bin:$PATH make wasi-libc
- task: Bash@3
displayName: Test TinyGo
inputs:
Expand Down