|
| 1 | +ngx_addon_name=ngx_rust_examples |
| 2 | +ngx_cargo_profile=ngx-module |
| 3 | + |
| 4 | +if [ $HTTP = YES ]; then |
| 5 | + ngx_module_type=HTTP |
| 6 | + |
| 7 | + if :; then |
| 8 | + ngx_module_name=ngx_http_async_module |
| 9 | + ngx_module_lib=async |
| 10 | + |
| 11 | + ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a |
| 12 | + ngx_module_deps=$ngx_module_lib |
| 13 | + ngx_module_libs="$ngx_module_lib -lm" |
| 14 | + |
| 15 | + # Module deps are usually added to the object file targets, but we don't have any |
| 16 | + LINK_DEPS="$LINK_DEPS $ngx_module_lib" |
| 17 | + |
| 18 | + . auto/module |
| 19 | + fi |
| 20 | + |
| 21 | + if :; then |
| 22 | + ngx_module_name=ngx_http_awssigv4_module |
| 23 | + ngx_module_lib=awssig |
| 24 | + |
| 25 | + ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a |
| 26 | + ngx_module_deps=$ngx_module_lib |
| 27 | + ngx_module_libs=$ngx_module_lib |
| 28 | + |
| 29 | + # Module deps are usually added to the object file targets, but we don't have any |
| 30 | + LINK_DEPS="$LINK_DEPS $ngx_module_lib" |
| 31 | + |
| 32 | + . auto/module |
| 33 | + fi |
| 34 | + |
| 35 | + if :; then |
| 36 | + ngx_module_name=ngx_http_curl_module |
| 37 | + ngx_module_lib=curl |
| 38 | + |
| 39 | + ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a |
| 40 | + ngx_module_deps=$ngx_module_lib |
| 41 | + ngx_module_libs=$ngx_module_lib |
| 42 | + |
| 43 | + # Module deps are usually added to the object file targets, but we don't have any |
| 44 | + LINK_DEPS="$LINK_DEPS $ngx_module_lib" |
| 45 | + |
| 46 | + . auto/module |
| 47 | + fi |
| 48 | + |
| 49 | + case "$NGX_PLATFORM" in |
| 50 | + Linux:*) |
| 51 | + ngx_module_name=ngx_http_orig_dst_module |
| 52 | + ngx_module_lib=httporigdst |
| 53 | + |
| 54 | + ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a |
| 55 | + ngx_module_deps=$ngx_module_lib |
| 56 | + ngx_module_libs=$ngx_module_lib |
| 57 | + |
| 58 | + # Module deps are usually added to the object file targets, but we don't have any |
| 59 | + LINK_DEPS="$LINK_DEPS $ngx_module_lib" |
| 60 | + |
| 61 | + . auto/module |
| 62 | + ;; |
| 63 | + esac |
| 64 | + |
| 65 | + if :; then |
| 66 | + ngx_module_name=ngx_http_upstream_custom_module |
| 67 | + ngx_module_lib=upstream |
| 68 | + |
| 69 | + ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a |
| 70 | + ngx_module_deps=$ngx_module_lib |
| 71 | + ngx_module_libs=$ngx_module_lib |
| 72 | + |
| 73 | + # Module deps are usually added to the object file targets, but we don't have any |
| 74 | + LINK_DEPS="$LINK_DEPS $ngx_module_lib" |
| 75 | + |
| 76 | + . auto/module |
| 77 | + fi |
| 78 | +fi |
| 79 | + |
| 80 | +# Write a cargo config with the $ngx_cargo_profile definition (optional) |
| 81 | + |
| 82 | +if [ "$NGX_DEBUG" = YES ]; then |
| 83 | + NGX_CARGO_PROFILE_BASE=dev |
| 84 | +else |
| 85 | + NGX_CARGO_PROFILE_BASE=release |
| 86 | +fi |
| 87 | + |
| 88 | +mkdir -p "$NGX_OBJS/.cargo" |
| 89 | +cat > "$NGX_OBJS/.cargo/config.toml" << END |
| 90 | + |
| 91 | +[profile.$ngx_cargo_profile] |
| 92 | +inherits = "$NGX_CARGO_PROFILE_BASE" |
| 93 | + |
| 94 | +END |
0 commit comments