diff --git a/BUILD.md b/BUILD.md index c61342fc..2f642d65 100644 --- a/BUILD.md +++ b/BUILD.md @@ -265,23 +265,25 @@ Extra requirements for Windows host: ```bash DOCKER=docker # or podman SOURCE_DIR=/build/RedPanda-CPP # source directory *in container* + JOBS=$(nproc) # reduce it for multiple builds at same time MIRROR=mirrors.kernel.org # leave empty for default mirror PLATFORM=linux/amd64 # or linux/386, linux/arm64/v8, linux/arm/v7, linux/riscv64 IMAGE=debian:12 # or Ubuntu (e.g. ubuntu:22.04) - $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh + $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh ``` * Windows host: ```ps1 $DOCKER = "docker" # or "podman" $SOURCE_DIR = "/build/RedPanda-CPP" # source directory *in container* + $JOBS = $Env:NUMBER_OF_PROCESSORS # reduce it for multiple builds at same time $MIRROR = "mirrors.kernel.org" # leave empty for default mirror $PLATFORM = "linux/amd64" # or "linux/386", "linux/arm64/v8", "linux/arm/v7", "linux/riscv64" $IMAGE = "debian:12" # or Ubuntu (e.g. "ubuntu:22.04") - & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh + & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh ``` ### Manual Install diff --git a/BUILD_cn.md b/BUILD_cn.md index 41159fef..00c638b9 100644 --- a/BUILD_cn.md +++ b/BUILD_cn.md @@ -265,23 +265,25 @@ Windows 宿主的额外要求: ```bash DOCKER=docker # 或 podman SOURCE_DIR=/build/RedPanda-CPP # *容器内*的源代码路径 + JOBS=$(nproc) # 同时构建多个包时可降低并行数 MIRROR=mirrors.ustc.edu.cn # 留空以使用默认的镜像站 PLATFORM=linux/amd64 # 或 linux/386、linux/arm64/v8、linux/arm/v7、linux/riscv64 IMAGE=debian:12 # 或 Ubuntu(如 ubuntu:22.04) - $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh + $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v $PWD:$SOURCE_DIR --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh ``` * Windows 宿主: ```ps1 $DOCKER = "docker" # 或 "podman" $SOURCE_DIR = "/build/RedPanda-CPP" # *容器内*的源代码路径 + $JOBS = $Env:NUMBER_OF_PROCESSORS # 同时构建多个包时可降低并行数 $MIRROR = "mirrors.ustc.edu.cn" # 留空以使用默认的镜像站 $PLATFORM = "linux/amd64" # 或 "linux/386"、"linux/arm64/v8"、"linux/arm/v7"、"linux/riscv64" $IMAGE = "debian:12" # 或 Ubuntu(如 "ubuntu:22.04") - & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh + & $DOCKER run --rm -e MIRROR=$MIRROR -e SOURCE_DIR=$SOURCE_DIR -e JOBS=$JOBS -v "$(Get-Location):$SOURCE_DIR" --platform $PLATFORM $IMAGE $SOURCE_DIR/packages/debian/01-in-docker.sh ``` ### 手动安装 diff --git a/packages/debian/01-in-docker.sh b/packages/debian/01-in-docker.sh index 6d2d664e..08c1b7d0 100755 --- a/packages/debian/01-in-docker.sh +++ b/packages/debian/01-in-docker.sh @@ -5,6 +5,7 @@ set -xe TMP_FOLDER=/build/redpanda-build DISTRO_ID=$(grep ^ID= /etc/os-release | cut -d= -f2- | tr -d '"') VERSION_ID=$(grep ^VERSION_ID= /etc/os-release | cut -d= -f2- | tr -d '"') +[[ -z $JOBS ]] && JOBS=$(nproc) # install deps default_repositories=( @@ -50,7 +51,7 @@ cp Red_Panda_CPP.pro $TMP_FOLDER # build cd $TMP_FOLDER -dpkg-buildpackage -us -uc +dpkg-buildpackage -us -uc -j$JOBS # copy back to host cd ..