diff options
| -rw-r--r-- | README.md | 23 | ||||
| -rwxr-xr-x | scripts/devtool-clang.sh | 41 |
2 files changed, 64 insertions, 0 deletions
| @@ -235,6 +235,29 @@ URI: ghttps://github.com/openembedded/bitbake.git | |||
| 235 | branch: master | 235 | branch: master |
| 236 | revision: HEAD | 236 | revision: HEAD |
| 237 | ``` | 237 | ``` |
| 238 | # Using Devtool and Upstream Development | ||
| 239 | |||
| 240 | All LLVM based recipes use single llvm source directory, As a LLVM | ||
| 241 | developer, you might want to work on your own repository to build | ||
| 242 | related recipes, devtool can we useful in establishing such a workflow | ||
| 243 | there is a script provided `scripts/devtool-clang.sh` which can assist | ||
| 244 | in setting up all the recipes to use custom LLVM repository, in order | ||
| 245 | to setup repository make sure that it has all the needed patches applied | ||
| 246 | or else it will fail to build. Such a tree is already prepared and kept | ||
| 247 | in sync at | ||
| 248 | |||
| 249 | https://github.com/kraj/llvm-project | ||
| 250 | |||
| 251 | There are branches under `oe` namespace which carry the needed OE patches | ||
| 252 | |||
| 253 | ``` | ||
| 254 | cd $TOPDIR/workspace/sources | ||
| 255 | git clone https://github.com/kraj/llvm-project -b oe/main llvm-project | ||
| 256 | ``` | ||
| 257 | |||
| 258 | Once project is setup and meta-clang is added, run `devtool-clang.sh` | ||
| 259 | script which will do the needed for setting up external sources for the | ||
| 260 | yocto 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 | # | ||
| 8 | layerloc="$(dirname "$0")/../conf/layer.conf" | ||
| 9 | workspace="$(dirname "$0")/../../../workspace" | ||
| 10 | |||
| 11 | origver=$(grep "LLVMVERSION =" < "$layerloc" | awk '{print $3}' | tr -d '"') | ||
| 12 | |||
| 13 | major=$(grep -e "set(LLVM_VERSION_MAJOR [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//") | ||
| 14 | minor=$(grep -e "set(LLVM_VERSION_MINOR [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//") | ||
| 15 | patch=$(grep -e "set(LLVM_VERSION_PATCH [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//") | ||
| 16 | |||
| 17 | recipes="\ | ||
| 18 | llvm-project-source-$origver \ | ||
| 19 | clang \ | ||
| 20 | clang-cross-riscv64 \ | ||
| 21 | clang-crosssdk-x86_64 \ | ||
| 22 | clang-cross-canadian-riscv64 \ | ||
| 23 | nativesdk-clang-glue \ | ||
| 24 | compiler-rt \ | ||
| 25 | compiler-rt-sanitizers \ | ||
| 26 | libclc \ | ||
| 27 | libcxx \ | ||
| 28 | openmp \ | ||
| 29 | " | ||
| 30 | |||
| 31 | for 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 | ||
| 35 | done | ||
| 36 | |||
| 37 | for f in "$workspace"/appends/*.bbappend; do | ||
| 38 | { echo "MAJOR_VER = \"$major\"" ; echo "MINOR_VER = \"$minor\"" ; echo "PATCH_VER = \"$patch\"" ; } >> "$f" | ||
| 39 | done | ||
| 40 | |||
| 41 | sed -i -e "s/$origver/$major.$minor.$patch/g" "$workspace"/appends/llvm-project-source.bbappend | ||
