⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 build.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 4 页
字号:
    }    return @apru_link_flags;}sub apr_config_path {    shift->apru_config_path("apr");}sub apu_config_path {    shift->apru_config_path("apu");}sub apru_config_path {    my ($self, $what) = @_;    my $key = "${what}_config_path"; # apr_config_path    my $mp_key = "MP_" . uc($what) . "_CONFIG"; # MP_APR_CONFIG    my $bindir = uc($what) . "_BINDIR"; # APR_BINDIR    return $self->{$key} if $self->{$key} and -x $self->{$key};    if (exists $self->{$mp_key} and -x $self->{$mp_key}) {        $self->{$key} = $self->{$mp_key};    }    my $config = $self->apr_generation ? "$what-1-config" : "$what-config";    if (!$self->{$key}) {        my @tries = ();        if ($self->httpd_is_source_tree) {            for my $base (grep defined $_, $self->dir) {                push @tries, grep -d $_,                    map catdir($base, "srclib", $_), qw(apr apr-util);            }            # Check for MP_AP_CONFIGURE="--with-apr[-util]=DIR|FILE"            my $what_long = ($what eq 'apu') ? 'apr-util' : 'apr';            if ($self->{MP_AP_CONFIGURE} &&                $self->{MP_AP_CONFIGURE} =~ /--with-${what_long}=(\S+)/) {                my $dir = $1;                $dir = dirname $dir if -f $dir;                push @tries, grep -d $_, $dir, catdir $dir, 'bin';            }        }        else {            push @tries, grep length,                map $self->apxs(-q => $_), $bindir, "BINDIR";            push @tries, catdir $self->{MP_AP_PREFIX}, "bin"                if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};        }        @tries = map { catfile $_, $config } @tries;        if (WIN32) {            my $ext = '.bat';            for (@tries) {                $_ .= $ext if ($_ and $_ !~ /$ext$/);            }        }        for my $try (@tries) {            next unless -x $try;            $self->{$key} = $try;        }    }    $self->{$key} ||= Apache::TestConfig::which($config);    # apr_bindir makes sense only if httpd/apr is installed, if we are    # building against the source tree we can't link against    # apr/aprutil libs    unless ($self->httpd_is_source_tree) {        $self->{apr_bindir} = $self->{$key}            ? dirname $self->{$key}            : '';        }    $self->{$key};}sub apr_includedir {    my ($self) = @_;    return $self->{apr_includedir}        if $self->{apr_includedir} and -d $self->{apr_includedir};    my $incdir;    my $apr_config_path = $self->apr_config_path;    if ($apr_config_path) {        my $httpd_version = $self->httpd_version;        chomp($incdir = `$apr_config_path --includedir`);    }    unless ($incdir and -d $incdir) {        # falling back to the default when apr header files are in the        # same location as the httpd header files        $incdir = $self->ap_includedir;    }    my @tries = ($incdir);    if ($self->httpd_is_source_tree) {        my $path = catdir $self->dir, "srclib", "apr", "include";        push @tries, $path if -d $path;    }    for (@tries) {        next unless $_ && -e catfile $_, "apr.h";        $self->{apr_includedir} = $_;        last;    }    unless ($self->{apr_includedir}) {        error "Can't find apr include/ directory,",            "use MP_APR_CONFIG=/path/to/apr-config";        exit 1;    }    $self->{apr_includedir};}#--- parsing apache *.h files ---sub mmn_eq {    my ($class, $dir) = @_;    return 1 if WIN32; #just assume, till Apache2::Build works under win32    my $instsrc;    {        local @INC = grep { !/blib/ } @INC;        my $instdir;        for (@INC) {             last if -d ($instdir = "$_/auto/Apache2/include");        }        $instsrc = $class->new(dir => $instdir);    }    my $targsrc = $class->new($dir ? (dir => $dir) : ());    my $inst_mmn = $instsrc->module_magic_number;    my $targ_mmn = $targsrc->module_magic_number;    unless ($inst_mmn && $targ_mmn) {        return 0;    }    if ($inst_mmn == $targ_mmn) {        return 1;    }    print "Installed MMN $inst_mmn does not match target $targ_mmn\n";    return 0;}sub module_magic_number {    my $self = shift;    return $self->{mmn} if $self->{mmn};    my $d = $self->ap_includedir;    return 0 unless $d;    #return $mcache{$d} if $mcache{$d};    my $fh;    for (qw(ap_mmn.h http_config.h)) {        last if open $fh, "$d/$_";    }    return 0 unless $fh;    my $n;    my $mmn_pat = join '|', qw(MODULE_MAGIC_NUMBER_MAJOR MODULE_MAGIC_NUMBER);    while(<$fh>) {        if(s/^\#define\s+($mmn_pat)\s+(\d+).*/$2/) {           chomp($n = $_);           last;       }    }    close $fh;    $self->{mmn} = $n}sub fold_dots {    my $v = shift;    $v =~ s/\.//g;    $v .= '0' if length $v < 3;    $v;}sub httpd_version_as_int {    my ($self, $dir) = @_;    my $v = $self->httpd_version($dir);    fold_dots($v);}sub httpd_version_cache {    my ($self, $dir, $v) = @_;    return '' unless $dir;    $self->{httpd_version}->{$dir} = $v if $v;    $self->{httpd_version}->{$dir};}sub httpd_version {    my ($self, $dir) = @_;    return unless $dir = $self->ap_includedir($dir);    if (my $v = $self->httpd_version_cache($dir)) {        return $v;    }    my $header = "$dir/ap_release.h";    open my $fh, $header or do {        error "Unable to open $header: $!";        return undef;    };    my $version;    while (<$fh>) {        #now taking bets on how many friggin times this will change        #over the course of apache 2.0.  1.3 changed it at least a half        #dozen times.  hopefully it'll stay in the same file at least.        if (/^\#define\s+AP_SERVER_MAJORVERSION\s+\"(\d+)\"/) {            #XXX could be more careful here.  whatever.  see above.            my $major = $1;            my $minor = (split /\s+/, scalar(<$fh>))[-1];            my $patch = (split /\s+/, scalar(<$fh>))[-1];            $version = join '.', $major, $minor, $patch;            $version =~ s/\"//g;            last;        }        elsif (/^\#define\s+AP_SERVER_BASEREVISION\s+\"(.*)\"/) {            $version = $1;            last;        }        elsif(/^\#define\s+AP_SERVER_MAJORVERSION_NUMBER\s+(\d+)/) {            # new 2.1 config            my $major = $1;            my $minor = (split /\s+/, scalar(<$fh>))[-1];            my $patch = (split /\s+/, scalar(<$fh>))[-1];            my $string = (split /\s+/, scalar(<$fh>))[-1];            $version = join '.', $major, $minor, "$patch$string";            $version =~ s/\"//g;            last;        }    }    close $fh;    debug "parsed version $version from ap_release.h";    $self->httpd_version_cache($dir, $version);}my %wanted_apr_config = map { $_, 1} qw(    HAS_THREADS HAS_DSO HAS_MMAP HAS_RANDOM HAS_SENDFILE    HAS_LARGE_FILES HAS_INLINE HAS_FORK);sub get_apr_config {    my $self = shift;    return $self->{apr_config} if $self->{apr_config};    my $header = catfile $self->apr_includedir, "apr.h";    open my $fh, $header or do {        error "Unable to open $header: $!";        return undef;    };    my %cfg;    while (<$fh>) {        next unless s/^\#define\s+APR_((HAVE|HAS|USE)_\w+)/$1/;        chomp;        my ($name, $val) = split /\s+/, $_, 2;        next unless $wanted_apr_config{$name};        $val =~ s/\s+$//;        next unless $val =~ /^\d+$/;        $cfg{$name} = $val;    }    $self->{apr_config} = \%cfg;}#--- generate Makefile ---sub canon_make_attr {    my ($self, $name) = (shift, shift);    my $attr = join '_', 'MODPERL', uc $name;    $self->{$attr} = "@_";    "$attr = $self->{$attr}\n\n";}sub xsubpp {    my $self = shift;    my $xsubpp = join ' ', '$(MODPERL_PERLPATH)',      '$(MODPERL_PRIVLIBEXP)/ExtUtils/xsubpp',        '-typemap', '$(MODPERL_PRIVLIBEXP)/ExtUtils/typemap';    my $typemap = $self->file_path('lib/typemap');    if (-e $typemap) {        $xsubpp .= join ' ',          ' -typemap', $typemap;    }    $xsubpp;}sub make_xs {    my ($self, $fh) = @_;    print $fh $self->canon_make_attr(xsubpp => $self->xsubpp);    return [] unless $self->{XS};    my @files;    my @xs_targ;    while (my ($name, $xs) = each %{ $self->{XS} }) {        #Foo/Bar.xs => Foo_Bar.c        (my $c = $xs) =~ s:.*?WrapXS/::;        $c =~ s:/:_:g;        $c =~ s:\.xs$:.c:;        push @files, $c;        push @xs_targ, <<EOF;$c: $xs\t\$(MODPERL_XSUBPP) $xs > \$*.xsc && \$(MODPERL_MV) \$*.xsc \$@EOF    }    my %o = (xs_o_files => 'o', xs_o_pic_files => 'lo');    for my $ext (qw(xs_o_files xs_o_pic_files)) {        print $fh $self->canon_make_attr($ext, map {            (my $file = $_) =~ s/c$/$o{$ext}/; $file;        } @files);    }    print $fh $self->canon_make_attr(xs_clean_files => @files);    \@xs_targ;}#when we use a bit of MakeMaker, make it use our values for these varsmy %perl_config_pm_alias = (    ABSPERL      => 'perlpath',    ABSPERLRUN   => 'perlpath',    PERL         => 'perlpath',    PERLRUN      => 'perlpath',    PERL_LIB     => 'privlibexp',    PERL_ARCHLIB => 'archlibexp',);my $mm_replace = join '|', keys %perl_config_pm_alias;# get rid of dupsmy %perl_config_pm_alias_values = reverse %perl_config_pm_alias;my @perl_config_pm_alias_values = keys %perl_config_pm_alias_values;my @perl_config_pm = (@perl_config_pm_alias_values, qw(cc cpprun    rm ranlib lib_ext obj_ext cccdlflags lddlflags optimize));sub mm_replace {    my $val = shift;    $$val =~ s/\(($mm_replace)\)/(MODPERL_\U$perl_config_pm_alias{$1})/g;}#help prevent warningsmy @mm_init_vars = (BASEEXT => '');sub make_tools {    my ($self, $fh) = @_;    for (@perl_config_pm) {        print $fh $self->canon_make_attr($_, $self->perl_config($_));    }    require ExtUtils::MakeMaker;    my $mm = bless { @mm_init_vars }, 'MM';    $mm->init_main;    $mm->init_others;    for (qw(rm_f mv ld ar cp test_f)) {        my $val = $mm->{"\U$_"};        if ($val) {            mm_replace(\$val);        }        else {            $val = $Config{$_};        }        print $fh $self->canon_make_attr($_ => $val);    }}sub export_files_MSWin32 {    my $self = shift;    my $xs_dir = $self->file_path("xs");    "-def:$xs_dir/modperl.def";}sub export_files_aix {    my $self = shift;    my $Wl = $self->ldopts_prefix;    # there are several modperl_*.exp, not just $(BASEEXT).exp    # $(BASEEXT).exp resolves to modperl_global.exp    my $xs_dir = $self->file_path("xs");    join " ", map "${Wl}-bE:$xs_dir/modperl_$_.exp", qw(inline ithreads);}sub dynamic_link_header_default {    return <<'EOF';$(MODPERL_LIBNAME).$(MODPERL_DLEXT): $(MODPERL_PIC_OBJS)	$(MODPERL_RM_F) $@	$(MODPERL_LD) $(MODPERL_LDDLFLAGS) \	$(MODPERL_AP_LIBS) \	$(MODPERL_PIC_OBJS) $(MODPERL_LDOPTS) \EOF}sub dynamic_link_default {    my $self = shift;    my $link = $self->dynamic_link_header_default . "\t" . '-o $@';    my $ranlib = "\t" . '$(MODPERL_RANLIB) $@' . "\n";    $link .= "\n" . $ranlib unless (DARWIN or OPENBSD);    $link;}sub dynamic_link_MSWin32 {    my $self = shift;    my $defs = $self->export_files_MSWin32;    my $symbols = $self->modperl_symbols_MSWin32;    return $self->dynamic_link_header_default .        "\t$defs" .        ($symbols ? ' \\' . "\n\t-pdb:$symbols" : '') .        ' -out:$@' . "\n\n";}sub dynamic_link_aix {    my $self = shift;    my $link = $self->dynamic_link_header_default .        "\t" . $self->export_files_aix . " \\\n" .        "\t" . '-o $@' . " \n" .        "\t" . '$(MODPERL_RANLIB) $@';}sub dynamic_link_cygwin {    my $self = shift;    return <<'EOF';$(MODPERL_LIBNAME).$(MODPERL_DLEXT): $(MODPERL_PIC_OBJS)	$(MODPERL_RM_F) $@	$(MODPERL_CC) -shared -o $@ \	-Wl,--out-implib=$(MODPERL_LIBNAME).dll.a \	-Wl,--export-all-symbols -Wl,--enable-auto-import \	-Wl,--enable-auto-image-base -Wl,--stack,8388608 \	$(MODPERL_PIC_OBJS) \	$(MODPERL_LDDLFLAGS) $(MODPERL_LDOPTS) \	$(MODPERL_AP_LIBS)	$(MODPERL_RANLIB) $@EOF}sub dynamic_link {    my $self = shift;    my $link = \&{"dynamic_link_$^O"};    $link = \&dynamic_link_default unless defined &$link;    $link->($self);}# Returns the link flags for the apache shared core librarymy $apache_corelib_cygwin;sub apache_corelib_cygwin {    return $apache_corelib_cygwin if $apache_corelib_cygwin;    my $self = shift;    my $mp_src = "$self->{cwd}/src/modules/perl";    my $core = 'httpd2core';    # There's a problem with user-installed perl on cygwin.    # MakeMaker doesn't know about the .dll.a libs and warns    # about missing -lhttpd2core. "Fix" it by copying    # the lib and adding .a suffix.    # For the static build create a soft link, because libhttpd2core.dll.a    # doesn't exist at this time.    if ($self->is_dynamic) {        my $libpath = $self->apxs(-q => 'exp_libdir');        File::Copy::copy("$libpath/lib$core.dll.a", "$mp_src/lib$core.a");    } else {        my $libpath = catdir($self->{MP_AP_PREFIX}, '.libs');        mkdir $libpath unless -d $libpath;        qx{touch $libpath/lib$core.dll.a && \        ln -fs $libpath/lib$core.dll.a $mp_src/lib$core.a};    }    $apache_corelib_cygwin = "-L$mp_src -l$core";}sub apache_libs_MSWin32 {    my $self = shift;    my $prefix = $self->apxs(-q => 'PREFIX') || $self->dir;    my @libs = map { "$prefix/lib/lib$_.lib" } qw(apr aprutil httpd);    "@libs";}sub apache_libs_cygwin {    my $self = shift;    join ' ', $self->apache_corelib_cygwin, $self->apru_link_flags;}sub apache_libs {    my $self = shift;    my $libs = \&{"apache_libs_$^O"};    return "" unless defined &$libs;    $libs->($self);}sub modperl_libs_MSWin32 {    my $self = shift;    "$self->{cwd}/src/modules/perl/$self->{MP_LIBNAME}.lib";}sub modperl_libs_cygwin {     my $self = shift;     return '' unless $self->is_dynamic;     return "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}";}sub modperl_libs {    my $self = shift;    my $libs = \&{"modperl_libs_$^O"};    return "" unless defined &$libs;    $libs->($self);}sub modperl_libpath_MSWin32 {    my $self = shift;    # mod_perl.lib will be installed into MP_AP_PREFIX/lib    # for use by 3rd party xs modules    "$self->{cwd}/src/modules/perl/$self->{MP_LIBNAME}.lib";}sub modperl_libpath_cygwin {    my $self = shift;    "$self->{cwd}/src/modules/perl/$self->{MP_LIBNAME}.dll.a";}sub modperl_libpath {    my $self = shift;    my $libpath = \&{"modperl_libpath_$^O"};    return "" unless defined &$libpath;    $libpath->($self);}# returns the directory and name of the aprext lib built under blib/ sub mp_apr_blib {    my $self = shift;    return unless (my $mp_apr_lib = $self->{MP_APR_LIB});    my $lib_mp_apr_lib = 'lib' . $mp_apr_lib;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -