summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-25 20:51:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-25 20:51:58 +0000
commita9d2342f6af5d9e1fb2a6e42d71493300c0c39f9 (patch)
treef37c14d206f0f3f728f7ee18fc1addaf4aaae0f5
parent01241d4574bf256aca1b6a379fe2c5685681d758 (diff)
Make install list list automatically generated from build targets and provide facility for installing extra files.
Using this, cert.pem and key.pem are only copied to the conf dir if you enabled an ssl module. Also, this provides facility for a 'make deinstall' which should be safe for use in all situations as it always specifies a file by name and never uses wildcards to rm. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8362 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--.Makefile.inc21
-rwxr-xr-xconfigure120
-rw-r--r--src/configreader.cpp8
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp3
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp2
6 files changed, 92 insertions, 64 deletions
diff --git a/.Makefile.inc b/.Makefile.inc
index af5a617e9..3afbf67a8 100644
--- a/.Makefile.inc
+++ b/.Makefile.inc
@@ -71,24 +71,8 @@ install: all@EXTRA_DIR@
@-install -d -m $(INSTMODE) $(BINPATH)
@-install -d -m $(INSTMODE) $(CONPATH)
@-install -d -m $(INSTMODE) $(MODPATH)
-@INSTALL_LIST@ -install -m $(INSTMODE) src/inspircd $(BINPATH)
-install -m $(INSTMODE) @STARTSCRIPT@ $(@DESTINATION@) 2>/dev/null
- @-cp .gdbargs $(BASE)
- @-cp conf/inspircd.quotes.example $(CONPATH)
- @-cp conf/inspircd.rules.example $(CONPATH)
- @-cp conf/inspircd.motd.example $(CONPATH)
- @-cp conf/inspircd.helpop-full.example $(CONPATH)
- @-cp conf/inspircd.helpop.example $(CONPATH)
- @-cp conf/inspircd.censor.example $(CONPATH)
- @-cp conf/inspircd.filter.example $(CONPATH)
- @-cp conf/key.pem $(CONPATH)
- @-cp conf/cert.pem $(CONPATH)
- @-cp docs/inspircd.conf.example $(CONPATH)
- ${MAKE} modinstall
-
-modinstall: mods
- ${MAKE} -C src/modules DIRNAME="src/modules" $(MAKEARGS) modinst
- @echo ""
+@INSTALL_LIST@ @echo ""
@echo "*************************************"
@echo "* INSTALL COMPLETE! *"
@echo "* *"
@@ -115,6 +99,9 @@ modclean:
rm -rf lib/*.so
rm -f bin/inspircd
+deinstall:
+@UNINSTALL_LIST@
+
squeakyclean: distclean
launchd_dir:
diff --git a/configure b/configure
index fb4b80ade..889667f03 100755
--- a/configure
+++ b/configure
@@ -49,9 +49,10 @@ my @immutabledeps = (
#
###############################################################################################
-# List of commands that make up 'make install'
+# List of commands that make up 'make install' and 'make deinstall'
my $install_list = "";
+my $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
@@ -1188,6 +1189,7 @@ EOF
if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
closedir(MDIRHANDLE);
$modules .= "$name.so ";
+ $uninstall_list = $uninstall_list . " -rm \$(MODULES)/$name.so\n";
}
}
}
@@ -1211,9 +1213,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'
- print "Writing dynamic-build \033[1;32msrc/Makefile\033[0m\n";
- write_dynamic_makefile();
+ print "Writing \033[1;32mMakefiles\033[0m\n";
write_dynamic_modules_makefile();
+ write_dynamic_makefile();
opendir(DIRHANDLE, $this);
@@ -1251,6 +1253,7 @@ EOF
$tmp =~ s/\@MAKEORDER\@/$config{MAKEORDER}/;
$tmp =~ s/\@VERSION\@/$version/;
$tmp =~ s/\@INSTALL_LIST\@/$install_list/;
+ $tmp =~ s/\@UNINSTALL_LIST\@/$uninstall_list/;
open(FILEHANDLE, ">$file");
print FILEHANDLE $tmp;
@@ -1308,8 +1311,6 @@ EOCHEESE
my $modules = "";
my $cmflags = "";
my $liflags = "";
- my $crud = "";
-
foreach $i (@modlist) {
###
# Write Entry to the MakeFile
@@ -1338,7 +1339,8 @@ m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/ch
\$(CC) -pipe -I../../include \$(FLAGS) $cmflags \$(PICLDFLAGS) $liflags -export-dynamic -o m_$i.so m_$i.cpp
";
}
- $crud = $crud . " install -m \$(INSTMODE) m_$i.so \$(MODPATH)\n";
+ $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
###
@@ -1363,13 +1365,11 @@ m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/ch
}
print FILEHANDLE "\n$mfrules\n";
closedir(MDIRHANDLE);
- $crud = $crud . " install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
+ $install_list = $install_list . " install -m \$(INSTMODE) src/modules/$name.so \$(MODPATH)\n";
}
}
}
closedir(DIRHANDLE);
-
- print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
}
sub read_module_directory {
@@ -1440,6 +1440,7 @@ sub write_dynamic_makefile
{
my $i = 0;
my @cmdlist = ();
+ my %existing_install_list = ();
opendir(DIRHANDLE, "src/commands");
foreach $name (sort readdir(DIRHANDLE))
{
@@ -1447,6 +1448,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);
@@ -1464,54 +1466,79 @@ sub write_dynamic_makefile
$config{USE_PORTS} = 0;
}
- print "Scanning src folder for core files";
- opendir(DIRHANDLE, "src");
- foreach $name (sort readdir(DIRHANDLE))
+ foreach my $dir (("src","src/commands","src/modes","src/socketengines","src/modules"))
{
- if ($name =~ /\.cpp$/)
+ print "Scanning \033[1;32m$dir\033[0m for core files ";
+ opendir(DIRHANDLE, $dir);
+ foreach $name (sort readdir(DIRHANDLE))
{
- open (CPP, "<src/$name") or die("Can't open src/$name to scan it! oh bugger");
- while (chomp($line = <CPP>))
+ if ($name =~ /\.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"))
+ open (CPP, "<$dir/$name") or die("Can't open $dir/$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)
{
- # Skip to 'endif'
- while (chomp($line = <CPP>))
+ if (($config{$1} !~ /y/i) and ($config{$1} ne "1"))
{
- die ("\$If buildsystem instruction within another \$If in file src/$name") if ($line =~ /\/\* \$If: (\w+) \*\//i);
- last if ($line =~ /\/\* \$EndIf \*\//i);
+ # Skip to 'endif'
+ while (chomp($line = <CPP>))
+ {
+ die ("\$If buildsystem instruction within another \$If in file $dir/$name") if ($line =~ /\/\* \$If: (\w+) \*\//i);
+ last if ($line =~ /\/\* \$EndIf \*\//i);
+ }
+ }
+ }
+ elsif ($line =~ /\/\* \$Install: (.*?) \*\//i)
+ {
+ if (!exists($existing_install_list{$1}))
+ {
+ $idir = (split(' ',$1))[1];
+ $ifile = (split(' ',$1))[0];
+ $install_list = $install_list . " -install -m \$(INSTMODE) $1\n";
+ $ifile =~ s/.*\///g;
+ $uninstall_list = $uninstall_list . " -rm $idir/$ifile\n";
+ }
+ }
+ elsif ($line =~ /\/\* \$CopyInstall: (.*?) \*\//i)
+ {
+ if (!exists($existing_install_list{$1}))
+ {
+ $idir = (split(' ',$1))[1];
+ $ifile = (split(' ',$1))[0];
+ $install_list = $install_list . " -cp $1\n" if (!exists($existing_install_list{$1}));
+ $ifile =~ s/.*\///g;
+ $uninstall_list = $uninstall_list . " -rm $idir/$ifile\n";
}
}
}
+ close CPP;
}
- close CPP;
}
+ closedir(DIRHANDLE);
+ print " done!\n";
}
- closedir(DIRHANDLE);
- print " done!\n";
$freebsd4libs = $config{CRAQ};
@@ -1534,6 +1561,7 @@ sub write_dynamic_makefile
$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";
+ $uninstall_list = $uninstall_list . " -rm \$(LIBPATH)/" . $filelist{$cpp} . "." . $libraryext . "\n";
}
$all = $all . "moo inspircd\n";
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 4de90cd78..b026f5a9f 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -12,6 +12,14 @@
*/
/* $Core: libIRCDconfigreader */
+/* $CopyInstall: conf/inspircd.quotes.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.rules.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.motd.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.helpop-full.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.helpop.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.censor.example $(CONPATH) */
+/* $CopyInstall: conf/inspircd.filter.example $(CONPATH) */
+/* $CopyInstall: docs/inspircd.conf.example $(CONPATH) */
#include "inspircd.h"
#include <fstream>
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 54d942305..097cd6d0b 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Install: src/inspircd $(BINPATH) */
+
#include "inspircd.h"
#include <signal.h>
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 4b059ca9f..2d806dd4e 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -35,7 +35,8 @@
/* $CompileFlags: exec("libgnutls-config --cflags") */
/* $LinkerFlags: rpath("libgnutls-config --libs") exec("libgnutls-config --libs") */
/* $ModDep: transport.h */
-
+/* $CopyInstall: conf/key.pem $(CONPATH) */
+/* $CopyInstall: conf/cert.pem $(CONPATH) */
enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED };
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 4696f0357..7d6f24cb3 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -42,6 +42,8 @@
/* $LinkerFlags: rpath("pkg-config --libs openssl") pkgconflibs("openssl","/libssl.so","-lssl -lcrypto -ldl") */
/* $ModDep: transport.h */
/* $NoPedantic */
+/* $CopyInstall: conf/key.pem $(CONPATH) */
+/* $CopyInstall: conf/cert.pem $(CONPATH) */
enum issl_status { ISSL_NONE, ISSL_HANDSHAKING, ISSL_OPEN };
enum issl_io_status { ISSL_WRITE, ISSL_READ };