6 if [ "$(echo "$top" | grep -c "fbcode\$
")" -ne 1 ]
8 echo "This script should be run from fbsource/fbcode."
12 DIR
=hphp
/hack
/.cargo_vendor
15 echo "Need to generate .cargo_vendor"
16 echo " Try 'hphp/hack/scripts/facebook/cargo_fetch.sh'"
17 read -r -p " Perform these steps? [y/n] " input
20 echo " Perfoming steps"
21 hphp
/hack
/scripts
/facebook
/cargo_fetch.sh
24 echo " No steps performed. Exiting."
32 cargo
="buck run fbsource//third-party/rust:cargo-cargo --"
33 cbindgen
="buck run fbsource//third-party/rust:cbindgen-cbindgen --"
35 # 'cargo update' ensures the existing Cargo.lock files contain the latest versions
38 (cd hphp
/hack
/src
/utils
/ffi
&& \
40 $cbindgen --config .
/cbindgen_ffi.toml \
42 --output "$top/hphp/hack/src/utils/ffi/ffi.h")
45 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhbc_id
&& \
47 $cbindgen --config ..
/..
/cbindgen_hhbc_id.toml \
48 --crate hhbc_by_ref_hhbc_id \
49 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_id.h")
52 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_label
&& \
54 $cbindgen --config ..
/..
/cbindgen_hhbc_label.toml \
55 --crate hhbc_by_ref_label \
56 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_label.h")
59 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_local
&& \
61 $cbindgen --config ..
/..
/cbindgen_hhbc_local.toml \
62 --crate hhbc_by_ref_local \
63 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_local.h")
66 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_runtime
&& \
68 $cbindgen --config ..
/..
/cbindgen_hhbc_runtime.toml \
69 --crate hhbc_by_ref_runtime \
70 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_runtime.h")
73 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhbc_ast
&& \
75 $cbindgen --config ..
/..
/cbindgen_hhbc_ast.toml \
76 --crate hhbc_by_ref_hhbc_ast \
77 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_ast.h")
79 # hhbc_instruction_sequence.h
80 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_instruction_sequence
&& \
82 $cbindgen --config ..
/..
/cbindgen_hhbc_instruction_sequence.toml \
83 --crate hhbc_by_ref_instruction_sequence \
84 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_instruction_sequence.h")
86 # hhbc_symbol_refs_state.h
87 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_symbol_refs_state
&& \
89 $cbindgen --config ..
/..
/cbindgen_hhbc_symbol_refs_state.toml \
90 --crate hhbc_by_ref_symbol_refs_state \
91 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_symbol_refs_state.h")
93 # hhbc_hhas_symbol_refs.h
94 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhas_symbol_refs
&& \
96 $cbindgen --config ..
/..
/cbindgen_hhbc_hhas_symbol_refs.toml \
97 --crate hhbc_by_ref_hhas_symbol_refs \
98 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_symbol_refs.h")
100 # hhbc_hhas_constant.h
101 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhas_constant
&& \
103 $cbindgen --config ..
/..
/cbindgen_hhbc_hhas_constant.toml \
104 --crate hhbc_by_ref_hhas_constant \
105 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_constant.h")
108 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhas_type
&& \
110 $cbindgen --config ..
/..
/cbindgen_hhbc_hhas_type.toml \
111 --crate hhbc_by_ref_hhas_type \
112 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_type.h")
113 # hhbc_hhas_attribute.h
114 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhas_attribute
&& \
116 $cbindgen --config ..
/..
/cbindgen_hhbc_hhas_attribute.toml \
117 --crate hhbc_by_ref_hhas_attribute \
118 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_attribute.h")
121 (cd hphp
/hack
/src
/hhbc
/hhbc_by_ref
/cargo
/hhbc_by_ref_hhas_adata
&& \
123 $cbindgen --config ..
/..
/cbindgen_hhbc_hhas_adata.toml \
124 --crate hhbc_by_ref_hhas_adata \
125 --output "$top/hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_adata.h")
127 signscript
="$top/../xplat/python/signedsource_lib/signedsource.py"
128 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/utils
/ffi
/ffi.h
129 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_id.h
130 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_label.h
131 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_local.h
132 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_runtime.h
133 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_ast.h
134 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_instruction_sequence.h
135 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_symbol_refs_state.h
136 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_hhas_symbol_refs.h
137 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_hhas_constant.h
138 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_hhas_type.h
139 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_hhas_attribute.h
140 eval "${signscript}" sign
"${top}"/hphp
/hack
/src
/hhbc
/hhbc_by_ref
/hhbc_hhas_adata.h
142 # Quick sanity check: Does a program that includes these headers compile?
144 #include "hphp/hack/src/hhbc/hhbc_by_ref/hhbc_instruction_sequence.h"
145 #include "hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_symbol_refs.h"
146 #include "hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_constant.h"
147 #include "hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_type.h"
148 #include "hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_attribute.h"
149 #include "hphp/hack/src/hhbc/hhbc_by_ref/hhbc_hhas_adata.h"
154 using namespace HPHP::hackc::hhbc::ast;
163 std::cout << "Ok!" << std::endl;
167 g
++ -std=c
++14 main.cpp
-I .
-o run
&& .
/run
168 rm -f .
/main.cpp .
/run