[Slackbuilds-users] [PATCH] android-tools: drop heavy gtest dependency via inline header mocking
Юрий Сорокин
mrvladislavovich at gmail.com
Wed Jun 3 04:59:41 UTC 2026
Hello everyone!
I would like to propose an optimization for the android-tools SlackBuild to
eliminate its dependency on gtest (Google Test Framework). Currently, gtest
is
required to build android-tools, but compiling such a heavy testing
framework
just to get adb and fastboot feels redundant for everyday users. gtest is
only
used for upstream development unit tests. If we look closely at the build
failure when gtest is missing, the only blocker is a single header include:
#include <gtest/gtest_prod.h> inside libziparchive. It is used solely for
the
FRIEND_TEST macro, which is completely useless when we are not running tests
anyway. Instead of adding a bulky .patch file to the repository, we can
elegantly mock this header inline directly inside the SlackBuild script
right
before the build directory is created. Since vendor/libbase/include is
already
in the compiler's include paths, the mock header is picked up automatically:
--- android-tools.SlackBuild_orig 2025-03-15 06:24:24.000000000 +0400
+++ android-tools.SlackBuild 2026-06-03 08:34:20.808218974 +0400
@@ -87,6 +87,10 @@
# Fix building with protobuf3 version 30
patch -p1 -d "vendor/extras" <
$CWD/android-tools-35.0.2-fix-protobuf-30.0-compilation.patch
+mkdir -p vendor/libbase/include/gtest &&
+ echo "#define FRIEND_TEST(test_case_name, test_name)" > \
+ vendor/libbase/include/gtest/gtest_prod.h
+
mkdir -p build
cd build
cmake \
I have successfully tested this on my environment (15.0 x86_64).
android-tools
compiles flawlessly without gtest being installed in the system at all.
Attached is the diff for android-tools.SlackBuild. If this looks good, we
can
also safely remove gtest from the REQUIRES line in android-tools.info. What
do
you think? I hope this saves some CPU cycles and disk space for Slackware
users.
Best regards, MyRequiem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20260603/53444d7f/attachment.htm>
More information about the SlackBuilds-users
mailing list