diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-01 15:04:48 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-01 15:04:48 +0000 |
commit | 192fa7d3138ccb5929dc9af8de3395d6ea25619c (patch) | |
tree | 1df4e484d98db4aaa90619db6a5a39ea5226beb5 /configure | |
parent | 990e04bab51bf1c3771938b8f598272c1b31cdca (diff) |
Fix build of m_spanningtree and display of dependency regeneration
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11557 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 288 |
1 files changed, 10 insertions, 278 deletions
@@ -67,35 +67,6 @@ our @immutabledeps = ( our $install_list = ""; our $uninstall_list = ""; -# This is a list of all files in the core. Each cpp file is mapped to a shared object file, -# whos file extension is omitted (these can vary from system to system). Auto detected by -# scanning the src/*.cpp files for files containing /* $Core */ identifiers. - -our %filelist = (); - -# If you wish for a file to have special dependencies in the makefile, add an entry here. -# Auto populated by /* $ExtraDeps: */ instruction - -our %specialdeps = (); - -# If you wish for a file to have extra make lines (in between the compile and link steps) -# then insert them here. -# Auto populated by /* $ExtraBuild: */ instruction - -our %extrabuildlines = (); - -# If you wish for a file to be linked against extra objects or arctives, insert them here. -# Auto populated by /* $ExtraObjects: */ instruction - -our %extraobjects = (); - -# If you wish to compile extra cpp sources into an object, define them here. -# NOTE: Certain cpp files such as the socket engines have a value auto calculated -# for this table so that their derived class is built. -# Auto populated by /* $ExtraSources: */ instruction - -our %extrasources = (); - our ($opt_use_gnutls, $opt_rebuild, $opt_use_openssl, $opt_nointeractive, $opt_ports, $opt_epoll, $opt_kqueue, $opt_noports, $opt_noepoll, $opt_nokqueue, $opt_ipv6, $opt_ipv6links, $opt_noipv6links, $opt_maxbuf, $opt_disable_debug, @@ -1280,10 +1251,9 @@ EOF # We can actually parse any file starting with . and ending with .inc, # but right now we only parse .inspircd.inc to form './inspircd' + prepare_dynamic_makefile(); - print "Writing \e[1;32mMakefiles\e[0m\n"; - write_dynamic_modules_makefile(); - write_dynamic_makefile(); + print "Writing \e[1;32mMakefiles\e[0m\n"; opendir(DIRHANDLE, $this); @@ -1302,7 +1272,7 @@ EOF print "Writing \e[1;32m$file\e[0m ...\n"; for my $var (qw( CC FLAGS DEVELOPER LDLIBS BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR LIBRARY_DIR - STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE + STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE CORE_FLAGS )) { s/\@$var\@/$config{$var}/g; } @@ -1348,106 +1318,6 @@ EOF chmod 0744, 'inspircd'; } -sub write_dynamic_modules_makefile { - # Modules Makefile.. - print "Writing \e[1;32msrc/modules/Makefile\e[0m\n"; - open(FILEHANDLE, ">src/modules/Makefile"); - -### -# Module Makefile Header -### - print FILEHANDLE <<EOF; -################################################### -# Copyright 2002-2009 The InspIRCd Development Team -# http://wiki.inspircd.org/Credits -# -# Thanks to Andrew Church <achurch\@achurch.org> -# for assisting with making this work right. -# -# Automatically Generated by ./configure to add a -# modules please run ./configure -modupdate -################################################### - -all: \$(MODULES) - -EOF - -if ($config{OSNAME} =~ /darwin/) { - print FILEHANDLE <<EOCHEESE; - -PICLDFLAGS = -twolevel_namespace -undefined dynamic_lookup -bundle - -EOCHEESE -} else { - print FILEHANDLE <<EOCHEESE; - -PICLDFLAGS = -fPIC -DPIC -shared - -EOCHEESE -} - - ### - # End Module Makefile Header - ### - - # Create a Modules List.. - my $modules = ""; - my $cmflags = ""; - my $liflags = ""; - foreach my $i (@modlist) { - ### - # Write Entry to the MakeFile - ### - $cmflags = getcompilerflags("src/modules/m_".$i.".cpp"); - $liflags = getlinkerflags("src/modules/m_".$i.".cpp"); - my $deps = getdependencies("src/modules/m_".$i.".cpp"); - - #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n"; - - - if (nopedantic("src/modules/m_".$i.".cpp")) - { - print FILEHANDLE " -m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps - \$(RUNCC) \$(NICEFLAGS) $cmflags \$(PICLDFLAGS) $liflags $SHARED -o m_$i.so m_$i.cpp -"; - } - else - { - print FILEHANDLE " -m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps - \$(RUNCC) \$(FLAGS) $cmflags \$(PICLDFLAGS) $liflags $SHARED -o m_$i.so m_$i.cpp -"; - } - $install_list = $install_list . " install -m \$(INSTMODE) src/modules/m_$i.so \$(MODPATH)\n"; - $uninstall_list = $uninstall_list . " -rm \$(MODULES)/m_$i.so\n"; - ### - # End Write Entry to the MakeFile - ### - } - - opendir(DIRHANDLE, "src/modules"); - foreach my $name (sort readdir(DIRHANDLE)) { - if ($name =~ /^m_(.+?)$/) { - $mfrules = ""; - $mobjs = ""; - $mliflags = ""; - $mfcount = 0; - # A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/ - if (defined(opendir(MDIRHANDLE, "src/modules/$name"))) { - read_module_directory("src/modules/$name", $name); - print "Composing Makefile rules for directory \e[1;32m$name\e[0m... (\e[1;32m$mfcount files found\e[0m)\n"; - print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $mobjs\n"; - print FILEHANDLE " \$(RUNCC) \$(FLAGS) $SHARED $mliflags -o $name.so $mobjs\n"; - print FILEHANDLE "\n$mfrules\n"; - closedir(MDIRHANDLE); - $install_list = $install_list . " install -m \$(INSTMODE) src/modules/$name.so \$(MODPATH)\n"; - } - } - } - closedir(DIRHANDLE); -} - sub read_module_directory { my ($dpath, $reldpath) = @_; @@ -1513,7 +1383,7 @@ sub calcdeps($) return length($immutable) ? $immutable . " " . $retlist : $retlist; } -sub write_dynamic_makefile +sub prepare_dynamic_makefile { my $i = 0; my @cmdlist = (); @@ -1528,7 +1398,7 @@ sub write_dynamic_makefile $cmdlist[$i++] = $1; $install_list = $install_list . " -install -m \$(INSTMODE) src/commands/cmd_" . $1 . ".so \$(LIBPATH)\n"; $uninstall_list = $uninstall_list . " -rm \$(LIBPATH)/cmd_$1.so\n"; - } + } } closedir(DIRHANDLE); @@ -1545,12 +1415,9 @@ sub write_dynamic_makefile $config{USE_PORTS} = 0; } - # formerly generated below this foreach, now it's not! magic. - my $all_core = ""; - - foreach my $dir (("src","src/commands","src/modes","src/socketengines","src/modules")) + foreach my $dir ("src/modules") { - print "Scanning \e[1;32m$dir\e[0m for core files "; + print "Scanning \e[1;32m$dir\e[0m for installation files "; opendir(DIRHANDLE, $dir); foreach my $name (sort readdir(DIRHANDLE)) { @@ -1561,22 +1428,7 @@ sub write_dynamic_makefile while (defined(my $line = <CPP>)) { chomp($line); - if ($line =~ /\/\* \$Core \*\//i) - { - my $sname = $name; - $sname =~ s/\.cpp$/.o/; - - # append it to list to be built - $all_core = $all_core . $sname . " "; - $filelist{$name} = $sname; - - # mark it as a core file, so it won't get shared object cflags - if (!exists($core_files_list{$name})) - { - $core_files_list{$name} = 1; - } - } - elsif ($line =~ /\/\* \$CopyInstall: (.*?) \*\//i) + if ($line =~ /\/\* \$CopyInstall: (.*?) \*\//i) { if (!exists($existing_install_list{$1})) { @@ -1596,133 +1448,13 @@ sub write_dynamic_makefile print " done!\n"; } - # modes need to be compiled in too - $all_core = $all_core . "modes/modeclasses.a"; - - my $freebsd4libs = (defined $config{CRAQ} ? $config{CRAQ} : ""); - - my $libraryext = ""; - my $binary_rule = ""; - if ($config{IS_DARWIN} eq "YES") { - $libraryext = "dylib"; - $binary_rule = " \$(RUNCC) -dynamic -bind_at_load -L. -o inspircd \$(LDLIBS) inspircd.o " + $config{CORE_FLAGS} = '-dynamic -bind_at_load -L.'; } else { - $libraryext = "so"; - $binary_rule = " \$(RUNCC) \$(FLAGS) $freebsd4libs -rdynamic -L. -o inspircd \$(LDLIBS) "; - } - - open(FH,">src/Makefile") or die("Could not write src/Makefile"); - print FH <<'EOM'; - -CXXFLAGS = ${FLAGS} -CPPFILES = $(shell /bin/ls -l modes/ | grep '\.cpp' | sed 's/^.* //' | grep -v svn) -RELCPPFILES = $(shell /bin/ls -l modes/ | grep '\.cpp' | sed 's/^.* /modes\//' | grep -v svn) - -all: - @echo "Don't run make here! Run it in the parent directory" - false - -EOM - - my $buildstring = ""; - my $deps = ""; - - foreach my $cpp (sort keys %filelist) - { - my $objs = $cpp; - my $rawcpp = $cpp; - $objs =~ s/\.cpp$/.o/; - if (exists($extraobjects{$cpp})) - { - $objs = $objs . " " . $extraobjects{$cpp}; - $all_core = $all_core . " " . $extraobjects{$cpp}; - } - if (exists($extrasources{$cpp})) - { - $rawcpp = $rawcpp . " " . $extrasources{$cpp}; - } - - $deps = calcdeps("src/$cpp"); - if (exists($extrasources{$cpp})) - { - foreach my $seperate (sort split(' ',$extrasources{$cpp})) - { - my $d = calcdeps("src/$extrasources{$cpp}") . " "; - if ($d ne "") - { - $deps = $deps . $d . " "; - } - } - } - $buildstring = $buildstring . $objs . ": $cpp $deps ". (defined($specialdeps{$cpp}) ? $specialdeps{$cpp} : "") . "\n"; - - if (exists($core_files_list{$cpp})) - { - # core files are statically linked into the binary and do not require $SHARED shared libs switches - $buildstring = $buildstring . " \$(RUNCC) \$(FLAGS) -c $rawcpp\n"; - } - else - { - $buildstring = $buildstring . " \$(RUNCC) \$(FLAGS) $SHARED -c $rawcpp\n"; - } - - if (exists($extrabuildlines{$cpp})) - { - $buildstring = $buildstring . " " . $extrabuildlines{$cpp} . "\n"; - } - } - - print FH "inspircd: $all_core\n"; - print FH "$binary_rule $all_core\n\n"; - - print FH $buildstring; - print FH <<'EOM'; - -.PHONY: all commands - -commands: - @${MAKE} -C commands $(MAKEARGS) commands - -modes/modeclasses.a: $(RELCPPFILES) ../include/inspircd.h ../include/inspircd_config.h - @${MAKE} -C modes $(MAKEARGS) CPPFILES="$(CPPFILES)" modeclasses.a - -EOM - - # close main makefile - close(FH); - - my $cmdobjs = ""; - # generate a list of .so - foreach my $cmd (@cmdlist) { - $cmdobjs = $cmdobjs . "cmd_$cmd.so "; - } - - # and now reopen the commands makefile - open(FH,">src/commands/Makefile") or die("Could not write src/commands/Makefile"); - print FH <<ITEM; -CXXFLAGS = \${FLAGS} - -all: - \@echo "Don't run make here! Run it in the root directory" - false - -.PHONY: all commands - -commands: $cmdobjs - -ITEM - - # now print the command file detail - foreach my $cmd (@cmdlist) { - print FH <<ITEM; -cmd_$cmd.so: cmd_$cmd.cpp ../../include/base.h ../../include/modules.h ../../include/inspircd.h ../../include/channels.h ../../include/users.h ../../include/inspircd_config.h ../../include/commands/cmd_$cmd.h - \$(RUNCC) \$(FLAGS) $SHARED -o cmd_$cmd.so cmd_$cmd.cpp - -ITEM + $config{CORE_FLAGS} = (defined $config{CRAQ} ? $config{CRAQ}. ' ' : "").'-rdynamic -L.' } } |