Add MinSizeRel support on Linux

Allows to build Telegram itself with multi-config generator as well as all dependencies with -Os optimizations
This commit is contained in:
Ilya Fedin
2026-02-26 22:00:25 +00:00
committed by John Preston
parent 5a6a38da29
commit 0cddac16fb
3 changed files with 15 additions and 1 deletions
+4 -1
View File
@@ -44,7 +44,7 @@ WORKDIR /usr/src
ENV AR=gcc-ar
ENV RANLIB=gcc-ranlib
ENV NM=gcc-nm
ENV CFLAGS='{% if DEBUG %}-g{% endif %} -O3 {% if LTO %}-flto=auto -ffat-lto-objects{% endif %} -pipe -fPIC -fno-strict-aliasing -fexceptions -fasynchronous-unwind-tables -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fhardened -Wno-hardened'
ENV CFLAGS='{% if DEBUG %}-g{% endif %} {% if MINSIZE %}-Os{% else %}-O3{% endif %} {% if LTO %}-flto=auto -ffat-lto-objects{% endif %} -pipe -fPIC -fno-strict-aliasing -fexceptions -fasynchronous-unwind-tables -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fhardened -Wno-hardened'
ENV CXXFLAGS=$CFLAGS
ENV LDFLAGS='-static-libstdc++ -static-libgcc -static-libasan -pthread -Wl,--push-state,--no-as-needed,-ldl,--pop-state -Wl,--as-needed -Wl,-z,muldefs'
@@ -527,6 +527,9 @@ RUN git clone -b n6.1.1 --depth=1 https://github.com/FFmpeg/FFmpeg.git \
--disable-network \
--disable-autodetect \
--disable-everything \
{%- if MINSIZE %}
--enable-small \
{%- endif %}
--enable-libdav1d \
--enable-libopenh264 \
--enable-libopus \
@@ -11,6 +11,7 @@ def checkEnv(envName, defaultValue):
def main():
print(Environment(loader=FileSystemLoader(dirname(__file__))).get_template("Dockerfile").render(
DEBUG=checkEnv("DEBUG", True),
MINSIZE=checkEnv("MINSIZE", False),
LTO=checkEnv("LTO", True),
ASAN=checkEnv("ASAN", False),
JOBS=checkEnv("JOBS", ""),