diff --git a/hphp/hack/CMakeLists.txt b/hphp/hack/CMakeLists.txt index 336fbaa3738dad..61bf3fcd8bdc31 100644 --- a/hphp/hack/CMakeLists.txt +++ b/hphp/hack/CMakeLists.txt @@ -124,7 +124,7 @@ set(CARGO_BUILD "${CMAKE_SOURCE_DIR}/hphp/hack/scripts/build_rust_to_ocaml.sh") add_custom_target( hack_ffi COMMAND - . "${CMAKE_CURRENT_BINARY_DIR}/dev_env.sh" && + . "${CMAKE_CURRENT_BINARY_DIR}/dev_env_rust_only.sh" && ${CARGO_BUILD} hack_parser_ffi rust_parser_ffi && ${CARGO_BUILD} rust_facts_ffi rust_facts_ffi && ${CARGO_BUILD} compile_ffi compile_ffi && @@ -185,6 +185,8 @@ add_dependencies(libdecl_cpp_ffi_stubs hack_ffi) set_target_properties(libdecl_cpp_ffi_stubs PROPERTIES IMPORTED_LOCATION ${LIBRUST_DECL_PATH}) configure_file(dev_env.sh.in dev_env.sh ESCAPE_QUOTES @ONLY) +configure_file(dev_env_common.sh.in dev_env_common.sh ESCAPE_QUOTES @ONLY) +configure_file(dev_env_rust_only.sh.in dev_env_rust_only.sh ESCAPE_QUOTES @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bin/hh_client DESTINATION bin diff --git a/hphp/hack/dev_env.sh.in b/hphp/hack/dev_env.sh.in index c855bf1fff7766..ef4858ac76d3e9 100644 --- a/hphp/hack/dev_env.sh.in +++ b/hphp/hack/dev_env.sh.in @@ -1,4 +1,3 @@ -#!/bin/sh # Copyright (c) 2019, Facebook, Inc. # All rights reserved. # @@ -11,24 +10,5 @@ # # source $BUILD_DIR/hphp/hack/dev_env.sh -export CMAKE_SOURCE_DIR="@CMAKE_SOURCE_DIR@" -export CMAKE_INSTALL_FULL_SYSCONFDIR="@CMAKE_INSTALL_FULL_SYSCONFDIR@" -export CMAKE_INSTALL_FULL_BINDIR="@CMAKE_INSTALL_FULL_BINDIR@" - -export HACK_NO_CARGO_VENDOR=true -export OPAMROOT="@OPAMROOT@" -export PYTHONPATH="@HPHP_HOME@" # needed for verify.py for `hack_dune_test` -export CARGO_HOME="@CMAKE_CURRENT_BINARY_DIR@/cargo_home" -export RUSTC="@RUSTC_BIN_DIR@/rustc" -export DUNE_BUILD_DIR="@DUNE_BUILD_DIR@" -export HACK_SOURCE_ROOT="@CMAKE_CURRENT_SOURCE_DIR@" -export HACK_BUILD_ROOT="@HACK_BUILD_ROOT@" -export HACK_BIN_DIR="@CMAKE_BINARY_DIR@/hphp/hack/bin" -export PATH="@RUSTC_BIN_DIR@:@CARGO_BIN_DIR@:$(dirname "@OPAM_EXECUTABLE@"):$PATH" - -export HACK_EXTRA_INCLUDE_PATHS="@extra_include_paths@" -export HACK_EXTRA_LINK_OPTS="@extra_link_opts@" -export HACK_EXTRA_LIB_PATHS="@extra_lib_paths@" -export HACK_EXTRA_NATIVE_LIBRARIES="@extra_native_libraries@" - +. "@CMAKE_CURRENT_BINARY_DIR@/dev_env_common.sh" eval $(opam env) diff --git a/hphp/hack/dev_env_common.sh.in b/hphp/hack/dev_env_common.sh.in new file mode 100644 index 00000000000000..0f702ab641d804 --- /dev/null +++ b/hphp/hack/dev_env_common.sh.in @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright (c) 2019, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the "hack" directory of this source tree. + +# Do not use this file directly - either use dev_env.sh or dev_env_rust_only.sh + +export CMAKE_SOURCE_DIR="@CMAKE_SOURCE_DIR@" +export CMAKE_INSTALL_FULL_SYSCONFDIR="@CMAKE_INSTALL_FULL_SYSCONFDIR@" +export CMAKE_INSTALL_FULL_BINDIR="@CMAKE_INSTALL_FULL_BINDIR@" + +export HACK_NO_CARGO_VENDOR=true +export OPAMROOT="@OPAMROOT@" +export PYTHONPATH="@HPHP_HOME@" # needed for verify.py for `hack_dune_test` +export CARGO_HOME="@CMAKE_CURRENT_BINARY_DIR@/cargo_home" +export RUSTC="@RUSTC_BIN_DIR@/rustc" +export DUNE_BUILD_DIR="@DUNE_BUILD_DIR@" +export HACK_SOURCE_ROOT="@CMAKE_CURRENT_SOURCE_DIR@" +export HACK_BUILD_ROOT="@HACK_BUILD_ROOT@" +export HACK_BIN_DIR="@CMAKE_BINARY_DIR@/hphp/hack/bin" +export PATH="@RUSTC_BIN_DIR@:@CARGO_BIN_DIR@:$(dirname "@OPAM_EXECUTABLE@"):$PATH" + +export HACK_EXTRA_INCLUDE_PATHS="@extra_include_paths@" +export HACK_EXTRA_LINK_OPTS="@extra_link_opts@" +export HACK_EXTRA_LIB_PATHS="@extra_lib_paths@" +export HACK_EXTRA_NATIVE_LIBRARIES="@extra_native_libraries@" diff --git a/hphp/hack/dev_env_rust_only.sh.in b/hphp/hack/dev_env_rust_only.sh.in new file mode 100644 index 00000000000000..1bc915f88eb104 --- /dev/null +++ b/hphp/hack/dev_env_rust_only.sh.in @@ -0,0 +1,14 @@ +# Copyright (c) 2019, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the "hack" directory of this source tree. + +# This file is processed by cmake; the produced file is intended for both +# internal usage by the build system, and for direct usage by people working on +# Hack itself from CMake builds: +# +# . $BUILD_DIR/hphp/hack/dev_env_rust_only.sh + +. "@CMAKE_CURRENT_BINARY_DIR@/dev_env_common.sh" +# Nothing else to do for rust :)