Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / 
tor-browser-build


Commits:
0508c07b by Pier Angelo Vendrame at 2025-08-21T15:17:58+02:00
Bug 41548: Unify CFLAGS definition for Android.

Avoid repeating -Oz, instead use a variable from rbm.conf.

- - - - -
00f0cf66 by Pier Angelo Vendrame at 2025-08-21T15:19:57+02:00
Bug 41548: Set tor's visibility to hidden on Android.

This helps to reduce the size of the tor binary on Android by almost 1MB
uncompressed and 370kB compressed on x86.
Add also other interesting linking options.

- - - - -


6 changed files:

- projects/libevent/config
- projects/openssl/config
- projects/tor/config
- projects/zlib/build
- projects/zstd/build
- rbm.conf


Changes:

=====================================
projects/libevent/config
=====================================
@@ -17,7 +17,7 @@ targets:
       configure_opt_project: --disable-shared
   android:
     var:
-      configure_opt_project: --disable-shared CFLAGS="-Oz"
+      configure_opt_project: --disable-shared CFLAGS="[% c('var/CFLAGS') %]"
 
 input_files:
   - project: container-image


=====================================
projects/openssl/config
=====================================
@@ -26,7 +26,7 @@ targets:
       configure_opts: '--cross-compile-prefix=[% c("var/build_target") %]- 
darwin64-[% c("var/macos_arch") %]-cc enable-ec_nistp_64_gcc_128'
   android:
     var:
-      configure_opts: 'CC=[% c("var/CC") %] android-[% c("var/toolchain_arch") 
%] -no-shared -D__ANDROID_API__=[% c("var/android_min_api") %] -Oz'
+      configure_opts: 'CC=[% c("var/CC") %] android-[% c("var/toolchain_arch") 
%] -no-shared -D__ANDROID_API__=[% c("var/android_min_api") %] [% 
c("var/CFLAGS") %]'
 
 input_files:
   - project: container-image


=====================================
projects/tor/config
=====================================
@@ -43,7 +43,7 @@ targets:
 
   android:
     var:
-      configure_opt_project: '--enable-android --enable-static-openssl 
--enable-static-libevent --enable-zstd --disable-tool-name-check 
--disable-system-torrc CFLAGS=-Oz'
+      configure_opt_project: '--enable-android --enable-static-openssl 
--enable-static-libevent --enable-zstd --disable-tool-name-check 
--disable-system-torrc CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="-Wl,--icf=safe 
-Wl,--pack-dyn-relocs=relr -Wl,--exclude-libs,ALL"'
 
 input_files:
   - project: container-image


=====================================
projects/zlib/build
=====================================
@@ -14,7 +14,7 @@ cd /var/tmp/build/[% project %]-[% c('version') %]
 [% IF c("var/android") -%]
   export CHOST=[% c("var/cross_prefix") %]
   export CC=[% c("var/CC") %]
-  export CFLAGS="-Oz"
+  export CFLAGS="[% c('var/CFLAGS') %]"
   ./configure --prefix=$distdir
   make -j[% c("num_procs") %]
   make -j[% c("num_procs") %] install


=====================================
projects/zstd/build
=====================================
@@ -8,7 +8,7 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') 
%].tar.[% c('compress_ta
 cd /var/tmp/build/[% project %]-[% c('version') %]
 export CPPFLAGS=-DZSTD_MULTITHREAD
 export CC=[% c("var/CC") %]
-export CFLAGS="-Oz"
+export CFLAGS="[% c('var/CFLAGS') %]"
 make -C lib -j[% c("num_procs") %] PREFIX=$distdir install
 # Only need static libraries
 rm $distdir/lib/libzstd.so*


=====================================
rbm.conf
=====================================
@@ -470,6 +470,7 @@ targets:
       compiler: android-toolchain
       android_min_api: 21
       CC: '[% c("var/cross_prefix") %][% c("var/android_min_api") %]-clang'
+      CFLAGS: '-Oz -fvisibility=hidden'
       container:
         suite: bookworm
         arch: amd64



View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/6100c67a3510070dcb491f60275af72282ba186a...00f0cf666218b20813349a9be98c79266decc36c

-- 
View it on GitLab: 
https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/compare/6100c67a3510070dcb491f60275af72282ba186a...00f0cf666218b20813349a9be98c79266decc36c
You're receiving this email because of your account on gitlab.torproject.org.


_______________________________________________
tbb-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to