[tbb-commits] [tor-browser-build/master] Bug 40125: Merge clang and fenix-clang projects

sysrqb at torproject.org sysrqb at torproject.org
Thu Oct 22 22:21:01 UTC 2020


commit bfd59379b6b0934cb4a0771e1a668e447a540971
Author: Georg Koppen <gk at torproject.org>
Date:   Sun Oct 18 07:17:14 2020 +0000

    Bug 40125: Merge clang and fenix-clang projects
---
 projects/clang/build        | 31 +++++++++++++++++++++----------
 projects/clang/config       | 14 ++++++++++++--
 projects/fenix-clang/build  | 34 ----------------------------------
 projects/fenix-clang/config | 19 -------------------
 projects/geckoview/build    |  2 +-
 projects/geckoview/config   |  2 +-
 projects/llvm-project/build |  4 ++--
 7 files changed, 37 insertions(+), 69 deletions(-)

diff --git a/projects/clang/build b/projects/clang/build
index 10700ce..c4c16d9 100644
--- a/projects/clang/build
+++ b/projects/clang/build
@@ -4,12 +4,14 @@ distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/dist
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
 export PATH="/var/tmp/dist/cmake/bin:$PATH"
-[% IF c("var/linux") %]
-  # We need a link to our GCC, otherwise the system cc gets used which points to
-  # /usr/bin/gcc.
-  [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
-                              hardened_gcc => 0 }) %]
-  ln -s gcc /var/tmp/dist/gcc/bin/cc
+[% IF c("var/linux") || c("var/android") %]
+  [% IF c("var/linux") %]
+    # We need a link to our GCC, otherwise the system cc gets used which points
+    # to /usr/bin/gcc.
+    [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
+                                hardened_gcc => 0 }) %]
+    ln -s gcc /var/tmp/dist/gcc/bin/cc
+  [% END %]
   tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
   export PATH="/var/tmp/dist/binutils/bin:$PATH"
 [% END -%]
@@ -20,10 +22,19 @@ cd clang-source
 export LLVM_HOME=$(pwd)
 mkdir build
 cd build
-cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir \
-                             -DCMAKE_BUILD_TYPE:STRING=Release \
-     [% IF c("var/rlbox") -%]-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \[% END -%]
-                             $LLVM_HOME
+# XXX: remove duplicated parts while fixing tor-browser-build#40048
+[% IF ! c("var/android") %]
+  cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir \
+                               -DCMAKE_BUILD_TYPE:STRING=Release \
+       [% IF c("var/rlbox") -%]-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \[% END -%]
+                               $LLVM_HOME
+[% ELSE %]
+  cmake ../llvm -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir \
+                                    -DCMAKE_BUILD_TYPE=Release \
+                                    -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
+            [% IF c("var/rlbox") -%]-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \[% END -%]
+                                    -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;lld"
+[% END -%]
 make -j[% c("buildconf/num_procs") %]
 make install
 cd /var/tmp/dist
diff --git a/projects/clang/config b/projects/clang/config
index 46d308a..6038eab 100644
--- a/projects/clang/config
+++ b/projects/clang/config
@@ -1,11 +1,17 @@
 # vim: filetype=yaml sw=2
-version: 9.0.1
+version: '[% c("var/llvm_version") %]'
 filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
 
 var:
+  llvm_version: '[% pc("clang-source", "version") %]'
   container:
     use_container: 1
 
+targets:
+  android:
+    var:
+      llvm_version: '[% pc("llvm-project", "version") %]'
+
 input_files:
   - project: container-image
   - name: '[% c("var/compiler") %]'
@@ -13,8 +19,12 @@ input_files:
     enable: '[% c("var/linux") %]'
   - name: binutils
     project: binutils
-    enable: '[% c("var/linux") %]'
+    enable: '[% c("var/linux") %] || [% c("var/android") %]'
   - project: cmake
     name: cmake
   - project: clang-source
     name: clang-source
+    enable: '[% ! c("var/android") %]'
+  - project: llvm-project
+    name: clang-source
+    enable: '[% c("var/android") %]'
diff --git a/projects/fenix-clang/build b/projects/fenix-clang/build
deleted file mode 100644
index c3c15f1..0000000
--- a/projects/fenix-clang/build
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-[% c("var/set_default_env") -%]
-distdir=/var/tmp/dist/[% project %]
-mkdir -p /var/tmp/dist
-tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
-export PATH="/var/tmp/dist/cmake/bin:$PATH"
-[% IF c("var/linux") %]
-  # We need a link to our GCC, otherwise the system cc gets used which points to
-  # /usr/bin/gcc.
-  [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
-                              hardened_gcc => 0 }) %]
-  ln -s gcc /var/tmp/dist/gcc/bin/cc
-[% END -%]
-tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
-export PATH="/var/tmp/dist/binutils/bin:$PATH"
-
-mkdir -p /var/tmp/build
-cd /var/tmp/build
-tar -xf $rootdir/[% c('input_files_by_name/llvm-project') %]
-cd llvm-project
-mkdir build
-cd build
-cmake ../llvm -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir \
-                          -DCMAKE_BUILD_TYPE=Release \
-                          -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
-  [% IF c("var/rlbox") -%]-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \[% END -%]
-                          -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;lld"
-make -j[% c("buildconf/num_procs") %]
-make install
-cd /var/tmp/dist
-[% c('tar', {
-        tar_src => [ project ],
-        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
-    }) %]
diff --git a/projects/fenix-clang/config b/projects/fenix-clang/config
deleted file mode 100644
index 4bc55f3..0000000
--- a/projects/fenix-clang/config
+++ /dev/null
@@ -1,19 +0,0 @@
-# vim: filetype=yaml sw=2
-version: '[% pc("llvm-project", "version") %]'
-filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
-
-var:
-  container:
-    use_container: 1
-
-input_files:
-  - project: container-image
-  - name: '[% c("var/compiler") %]'
-    project: '[% c("var/compiler") %]'
-    enable: '[% c("var/linux") %]'
-  - name: binutils
-    project: binutils
-  - project: cmake
-    name: cmake
-  - project: llvm-project
-    name: llvm-project
diff --git a/projects/geckoview/build b/projects/geckoview/build
index 8296856..1c6582c 100644
--- a/projects/geckoview/build
+++ b/projects/geckoview/build
@@ -20,7 +20,7 @@ tar -C /var/tmp/dist -xf [% c('input_files_by_name/node') %]
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/clang') %]
 export LLVM_CONFIG="/var/tmp/dist/clang/bin/llvm-config"
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/binutils') %]
-export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bin:/var/tmp/dist/python/bin:/var/tmp/dist/node/bin:/var/tmp/dist/fenix-clang/bin:/var/tmp/dist/binutils/bin:$PATH"
+export PATH="/var/tmp/dist/rust/bin:/var/tmp/dist/cbindgen:/var/tmp/dist/nasm/bin:/var/tmp/dist/python/bin:/var/tmp/dist/node/bin:/var/tmp/dist/clang/bin:/var/tmp/dist/binutils/bin:$PATH"
 
 tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
 
diff --git a/projects/geckoview/config b/projects/geckoview/config
index c9eb23e..36d1212 100644
--- a/projects/geckoview/config
+++ b/projects/geckoview/config
@@ -154,7 +154,7 @@ input_files:
     name: nasm
   - project: python
     name: python
-  - project: fenix-clang
+  - project: clang
     name: clang
   - filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
     name: gradle-dependencies
diff --git a/projects/llvm-project/build b/projects/llvm-project/build
index ac0f21b..e35adbf 100644
--- a/projects/llvm-project/build
+++ b/projects/llvm-project/build
@@ -1,8 +1,8 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
 tar xf [% project %]-[% c("version") %].tar.gz
-mv [% project %]-[% c("version") %] [% project %]
+mv [% project %]-[% c("version") %] clang-source
 [% c('tar', {
-        tar_src => [ project ],
+        tar_src => [ 'clang-source' ],
         tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
     }) %]



More information about the tbb-commits mailing list