This repository has been archived by the owner on Apr 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Support building ngx_pagespeed as a dynamic module #1115
Merged
crowell
merged 1 commit into
trunk-tracking
from
oschaaf-trunk-tracking-dynamic-modules
Feb 16, 2016
Merged
Changes from all commits
Commits
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 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 |
---|---|---|
|
@@ -193,72 +193,123 @@ ngx_feature_test=" | |
# Test whether we have pagespeed and can compile and link against it. | ||
. "$ngx_addon_dir/cpp_feature" | ||
|
||
if [ $ngx_found = yes ]; then | ||
ps_src="$ngx_addon_dir/src" | ||
ngx_addon_name=ngx_pagespeed | ||
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ | ||
$ps_src/log_message_handler.h \ | ||
$ps_src/ngx_base_fetch.h \ | ||
$ps_src/ngx_caching_headers.h \ | ||
$ps_src/ngx_event_connection.h \ | ||
$ps_src/ngx_fetch.h \ | ||
$ps_src/ngx_gzip_setter.h \ | ||
$ps_src/ngx_list_iterator.h \ | ||
$ps_src/ngx_message_handler.h \ | ||
$ps_src/ngx_pagespeed.h \ | ||
$ps_src/ngx_rewrite_driver_factory.h \ | ||
$ps_src/ngx_rewrite_options.h \ | ||
$ps_src/ngx_server_context.h \ | ||
$ps_src/ngx_url_async_fetcher.h \ | ||
$psol_binary" | ||
NGX_ADDON_SRCS="$NGX_ADDON_SRCS \ | ||
$ps_src/log_message_handler.cc \ | ||
$ps_src/ngx_base_fetch.cc \ | ||
$ps_src/ngx_caching_headers.cc \ | ||
$ps_src/ngx_event_connection.cc \ | ||
$ps_src/ngx_fetch.cc \ | ||
$ps_src/ngx_gzip_setter.cc \ | ||
$ps_src/ngx_list_iterator.cc \ | ||
$ps_src/ngx_message_handler.cc \ | ||
$ps_src/ngx_pagespeed.cc \ | ||
$ps_src/ngx_rewrite_driver_factory.cc \ | ||
$ps_src/ngx_rewrite_options.cc \ | ||
$ps_src/ngx_server_context.cc \ | ||
$ps_src/ngx_url_async_fetcher.cc" | ||
# Save our sources in a separate var since we may need it in config.make | ||
PS_NGX_SRCS="$NGX_ADDON_SRCS" | ||
if [ $ngx_found = no ]; then | ||
cat << END | ||
$0: error: module ngx_pagespeed requires the pagespeed optimization library. | ||
Look in obj/autoconf.err for more details. | ||
END | ||
exit 1 | ||
fi | ||
|
||
if [ "$position_aux" = "true" ] ; then | ||
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" | ||
else | ||
# Make pagespeed run immediately before gzip and Brotli. | ||
if echo $HTTP_FILTER_MODULES | grep ngx_http_brotli_filter_module >/dev/null; then | ||
module=ngx_http_brotli_filter_module | ||
elif [ $HTTP_GZIP = YES ]; then | ||
module=ngx_http_gzip_filter_module | ||
ps_src="$ngx_addon_dir/src" | ||
ngx_addon_name=ngx_pagespeed | ||
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \ | ||
$ps_src/log_message_handler.h \ | ||
$ps_src/ngx_base_fetch.h \ | ||
$ps_src/ngx_caching_headers.h \ | ||
$ps_src/ngx_event_connection.h \ | ||
$ps_src/ngx_fetch.h \ | ||
$ps_src/ngx_gzip_setter.h \ | ||
$ps_src/ngx_list_iterator.h \ | ||
$ps_src/ngx_message_handler.h \ | ||
$ps_src/ngx_pagespeed.h \ | ||
$ps_src/ngx_rewrite_driver_factory.h \ | ||
$ps_src/ngx_rewrite_options.h \ | ||
$ps_src/ngx_server_context.h \ | ||
$ps_src/ngx_url_async_fetcher.h \ | ||
$psol_binary" | ||
NPS_SRCS=" \ | ||
$ps_src/log_message_handler.cc \ | ||
$ps_src/ngx_base_fetch.cc \ | ||
$ps_src/ngx_caching_headers.cc \ | ||
$ps_src/ngx_event_connection.cc \ | ||
$ps_src/ngx_fetch.cc \ | ||
$ps_src/ngx_gzip_setter.cc \ | ||
$ps_src/ngx_list_iterator.cc \ | ||
$ps_src/ngx_message_handler.cc \ | ||
$ps_src/ngx_pagespeed.cc \ | ||
$ps_src/ngx_rewrite_driver_factory.cc \ | ||
$ps_src/ngx_rewrite_options.cc \ | ||
$ps_src/ngx_server_context.cc \ | ||
$ps_src/ngx_url_async_fetcher.cc" | ||
# Save our sources in a separate var since we may need it in config.make | ||
PS_NGX_SRCS="$NGX_ADDON_SRCS \ | ||
$NPS_SRCS" | ||
|
||
# Make pagespeed run immediately before gzip and Brotli. | ||
if echo $HTTP_FILTER_MODULES | grep ngx_http_brotli_filter_module >/dev/null; then | ||
next=ngx_http_brotli_filter_module | ||
elif [ $HTTP_GZIP = YES ]; then | ||
next=ngx_http_gzip_filter_module | ||
else | ||
next=ngx_http_range_header_filter_module | ||
fi | ||
|
||
if [ -n "$ngx_module_link" ]; then | ||
# nginx-1.9.11+ | ||
ngx_module_type=HTTP_FILTER | ||
ngx_module_name="ngx_pagespeed ngx_pagespeed_etag_filter" | ||
ngx_module_incs="$ngx_feature_path" | ||
ngx_module_deps= | ||
ngx_module_srcs="$NPS_SRCS" | ||
ngx_module_libs="$ngx_feature_libs" | ||
ngx_module_order="ngx_http_range_header_filter_module\ | ||
ngx_pagespeed_etag_filter\ | ||
ngx_http_gzip_filter_module \ | ||
ngx_http_brotli_filter_module \ | ||
ngx_pagespeed \ | ||
ngx_http_postpone_filter_module \ | ||
ngx_http_ssi_filter_module \ | ||
ngx_http_charset_filter_module \ | ||
ngx_http_xslt_filter_module \ | ||
ngx_http_image_filter_module \ | ||
ngx_http_sub_filter_module \ | ||
ngx_http_addition_filter_module \ | ||
ngx_http_gunzip_filter_module \ | ||
ngx_http_userid_filter_module \ | ||
ngx_http_headers_filter_module" | ||
|
||
. auto/module | ||
|
||
if [ $ngx_module_link != DYNAMIC ]; then | ||
# ngx_module_order doesn't work with static modules, | ||
# so we must re-order filters here. | ||
if [ "$position_aux" = "true" ] ; then | ||
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" | ||
else | ||
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES \ | ||
| sed "s/ngx_pagespeed//" \ | ||
| sed "s/$next/$next ngx_pagespeed/") | ||
fi | ||
# Make the etag header filter run immediately before range header filter. | ||
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES \ | ||
| sed "s/ngx_pagespeed_etag_filter//" \ | ||
| sed "s/ngx_http_range_header_filter_module/ngx_http_range_header_filter_module ngx_pagespeed_etag_filter/") | ||
else | ||
module=ngx_http_range_header_filter_module | ||
# config.make is not executed for dynamic modules | ||
CFLAGS="$CFLAGS -Wno-c++11-extensions" | ||
if [ "$position_aux" = "true" ] ; then | ||
ngx_module_type=HTTP_AUX_FILTER | ||
ngx_module_order="" | ||
fi | ||
fi | ||
|
||
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES |\ | ||
sed "s/$module/$module $ngx_addon_name/") | ||
else | ||
CORE_LIBS="$CORE_LIBS $pagespeed_libs" | ||
CORE_INCS="$CORE_INCS $pagespeed_include" | ||
NGX_ADDON_SRCS="$PS_NGX_SRCS" | ||
if [ "$position_aux" = "true" ] ; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feature is ignored in nginx-1.9.11+ code path, is that desirable behavior? Also, I'm not clear on what this is supposed to achieve in the first place... |
||
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" | ||
else | ||
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES | sed "s/$next/$next $ngx_addon_name/") | ||
fi | ||
|
||
# Make the etag header filter run immediately before range header filter. | ||
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES |\ | ||
sed "s/ngx_http_range_header_filter_module/ngx_http_range_header_filter_module ngx_pagespeed_etag_filter/") | ||
|
||
CORE_LIBS="$CORE_LIBS $pagespeed_libs" | ||
CORE_INCS="$CORE_INCS $pagespeed_include" | ||
echo "List of modules (in reverse order of applicability): "$HTTP_FILTER_MODULES | ||
else | ||
cat << END | ||
$0: error: module ngx_pagespeed requires the pagespeed optimization library. | ||
Look in obj/autoconf.err for more details. | ||
END | ||
exit 1 | ||
fi | ||
|
||
echo "List of modules (in reverse order of applicability): "$HTTP_FILTER_MODULES | ||
|
||
# Test whether the compiler is compatible | ||
ngx_feature="psol-compiler-compat" | ||
ngx_feature_name="" | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PiotrSikora config.make is not executed for dynamic modules, see https://github.com/nginx/nginx/blob/master/auto/make#L436
So this is the best I can come up with to allow us to build ngx_pagespeed.so with clang