diff --git a/exports/taskfiles/utils/boost.yaml b/exports/taskfiles/utils/boost.yaml index 3de30fc..33fec0a 100644 --- a/exports/taskfiles/utils/boost.yaml +++ b/exports/taskfiles/utils/boost.yaml @@ -1,107 +1,108 @@ version: "3" includes: + checksum: "checksum.yaml" remote: "remote.yaml" set: ["u", "pipefail"] shopt: ["globstar"] tasks: - # Runs the bootstrap.sh generate step in the given source directory. Boost only supports - # in-source generation and building. + # Generates `GENERATE_DIR` by copying `SOURCE_DIR` and then running boost's bootstrap step. # # @param {string} SOURCE_DIR Project source directory. + # @param {string} GENERATE_DIR Directory in which to generate `b2` and the build configuration. + # @param {string} GENERATE_CHECKSUM_FILE Checksum file for `GENERATE_DIR`. # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. # @param {string[]} TARGETS Target libraries to build. # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the generate command. generate: internal: true - dir: "{{.SOURCE_DIR}}" vars: EXTRA_ARGS: ref: "default (list) .EXTRA_ARGS" requires: - vars: ["SOURCE_DIR", "INSTALL_PREFIX", "TARGETS"] + vars: ["SOURCE_DIR", "GENERATE_DIR", "GENERATE_CHECKSUM_FILE", "INSTALL_PREFIX", "TARGETS"] + sources: + - "{{.SOURCE_DIR}}/**/*" + generates: + - "{{.GENERATE_CHECKSUM_FILE}}" + deps: + - task: "checksum:validate" + vars: + CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.GENERATE_DIR}}" cmds: - >- + rm -rf "{{.GENERATE_DIR}}" + - >- + cp -R "{{.SOURCE_DIR}}" "{{.GENERATE_DIR}}" + - >- + pushd "{{.GENERATE_DIR}}"; ./bootstrap.sh --prefix="{{.INSTALL_PREFIX}}" --exec-prefix="{{.INSTALL_PREFIX}}" --with-libraries={{(join "," .TARGETS)}} {{- range .EXTRA_ARGS}} "{{.}}" - {{- end}} + {{- end}}; + popd + - task: "checksum:compute" + vars: + CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}" + INCLUDE_PATTERNS: + - "{{.GENERATE_DIR}}" - # Runs the b2 build step for boost. The caller must have previously called `generate` on - # `SOURCE_DIR` for this task to succeed. + # Runs boost's b2 build and install step, and creates a CMake settings file. The caller must have + # previously called `generate` on `SOURCE_DIR` (to produce the `GENERATE_DIR`) for this task to + # succeed. # - # @param {string} SOURCE_DIR Directory containing the boost source. + # @param {string} GENERATE_DIR Directory containing boost's source and build files. + # @param {string} BUILD_DIR Directory in which to build boost. + # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command. # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - build: + # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings + # file should be stored. + build-and-install: internal: true - dir: "{{.SOURCE_DIR}}" vars: EXTRA_ARGS: ref: "default (list) .EXTRA_ARGS" JOBS: >- {{default "" .JOBS}} requires: - vars: ["SOURCE_DIR"] + vars: ["GENERATE_DIR", "BUILD_DIR", "INSTALL_PREFIX"] cmds: - >- + pushd "{{.GENERATE_DIR}}"; ./b2 + install + --build-dir="{{.BUILD_DIR}}" {{- range .EXTRA_ARGS}} "{{.}}" {{- end}} {{- if .JOBS}} "-j{{.JOBS}}" - {{- end}} - - # Runs the b2 install step for boost. The caller must have previously called `build` on - # `SOURCE_DIR` for this task to succeed. If `CMAKE_SETTINGS_DIR` is set, a settings file will be - # created in that directory, containing a `boost_ROOT` CMake variable that points to - # `INSTALL_PREFIX`. - # - # @param {string} SOURCE_DIR Directory containing the boost source. - # @param {string} INSTALL_PREFIX Path prefix of where the project should be installed. - # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings - # file should be stored. - # @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command. - install: - internal: true - dir: "{{.SOURCE_DIR}}" - vars: - EXTRA_ARGS: - ref: "default (list) .EXTRA_ARGS" - INSTALL_PREFIX: >- - {{default "" .INSTALL_PREFIX}} - CMAKE_SETTINGS_DIR: >- - {{default "" .CMAKE_SETTINGS_DIR}} - requires: - vars: ["SOURCE_DIR", "INSTALL_PREFIX"] - cmds: - - >- - ./b2 - install - {{- range .EXTRA_ARGS}} - "{{.}}" - {{- end}} + {{- end}}; + popd; - >- {{- if .CMAKE_SETTINGS_DIR}} echo "set(Boost_ROOT \"{{.INSTALL_PREFIX}}\" CACHE PATH - \"Package root for boost.\" - )" >> "{{.CMAKE_SETTINGS_DIR}}/boost.cmake" + \"Package root for Boost.\" + )" >> "{{.CMAKE_SETTINGS_DIR}}/Boost.cmake" {{- end}} + # Downloads boost from `URL` and installs boost. # # General parameters - # @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory to store the install and src - # directories inside. + # @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory in which to store the source, generate, + # build, and install directories. # @param {string} [SOURCE_DIR={{.WORK_DIR}}/boost-src] Directory in which to extract the tar # file. # @@ -110,19 +111,22 @@ tasks: # @param {string} URL # # Boost generate parameters + # @param {string} [GENERATE_DIR={{.WORK_DIR}}/boost-generate] Directory in which to generate the + # project build files. + # @param {string} [GENERATE_CHECKSUM_FILE={{.WORK_DIR}}/boost-generate.md5] Checksum file for the + # generate directory. # @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/boost-install] Path prefix of where the project # should be installed. # @param {string[]} [TARGETS] Target libraries to build. - # @param {string[]} [GEN_ARGS] Any additional arguments to pass to the generate command. + # @param {string[]} [GENERATE_ARGS] Any additional arguments to pass to the generate command. # - # Boost build parameters + # Boost build-and-install parameters + # @param {string} [BUILD_DIR={{.WORK_DIR}}/boost-build] Directory in which to build the project. # @param {int} [JOBS] The maximum number of concurrent processes to use when building. If # omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the # default is the number of cores. - # @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the build command. - # - # Boost install parameters - # @param {string[]} [INSTALL_ARGS] Any additional arguments to pass to the install command. + # @param {string[]} [BUILD_AND_INSTALL_ARGS] Any additional arguments to pass to boost's build + # and install command. # @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings # file should be stored. download-and-install: @@ -136,22 +140,24 @@ tasks: {{default (printf "%s/boost-src" .WORK_DIR) .SOURCE_DIR}} # Boost generate parameters + GENERATE_DIR: >- + {{default (printf "%s/boost-generate" .WORK_DIR) .GENERATE_DIR}} + GENERATE_CHECKSUM_FILE: >- + {{default (printf "%s/boost-generate.md5" .WORK_DIR) .GENERATE_CHECKSUM_FILE}} INSTALL_PREFIX: >- {{default (printf "%s/boost-install" .WORK_DIR) .INSTALL_PREFIX}} TARGETS: ref: "default (list) .TARGETS" - GEN_ARGS: - ref: "default (list) .GEN_ARGS" + GENERATE_ARGS: + ref: "default (list) .GENERATE_ARGS" - # Boost build parameters - BUILD_ARGS: - ref: "default (list) .BUILD_ARGS" + # Boost build-and-install parameters + BUILD_DIR: >- + {{default (printf "%s/boost-build" .WORK_DIR) .BUILD_DIR}} + BUILD_AND_INSTALL_ARGS: + ref: "default (list) .BUILD_AND_INSTALL_ARGS" JOBS: >- {{default "" .JOBS}} - - # Boost install parameters - INSTALL_ARGS: - ref: "default (list) .INSTALL_ARGS" CMAKE_SETTINGS_DIR: >- {{default "" .CMAKE_SETTINGS_DIR}} requires: @@ -166,21 +172,19 @@ tasks: - task: "generate" vars: SOURCE_DIR: "{{.SOURCE_DIR}}" + GENERATE_DIR: "{{.GENERATE_DIR}}" + GENERATE_CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" TARGETS: ref: ".TARGETS" EXTRA_ARGS: - ref: ".GEN_ARGS" - - task: "build" - vars: - SOURCE_DIR: "{{.SOURCE_DIR}}" - JOBS: "{{.JOBS}}" - EXTRA_ARGS: - ref: ".BUILD_ARGS" - - task: "install" + ref: ".GENERATE_ARGS" + - task: "build-and-install" vars: - SOURCE_DIR: "{{.SOURCE_DIR}}" + GENERATE_DIR: "{{.GENERATE_DIR}}" + BUILD_DIR: "{{.BUILD_DIR}}" INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" - CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}" EXTRA_ARGS: - ref: ".INSTALL_ARGS" + ref: ".BUILD_AND_INSTALL_ARGS" + JOBS: "{{.JOBS}}" + CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}"