学习并整理windows下编译nginx的步骤

参考链接:https://blog.csdn.net/i348018533/article/details/51701865

              https://blog.csdn.net/hyhnoproblem/article/details/42365393

一、安装msys

点击左侧All Packages->msys->MSYS Base System检查右侧菜单的选中组件中是否有msys-make、msys-tar,没有选中则选中安装即可。

二、下载源码

  2.1 下载nginx源码和依赖模块

  

 2.2 下载zlib、openssl和pcre

 解压到$(NGINX_SOURCE)\objs\lib目录,这个$(NGINX_SOURCE)为nginx源码放置路径,例如:D:\nginx

2.3生成makefile

 a) 启动vs2015命令行。通过vs 2015工具命令行启动msys,能省略配置cl路径的步骤。

 b) 在上述命令行中启动msys.

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>cd /d C:\MinGW\msys\1.0  C:\MinGW\msys\1.0>msys.bat 

c) 在msys控制台窗口中,运行配置脚本。(如需要粘贴命令,可以参考下面截图方法粘贴)

这块编译某些openssl版本是会出错,需要加上

--with-openssl-opt=no-asm

2.4 编译

  还是在刚才vs 2015的命令行窗口中输入:

 编译过程中,会遇到一些问题,可以搜索谷歌来解决,谷歌上面没有答案的话,自己尝试来解决。下面列出一些问题:

  (1) 编译过程中,需要perl工具,我刚开始下载草莓perl下不下来,然后连上vpn之后就可以下载安装了。

  (2) 如果出现如下错误:

error LNK2019: 无法解析的外部符号 _OPENSSL_ia32_cpuid,该符号在函数 _OPENSSL_cpuid_setup 中被引用
原因是之前编译的临时文件没有清理的问题,因为我之前编译的时候没有添加no-asm选项,后面加上时没有清理就直接编译了,那肯定有问题。所以重新清理下再编译即可。
nmake -f ms\nt.mak clean

   (3)出现如下错误,这块将-WX去掉了

    (4). 编译pcre的时候,需要以下修改:

第一步:把config.h.generic重命名成config.h.

第二步:把pcre.h.generic重命名成pcre.h。

第三步:重命名pcre_chartables.c.dist为pcre_chartables.c。

2.5 运行nginx

 注意:在运行之前,还需要把所需要的动态库放到nginx\nginx-xxx\目录中,如libapr-1.dll、libapriconv-1.dll、libaprutil-1.dll、pcre3.dll

 a) 把objs\nginx.exe拷贝到上一级目录

 b)创建文件夹logs、temp

 c)启动nginx.exe

 

注意:在增加了add-module iwall3模块之后,编译需要去掉预编译头:

编译动态库的时候,需要去掉如下注释:

然后修改auto/make,如下图所示是需要增加的内容:

然后就可以使用nmake -f build/Makefile来编译动态库了(add-dynamic-module)

修改的auto/make和auto/cc/msvc文件如下:


# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.echo "creating $NGX_MAKEFILE"mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \$NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \$NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/modules \$NGX_OBJS/src/http/modules/perl \$NGX_OBJS/src/mail \$NGX_OBJS/src/stream \$NGX_OBJS/src/miscngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`cat << END                                                     > $NGX_MAKEFILECC =	$CC
CFLAGS = $CFLAGS
CPP =	$CPP
LINK =	$LINKENDif test -n "$NGX_PERL_CFLAGS"; thenecho NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS                   >> $NGX_MAKEFILEecho NGX_PM_CFLAGS = $NGX_PM_CFLAGS                       >> $NGX_MAKEFILEecho NGX_PM_LDFLAGS = $NGX_PM_LDFLAGS                     >> $NGX_MAKEFILE
fi# ALL_INCS, required by the addons and by OpenWatcom C precompiled headersngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS $STREAM_INCS\| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \-e "s/\//$ngx_regex_dirsep/g"`cat << END                                                    >> $NGX_MAKEFILEALL_INCS = $ngx_include_opt$ngx_incsENDngx_all_srcs="$CORE_SRCS"# the core dependencies and include pathsngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_incs=`echo $CORE_INCS $NGX_OBJS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \-e "s/\//$ngx_regex_dirsep/g"`cat << END                                                    >> $NGX_MAKEFILECORE_DEPS = $ngx_depsCORE_INCS = $ngx_include_opt$ngx_incsEND# the http dependencies and include pathsif [ $HTTP = YES ]; thenngx_all_srcs="$ngx_all_srcs $HTTP_SRCS"ngx_deps=`echo $HTTP_DEPS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_incs=`echo $HTTP_INCS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \-e "s/\//$ngx_regex_dirsep/g"`cat << END                                                >> $NGX_MAKEFILEHTTP_DEPS = $ngx_depsHTTP_INCS = $ngx_include_opt$ngx_incsENDfi# the mail dependencies and include pathsif [ $MAIL != NO ]; thenif [ $MAIL = YES ]; thenngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"fingx_deps=`echo $MAIL_DEPS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_incs=`echo $MAIL_INCS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \-e "s/\//$ngx_regex_dirsep/g"`cat << END                                                >> $NGX_MAKEFILEMAIL_DEPS = $ngx_depsMAIL_INCS = $ngx_include_opt$ngx_incsENDfi# the stream dependencies and include pathsif [ $STREAM != NO ]; thenif [ $STREAM = YES ]; thenngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"fingx_deps=`echo $STREAM_DEPS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_incs=`echo $STREAM_INCS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \-e "s/\//$ngx_regex_dirsep/g"`cat << END                                                >> $NGX_MAKEFILESTREAM_DEPS = $ngx_depsSTREAM_INCS = $ngx_include_opt$ngx_incsENDfingx_all_srcs="$ngx_all_srcs $MISC_SRCS"if test -n "$NGX_ADDON_SRCS$DYNAMIC_MODULES"; thencat << END                                                >> $NGX_MAKEFILEADDON_DEPS = \$(CORE_DEPS) $NGX_ADDON_DEPSENDfi# nginxngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`for ngx_src in $NGX_ADDON_SRCS
dongx_obj="addon/`basename \`dirname $ngx_src\``"test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_objngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \| sed -e "s/\//$ngx_regex_dirsep/g"`ngx_all_srcs="$ngx_all_srcs $ngx_obj"
donengx_all_objs=`echo $ngx_all_srcs \| sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \-e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \-e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \-e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`if test -n "$NGX_RES"; thenngx_res=$NGX_RES
elsengx_res="$NGX_RC $NGX_ICONS"ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
fingx_deps=`echo $ngx_all_objs $ngx_modules_obj $ngx_res $LINK_DEPS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_libs=
if test -n "$NGX_LD_OPT$CORE_LIBS"; thenngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
fingx_link=${CORE_LINK:+`echo $CORE_LINK \| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}ngx_main_link=${MAIN_LINK:+`echo $MAIN_LINK \| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}#\$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_linkcat << END                                                    >> $NGX_MAKEFILEbuild:	binary nginx_lib modules manpage binary:	$NGX_OBJS${ngx_dirsep}nginx$ngx_binext$NGX_OBJS${ngx_dirsep}nginx$ngx_binext:	$ngx_deps$ngx_spacer\$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main$ngx_rcc
$ngx_long_endnginx_lib: $NGX_OBJS${ngx_dirsep}nginx.lib$NGX_OBJS${ngx_dirsep}nginx.lib: $ngx_deps$ngx_spacerlib $ngx_long_start $ngx_objs /out:$NGX_OBJS${ngx_dirsep}nginx.lib 
$ngx_long_end    modules:
END# ngx_modules.cif test -n "$NGX_PCH"; thenngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
elsengx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS)"
ficat << END                                                    >> $NGX_MAKEFILE$ngx_modules_obj:	\$(CORE_DEPS)$ngx_cont$ngx_modules_c$ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUXEND# the core sourcesfor ngx_src in $CORE_SRCS
dongx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_obj=`echo $ngx_src \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`cat << END                                                >> $NGX_MAKEFILE$ngx_obj:	\$(CORE_DEPS)$ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDdone# the http sourcesif [ $HTTP = YES ]; thenif test -n "$NGX_PCH"; thenngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"elsengx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS)"ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)"fifor ngx_source in $HTTP_SRCSdongx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_obj=`echo $ngx_src \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; thencat << END                                        >> $NGX_MAKEFILE$ngx_obj:	\$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src$ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDelsecat << END                                        >> $NGX_MAKEFILE$ngx_obj:	\$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDfidonefi# the mail sourcesif [ $MAIL = YES ]; thenif test -n "$NGX_PCH"; thenngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"elsengx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(MAIL_INCS)"fifor ngx_src in $MAIL_SRCSdongx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_obj=`echo $ngx_src \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`cat << END                                            >> $NGX_MAKEFILE$ngx_obj:	\$(CORE_DEPS) \$(MAIL_DEPS)$ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDdonefi# the stream sourcesif [ $STREAM = YES ]; thenif test -n "$NGX_PCH"; thenngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"elsengx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(STREAM_INCS)"fifor ngx_src in $STREAM_SRCSdongx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_obj=`echo $ngx_src \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`cat << END                                            >> $NGX_MAKEFILE$ngx_obj:	\$(CORE_DEPS) \$(STREAM_DEPS)$ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDdonefi# the misc sourcesif test -n "$MISC_SRCS"; thenngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"for ngx_src in $MISC_SRCSdongx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_obj=`echo $ngx_src \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`cat << END                                            >> $NGX_MAKEFILE$ngx_obj:	\$(CORE_DEPS) $ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDdonefi# the addons sourcesif test -n "$NGX_ADDON_SRCS"; thenngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"for ngx_src in $NGX_ADDON_SRCSdongx_obj="addon/`basename \`dirname $ngx_src\``"ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \| sed -e "s/\//$ngx_regex_dirsep/g"`ngx_obj=`echo $ngx_obj \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`cat << END                                            >> $NGX_MAKEFILE$ngx_obj:	\$(ADDON_DEPS)$ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDdonefi# the addons config.makeif test -n "$NGX_ADDONS$DYNAMIC_ADDONS"; thenfor ngx_addon_dir in $NGX_ADDONS $DYNAMIC_ADDONSdoif test -f $ngx_addon_dir/config.make; then. $ngx_addon_dir/config.makefidone
fi# Win32 resource fileif test -n "$NGX_RES"; thenngx_res=`echo "$NGX_RES:	$NGX_RC $NGX_ICONS" \| sed -e "s/\//$ngx_regex_dirsep/g"`ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`cat << END                                                >> $NGX_MAKEFILE$ngx_res$ngx_rccENDfi# the precompiled headersif test -n "$NGX_PCH"; thenecho "#include " > $NGX_OBJS/ngx_pch.cngx_pch="src/core/ngx_config.h $OS_CONFIG $NGX_OBJS/ngx_auto_config.h"ngx_pch=`echo "$NGX_PCH:	$ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)"ngx_src="$ngx_src $ngx_objout$NGX_OBJS/ngx_pch.obj $NGX_OBJS/ngx_pch.c"ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`cat << END                                                >> $NGX_MAKEFILE$ngx_pch$ngx_srcENDfi# dynamic modulesif test -n "$NGX_PCH"; thenngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
elsengx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) \$(ALL_INCS)"ngx_perl_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(NGX_PERL_CFLAGS)"ngx_perl_cc="$ngx_perl_cc \$(ALL_INCS)"
fifor ngx_module in $DYNAMIC_MODULES
doeval ngx_module_srcs="\$${ngx_module}_SRCS"eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""eval ngx_module_modules="\$${ngx_module}_MODULES"eval ngx_module_order="\$${ngx_module}_ORDER"ngx_modules_c=$NGX_OBJS/${ngx_module}_modules.ccat << END                                    > $ngx_modules_c#include 
#include ENDfor mod in $ngx_module_modulesdoecho "extern ngx_module_t  $mod;"         >> $ngx_modules_cdoneecho                                          >> $ngx_modules_cecho 'extern ngx_module_t *ngx_modules[] = {'        >> $ngx_modules_cfor mod in $ngx_module_modulesdoecho "    &$mod,"                         >> $ngx_modules_cdonecat << END                                    >> $ngx_modules_cNULL
};
ENDecho 'extern char *ngx_module_names[] = {'           >> $ngx_modules_cfor mod in $ngx_module_modulesdoecho "    \"$mod\","                      >> $ngx_modules_cdonecat << END                                    >> $ngx_modules_cNULL
};ENDecho 'extern char *ngx_module_order[] = {'           >> $ngx_modules_cfor mod in $ngx_module_orderdoecho "    \"$mod\","                      >> $ngx_modules_cdonecat << END                                    >> $ngx_modules_cNULL
};ENDngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"`ngx_modules_obj=`echo $ngx_modules_c \| sed -e "s/\(.*\.\)c/\1$ngx_objext/"`ngx_module_objs=for ngx_src in $ngx_module_srcsdocase "$ngx_src" insrc/*)ngx_obj=$ngx_src;;*)ngx_obj="addon/`basename \`dirname $ngx_src\``"mkdir -p $NGX_OBJS/$ngx_objngx_obj="$ngx_obj/`basename $ngx_src`";;esacngx_module_objs="$ngx_module_objs $ngx_obj"donengx_module_objs=`echo $ngx_module_objs \| sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \-e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \-e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \-e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \| sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \-e "s/\//$ngx_regex_dirsep/g"`ngx_obj=$NGX_OBJS$ngx_dirsep$ngx_module$ngx_modextif [ "$NGX_PLATFORM" = win32 ]; thenngx_module_libs="$CORE_LIBS $ngx_module_libs"fingx_libs=if test -n "$NGX_LD_OPT$ngx_module_libs"; thenngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`fingx_link=${CORE_LINK:+`echo $CORE_LINK \| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}cat << END                                            >> $NGX_MAKEFILEmodules:	$ngx_obj$ngx_obj:	$ngx_deps$ngx_spacer\$(LINK) $ngx_long_start$ngx_binout$ngx_obj$ngx_long_cont$ngx_objs$ngx_module_link$ngx_libs$ngx_link$ngx_main_link
$ngx_long_end$ngx_modules_obj:	\$(CORE_DEPS)$ngx_cont$ngx_modules_c$ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUXENDfor ngx_source in $ngx_module_srcsdocase "$ngx_source" insrc/*)ngx_obj=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`;;*)ngx_obj="addon/`basename \`dirname $ngx_source\``"ngx_obj=`echo $ngx_obj/\`basename $ngx_source\` \| sed -e "s/\//$ngx_regex_dirsep/g"`;;esacngx_obj=`echo $ngx_obj \| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; thencat << END                                        >> $NGX_MAKEFILE$ngx_obj:	\$(ADDON_DEPS)$ngx_cont$ngx_src$ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDelsecat << END                                        >> $NGX_MAKEFILE$ngx_obj:	\$(ADDON_DEPS)$ngx_cont$ngx_src$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUXENDfidone
donecat << END                                                    > $NGX_OBJS/nginx.def
LIBRARYEXPORTSngx_modulesngx_module_namesngx_module_orderEND

 


# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.# MSVC 6.0 SP2                            cl 12.00
# MSVC Toolkit 2003 (7.1)                 cl 13.10
# MSVC 2005 Express Edition SP1 (8.0)     cl 14.00
# MSVC 2008 Express Edition (9.0)         cl 15.00
# MSVC 2010 (10.0)                        cl 16.00
# MSVC 2015 (14.0)                        cl 19.00NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'Compiler Version' 2>&1 \| sed -e 's/^.* Version \(.*\)/\1/'`
NGX_MSVC_VER=19
echo " + cl version: $NGX_MSVC_VER"have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/definengx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`# optimizations# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
CFLAGS="$CFLAGS -O2"# enable global optimization
#CFLAGS="$CFLAGS -Og"
# enable intrinsic functions
#CFLAGS="$CFLAGS -Oi"# disable inline expansion
#CFLAGS="$CFLAGS -Ob0"
# explicit inline expansion
#CFLAGS="$CFLAGS -Ob1"
# explicit and implicit inline expansion
#CFLAGS="$CFLAGS -Ob2"# enable frame pointer omission
#CFLAGS="$CFLAGS -Oy"
# disable stack checking calls
#CFLAGS="$CFLAGS -Gs"# pools strings as read/write
#CFLAGS="$CFLAGS -Gf"
# pools strings as read-only
#CFLAGS="$CFLAGS -GF"case $CPU inpentium)# optimize for Pentium and AthlonCPU_OPT="-G5";;pentiumpro)# optimize for Pentium Pro, Pentium II and Pentium IIICPU_OPT="-G6";;pentium4)# optimize for Pentium 4, MSVC 7CPU_OPT="-G7";;
esac# __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm
#CPU_OPT="$CPU_OPT -Gd"
# __stdcall
#CPU_OPT="$CPU_OPT -Gz"
# __fastcall
#CPU_OPT="$CPU_OPT -Gr"CFLAGS="$CFLAGS $CPU_OPT"# warningsCFLAGS="$CFLAGS -W4"# stop on warning
CFLAGS="$CFLAGS -WX"# disable logo
CFLAGS="$CFLAGS -nologo"# the link flags
CORE_LINK="$CORE_LINK -link -verbose:lib"# link with libcmt.lib, multithreaded
LIBC="-MT"
# link with msvcrt.dll
# however, MSVC Toolkit 2003 has no MSVCRT.LIB
#LIBC="-MD"CFLAGS="$CFLAGS $LIBC"CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"# Win32 GUI mode application
#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"# debug
# msvc under Wine issues
# C1902: Program database manager mismatch; please check your installation
if [ -z "$NGX_WINE" ]; thenCFLAGS="$CFLAGS -Zi"CORE_LINK="$CORE_LINK -debug"
fi# MSVC 2005 supports C99 variadic macros
if [ "$ngx_msvc_ver" -ge 14 ]; thenhave=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
fi# precompiled headers
#CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
#CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj"
#NGX_PCH="$NGX_OBJS/ngx_config.pch"
#NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch"
#NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch"# the resource file
NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
CORE_LINK="$NGX_RES $CORE_LINK"# dynamic modules
MAIN_LINK="-link -def:$NGX_OBJS/nginx.def"
MODULE_LINK="-LD $NGX_OBJS/nginx.lib"ngx_pic_opt=
ngx_objout="-Fo"
ngx_binout="-Fe"
ngx_objext="obj"
ngx_binext=".exe"ngx_long_start='@<<'
ngx_long_end='<<'
ngx_long_regex_cont=' \'
ngx_long_cont=''# MSVC understand / in path
#ngx_regex_dirsep='\\'
#ngx_dirsep="\\"

运行动态库的过程(load_module)出现了错误,目前还没解决。


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部