@@ -105,12 +105,19 @@ my $prefix = '/usr/local/openresty';
105105my %resty_opts ;
106106my $dry_run ;
107107my @ngx_rpaths ;
108+ my $cc ;
108109
109110my (@ngx_opts , @ngx_cc_opts , @ngx_ld_opts );
110111
111112for my $opt (@ARGV ) {
112113 next unless defined $opt ;
113114
115+ if ($opt =~ / ^--with-cc=(.+)/ ) {
116+ $cc = $1 ;
117+ push @ngx_opts , $opt ;
118+ next ;
119+ }
120+
114121 if ($opt eq ' --dry-run' ) {
115122 $dry_run = 1;
116123 next ;
@@ -317,14 +324,21 @@ sub build_resty_opts {
317324
318325 cd $luajit_src ;
319326
320- shell " make PREFIX=$luajit_prefix " , $dry_run ;
321- shell " make install PREFIX=$luajit_prefix DESTDIR=$luajit_root " , $dry_run ;
327+ my $extra_opts = ' ' ;
328+
329+ if (defined $cc ) {
330+ $extra_opts .= " CC=$cc " ;
331+ }
332+
333+ shell " make$extra_opts PREFIX=$luajit_prefix " , $dry_run ;
334+
335+ shell " make install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root " , $dry_run ;
322336
323337 push @make_cmds , " cd build/$luajit_src && "
324- . " \$ (MAKE) PREFIX=$luajit_prefix " ;
338+ . " \$ (MAKE)$extra_opts PREFIX=$luajit_prefix " ;
325339
326340 push @make_install_cmds , " cd build/$luajit_src && "
327- . " \$ (MAKE) install PREFIX=$luajit_prefix DESTDIR=\$ (DESTDIR)" ;
341+ . " \$ (MAKE) install$extra_opts PREFIX=$luajit_prefix DESTDIR=\$ (DESTDIR)" ;
328342
329343 env LUAJIT_LIB => " $luajit_root$luajit_prefix /lib" ;
330344 env LUAJIT_INC => " $luajit_root$luajit_prefix /include/luajit-2.0" ;
@@ -354,16 +368,21 @@ sub build_resty_opts {
354368
355369 cd $lua_src ;
356370
357- shell " make $platform " , $dry_run ;
358- shell " make install INSTALL_TOP=$lua_root$lua_prefix " , $dry_run ;
371+ my $extra_opts = ' ' ;
372+ if (defined $cc ) {
373+ $extra_opts .= " CC=$cc " ;
374+ }
375+
376+ shell " make$extra_opts $platform " , $dry_run ;
377+ shell " make install$extra_opts INSTALL_TOP=$lua_root$lua_prefix " , $dry_run ;
359378
360379 env LUA_LIB => " $lua_root$lua_prefix /lib" ;
361380 env LUA_INC => " $lua_root$lua_prefix /include" ;
362381
363- push @make_cmds , " cd build/$lua_src && \$ (MAKE) $platform " ;
382+ push @make_cmds , " cd build/$lua_src && \$ (MAKE)$extra_opts $platform " ;
364383
365384 push @make_install_cmds , " cd build/$lua_src && "
366- . " \$ (MAKE) install INSTALL_TOP=\$ (DESTDIR)$lua_prefix " ;
385+ . " \$ (MAKE) install$extra_opts INSTALL_TOP=\$ (DESTDIR)$lua_prefix " ;
367386
368387 cd ' ..' ;
369388 }
0 commit comments