-
Notifications
You must be signed in to change notification settings - Fork 79
Use prebuilt nginx tree if $NGX_OBJS is specified #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
df6d5ab
feat(sys): use prebuilt NGINX tree if $NGX_OBJS is specified
bavshin-f5 cfb3cf7
feat(sys): make deps required for building NGINX optional
bavshin-f5 d653666
feat(sys): generate string constants as CStr
bavshin-f5 23b2d8d
fix: test execution with external NGINX source tree
bavshin-f5 3aebcdb
feat: example of NGINX buildsystem integration
bavshin-f5 91a042b
doc: document integration with the NGINX buildsystem
bavshin-f5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
ngx_addon_name=ngx_rust_examples | ||
ngx_cargo_profile=ngx-module | ||
|
||
if [ $HTTP = YES ]; then | ||
ngx_module_type=HTTP | ||
|
||
if :; then | ||
ngx_module_name=ngx_http_async_module | ||
ngx_module_lib=async | ||
|
||
ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a | ||
ngx_module_deps=$ngx_module_lib | ||
ngx_module_libs="$ngx_module_lib -lm" | ||
|
||
# Module deps are usually added to the object file targets, but we don't have any | ||
LINK_DEPS="$LINK_DEPS $ngx_module_lib" | ||
|
||
. auto/module | ||
fi | ||
|
||
if :; then | ||
ngx_module_name=ngx_http_awssigv4_module | ||
ngx_module_lib=awssig | ||
|
||
ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a | ||
ngx_module_deps=$ngx_module_lib | ||
ngx_module_libs=$ngx_module_lib | ||
|
||
# Module deps are usually added to the object file targets, but we don't have any | ||
LINK_DEPS="$LINK_DEPS $ngx_module_lib" | ||
|
||
. auto/module | ||
fi | ||
|
||
if :; then | ||
ngx_module_name=ngx_http_curl_module | ||
ngx_module_lib=curl | ||
|
||
ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a | ||
ngx_module_deps=$ngx_module_lib | ||
ngx_module_libs=$ngx_module_lib | ||
|
||
# Module deps are usually added to the object file targets, but we don't have any | ||
LINK_DEPS="$LINK_DEPS $ngx_module_lib" | ||
|
||
. auto/module | ||
fi | ||
|
||
case "$NGX_PLATFORM" in | ||
Linux:*) | ||
ngx_module_name=ngx_http_orig_dst_module | ||
ngx_module_lib=httporigdst | ||
|
||
ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a | ||
ngx_module_deps=$ngx_module_lib | ||
ngx_module_libs=$ngx_module_lib | ||
|
||
# Module deps are usually added to the object file targets, but we don't have any | ||
LINK_DEPS="$LINK_DEPS $ngx_module_lib" | ||
|
||
. auto/module | ||
;; | ||
esac | ||
|
||
if :; then | ||
ngx_module_name=ngx_http_upstream_custom_module | ||
ngx_module_lib=upstream | ||
|
||
ngx_module_lib=$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_module_lib.a | ||
ngx_module_deps=$ngx_module_lib | ||
ngx_module_libs=$ngx_module_lib | ||
|
||
# Module deps are usually added to the object file targets, but we don't have any | ||
LINK_DEPS="$LINK_DEPS $ngx_module_lib" | ||
|
||
. auto/module | ||
fi | ||
fi | ||
|
||
# Write a cargo config with the $ngx_cargo_profile definition (optional) | ||
|
||
if [ "$NGX_DEBUG" = YES ]; then | ||
NGX_CARGO_PROFILE_BASE=dev | ||
else | ||
NGX_CARGO_PROFILE_BASE=release | ||
fi | ||
|
||
mkdir -p "$NGX_OBJS/.cargo" | ||
cat > "$NGX_OBJS/.cargo/config.toml" << END | ||
|
||
[profile.$ngx_cargo_profile] | ||
inherits = "$NGX_CARGO_PROFILE_BASE" | ||
|
||
END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
ngx_addon_name=ngx_rust_examples | ||
ngx_cargo_profile=ngx-module | ||
ngx_cargo_manifest=$(realpath $ngx_addon_dir/Cargo.toml) | ||
ngx_cargo_features= | ||
ngx_rust_examples="async awssig curl upstream" | ||
|
||
case "$NGX_PLATFORM" in | ||
Linux:*) | ||
ngx_cargo_features="$ngx_cargo_features linux" | ||
ngx_rust_examples="$ngx_rust_examples httporigdst" | ||
;; | ||
esac | ||
|
||
for ngx_rust_example in $ngx_rust_examples | ||
do | ||
|
||
cat << END >> $NGX_MAKEFILE | ||
|
||
# Always call cargo instead of tracking the source modifications | ||
.PHONY: $NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_rust_example.a | ||
|
||
$NGX_OBJS/$ngx_addon_name/$ngx_cargo_profile/examples/lib$ngx_rust_example.a: | ||
cd $NGX_OBJS && \\ | ||
NGX_OBJS="\$\$PWD" cargo rustc \\ | ||
--crate-type staticlib \\ | ||
--example "$ngx_rust_example" \\ | ||
--no-default-features \\ | ||
--features "$ngx_cargo_features" \\ | ||
--profile $ngx_cargo_profile \\ | ||
--target-dir $ngx_addon_name \\ | ||
--manifest-path $ngx_cargo_manifest | ||
|
||
END | ||
|
||
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.