Get release CFLAGS from Dockerfile on Linux

This commit is contained in:
Ilya Fedin 2024-07-19 18:07:45 +04:00 committed by John Preston
parent ac78ae823c
commit 2c7922ce7b
2 changed files with 5 additions and 7 deletions

View file

@ -3,13 +3,12 @@
{%- set GIT_UPDATE_M4 = "git submodule set-url m4 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 && git config -f .gitmodules submodule.m4.shallow true && git submodule init && git submodule update" -%} {%- set GIT_UPDATE_M4 = "git submodule set-url m4 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 && git config -f .gitmodules submodule.m4.shallow true && git submodule init && git submodule update" -%}
{%- set QT = "6.7.2" -%} {%- set QT = "6.7.2" -%}
{%- set QT_TAG = "v" ~ QT -%} {%- set QT_TAG = "v" ~ QT -%}
{%- set CFLAGS_DEBUG = "-g -pipe -fPIC -fstack-protector-all -fstack-clash-protection -fcf-protection -D_GLIBCXX_ASSERTIONS" -%} {%- set CFLAGS_DEBUG = "$CFLAGS -O0 -fno-lto -U_FORTIFY_SOURCE" -%}
{%- set CFLAGS_LTO = "-flto=auto -ffat-lto-objects" -%}
{%- set LibrariesPath = "/usr/src/Libraries" -%} {%- set LibrariesPath = "/usr/src/Libraries" -%}
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
FROM rockylinux:8 AS builder-base FROM rockylinux:8 AS builder
ENV LANG C.UTF-8 ENV LANG C.UTF-8
ENV LIBRARY_PATH /usr/local/lib64:/usr/local/lib:/lib64:/lib:/usr/lib64:/usr/lib ENV LIBRARY_PATH /usr/local/lib64:/usr/local/lib:/lib64:/lib:/usr/lib64:/usr/lib
ENV LD_LIBRARY_PATH $LIBRARY_PATH ENV LD_LIBRARY_PATH $LIBRARY_PATH
@ -33,11 +32,10 @@ WORKDIR {{ LibrariesPath }}
RUN python3 -m pip install meson ninja RUN python3 -m pip install meson ninja
FROM builder-base AS builder
ENV AR gcc-ar ENV AR gcc-ar
ENV RANLIB gcc-ranlib ENV RANLIB gcc-ranlib
ENV NM gcc-nm 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 ENV CXXFLAGS $CFLAGS
FROM builder AS patches FROM builder AS patches
@ -803,7 +801,7 @@ RUN cmake --build out --config Debug --parallel \
&& find out -mindepth 1 -maxdepth 1 ! -name Debug -exec rm -rf {} \; && find out -mindepth 1 -maxdepth 1 ! -name Debug -exec rm -rf {} \;
{%- endif %} {%- endif %}
FROM builder-base FROM builder
COPY --link --from=zlib {{ LibrariesPath }}/zlib-cache / COPY --link --from=zlib {{ LibrariesPath }}/zlib-cache /
COPY --link --from=xz {{ LibrariesPath }}/xz-cache / COPY --link --from=xz {{ LibrariesPath }}/xz-cache /
COPY --link --from=protobuf {{ LibrariesPath }}/protobuf-cache / COPY --link --from=protobuf {{ LibrariesPath }}/protobuf-cache /

View file

@ -3,4 +3,4 @@ set -e
cd Telegram cd Telegram
./configure.sh "$@" ./configure.sh "$@"
cmake --build ../out --config "${CONFIG:-RelWithDebInfo}" --parallel cmake --build ../out --config "${CONFIG:-Release}" --parallel