move to new build system

This commit is contained in:
2024-06-06 14:17:47 -05:00
parent 88d8bf63f5
commit aee68520b3
563 changed files with 4283 additions and 361439 deletions

View File

@ -1,79 +1,47 @@
#!/bin/bash
BUILD_TYPE=$1
BUILD_CLEAN=$2
IS_MINGW=$3
CURRENT_DIR=$(dirname "$0")
CURRENT_DIR=$(realpath ${CURRENT_DIR})
if [ "${BUILD_TYPE}" == "" ]; then
BUILD_TYPE=Release
. "${CURRENT_DIR}/env.sh" "$1" "$2" "$3" "$4" "$5"
mkdir -p "${PROJECT_BUILD_DIR}/build"
if [ -f "${SOURCE_DIR}/pre_build.sh" ]; then
"${SOURCE_DIR}/pre_build.sh"
fi
if [ "${IS_MINGW}" == "1" ]; then
BUILD_ROOT=build2
else
BUILD_ROOT=build
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
APP_BINARY_EXT=.exe
fi
BUILD_FOLDER=$(echo "${BUILD_TYPE}" | tr '[:upper:]' '[:lower:]')
if [ "${BUILD_FOLDER}" == "release" ]; then
BUILD_TYPE=Release
fi
pushd "${PROJECT_BUILD_DIR}"
cmake "${SOURCE_DIR}" -G"Unix Makefiles" ${PROJECT_CMAKE_OPTS} || exit 1
NUM_JOBS=${MY_NUM_JOBS}
if [[ -z "${NUM_JOBS}" ]]; then
NUM_JOBS=$(getconf _NPROCESSORS_ONLN 2> /dev/null || getconf NPROCESSORS_ONLN 2> /dev/null || echo 1)
if [ "${NUM_JOBS}" -gt "2" ]; then
NUM_JOBS=$(expr ${NUM_JOBS} - 2)
elif [ "${NUM_JOBS}" -gt "1" ]; then
NUM_JOBS=$(expr ${NUM_JOBS} - 1)
fi
fi
echo "Job count: ${NUM_JOBS}"
pushd "$(dirname "$0")"
mkdir -p ../${BUILD_ROOT}/${BUILD_FOLDER}
pushd ../${BUILD_ROOT}/${BUILD_FOLDER}
if [ "${IS_MINGW}" == "1" ]; then
TOOLCHAIN=$(realpath /cmake_toolchain.cmake)
CMAKE_ADDITIONAL_OPTS=-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
fi
if [ "${IS_MINGW}" == "1" ]; then
EXE_EXT=.exe
fi
cmake ../.. ${CMAKE_ADDITIONAL_OPTS} \
-G"Unix Makefiles" \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DREPERTORY_ENABLE_S3=ON \
-DREPERTORY_ENABLE_S3_TESTING=ON || exit 1
pushd ..
ln -sf ${BUILD_FOLDER}/compile_commands.json .
ln -sf ${BUILD_FOLDER}/repertory${EXE_EXT} .
ln -sf ${BUILD_FOLDER}/unittests${EXE_EXT} .
if [ "${IS_MINGW}" == "1" ]; then
ln -sf ${BUILD_FOLDER}/winfsp-x64.dll .
fi
popd
if [ "${BUILD_CLEAN}" == "clean" ]; then
if [ "${PROJECT_BUILD_CLEAN}" == "clean" ]; then
make clean
pushd build
make clean
popd
fi
make -j${NUM_JOBS} || exit 1
pushd build
make -j${NUM_JOBS} || exit 1
popd
popd
pushd ../${BUILD_ROOT}
ln -sf ${BUILD_FOLDER}/compile_commands.json .
ln -sf ${BUILD_FOLDER}/repertory${EXE_EXT} .
ln -sf ${BUILD_FOLDER}/unittests${EXE_EXT} .
if [ "${IS_MINGW}" == "1" ]; then
ln -sf ${BUILD_FOLDER}/winfsp-x64.dll .
if [ "${PROJECT_IS_MINGW}" != "1" ] && [ "${PROJECT_REQUIRE_ALPINE}" == "ON" ]; then
rsync -av --progress /usr/share/icu/74.1/ "${PROJECT_DIST_DIR}/icu/"
fi
popd
ln -sf ../3rd_party/cacert.pem ../${BUILD_ROOT}/cacert.pem
popd
for APP in ${PROJECT_APP_LIST[@]}; do
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
done
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
. "${CURRENT_DIR}/copy_mingw64_deps.sh" "$1" "$2" "$3" "$4" "$5"
fi
ln -sf "${PROJECT_BUILD_DIR}/build/compile_commands.json" "${SOURCE_DIR}/compile_commands.json"