: # # This script checks various configure parameters and uses three files: # * autogen.input (ro) # * autogen.lastrun (rw) # * autogen.lastrun.bak (rw) # # If _no_ parmeters: # Read args from autogen.input or autogen.lastrun # Else # Backup autogen.lastrun as autogen.lastrun.bak # Write autogen.lastrun with new commandline args # # Run configure with checked args # eval 'exec perl -S $0 ${1+"$@"}' if 0; use strict; use Cwd ('cwd', 'realpath'); use File::Basename; my $src_path=dirname(realpath($0)); my $build_path=realpath(cwd()); # since this looks crazy, if you have a symlink on a path up to and including # the current directory, we need our configure to run in the realpath of that # such that compiled (realpath'd) dependency filenames match the filenames # used in our makefiles - ie. this gets dependencies right via SRC_ROOT chdir ($build_path); # more amazingly, if you don't clobber 'PWD' shells will re-assert their # old path from the environment, not cwd. $ENV{PWD} = $build_path; sub clean() { system ("rm -Rf autom4te.cache"); system ("rm -f missing install-sh mkinstalldirs libtool ltmain.sh"); print "Cleaned the build tree\n"; } my $aclocal; # check we have various vital tools sub sanity_checks($) { my $system = shift; my @path = split (':', $ENV{'PATH'}); my %required = ( 'pkg-config' => "pkg-config is required to be installed", 'autoconf' => "autoconf is required", $aclocal => "$aclocal is required", ); for my $elem (@path) { for my $app (keys %required) { if (-f "$elem/$app") { delete $required{$app}; } } } if ((keys %required) > 0) { print ("Various low-level dependencies are missing, please install them:\n"); for my $app (keys %required) { print "\t $app: " . $required{$app} . "\n"; } exit (1); } } # one argument per line sub read_args($) { my $file = shift; my $fh; my @lst; open ($fh, $file) || die "can't open file: $file"; while (<$fh>) { chomp(); s/\s+$//; # migrate from the old system if ( substr($_, 0, 1) eq "'" ) { print STDERR "Migrating options from the old autogen.lastrun format, using:\n"; my @opts; @opts = split(/'/); foreach my $opt (@opts) { if ( substr($opt, 0, 1) eq "-" ) { push @lst, $opt; print STDERR " $opt\n"; } } } elsif ( substr($_, 0, 1) eq "#" ) { # comment } elsif ( length == 0 ) { # empty line } else { push @lst, $_; } } close ($fh); # print "read args from file '$file': @lst\n"; return @lst; } sub invalid_distro($$) { my ($config, $distro) = @_; print STDERR "Can't find distro option set: $config\nThis is not necessarily a problem.\n"; print STDERR "Distros with distro option sets are:\n"; my $dirh; opendir ($dirh, "$src_path/distro-configs"); while (($_ = readdir ($dirh))) { /(.*)\.conf$/ || next; print STDERR "\t$1\n"; } closedir ($dirh); } # Avoid confusing "aclocal: error: non-option arguments are not accepted: '.../m4'." error message. die "\$src_path must not contain spaces, but it is '$src_path'." if ($src_path =~ / /); # Alloc $ACLOCAL to specify which aclocal to use $aclocal = $ENV{ACLOCAL} ? $ENV{ACLOCAL} : 'aclocal'; my $system = `uname -s`; chomp $system; sanity_checks ($system) unless($system eq 'Darwin'); my $aclocal_flags = $ENV{ACLOCAL_FLAGS}; $aclocal_flags .= " -I $src_path/m4"; $aclocal_flags .= " -I $src_path/m4/mac" if ($system eq 'Darwin'); $aclocal_flags .= " -I /opt/freeware/share/aclocal" if ($system eq 'AIX'); $ENV{AUTOMAKE_EXTRA_FLAGS} = '--warnings=no-portability' if (!($system eq 'Darwin')); if ($src_path ne $build_path) { system ("ln -sf $src_path/configure.ac configure.ac"); system ("ln -sf $src_path/g g"); my @modules = <$src_path/*/Makefile>; foreach my $module (@modules) { my $dir = basename (dirname ($module)); mkdir ($dir); system ("ln -sf $src_path/$dir/Makefile $dir/Makefile"); } my @external_modules = <$src_path/external/*/Makefile>; mkdir ("external"); system ("ln -sf $src_path/external/Module_external.mk external/"); foreach my $module (@external_modules) { my $dir = basename (dirname ($module)); mkdir ("external/$dir"); system ("ln -sf $src_path/external/$dir/Makefile external/$dir/Makefile"); } } system ("$aclocal $aclocal_flags") && die "Failed to run aclocal"; unlink ("configure"); system ("autoconf -I ${src_path}") && die "Failed to run autoconf"; die "Failed to generate the configure script" if (! -f "configure"); # Handle help arguments first, so we don't clobber autogen.lastrun for my $arg (@ARGV) { if ($arg =~ /^(--help|-h|-\?)$/) { print STDERR "autogen.sh - libreoffice configuration helper\n"; print STDERR " --clean forcibly re-generate configuration\n"; print STDERR " --best-effort don't fail on un-known configure with/enable options\n"; print STDERR "\nOther arguments passed directly to configure:\n\n"; system ("./configure --help"); exit; } } my @cmdline_args = (); my $input = "autogen.input"; my $lastrun = "autogen.lastrun"; if (!@ARGV) { if (-f $input) { if (-f $lastrun) { print STDERR < 0) { # if there's already an autogen.lastrun, make a backup first if (-e $lastrun) { open (my $fh, $lastrun) || warn "Can't open $lastrun.\n"; open (BAK, ">$lastrun.bak") || warn "Can't create backup file $lastrun.bak.\n"; while (<$fh>) { print BAK; } close (BAK) && close ($fh); } # print "Saving command-line args to $lastrun\n"; my $fh; open ($fh, ">autogen.lastrun") || die "Can't open autogen.lastrun: $!"; for my $arg (@cmdline_args) { print $fh "$arg\n"; } close ($fh); } } push @args, "--srcdir=$src_path"; push @args, "--enable-option-checking=$option_checking"; print "Running ./configure with '" . join ("' '", @args), "'\n"; system ("./configure", @args) && die "Error running configure"; } # Local Variables: # mode: perl # cperl-indent-level: 4 # tab-width: 4 # indent-tabs-mode: nil # End: # vim:set ft=perl shiftwidth=4 softtabstop=4 expandtab: # LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/registry/tools
AgeCommit message (Expand)Author
2016-02-12loplugin:unusedmethodsNoel Grandin
2016-02-04[ABI CHANGE] In SDK, replace regcompare with unoidl-checkStephan Bergmann
2016-02-04loplugin:fpcomparison in registry/Noel Grandin
2016-01-10Fix typosAndrea Gelmini
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
2015-11-06coverity#1338272 Uncaught exceptionCaolán McNamara
2015-11-06coverity#1338270 Uncaught exceptionCaolán McNamara
2015-11-06coverity#1338252 Uncaught exceptionCaolán McNamara
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
2015-10-12Replace "SAL_DELETED_FUNCTION" with "= delete" in LIBO_INTERNAL_ONLY codeStephan Bergmann
2015-07-03No need for a C API hereStephan Bergmann
2015-07-03Move module-private includes from include/registry/ to registry/Stephan Bergmann
2015-04-09convert RTReferenceType to scoped enumNoel Grandin
2015-04-09convert RTMethodMode to scoped enumNoel Grandin
2015-04-09convert RT_ACCESS fields to scoped enumNoel Grandin
2015-04-09convert RegError to scoped enumNoel Grandin
2015-04-09convert RegValueType to scoped enumNoel Grandin
2015-04-09convert REG_ constants to scoped enumNoel Grandin
2015-02-23remove unnecessary parenthesis in return statementsNoel Grandin
2015-02-07loplugin:deletedspecialStephan Bergmann
2014-11-24Bin commented-out unreachable 'break' statementsTor Lillqvist
2014-10-29remove unnecessary 'using namespace rtl' declarationsNoel Grandin
2014-05-01Many spelling fixes: directories r* - z*.Pedro Giffuni
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
2014-02-27coverity#1187666 Mixing enum typesCaolán McNamara
2014-02-17registry: sal_Bool -> boolStephan Bergmann
2014-01-28bool improvementsStephan Bergmann
2014-01-10simplifyStephan Bergmann
2013-10-31Convert indexOf->startsWith and lastIndexOf->endsWithNoel Grandin
2013-08-30WaE: size_t/sal_Int32: possible loss of dataTor Lillqvist
2013-08-21finish deprecation of O(U)String::valueOf()Luboš Luňák
2013-05-29fdo#60724 change spelling error REMOVEABLE -> REMOVABLE IIThomas Arnhold