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

📄 build.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 4 页
字号:
    my @dirs = qw(blib arch auto);    my $apr_blib = catdir $self->{cwd}, @dirs, $lib_mp_apr_lib;    my $full_libname = $lib_mp_apr_lib . $Config{lib_ext};    return ($apr_blib, $full_libname);}sub mp_apr_lib_MSWin32 {    my $self = shift;    # The MP_APR_LIB will be installed into MP_AP_PREFIX/lib    # for use by 3rd party xs modules    my ($dir, $lib) = $self->mp_apr_blib();    $lib =~ s[^lib(\w+)$Config{lib_ext}$][$1];    $dir = Win32::GetShortPathName($dir);    return qq{ -L$dir -l$lib };}sub mp_apr_lib_cygwin {    my $self = shift;    my ($dir, $lib) = $self->mp_apr_blib();    $lib =~ s[^lib(\w+)$Config{lib_ext}$][$1];    my $libs = "-L$dir -l$lib";    # This is ugly, but is the only way to prevent the "undefined    # symbols" error    $libs .= join ' ', '',        '-L' . catdir($self->perl_config('archlibexp'), 'CORE'), '-lperl';    $libs;}# linking used for the aprext lib used to build APR/APR::*sub mp_apr_lib {    my $self = shift;    my $libs = \&{"mp_apr_lib_$^O"};    return "" unless defined &$libs;    $libs->($self);}sub modperl_symbols_MSWin32 {    my $self = shift;    return "" unless $self->{MP_DEBUG};    "$self->{cwd}/src/modules/perl/$self->{MP_LIBNAME}.pdb";}sub modperl_symbols {    my $self = shift;    my $symbols = \&{"modperl_symbols_$^O"};    return "" unless defined &$symbols;    $symbols->($self);}sub write_src_makefile {    my $self = shift;    my $code = ModPerl::Code->new;    my $path = $code->path;    my $install = <<'EOI';install:EOI    if (!$self->should_build_apache) {        $install .= <<'EOI';# install mod_perl.so	@$(MKPATH) $(DESTDIR)$(MODPERL_AP_LIBEXECDIR)	$(MODPERL_TEST_F) $(MODPERL_LIB_DSO) && \	$(MODPERL_CP) $(MODPERL_LIB_DSO) $(DESTDIR)$(MODPERL_AP_LIBEXECDIR)EOI    }    $install .= <<'EOI';# install mod_perl .h files	@$(MKPATH) $(DESTDIR)$(MODPERL_AP_INCLUDEDIR)	$(MODPERL_CP) $(MODPERL_H_FILES) $(DESTDIR)$(MODPERL_AP_INCLUDEDIR)EOI    my $mf = $self->default_file('makefile');    open my $fh, '>', $mf or die "open $mf: $!";    print $fh noedit_warning_hash();    print $fh $self->canon_make_attr('makefile', basename $mf);    $self->make_tools($fh);    print $fh $self->canon_make_attr('ap_libs', $self->apache_libs);    print $fh $self->canon_make_attr('libname', $self->{MP_LIBNAME});    print $fh $self->canon_make_attr('dlext', 'so'); #always use .so    if (AIX) {        my $xs_dir = $self->file_path("xs");        print $fh "BASEEXT = $xs_dir/modperl_global\n\n";    }    my %libs = (        dso    => "$self->{MP_LIBNAME}.$self->{MODPERL_DLEXT}",        static => "$self->{MP_LIBNAME}$self->{MODPERL_LIB_EXT}",    );    #XXX short-term compat for Apache::TestConfigPerl    $libs{shared} = $libs{dso};    while (my ($type, $lib) = each %libs) {        print $fh $self->canon_make_attr("lib_$type", $libs{$type});    }    if (my $symbols = $self->modperl_symbols) {        print $fh $self->canon_make_attr('lib_symbols', $symbols);        $install .= <<'EOI';# install mod_perl symbol file	@$(MKPATH) $(MODPERL_AP_LIBEXECDIR)	$(MODPERL_TEST_F) $(MODPERL_LIB_SYMBOLS) && \	$(MODPERL_CP) $(MODPERL_LIB_SYMBOLS) $(MODPERL_AP_LIBEXECDIR)EOI    }    if ($self->is_dynamic && (my $libs = $self->modperl_libpath)) {        print $fh $self->canon_make_attr('lib_location', $libs);        print $fh $self->canon_make_attr('ap_libdir',            $self->ap_destdir(catdir $self->{MP_AP_PREFIX}, 'lib')        );        $install .= <<'EOI';# install mod_perl.lib	@$(MKPATH) $(MODPERL_AP_LIBDIR)	$(MODPERL_TEST_F) $(MODPERL_LIB_LOCATION) && \	$(MODPERL_CP) $(MODPERL_LIB_LOCATION) $(MODPERL_AP_LIBDIR)EOI    }    my $libperl = join '/',      $self->perl_config('archlibexp'), 'CORE', $self->perl_config('libperl');    #this is only used for deps, if libperl has changed, relink mod_perl.so    #not all perl dists put libperl where it should be, so just leave this    #out if it isn't in the proper place    if (-e $libperl) {        print $fh $self->canon_make_attr('libperl', $libperl);    }    for my $method (qw(ccopts ldopts inc)) {        print $fh $self->canon_make_attr($method, $self->$method());    }    for my $method (qw(c_files o_files o_pic_files h_files)) {        print $fh $self->canon_make_attr($method, @{ $code->$method() });    }    my @libs;    for my $type (map { uc } keys %libs) {        next unless $self->{"MP_USE_$type"};        # on win32 mod_perl.lib must come after mod_perl.so        $type eq 'STATIC'            ? push    @libs, $self->{"MODPERL_LIB_$type"}            : unshift @libs, $self->{"MODPERL_LIB_$type"};    }    print $fh $self->canon_make_attr('lib', "@libs");    print $fh $self->canon_make_attr('AP_INCLUDEDIR',        $self->ap_destdir($self->install_headers_dir));    print $fh $self->canon_make_attr('AP_LIBEXECDIR',        $self->ap_destdir($self->apxs(-q => 'LIBEXECDIR')));    my $xs_targ = $self->make_xs($fh);    print $fh <<'EOF';MODPERL_CCFLAGS = $(MODPERL_INC) $(MODPERL_CCOPTS) $(MODPERL_OPTIMIZE)MODPERL_CCFLAGS_SHLIB = $(MODPERL_CCFLAGS) $(MODPERL_CCCDLFLAGS)MODPERL_OBJS = $(MODPERL_O_FILES) $(MODPERL_XS_O_FILES)MODPERL_PIC_OBJS = $(MODPERL_O_PIC_FILES) $(MODPERL_XS_O_PIC_FILES)MKPATH = $(MODPERL_PERLPATH) "-MExtUtils::Command" -e mkpathall: liblib: $(MODPERL_LIB)EOF    print $fh $install;    print $fh <<'EOF';.SUFFIXES: .xs .c $(MODPERL_OBJ_EXT) .lo .i .s.c.lo:	$(MODPERL_CC) $(MODPERL_CCFLAGS_SHLIB) \	-c $< && $(MODPERL_MV) $*$(MODPERL_OBJ_EXT) $*.lo.c$(MODPERL_OBJ_EXT):	$(MODPERL_CC) $(MODPERL_CCFLAGS) -c $<.c.i:	$(MODPERL_CPPRUN) $(MODPERL_CCFLAGS) -c $< > $*.i.c.s:	$(MODPERL_CC) -O -S $(MODPERL_CCFLAGS) -c $<.xs.c:	$(MODPERL_XSUBPP) $*.xs >$@.xs$(MODPERL_OBJ_EXT):	$(MODPERL_XSUBPP) $*.xs >$*.c	$(MODPERL_CC) $(MODPERL_CCFLAGS) -c $*.c.xs.lo:	$(MODPERL_XSUBPP) $*.xs >$*.c	$(MODPERL_CC) $(MODPERL_CCFLAGS_SHLIB) \	-c $*.c && $(MODPERL_MV) $*$(MODPERL_OBJ_EXT) $*.loclean:	$(MODPERL_RM_F) *.a *.so *.xsc \	$(MODPERL_LIBNAME).exp $(MODPERL_LIBNAME).lib \	*$(MODPERL_OBJ_EXT) *.lo *.i *.s *.pdb \	$(MODPERL_CLEAN_FILES) \	$(MODPERL_XS_CLEAN_FILES)$(MODPERL_OBJS): $(MODPERL_H_FILES) $(MODPERL_MAKEFILE)$(MODPERL_PIC_OBJS): $(MODPERL_H_FILES) $(MODPERL_MAKEFILE)$(MODPERL_LIB): $(MODPERL_LIBPERL)$(MODPERL_LIBNAME)$(MODPERL_LIB_EXT): $(MODPERL_OBJS)	$(MODPERL_RM_F) $@	$(MODPERL_AR) crv $@ $(MODPERL_OBJS)	$(MODPERL_RANLIB) $@EOF    print $fh $self->dynamic_link;    print $fh @$xs_targ;    print $fh "\n"; # Makefile must end with \n to avoid warnings    close $fh;}#--- generate MakeMaker parameter values ---sub otherldflags_default {    my $self = shift;    # e.g. aix's V:ldflags feeds -brtl and other flags    $self->perl_config('ldflags');}sub otherldflags {    my $self = shift;    my $flags = \&{"otherldflags_$^O"};    return $self->otherldflags_default unless defined &$flags;    $flags->($self);}sub otherldflags_MSWin32 {    my $self = shift;    my $flags = $self->otherldflags_default;    $flags .= ' -pdb:$(INST_ARCHAUTODIR)\$(BASEEXT).pdb' if $self->{MP_DEBUG};    $flags;}sub typemaps {    my $self = shift;    my @typemaps = ();    # XXX: could move here the code from ModPerl::BuildMM    return [] if IS_MOD_PERL_BUILD;    # for post install use    for (@INC) {        # make sure not to pick mod_perl 1.0 typemap        my $file = "$_/auto/Apache2/typemap";        push @typemaps, $file if -e $file;    }    return \@typemaps;}sub includes {    my $self = shift;    my @inc = ();    unless (IS_MOD_PERL_BUILD) {        # XXX: what if apxs is not available? win32?        my $ap_inc = $self->apxs('-q' => 'INCLUDEDIR');        if ($ap_inc && -d $ap_inc) {            push @inc, $ap_inc;            return \@inc;        }        # this is fatal        my $reason = $ap_inc            ? "path $ap_inc doesn't exist"            : "apxs -q INCLUDEDIR didn't return a value";        die "Can't find the mod_perl include dir (reason: $reason)";    }    my $os = WIN32 ? 'win32' : 'unix';    push @inc, $self->file_path("src/modules/perl", "xs");    push @inc, $self->mp_include_dir;    unless ($self->httpd_is_source_tree) {        push @inc, $self->apr_includedir;        my $apuc = $self->apu_config_path;        if ($apuc && -x $apuc) {            chomp(my $apuincs = qx($apuc --includes));            # win32: /Ipath, elsewhere -Ipath            $apuincs =~ s{^\s*(-|/)I}{};            push @inc, $apuincs;        }        my $ainc = $self->apxs('-q' => 'INCLUDEDIR');        if (-d $ainc) {            push @inc, $ainc;            return \@inc;        }    }    if ($self->{MP_AP_PREFIX}) {        my $src = $self->dir;        for ("$src/modules/perl", "$src/include",             "$src/srclib/apr/include",             "$src/srclib/apr-util/include",             "$src/os/$os")            {                push @inc, $_ if -d $_;            }    }    return \@inc;}sub inc {    my @includes = map { "-I$_" } @{ shift->includes };    "@includes";}### Picking the right LFS support flags for mod_perl, by Joe Orton ##### on Unix systems where by default off_t is a "long", a 32-bit integer,# there are two different ways to get "large file" support, i.e. the# ability to manipulate files bigger than 2Gb:## 1) you compile using -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64.  This# makes sys/types.h expose off_t as a "long long", a 64-bit integer, and# changes the size of a few other types too.  The C library headers# automatically arrange to expose a correct implementation of functions# like lseek() which take off_t parameters.## 2) you compile using -D_LARGEFILE64_SOURCE, and use what is called the# "transitional" interface.  This means that the system headers expose a# new type, "off64_t", which is a long long, but the size of off_t is not# changed.   A bunch of new functions like lseek64() are exposed by the C # library headers, which take off64_t parameters in place of off_t.## Perl built with -Duselargefiles uses approach (1).## APR HEAD uses (2) by default. APR 0.9 does not by default use either# approach, but random users can take a httpd-2.0.49 tarball, and do:##   export CPPFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"#   ./configure## to build a copy of apr/httpd which uses approach (1), though this# isn't really a supported configuration.## The problem that mod_perl has to work around is when you take a# package built with approach (1), i.e. Perl, and any package which was# *not* built with (1), i.e. APR, and want to interface between# them. [1]## So what you want to know is whether APR was built using approach (1)# or not.  APR_HAS_LARGE_FILES in HEAD just tells you whether APR was# built using approach (2) or not, which isn't useful in solving this# problem.## [1]: In some cases, it may be OK to interface between packages which# use (1) and packages which use (2).  APR HEAD is currently not such a# case, since the size of apr_ino_t is still changing when# _FILE_OFFSET_BITS is defined.## If you want to see how this matters, get some httpd function to do at# the very beginning of main():##   printf("sizeof(request_rec) = %lu, sizeof(apr_finfo_t) = %ul",#          sizeof(request_rec), sizeof(apr_finfo_t));## and then put the same printf in mod_perl somewhere, and see the# differences. This is why it is a really terribly silly idea to ever# use approach (1) in anything other than an entirely self-contained# application.## there is no conflict if both libraries either have or don't have# large files support enabledsub has_large_files_conflict {    my $self = shift;    my $apxs_flags = join $self->apxs_extra_cflags, $self->apxs_extra_cppflags;    my $apr_lfs64  = $apxs_flags      =~ /-D_FILE_OFFSET_BITS=64/;    my $perl_lfs64 = $Config{ccflags} =~ /-D_FILE_OFFSET_BITS=64/;    # XXX: we don't really deal with the case where APR was built with    # -D_FILE_OFFSET_BITS=64 but perl wasn't, since currently we strip    # only perl's ccflags, not apr's flags. the reason we don't deal    # with it is that we didn't have such a case yet, but may need to    # deal with it later    return $perl_lfs64 ^ $apr_lfs64;}# if perl is built with uselargefiles, but apr not, the build won't# work together as it uses two binary incompatible libraries, so# reduce the functionality to the greatest common denominator (C code# will have to make sure to prevent any operations that may rely on# effects created by uselargefiles, e.g. Off_t=8 instead of Off_t=4)sub strip_lfs {    my ($self, $cflags) = @_;    return $cflags unless $self->has_large_files_conflict();    my $lf = $Config{ccflags_uselargefiles}        || '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64';    $cflags =~ s/$lf//;    $cflags;}sub define {    my $self = shift;    return "";}1;__END__=head1 NAMEApache2::Build - Methods for locating and parsing bits of Apache source code=head1 SYNOPSIS use Apache2::Build (); my $build = Apache2::Build->new; # rebuild mod_perl with build opts from the previous build % cd modperl-2.0 % perl -MApache2::Build -e rebuild=head1 DESCRIPTIONThis module provides methods for locating and parsing bits of Apachesource code.Since mod_perl remembers what build options were used to build it, youcan use this knowledge to rebuild it using the same options. Simplychdir to the mod_perl source directory and run:  % cd modperl-2.0  % perl -MApache2::Build -e rebuildIf you want to rebuild not yet installed, but already built mod_perl,run from its root directory:  % perl -Ilib -MApache2::Build -e rebuild=head1 METHODS=over 4=item newCreate an object blessed into the B<Apache2::Build> class. my $build = Apache2::Build->new;=item dirTop level directory where source files are located. my $dir = $build->dir; -d $dir or die "can't stat $dir $!\n";=item findSearches for apache source directories, return a list of those found.Example: for my $dir ($build->find) {    my $yn = prompt "Configure with $dir ?", "y";    ... }=item incPrint include paths for MakeMaker's B<INC> argument toC<WriteMakefile>.Example: use ExtUtils::MakeMaker; use Apache2::Build (); WriteMakefile(     'NAME'    => 'Apache2::Module',     'VERSION' => '0.01',     'INC'     => Apache2::Build->new->inc, );=item module_magic_numberReturn the B<MODULE_MAGIC_NUMBER> defined in the apache source.Example: my $mmn = $build->module_magic_number;=item httpd_versionReturn the server version.Example: my $v = $build->httpd_version;=item otherldflagsReturn other ld flags for MakeMaker's B<dynamic_lib> argument toC<WriteMakefile>. This might be needed on systems like AIX that needspecial flags to the linker to be able to reference mod_perl or httpdsymbols.Example: use ExtUtils::MakeMaker; use Apache2::Build (); WriteMakefile(     'NAME'        => 'Apache2::Module',     'VERSION'     => '0.01',      'INC'         => Apache2::Build->new->inc,     'dynamic_lib' => {         'OTHERLDFLAGS' => Apache2::Build->new->otherldflags,     }, );=back=head1 AUTHORDoug MacEachern=cut

⌨️ 快捷键说明

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