Improve portability in HHVM's CMake build files (#9085)
commitb2823d476ba8ada493329078ec8e5f5d17329635
authorBo Yang <atry@fb.com>
Thu, 12 May 2022 21:39:32 +0000 (12 14:39 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 12 May 2022 21:39:32 +0000 (12 14:39 -0700)
treea677409e0baa63250f6ecbd212bebb99ce37f3cf
parente577da2271402a900e15143d69e556fcd842aebe
Improve portability in HHVM's CMake build files (#9085)

Summary:
This PR is a redo of previously reverted https://github.com/facebook/hhvm/issues/9080.

This PR includes improvement of portability in HHVM's CMake build files. They are necessary to let HHVM build with Nix, but these changes are not specifically to Nix, because other untested OS might also have similar behavior like Nix:

- `CMAKE_INSTALL_PREFIX` is replaced by `CMAKE_INSTALL_FULL_*`, because the manual concatenation of `${CMAKE_INSTALL_PREFIX}/${xxx}` would point to a wrong path if `xxx` is an absolute path. Note that https://github.com/facebook/hhvm/issues/9080 incorrectly changes the behavior of the CMake `install` command, because the CMake `install` command only automatically prepends the prefix to directories specified in `DESTINATION`, not in `CODE`. `CMAKE_INSTALL_FULL_*` used by this PR should be fine.
- `PAM_LIB` is added to fix https://github.com/facebook/hhvm/issues/257
- Passing `HAVE_SYSTEM_TZDATA_PREFIX` to `timelib` to customize the `zoneinfo` path instead of hard-coded `/usr/share/zoneinfo`, which does not exist on Nix.
- Passing `CMAKE_OSX_DEPLOYMENT_TARGET` to `thrift` explicitly, otherwise it would be inferred as 10.12 implicitly on Nix, and thrift does not compile when targeting macOS 10.12.
- Skip `zstd` detection by manually setting `CAN_USE_SYSTEM_ZSTD` because the original `zstd` detection script does not work for Nix

Pull Request resolved: https://github.com/facebook/hhvm/pull/9085

Test Plan: Tested along with the next diff D36068249 on Github Action

Reviewed By: alexeyt

Differential Revision: D36203896

Pulled By: Atry

fbshipit-source-id: 59fcbe0c008b35c8f20966a2c87f895c608ccce9
13 files changed:
CMake/HPHPFindLibs.cmake
CMake/HPHPFunctions.cmake
CMake/HPHPIZEFunctions.cmake
CMake/HPHPSetup.cmake
hphp/tools/hphpize/CMakeLists.txt
hphp/tools/hphpize/hphpize.cmake.in
third-party/CMakeLists.txt
third-party/mcrouter/mcrouter-CMakeLists.txt
third-party/mcrouter/mcrouter-thrift-codegen.cmake
third-party/thrift/CMakeLists.txt
third-party/timelib/CMakeLists.txt
third-party/timelib/timelib-CMakeLists.txt
third-party/zstd/CMakeLists.txt