From 49f2f0dbfd324866c582d3d7b6719de9b0b26911 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Thu, 13 Feb 2025 15:52:11 +0800 Subject: [PATCH 1/2] doc: update install instructions --- README.md | 6 +++--- doc/_readme/scripts/install_macos.sh | 2 +- doc/_readme/scripts/install_ubuntu.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 60f53efd..a1682533 100644 --- a/README.md +++ b/README.md @@ -362,7 +362,7 @@ brew update brew install llvm@18 bdw-gc openssl cjson libffi pkg-config brew install python@3.12 # optional brew link --force libffi -go install -v github.com/goplus/llgo/cmd/llgo@latest +curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash ``` @@ -378,7 +378,7 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update sudo apt-get install -y llvm-18-dev clang-18 libclang-18-dev lld-18 pkg-config libgc-dev libssl-dev zlib1g-dev libcjson-dev libsqlite3-dev libunwind-dev sudo apt-get install -y python3.12-dev # optional -go install -v github.com/goplus/llgo/cmd/llgo@latest +curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash ``` #### Alpine Linux @@ -391,7 +391,7 @@ export LLVM_CONFIG=/usr/lib/llvm18/bin/llvm-config export CGO_CPPFLAGS="$($LLVM_CONFIG --cppflags)" export CGO_CXXFLAGS=-std=c++17 export CGO_LDFLAGS="$($LLVM_CONFIG --ldflags) $($LLVM_CONFIG --libs all)" -go install -v -tags=byollvm -ldflags="-X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=$LLVM_CONFIG" github.com/goplus/llgo/cmd/llgo@latest +curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash ``` ### on Windows diff --git a/doc/_readme/scripts/install_macos.sh b/doc/_readme/scripts/install_macos.sh index afa44c3c..3b889180 100644 --- a/doc/_readme/scripts/install_macos.sh +++ b/doc/_readme/scripts/install_macos.sh @@ -3,4 +3,4 @@ brew update brew install llvm@18 bdw-gc openssl cjson libffi pkg-config brew install python@3.12 # optional brew link --force libffi -go install -v github.com/goplus/llgo/cmd/llgo@latest +curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash diff --git a/doc/_readme/scripts/install_ubuntu.sh b/doc/_readme/scripts/install_ubuntu.sh index e749f237..24c00d03 100644 --- a/doc/_readme/scripts/install_ubuntu.sh +++ b/doc/_readme/scripts/install_ubuntu.sh @@ -4,4 +4,4 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update sudo apt-get install -y llvm-18-dev clang-18 libclang-18-dev lld-18 pkg-config libgc-dev libssl-dev zlib1g-dev libcjson-dev libsqlite3-dev libunwind-dev sudo apt-get install -y python3.12-dev # optional -go install -v github.com/goplus/llgo/cmd/llgo@latest \ No newline at end of file +curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash \ No newline at end of file From 3a2d24d7cce71c767b3dbfc5875dfadaf7790820 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Thu, 13 Feb 2025 16:13:50 +0800 Subject: [PATCH 2/2] doc: update doc test for installation instructions --- .github/workflows/doc.yml | 88 ++++++++++++++++++++++++++- README.md | 11 +++- doc/_readme/scripts/install_full.sh | 9 +++ doc/_readme/scripts/install_llgo.sh | 9 +-- doc/_readme/scripts/install_ubuntu.sh | 2 +- 5 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 doc/_readme/scripts/install_full.sh diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 7765694a..b24de924 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -29,7 +29,7 @@ jobs: with: args: README.md - doc_test: + remote_install: strategy: matrix: os: @@ -58,7 +58,42 @@ jobs: set -x source doc/_readme/scripts/install_ubuntu.sh - - name: Install llgo + - name: Test doc code blocks + run: | + set -e + set -x + source doc/_readme/scripts/run.sh + + local_install: + strategy: + matrix: + os: + - macos-latest + - ubuntu-24.04 + runs-on: ${{matrix.os}} + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Install dependencies on macOS + if: startsWith(matrix.os, 'macos') + run: | + set -e + set -x + source doc/_readme/scripts/install_macos.sh + + - name: Install dependencies on Ubuntu + if: startsWith(matrix.os, 'ubuntu') + run: | + set -e + set -x + source doc/_readme/scripts/install_ubuntu.sh + + - name: Install llgo with tools run: | set -e set -x @@ -79,3 +114,52 @@ jobs: set -x source doc/_readme/scripts/run.sh + local_install_full: + strategy: + matrix: + os: + - macos-latest + - ubuntu-24.04 + runs-on: ${{matrix.os}} + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Install dependencies on macOS + if: startsWith(matrix.os, 'macos') + run: | + set -e + set -x + source doc/_readme/scripts/install_macos.sh + + - name: Install dependencies on Ubuntu + if: startsWith(matrix.os, 'ubuntu') + run: | + set -e + set -x + source doc/_readme/scripts/install_ubuntu.sh + + - name: Install llgo with tools + run: | + set -e + set -x + git() { + if [ "$1" = "clone" ]; then + # do nothing because we already have the branch + cd .. + else + command git "$@" + fi + } + source doc/_readme/scripts/install_full.sh + echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV + + - name: Test doc code blocks + run: | + set -e + set -x + source doc/_readme/scripts/run.sh diff --git a/README.md b/README.md index a1682533..2a8ef5db 100644 --- a/README.md +++ b/README.md @@ -398,6 +398,15 @@ curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | TODO +### Install from source + + + +```sh +git clone https://github.com/goplus/llgo.git +cd llgo +./install.sh +``` ## Development tools @@ -409,7 +418,7 @@ TODO How do I generate these tools? - + ```sh git clone https://github.com/goplus/llgo.git diff --git a/doc/_readme/scripts/install_full.sh b/doc/_readme/scripts/install_full.sh new file mode 100644 index 00000000..316dc229 --- /dev/null +++ b/doc/_readme/scripts/install_full.sh @@ -0,0 +1,9 @@ +# shellcheck disable=all +git clone https://github.com/goplus/llgo.git +cd llgo/compiler +go install -v ./cmd/... +go install -v ./chore/... # compile all tools except pydump +export LLGO_ROOT=$PWD/.. +cd ../_xtool +llgo install ./... # compile pydump +go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 # compile pysigfetch diff --git a/doc/_readme/scripts/install_llgo.sh b/doc/_readme/scripts/install_llgo.sh index 98dca7bc..99399703 100644 --- a/doc/_readme/scripts/install_llgo.sh +++ b/doc/_readme/scripts/install_llgo.sh @@ -1,9 +1,4 @@ # shellcheck disable=all git clone https://github.com/goplus/llgo.git -cd llgo/compiler -go install -v ./cmd/... -go install -v ./chore/... # compile all tools except pydump -export LLGO_ROOT=$PWD/.. -cd ../_xtool -llgo install ./... # compile pydump -go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 # compile pysigfetch \ No newline at end of file +cd llgo +./install.sh diff --git a/doc/_readme/scripts/install_ubuntu.sh b/doc/_readme/scripts/install_ubuntu.sh index 24c00d03..3a7ff176 100644 --- a/doc/_readme/scripts/install_ubuntu.sh +++ b/doc/_readme/scripts/install_ubuntu.sh @@ -4,4 +4,4 @@ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update sudo apt-get install -y llvm-18-dev clang-18 libclang-18-dev lld-18 pkg-config libgc-dev libssl-dev zlib1g-dev libcjson-dev libsqlite3-dev libunwind-dev sudo apt-get install -y python3.12-dev # optional -curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash \ No newline at end of file +curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash