Root/
| Source at commit c0eb1e1eb8e83a9a17715239bb06cb343c0df4f2 created 3 years 3 months ago. By Luciano M. F. Rocha, MyConfig.pm: misc fixes for new cpan version; make it smarter | |
|---|---|
| 1 | ## vim: ts=2 sw=2 et |
| 2 | |
| 3 | ## if normal user, use prefix = $HOME/opt/`arch`/perl |
| 4 | my ($makepl_arg, $mbuildpl_arg) = ('', ''); |
| 5 | |
| 6 | my $home = $ENV{HOME} || (getpwuid($<))[7] || "/"; |
| 7 | |
| 8 | if ($home && $<) { |
| 9 | my $uname; |
| 10 | |
| 11 | for my $o (qw(-m -i -p)) { |
| 12 | $uname = `uname $o 2>/dev/null`; |
| 13 | last if $uname && $uname !~ /unknown/; |
| 14 | } |
| 15 | chomp $uname; |
| 16 | |
| 17 | ## some archs have different names depending on CPU or OS, use a common name |
| 18 | if ($uname =~ /i[3456]86/) { |
| 19 | $uname = "i386"; |
| 20 | } elsif ($uname =~ /ower.*64/ || $uname =~ /ppc.*64/) { |
| 21 | $uname = "ppc64"; |
| 22 | } elsif ($uname =~ /ower/ || $uname =~ /ppc/) { |
| 23 | $uname = "ppc"; |
| 24 | } |
| 25 | |
| 26 | my $prefix = "$home/opt/$uname/perl"; |
| 27 | $makepl_arg = "PREFIX=$prefix"; |
| 28 | $mbuildpl_arg = "--install_base $prefix"; |
| 29 | } |
| 30 | |
| 31 | ## don't require full path for system utilities |
| 32 | ## default path: |
| 33 | my $def_path = q[/usr/local/bin:/usr/bin:/bin]; |
| 34 | my @path = split(/:/, $ENV{PATH} || $def_path); |
| 35 | |
| 36 | sub findexec |
| 37 | { |
| 38 | for my $c (@_) { |
| 39 | next unless $c; |
| 40 | for my $p (@path) { |
| 41 | my $pc = "$p/$c"; |
| 42 | return $pc if -x $pc; |
| 43 | } |
| 44 | } |
| 45 | ""; |
| 46 | } |
| 47 | |
| 48 | $CPAN::Config = { |
| 49 | 'applypatch' => q[], |
| 50 | 'auto_commit' => q[0], |
| 51 | 'build_cache' => q[100], |
| 52 | ## build sources under /tmp, path depends on uid |
| 53 | 'build_dir' => "/tmp/build.cpan.$</b", |
| 54 | 'build_dir_reuse' => q[1], |
| 55 | 'build_requires_install_policy' => q[ask/yes], |
| 56 | 'bzip2' => findexec('bzip2'), |
| 57 | 'cache_metadata' => q[1], |
| 58 | 'check_sigs' => q[0], |
| 59 | 'commandnumber_in_prompt' => q[1], |
| 60 | 'cpan_home' => "$home/.cpan", |
| 61 | 'curl' => findexec('curl'), |
| 62 | 'ftp' => findexec('ftp'), |
| 63 | 'ftp_passive' => q[1], |
| 64 | 'ftp_proxy' => q[], |
| 65 | 'getcwd' => q[cwd], |
| 66 | 'gpg' => findexec('gpg'), |
| 67 | 'gzip' => findexec('gzip'), |
| 68 | 'histfile' => "$home/.cpan/histfile", |
| 69 | 'histsize' => q[100], |
| 70 | 'http_proxy' => q[], |
| 71 | 'inactivity_timeout' => q[0], |
| 72 | 'index_expire' => q[1], |
| 73 | 'inhibit_startup_message' => q[0], |
| 74 | ## sources go under /tmp, path depends on uid |
| 75 | 'keep_source_where' => "/tmp/build.cpan.$</s", |
| 76 | 'links' => findexec(qw(links elinks)), |
| 77 | 'load_module_verbosity' => q[v], |
| 78 | 'make' => findexec('make'), |
| 79 | 'make_arg' => q[], |
| 80 | 'make_install_arg' => q[], |
| 81 | 'make_install_make_command' => findexec('make'), |
| 82 | 'makepl_arg' => $makepl_arg, |
| 83 | 'mbuild_arg' => q[], |
| 84 | 'mbuild_install_arg' => q[], |
| 85 | 'mbuild_install_build_command' => q[./Build], |
| 86 | 'mbuildpl_arg' => $mbuildpl_arg, |
| 87 | 'ncftp' => findexec(qw(lftp ncftp)), |
| 88 | 'ncftpget' => findexec(qw(lftpget ncftpget)), |
| 89 | 'no_proxy' => q[], |
| 90 | 'pager' => findexec($ENV{PAGER}, qw(less more)), |
| 91 | 'patch' => findexec('patch'), |
| 92 | 'prefer_installer' => q[MB], |
| 93 | 'prefs_dir' => "$home/.cpan/prefs", |
| 94 | 'prerequisites_policy' => q[ask], |
| 95 | 'scan_cache' => q[atstart], |
| 96 | 'shell' => findexec(qw(bash sh)), |
| 97 | 'show_unparsable_versions' => q[0], |
| 98 | 'show_upload_date' => q[0], |
| 99 | 'show_zero_versions' => q[0], |
| 100 | 'tar' => findexec('tar'), |
| 101 | 'tar_verbosity' => q[v], |
| 102 | 'term_is_latin' => q[0], |
| 103 | 'term_ornaments' => q[1], |
| 104 | 'test_report' => q[0], |
| 105 | 'unzip' => findexec('unzip'), |
| 106 | 'urllist' => [q[http://cpan.perl.pt/], q[http://perl.di.uminho.pt/cpan/], |
| 107 | q[http://www.perl.org/CPAN/]], |
| 108 | 'use_sqlite' => q[0], |
| 109 | 'wget' => findexec('wget'), |
| 110 | 'yaml_load_code' => q[0], |
| 111 | 'yaml_module' => q[YAML], |
| 112 | }; |
| 113 | 1; |
| 114 | __END__ |
| 115 | |
