diff --git a/paddle/scripts/musl_build/Dockerfile b/paddle/scripts/musl_build/Dockerfile index 6621a90802e2b19356dde1921035e5bc8844b7e1..1c53284cef6b3972c2310244cfa51589cfb10c1d 100644 --- a/paddle/scripts/musl_build/Dockerfile +++ b/paddle/scripts/musl_build/Dockerfile @@ -11,8 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +ARG PYTHON_VERSION=3.7 -FROM python:3.7-alpine3.11 +FROM python:${PYTHON_VERSION}-alpine3.11 USER root diff --git a/paddle/scripts/musl_build/README.md b/paddle/scripts/musl_build/README.md index d80e9d8b6fcb74e9f321c88a233091909fd0413c..9842971301b5ae08f2c31495e6eb093bd0be39fd 100644 --- a/paddle/scripts/musl_build/README.md +++ b/paddle/scripts/musl_build/README.md @@ -90,7 +90,7 @@ make -j8 compiling docker building script. it use alpine linux 3.10 as musl linux build enironment. it will try to install all the compiling tools, development packages, and python requirements for paddle musl compiling. environment variables: - + - PYTHON_VERSION: the version of python used for image building, default=3.7. - WITH_PRUNE_DAYS: prune old docker images, with days limitation. - WITH_REBUILD: force to rebuild the image, default=0. - WITH_REQUIREMENT: build with the python requirements, default=1. @@ -101,12 +101,13 @@ make -j8 - HTTPS_PROXY: use https proxy. 2. **build_paddle.sh** automatically or manually paddle building script. it will mount the root directory of paddle source to /paddle, and run compile procedure in /root/build directory. the output wheel package will save to the ./output directory relative to working directory. - - environment variables: + environment variables: - BUILD_MAN: build the paddle manually, default=0. - WITH_TEST: build with unitest, and run unitest check, default=0. - - WITH_PRUNE_CONTAINER: remove the container after building, default=0. + - WITH_PRUNE_CONTAINER: remove the container after building, default=1. + - CTEST_*: CTEST flages used for unit test. + - FLAGS_*: build flages used for paddle building. - HTTP_PROXY: use http proxy. - HTTPS_PROXY: use https proxy. diff --git a/paddle/scripts/musl_build/build_docker.sh b/paddle/scripts/musl_build/build_docker.sh index 8f6e5b07bb1236289b68b5fdbaa5b3e245e37e4a..0739cbdf731c84a4e619d8b62ef3e5aca02afb25 100755 --- a/paddle/scripts/musl_build/build_docker.sh +++ b/paddle/scripts/musl_build/build_docker.sh @@ -24,6 +24,7 @@ source "$CUR_DIR/config.sh" WITH_REQUIREMENT="${WITH_REQUIREMENT-0}" WITH_UT_REQUIREMENT="${WITH_UT_REQUIREMENT-0}" WITH_REBUILD="${WITH_REBUILD-0}" +PYTHON_VERSION="${PYTHON_VERSION-3.7}" # exit when any command fails set -e @@ -43,6 +44,8 @@ function prune_image(){ function build_image(){ declare -a BUILD_ARGS + BUILD_ARGS+=("--build-arg" "PYTHON_VERSION=$PYTHON_VERSION") + echo ">>> python version: $PYTHON_VERSION" if [ "$HTTP_PROXY" ]; then BUILD_ARGS+=("--build-arg" "http_proxy=$HTTP_PROXY") diff --git a/paddle/scripts/musl_build/build_inside.sh b/paddle/scripts/musl_build/build_inside.sh index 32a6d5c3f33e3da1e334a37b12282cb0451454e2..04dea2086a67803b4943ac8d639184705b92cb77 100755 --- a/paddle/scripts/musl_build/build_inside.sh +++ b/paddle/scripts/musl_build/build_inside.sh @@ -18,6 +18,8 @@ PADDLE_DIR=/paddle BUILD_DIR=$PWD/build echo ">>> paddle: $PADDLE_DIR" +export PADDLE_ROOT="$PADDLE_DIR" + echo ">>> python: $PYTHON_VERSION" # exit when any command fails @@ -64,7 +66,7 @@ fi echo ">>> compile source code" set -x -export FLAGS_call_stack_level=2 +export FLAGS_call_stack_level="${FLAGS_call_stack_level-2}" cmake "$PADDLE_DIR" \ -DWITH_MUSL=ON \ diff --git a/paddle/scripts/musl_build/build_paddle.sh b/paddle/scripts/musl_build/build_paddle.sh index 19d64d91501f2a60d6995d2cd281d9cab4cf6e70..879bb823c27143f95b0fc553d8713802b7a5ba79 100755 --- a/paddle/scripts/musl_build/build_paddle.sh +++ b/paddle/scripts/musl_build/build_paddle.sh @@ -81,7 +81,17 @@ if [ "$BUILD_MAN" != "1" ]; then RUN_ARGS+=("--env" "WITH_UT_REQUIREMENT=$MOUNT_DIR/$UNITTEST_REQ") echo ">>> install unit test requirement" fi - + + for CTEST_FLAGS in $(env | grep ^CTEST_); do + RUN_ARGS+=("--env" "$CTEST_FLAGS") + echo ">>> ctest: $CTEST_FLAGS" + done + + for CBUILD_FLAGS in $(env | grep ^FLAGS_); do + RUN_ARGS+=("--env" "$CBUILD_FLAGS") + echo ">>> flags: $CBUILD_FLAGS" + done + if [ "$WITH_PRUNE_CONTAINER" == "1" ]; then echo ">>> with prune container" RUN_ARGS+=("--rm")