summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2024-05-24 23:14:59 -0700
committerKhem Raj <raj.khem@gmail.com>2024-05-26 08:14:49 -0700
commit253e0560d4a92e219590b49f9ce0779a3f7d4dfc (patch)
treee3d389ce212b84fceec7e755225d8373003f8917
parent4e63e15e7fc33f3e25b5ec863e492c0535086947 (diff)
downloadmeta-clang-253e0560d4a92e219590b49f9ce0779a3f7d4dfc.tar.gz
devtool-clang.sh: Add script for setting devtool workflow
Document the process in README Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--README.md23
-rwxr-xr-xscripts/devtool-clang.sh41
2 files changed, 64 insertions, 0 deletions
diff --git a/README.md b/README.md
index 599237c..3a7e427 100644
--- a/README.md
+++ b/README.md
@@ -235,6 +235,29 @@ URI: ghttps://github.com/openembedded/bitbake.git
235branch: master 235branch: master
236revision: HEAD 236revision: HEAD
237``` 237```
238# Using Devtool and Upstream Development
239
240All LLVM based recipes use single llvm source directory, As a LLVM
241developer, you might want to work on your own repository to build
242related recipes, devtool can we useful in establishing such a workflow
243there is a script provided `scripts/devtool-clang.sh` which can assist
244in setting up all the recipes to use custom LLVM repository, in order
245to setup repository make sure that it has all the needed patches applied
246or else it will fail to build. Such a tree is already prepared and kept
247in sync at
248
249https://github.com/kraj/llvm-project
250
251There are branches under `oe` namespace which carry the needed OE patches
252
253```
254cd $TOPDIR/workspace/sources
255git clone https://github.com/kraj/llvm-project -b oe/main llvm-project
256```
257
258Once project is setup and meta-clang is added, run `devtool-clang.sh`
259script which will do the needed for setting up external sources for the
260yocto recipes, now yocto will use custom LLVM tree for its needs.
238 261
239# Contributing 262# Contributing
240 263
diff --git a/scripts/devtool-clang.sh b/scripts/devtool-clang.sh
new file mode 100755
index 0000000..08f9214
--- /dev/null
+++ b/scripts/devtool-clang.sh
@@ -0,0 +1,41 @@
1#!/usr/bin/env sh
2# Clone the repository first if not already done locally
3# git clone https://github.com/kraj/llvm-project -b oe/main /mnt/b/yoe/master/workspace/sources/llvm-project
4#
5# if local repository exists then make a clone/copy
6# git clone /home/kraj/work/llvm-project /mnt/b/yoe/master/workspace/sources/llvm-project
7#
8layerloc="$(dirname "$0")/../conf/layer.conf"
9workspace="$(dirname "$0")/../../../workspace"
10
11origver=$(grep "LLVMVERSION =" < "$layerloc" | awk '{print $3}' | tr -d '"')
12
13major=$(grep -e "set(LLVM_VERSION_MAJOR [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//")
14minor=$(grep -e "set(LLVM_VERSION_MINOR [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//")
15patch=$(grep -e "set(LLVM_VERSION_PATCH [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//")
16
17recipes="\
18llvm-project-source-$origver \
19clang \
20clang-cross-riscv64 \
21clang-crosssdk-x86_64 \
22clang-cross-canadian-riscv64 \
23nativesdk-clang-glue \
24compiler-rt \
25compiler-rt-sanitizers \
26libclc \
27libcxx \
28openmp \
29"
30
31for recipe in $recipes; do
32 devtool modify -n "$recipe" "$workspace/sources/llvm-project"
33 sed -i "/pn-$recipe /p;s/pn-$recipe /pn-nativesdk-$recipe /g" "$workspace"/appends/"$recipe"*.bbappend
34 sed -i "/pn-$recipe /p;s/pn-$recipe /pn-$recipe-native /g" "$workspace"/appends/"$recipe"*.bbappend
35done
36
37for f in "$workspace"/appends/*.bbappend; do
38 { echo "MAJOR_VER = \"$major\"" ; echo "MINOR_VER = \"$minor\"" ; echo "PATCH_VER = \"$patch\"" ; } >> "$f"
39done
40
41sed -i -e "s/$origver/$major.$minor.$patch/g" "$workspace"/appends/llvm-project-source.bbappend