Skip to content

Commit

Permalink
Allow the download of clang for windows crossbuild
Browse files Browse the repository at this point in the history
download prebuild rc (linux version) from google storage
  • Loading branch information
uazo committed Aug 7, 2023
1 parent 41c823b commit 1a1319d
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 14 deletions.
3 changes: 2 additions & 1 deletion build/bromite_patches_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,5 @@ Timezone-customization.patch
00Disable-Feeback-Collector.patch
00Disable-remote-altsvc-for-h3-connections.patch
00do-not-block-build-incompatible-profiles.patch
00Allow-DocumentPiP-if-PopupsAndRedirects-are-active.patch
00Allow-DocumentPiP-if-PopupsAndRedirects-are-active.patch
00allow-the-download-of-clang-for-windows-crossbuild.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From: uazo <[email protected]>
Date: Mon, 7 Aug 2023 11:05:03 +0000
Subject: allow the download of clang for windows crossbuild

In the linux2win crossbuild some libraries are not checkout by default
and launching tools/clang/scripts/update.py deletes by default the
previous package.
this patch bypasses the output directory deletion, allowing the windows
toolchain to be downloaded on top of the android one
---
tools/clang/scripts/update.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -12,6 +12,8 @@ near-tip-of-tree clang version:
$ curl -s https://raw.githubusercontent.com/chromium/chromium/main/tools/clang/scripts/update.py | python3 - --output-dir=/tmp/clang

(Note that the output dir may be deleted and re-created if it exists.)
+
+exec: tools/clang/scripts/update.py --package=clang --host-os=win --no-clear=true
"""

import sys
@@ -237,7 +239,7 @@ def DownloadAndUnpackClangWinRuntime(output_dir):
sys.exit(1)


-def UpdatePackage(package_name, host_os, dir=LLVM_BUILD_DIR):
+def UpdatePackage(package_name, host_os, no_clear, dir=LLVM_BUILD_DIR):
stamp_file = None
package_file = None

@@ -269,6 +271,8 @@ def UpdatePackage(package_name, host_os, dir=LLVM_BUILD_DIR):
target_os = env.get('target_os', target_os)
except:
pass
+ if host_os != "":
+ target_os = [ host_os ]

if os.path.exists(OLD_STAMP_FILE):
# Delete the old stamp file so it doesn't look like an old version of clang
@@ -282,7 +286,7 @@ def UpdatePackage(package_name, host_os, dir=LLVM_BUILD_DIR):

# Updating the main clang package nukes the output dir. Any other packages
# need to be updated *after* the clang package.
- if package_name == 'clang' and os.path.exists(dir):
+ if not no_clear and (package_name == 'clang' and os.path.exists(dir)):
RmTree(dir)

DownloadAndUnpackPackage(package_file, dir, host_os)
@@ -332,6 +336,8 @@ def main():
'and exit.'))
parser.add_argument('--verify-version',
help='Verify that clang has the passed-in version.')
+ parser.add_argument('--no-clear',
+ help='Do not remove old file before extracting.')
args = parser.parse_args()

if args.verify_version and args.verify_version != RELEASE_VERSION:
@@ -373,7 +379,7 @@ def main():
print('--llvm-force-head-revision can only be used for --print-revision')
return 1

- return UpdatePackage(args.package, args.host_os, output_dir)
+ return UpdatePackage(args.package, args.host_os, args.no_clear, output_dir)


if __name__ == '__main__':
--
2.25.1
11 changes: 11 additions & 0 deletions tools/images/bromite-build/pre-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@ cd $WORKSPACE/
wget https://github.com/clangd/clangd/releases/download/snapshot_20211205/clangd_indexing_tools-linux-snapshot_20211205.zip
unzip clangd_indexing_tools-linux-snapshot_20211205.zip
rm clangd_indexing_tools-linux-snapshot_20211205.zip

echo -e ${RED} -------- download rc ${NC}
cd $WORKSPACE/chromium/src
third_party/depot_tools/download_from_google_storage.py \
--no_resume --no_auth \
--bucket chromium-browser-clang/rc \
-s build/toolchain/win/rc/linux64/rc.sha1

echo -e ${RED} -------- download win clang prebuilds ${NC}
cd $WORKSPACE/chromium/src
tools/clang/scripts/update.py --package=clang --host-os=win --no-clear=true
13 changes: 0 additions & 13 deletions tools/images/chr-source/prepare-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,3 @@ gclient runhooks

echo -e ${RED} -------- download objdump ${NC}
tools/clang/scripts/update.py --package=objdump

echo -e ${RED} -------- download rc ${NC}
cd build/toolchain/win/rc
git clone -q https://github.com/nico/hack
cd hack/res

../../../../../../third_party/llvm-build/Release+Asserts/bin/clang++ \
-std=c++14 rc.cc -Wall \
-Wno-c++11-narrowing -O2 -fno-rtti -fno-exceptions -DNDEBUG \
-o rc-linux64 -fuse-ld=lld -target x86_64-unknown-linux-gnu
cd ../../../../../../
cp build/toolchain/win/rc/hack/res/rc-linux64 build/toolchain/win/rc/linux64/rc

0 comments on commit 1a1319d

Please sign in to comment.