use make::gnutlscert;
use make::opensslcert;
- my %filelist = (
- "channels.cpp" => "libIRCDchannels",
- "mode.cpp" => "libIRCDmode",
- "xline.cpp" => "libIRCDxline",
- "inspstring.cpp"=> "libIRCDstring",
- "dns.cpp" => "libIRCDasyncdns",
- "base.cpp" => "libIRCDbase",
- "configreader.cpp"=> "libIRCDconfigreader",
- "inspsocket.cpp"=> "libIRCDinspsocket",
- "commands.cpp" => "libIRCDcommands",
- "dynamic.cpp" => "libIRCDdynamic",
- "users.cpp" => "libIRCDusers",
- "modules.cpp" => "libIRCDmodules",
- "wildcard.cpp" => "libIRCDwildcard",
- "helperfuncs.cpp"=> "libIRCDhelper",
- "hashcomp.cpp" => "libIRCDhash",
- "socket.cpp" => "libIRCDsocket",
- "socketengine.cpp"=> "libIRCDsocketengine",
- "userprocess.cpp"=> "libIRCDuserprocess",
- "cull_list.cpp"=> "libIRCDcull_list",
- "command_parse.cpp"=> "libIRCDcommand_parse",
- "timer.cpp" => "libIRCDtimer",
- "snomasks.cpp" => "libIRCDsnomasks",
- "server.cpp" => "libIRCDserver",
- "filelogger.cpp"=> "libIRCDfilelogger",
- "user_resolver.cpp"=> "libIRCDuserresolver",
- );
-
- my %specialdeps = (
- "mode.cpp" => "\$(RELCPPFILES)",
- );
-
- my %extrabuildlines = (
- "mode.cpp" => "\${MAKE} -C \"modes\" DIRNAME=\"src/modes\" CC=\"\$(CC)\" \$(MAKEARGS) CPPFILES=\"\$(CPPFILES)\"",
- );
+###############################################################################################
+#
+# EDITABLE VARIABLES
+#
+###############################################################################################
+
+# If you wish to ignore a dependency throughout the entire core, add it here.
+
+my @ignoredeps = (
+ "inspircd_win32wrapper.h", # windows has its own configure program
+);
+
+# If you wish for all files in the entire core to have a given dependency, insert it here.
+# You should keep this to an absolute minimum to avoid rebuilds that are not neccessary.
+
+my @immutabledeps = (
+ "inspircd_config.h", # auto re-generated by configure
+ "inspircd.h",
+);
+
+###############################################################################################
+#
+# NON-EDITABLE VARIABLES
+#
+###############################################################################################
+
+# List of commands that make up 'make install'
+
+my $install_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.
- my %extraobjects = (
- "mode.cpp" => "modes/modeclasses.a"
- );
+my %filelist = ();
- my %extrasources = (
- );
+# If you wish for a file to have special dependencies in the makefile, add an entry here.
+# Auto populated by /* $ExtraDeps: */ instruction
- my @ignoredeps = (
- "inspircd_win32wrapper.h",
- );
+my %specialdeps = ();
- my @immutabledeps = (
- "inspircd_config.h",
- );
+# 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
+
+my %extrabuildlines = ();
+
+# If you wish for a file to be linked against extra objects or arctives, insert them here.
+# Auto populated by /* $ExtraObjects: */ instruction
+
+my %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
+
+my %extrasources = ();
GetOptions (
chomp($config{GCCVER} = `g++ -dumpversion | cut -c 1`); # Major GCC Version
$config{_SOMAXCONN} = SOMAXCONN; # Max connections in accept queue
$config{OSNAME} = $^O; # Operating System Name
-$config{IS_DARWIN} = "NO"; # Is OSX?
-$config{STARTSCRIPT} = "inspircd"; # start script?
-$config{DESTINATION} = "BASE"; # Is target path.
-$config{EXTRA_DIR} = ""; # Is empty.
+$config{IS_DARWIN} = "NO"; # Is OSX?
+$config{STARTSCRIPT} = "inspircd"; # start script?
+$config{DESTINATION} = "BASE"; # Is target path.
+$config{EXTRA_DIR} = ""; # Is empty.
if ($config{OSNAME} =~ /darwin/i)
{
$config{IS_DARWIN} = "YES";
- $config{STARTSCRIPT} = "org.inspircd.plist"; # start script for OSX.
- $config{DESTINATION} = "LAUNCHDPATH"; # Is OSX target.
- $config{EXTRA_DIR} = " launchd_dir"; # Is OSX specific path.
+ $config{STARTSCRIPT} = "org.inspircd.plist"; # start script for OSX.
+ $config{DESTINATION} = "LAUNCHDPATH"; # Is OSX target.
+ $config{EXTRA_DIR} = " launchd_dir"; # Is OSX specific path.
}
$config{CC} = "g++"; # C++ compiler
if (defined $opt_cc)
print "SSL Certificates Not found, Generating.. \n\n
*************************************************************
* Generating the certificates may take some time, go grab a *
-* coffee, or something. *
+* coffee, or something. *
*************************************************************\n\n";
make_openssl_cert();
print "\nCertificate generation complete, copying to config directory... ";
my $file = "";
my $exe = "inspircd";
- opendir(DIRHANDLE, $this);
-
# Do this once here, and cache it in the .*.inc files,
# rather than attempting to read src/version.sh from
# compiled code -- we might not have the source to hand.
chomp(my $revision = getrevision());
$version = "$version(r$revision)";
- my $LIBEXT = "so";
- if ($config{IS_DARWIN} eq "YES")
- {
- $LIBEXT = "dylib";
- }
# We can actually parse any file starting with . and ending with .inc,
# but right now we only parse .inspircd.inc to form './inspircd'
+ print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
+ write_dynamic_makefile();
+ write_dynamic_modules_makefile();
+
+ opendir(DIRHANDLE, $this);
+
foreach $name (sort readdir(DIRHANDLE)) {
if ($name =~ /^\.(.+)\.inc$/) {
$file = $1;
# All .name.inc files need parsing!
$tmp = "";
- open(FILEHANDLE, ".$file.inc");
+ open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc");
while (<FILEHANDLE>) {
$tmp .= $_;
}
close(FILEHANDLE);
+ 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/\@MODULE_DIR\@/$config{MODULE_DIR}/;
$tmp =~ s/\@BINARY_DIR\@/$config{BINARY_DIR}/;
$tmp =~ s/\@LIBRARY_DIR\@/$config{LIBRARY_DIR}/;
- $tmp =~ s/\@LIBRARY_EXT\@/$LIBEXT/;
$tmp =~ s/\@MODULES\@/$modules/;
$tmp =~ s/\@STARTSCRIPT\@/$config{STARTSCRIPT}/;
$tmp =~ s/\@DESTINATION\@/$config{DESTINATION}/;
$tmp =~ s/\@EXECUTABLE\@/$exe/;
$tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
$tmp =~ s/\@VERSION\@/$version/;
+ $tmp =~ s/\@INSTALL_LIST\@/$install_list/;
- print "Writing \033[1;32m$file\033[0m\n";
open(FILEHANDLE, ">$file");
print FILEHANDLE $tmp;
}
# Make inspircd executable!
chmod 0744, 'inspircd';
-
- print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
- write_dynamic_makefile();
- write_dynamic_modules_makefile();
}
sub write_dynamic_modules_makefile {
$dupe{$d} = 1;
}
- my $immutable = "";
+ my $immutable = "";
foreach my $dep (@immutabledeps)
{
$immutable = $immutable . "../include/$dep ";
return length($immutable) ? $immutable . " " . $retlist : $retlist;
}
-sub write_dynamic_makefile {
-
+sub write_dynamic_makefile
+{
my $i = 0;
my @cmdlist = ();
opendir(DIRHANDLE, "src/commands");
- foreach $name (sort readdir(DIRHANDLE)) {
- if ($name =~ /^cmd_(.+)\.cpp$/) {
+ foreach $name (sort readdir(DIRHANDLE))
+ {
+ if ($name =~ /^cmd_(.+)\.cpp$/)
+ {
$cmdlist[$i++] = $1;
+ $install_list = $install_list . " -install -m \$(INSTMODE) src/commands/cmd_" . $name . ".so \$(LIBPATH)\n";
}
}
closedir(DIRHANDLE);
- $se = "socketengine_select";
- if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
- $se = "socketengine_kqueue";
+ if (!$has_epoll)
+ {
+ $config{USE_EPOLL} = 0;
}
- elsif (($has_epoll) && ($config{USE_EPOLL} eq "y")) {
- $se = "socketengine_epoll";
+ if (!$has_kqueue)
+ {
+ $config{USE_KQUEUE} = 0;
}
- elsif (($has_ports) && ($config{USE_PORTS} eq "y")) {
- $se = "socketengine_ports";
+ if (!$has_ports)
+ {
+ $config{USE_PORTS} = 0;
}
- $extrasources{"socketengine.cpp"} = $se . ".cpp";
- $extraobjects{"socketengine.cpp"} = $se . ".o";
+ print "Scanning src folder for core files";
+ opendir(DIRHANDLE, "src");
+ foreach $name (sort readdir(DIRHANDLE))
+ {
+ if ($name =~ /\.cpp$/)
+ {
+ open (CPP, "<src/$name") or die("Can't open src/$name to scan it! oh bugger");
+ while (chomp($line = <CPP>))
+ {
+ if ($line =~ /\/\* \$Core: (\w+) \*\//i)
+ {
+ $filelist{$name} = $1;
+ print ".";
+ }
+ elsif ($line =~ /\/\* \$ExtraDeps: (.*?) \*\//i)
+ {
+ $specialdeps{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$ExtraObjects: (.*?) \*\//i)
+ {
+ $extraobjects{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$ExtraBuild: (.*?) \*\//i)
+ {
+ $extrabuildlines{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$ExtraSources: (.*?) \*\//i)
+ {
+ $extrasources{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$If: (\w+) \*\//i)
+ {
+ if (($config{$1} !~ /y/i) and ($config{$1} ne "1"))
+ {
+ # Skip to 'endif'
+ while (chomp($line = <CPP>))
+ {
+ die ("\$If buildsystem instruction within another \$If in file src/$name") if ($line =~ /\/\* \$If: (\w+) \*\//i);
+ last if ($line =~ /\/\* \$EndIf \*\//i);
+ }
+ }
+ }
+ }
+ close CPP;
+ }
+ }
+ closedir(DIRHANDLE);
+ print " done!\n";
$freebsd4libs = $config{CRAQ};
{
$all = $all . $filelist{$cpp} . "." . $libraryext . " ";
$all_libsonly = $all_libsonly . $filelist{$cpp} . "." . $libraryext . " ";
+ $install_list = $install_list . " -install -m \$(INSTMODE) src/" . $filelist{$cpp} . "." . $libraryext . " \$(LIBPATH)\n";
}
$all = $all . "moo inspircd\n";