-
- print "Writing \033[1;32m$file\033[0m ...\n";
- $tmp =~ s/\@CC\@/$config{CC}/;
- $tmp =~ s/\@MAKEPROG\@/$config{MAKEPROG}/;
- $tmp =~ s/\@FLAGS\@/$config{FLAGS}/;
- $tmp =~ s/\@DEVELOPER\@/$config{DEVELOPER}/;
- $tmp =~ s/\@LDLIBS\@/$config{LDLIBS}/;
- $tmp =~ s/\@BASE_DIR\@/$config{BASE_DIR}/;
- $tmp =~ s/\@CONFIG_DIR\@/$config{CONFIG_DIR}/;
- $tmp =~ s/\@MODULE_DIR\@/$config{MODULE_DIR}/;
- $tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
- $tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
- $tmp =~ s/\@MODULES\@/$modules/;
- $tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/;
- $tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/;
- $tmp =~ s/\@EXTRA_DIR\@/$config{EXTRA_DIR}/;
- $tmp =~ s/\@EXECUTABLE\@/$exe/;
- $tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
- $tmp =~ s/\@VERSION\@/$version/;
- $tmp =~ s/\@INSTALL_LIST\@/$install_list/;
-
- open(FILEHANDLE, ">$file");
- print FILEHANDLE $tmp;
- }
- }
- closedir(DIRHANDLE);
-
- # Make inspircd executable!
- chmod 0744, 'inspircd';
-}
-
-sub write_dynamic_modules_makefile {
- # Modules Makefile..
- print "Writing \033[1;32msrc/modules/Makefile\033[0m\n";
- open(FILEHANDLE, ">src/modules/Makefile");
-
-###
-# Module Makefile Header
-###
- print FILEHANDLE <<EOF;
-###################################################
-# Copyright 2002-2007 The InspIRCd Development Team
-# http://www.inspircd.org/wiki/index.php/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
-
-$nicerflags = $config{FLAGS};
-$nicerflags =~ s/\-pedantic//g;
-
-if ($config{OSNAME} =~ /darwin/) {
- print FILEHANDLE <<EOCHEESE;
-
-PICLDFLAGS = -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle
-LAMEFLAGS = $nicerflags
-
-EOCHEESE
-} else {
- print FILEHANDLE <<EOCHEESE;
-
-PICLDFLAGS = -fPIC -DPIC -shared \$(FLAGS)
-LAMEFLAGS = $nicerflags
-
-EOCHEESE
-}
-
- ###
- # End Module Makefile Header
- ###
-
- # Create a Modules List..
- my $modules = "";
- my $cmflags = "";
- my $liflags = "";
- my $crud = "";
-
- foreach $i (@modlist) {
- ###
- # Write Entry to the MakeFile
- ###
- $cmflags = getcompilerflags("src/modules/m_".$i.".cpp");
- $liflags = getlinkerflags("src/modules/m_".$i.".cpp");
- $deps = getdependencies("src/modules/m_".$i.".cpp");
-
- if (nopedantic("src/modules/m_".$i.".cpp"))
- {
- $fl = "\$(LAMEFLAGS)";
- }
- else
- {
- $fl = "\$(FLAGS)";
- }
-
- #print "file: $i: cmflags=$cmflags; liflags=$liflags; deps=$deps\n";
-
- print FILEHANDLE <<EOCHEESE;
-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
- \$(CC) -pipe -I../../include $fl $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
-EOCHEESE
- $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
-###
- # End Write Entry to the MakeFile
- ###
- }
-
- opendir(DIRHANDLE, "src/modules");
- foreach $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 (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
- read_module_directory("src/modules/$name", $name);
- print "Composing Makefile rules for directory \033[1;32m$name\033[0m... (\033[1;32m$mfcount files found\033[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";
- if ($config{IS_DARWIN} eq "YES") {
- print FILEHANDLE " \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup $fl $mliflags -bundle -o $name.so $mobjs\n";
- } else {
- print FILEHANDLE " \$(CC) -pipe $fl -shared $mliflags -o $name.so $mobjs\n";
- }
- print FILEHANDLE "\n$mfrules\n";
- closedir(MDIRHANDLE);
- $crud = $crud . " install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
- }