Skip to content

Commit

Permalink
Get release CFLAGS from Dockerfile on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-fedin committed Jul 20, 2024
1 parent 4f7a124 commit 1ed3f91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions Telegram/build/docker/centos_env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
{%- set GIT_FREEDESKTOP = GIT ~ "/gitlab-freedesktop-mirrors" -%}
{%- set QT = "6.7.2" -%}
{%- set QT_TAG = "v" ~ QT -%}
{%- set CFLAGS_DEBUG = "-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -fcf-protection -D_GLIBCXX_ASSERTIONS" -%}
{%- set CFLAGS_LTO = "-flto=auto -ffat-lto-objects" -%}
{%- set CFLAGS_DEBUG = "$CFLAGS -O0 -fno-lto -U_FORTIFY_SOURCE" -%}
{%- set LibrariesPath = "/usr/src/Libraries" -%}

# syntax=docker/dockerfile:1

FROM rockylinux:8 AS builder-base
FROM rockylinux:8 AS builder
ENV LANG C.UTF-8
ENV LIBRARY_PATH /usr/local/lib64:/usr/local/lib:/lib64:/lib:/usr/lib64:/usr/lib
ENV LD_LIBRARY_PATH $LIBRARY_PATH
Expand All @@ -32,11 +31,10 @@ WORKDIR {{ LibrariesPath }}

RUN python3 -m pip install meson ninja

FROM builder-base AS builder
ENV AR gcc-ar
ENV RANLIB gcc-ranlib
ENV NM gcc-nm
ENV CFLAGS {% if DEBUG %}-g{% endif %} -O3 {% if LTO %}{{ CFLAGS_LTO }}{% endif %} -pipe -fPIC -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -DNDEBUG -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS
ENV CFLAGS {% if DEBUG %}-g{% endif %} -O3 {% if LTO %}-flto=auto -ffat-lto-objects{% endif %} -pipe -fPIC -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector-all -fstack-clash-protection -fcf-protection -D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS
ENV CXXFLAGS $CFLAGS

FROM builder AS patches
Expand Down Expand Up @@ -782,7 +780,7 @@ RUN cmake --build out --config Debug --parallel \
&& find out -mindepth 1 -maxdepth 1 ! -name Debug -exec rm -rf {} \;
{%- endif %}

FROM builder-base
FROM builder
COPY --link --from=zlib {{ LibrariesPath }}/zlib-cache /
COPY --link --from=xz {{ LibrariesPath }}/xz-cache /
COPY --link --from=protobuf {{ LibrariesPath }}/protobuf-cache /
Expand Down
2 changes: 1 addition & 1 deletion Telegram/build/docker/centos_env/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e

cd Telegram
./configure.sh "$@"
cmake --build ../out --config "${CONFIG:-RelWithDebInfo}" --parallel
cmake --build ../out --config "${CONFIG:-Release}" --parallel

0 comments on commit 1ed3f91

Please sign in to comment.