Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Enable portable flag for Docker container builds #1602

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN apk update && apk add git gcc g++ make cmake ninja autoconf automake libtool
WORKDIR /kvrocks

COPY . .
RUN ./x.py build -DENABLE_OPENSSL=ON -DCMAKE_BUILD_TYPE=Release -j $(nproc) $MORE_BUILD_ARGS
RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=1 -DCMAKE_BUILD_TYPE=Release -j $(nproc) $MORE_BUILD_ARGS

FROM alpine:3.16

Expand Down
7 changes: 6 additions & 1 deletion x.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def build(dir: str, jobs: Optional[int], ghproxy: bool, ninja: bool, unittest: b

makedirs(dir, exist_ok=True)

cmake_options = ["-DCMAKE_BUILD_TYPE=RelWithDebInfo", "-DPORTABLE=0"]
cmake_options = ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"]
if ghproxy:
cmake_options.append("-DDEPS_FETCH_PROXY=https://ghproxy.com/")
if ninja:
Expand All @@ -119,6 +119,11 @@ def build(dir: str, jobs: Optional[int], ghproxy: bool, ninja: bool, unittest: b
cmake_options += ["-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"]
if D:
cmake_options += [f"-D{o}" for o in D]

portable_flag_enabled = any("DPORTABLE" in o for o in cmake_options)
mapleFU marked this conversation as resolved.
Show resolved Hide resolved
if not portable_flag_enabled:
cmake_options.append("-DPORTABLE=0")

run(cmake, str(basedir), *cmake_options, verbose=True, cwd=dir)

if skip_build:
Expand Down