From 2ad8a6791bbc548dee4156eaf661612bea3d310f Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 14 Jun 2015 18:20:47 +0100 Subject: Fix system-wide installation of the data and log directories. The existing method works fine when building with the default paths but breaks when you are doing a system-wide installation. --- make/template/main.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'make') diff --git a/make/template/main.mk b/make/template/main.mk index d5705d928..1dff0fc20 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -42,6 +42,7 @@ PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS) BASE = "$(DESTDIR)@BASE_DIR@" CONPATH = "$(DESTDIR)@CONFIG_DIR@" MODPATH = "$(DESTDIR)@MODULE_DIR@" +LOGPATH = "$(DESTDIR)@LOG_DIR@" DATPATH = "$(DESTDIR)@DATA_DIR@" BINPATH = "$(DESTDIR)@BINARY_DIR@" INSTALL = install @@ -220,8 +221,8 @@ install: target exit 1; \ fi @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE) - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/data - @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE)/logs + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(DATPATH) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(LOGPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules -- cgit v1.2.3 From 4e3d7a6e30eadf714483994681b8b2534229f4a8 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Fri, 22 May 2015 04:22:52 +0100 Subject: Show a better warning when certtool/openssl are missing. --- make/gnutlscert.pm | 13 +++++++------ make/opensslcert.pm | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'make') diff --git a/make/gnutlscert.pm b/make/gnutlscert.pm index 1204369a9..2c46e0e63 100644 --- a/make/gnutlscert.pm +++ b/make/gnutlscert.pm @@ -29,9 +29,16 @@ use Exporter 'import'; use make::configure; our @EXPORT = qw(make_gnutls_cert); +# On OS X the GnuTLS certtool is prefixed to avoid collision with the system certtool. +my $certtool = $^O eq 'darwin' ? 'gnutls-certtool' : 'certtool'; sub make_gnutls_cert() { + if (system "$certtool --version >/dev/null 2>&1") + { + print "\e[1;31mError:\e[0m unable to find '$certtool' in the PATH!\n"; + return 1; + } open (FH, ">certtool.template"); my $timestr = time(); my $commonname = promptstring_s('What is the hostname of your server?', 'irc.example.com'); @@ -133,12 +140,6 @@ ocsp_signing_key time_stamping_key __END__ close(FH); -my $certtool = "certtool"; -if (`uname -s` eq "Darwin\n") { - # On OS X the certtool binary name is different to prevent - # collisions with the system certtool from NSS. - $certtool = "gnutls-certtool"; -} if ( (my $status = system("$certtool --generate-privkey --outfile key.pem")) ne 0) { return 1; } if ( (my $status = system("$certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template certtool.template")) ne 0) { return 1; } unlink("certtool.template"); diff --git a/make/opensslcert.pm b/make/opensslcert.pm index b8c9d164f..1bf27df15 100644 --- a/make/opensslcert.pm +++ b/make/opensslcert.pm @@ -32,6 +32,11 @@ our @EXPORT = qw(make_openssl_cert); sub make_openssl_cert() { + if (system 'openssl version >/dev/null 2>&1') + { + print "\e[1;31mCertificate generation failed:\e[0m unable to find 'openssl' in the PATH!\n"; + return; + } open (FH, ">openssl.template"); my $commonname = promptstring_s('What is the hostname of your server?', 'irc.example.com'); my $email = promptstring_s('What email address can you be contacted at?', 'example@example.com'); -- cgit v1.2.3 From 0207736989eb1bdd576386992fca33a4b92629c5 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 23 Jun 2015 22:45:03 +0100 Subject: Log STDOUT and STDERR in the launchd script. --- make/template/org.inspircd.plist | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'make') diff --git a/make/template/org.inspircd.plist b/make/template/org.inspircd.plist index 2656d1df3..4dac209f6 100644 --- a/make/template/org.inspircd.plist +++ b/make/template/org.inspircd.plist @@ -21,6 +21,10 @@ ServiceIPC + StandardOutPath + @LOG_DIR@/launchd-stdout.log + StandardErrorPath + @LOG_DIR@/launchd-stderr.log UserName ircdaemon -- cgit v1.2.3 From 3fbba606c3fbb76a5bc045d4d7717528366ae84e Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 19 Jul 2015 17:17:29 +0100 Subject: Fix checking whether kqueue is available. It seems like the newer OS X versions don't put headers into the system include directories. Switch to using a test file instead. --- configure | 18 ++---------------- make/check_kqueue.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 make/check_kqueue.cpp (limited to 'make') diff --git a/configure b/configure index 76ef8ce36..bdbcf6afe 100755 --- a/configure +++ b/configure @@ -382,22 +382,8 @@ print "yes\n" if $config{HAS_STRLCPY} eq "true"; print "no\n" if $config{HAS_STRLCPY} eq "false"; printf "Checking if kqueue exists... "; -$has_kqueue = 0; -$fail = 0; -open(KQUEUE, ")) { - chomp($line); - # try and find the delcaration of: - # int kqueue(void); - if ($line =~ /int(\0x9|\s)+kqueue/) { - $has_kqueue = 1; - } - } - close(KQUEUE); -} -print "yes\n" if $has_kqueue == 1; -print "no\n" if $has_kqueue == 0; +$has_kqueue = test_compile('kqueue'); +print $has_kqueue ? "yes\n" : "no\n"; printf "Checking for epoll support... "; $has_epoll = test_compile('epoll'); diff --git a/make/check_kqueue.cpp b/make/check_kqueue.cpp new file mode 100644 index 000000000..6034253df --- /dev/null +++ b/make/check_kqueue.cpp @@ -0,0 +1,26 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2015 Peter Powell + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include +#include + +int main() { + int fd = kqueue(); + return (fd < 0); +} -- cgit v1.2.3 From e5cfa9c0c295596f688a18f5562cbb73b8e3997c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 21 Jul 2015 23:22:17 +0100 Subject: Switch strlcpy test to use a test file too. --- configure | 19 ++----------------- make/check_strlcpy.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 make/check_strlcpy.cpp (limited to 'make') diff --git a/configure b/configure index bdbcf6afe..2eba9edb1 100755 --- a/configure +++ b/configure @@ -363,23 +363,8 @@ print "yes\n" if $config{HAS_STDINT} eq "true"; print "no\n" if $config{HAS_STDINT} eq "false"; printf "Checking if strlcpy exists... "; -# Perform the strlcpy() test.. -$config{HAS_STRLCPY} = "false"; -$fail = 0; -open(STRLCPY, ")) { - chomp($line); - # try and find the delcaration of: - # size_t strlcpy(...) - if ($line =~ /size_t(\0x9|\s)+strlcpy/) { - $config{HAS_STRLCPY} = "true"; - } - } - close(STRLCPY); -} -print "yes\n" if $config{HAS_STRLCPY} eq "true"; -print "no\n" if $config{HAS_STRLCPY} eq "false"; +$config{HAS_STRLCPY} = test_compile('strlcpy'); +print $config{HAS_STRLCPY} ? "yes\n" : "no\n"; printf "Checking if kqueue exists... "; $has_kqueue = test_compile('kqueue'); diff --git a/make/check_strlcpy.cpp b/make/check_strlcpy.cpp new file mode 100644 index 000000000..e51d18d40 --- /dev/null +++ b/make/check_strlcpy.cpp @@ -0,0 +1,25 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2015 Peter Powell + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include + +int main() { + char test[5]; + strlcpy(test, "test", sizeof(test)); +} -- cgit v1.2.3 From 4c751dbbe8945e5efc230a59b0ed51c2ba10cf92 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 21 Jul 2015 23:30:54 +0100 Subject: Switch test to use a test file too. --- configure | 10 ++-------- make/check_stdint.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 make/check_stdint.cpp (limited to 'make') diff --git a/configure b/configure index 2eba9edb1..fd00ff89c 100755 --- a/configure +++ b/configure @@ -353,14 +353,8 @@ $exec = $config{CC} . " -dumpversion | cut -c 3"; chomp($config{GCCMINOR} = `$exec`); printf "Checking if stdint.h exists... "; -$config{HAS_STDINT} = "true"; -our $fail = 0; -open(STDINT, " + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include + +int main() { + uint32_t ret = 0; + return ret; +} -- cgit v1.2.3 From 0b4285abd12323920d92fee51e199edd7527dbec Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 21 Jul 2015 23:34:05 +0100 Subject: Add missing copyright headers to test files. --- make/check_epoll.cpp | 1 + make/check_eventfd.cpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'make') diff --git a/make/check_epoll.cpp b/make/check_epoll.cpp index 918d3907e..a5ed1c10b 100644 --- a/make/check_epoll.cpp +++ b/make/check_epoll.cpp @@ -1,6 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2009 Daniel De Graaf * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public diff --git a/make/check_eventfd.cpp b/make/check_eventfd.cpp index 980d04485..9b38b793b 100644 --- a/make/check_eventfd.cpp +++ b/make/check_eventfd.cpp @@ -1,6 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2012 William Pitcock + * Copyright (C) 2009-2010 Daniel De Graaf * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public -- cgit v1.2.3 From 79d1a436bb5c7ab40e43130495c455ffc8c682a2 Mon Sep 17 00:00:00 2001 From: Richard Bradfield Date: Wed, 22 Jul 2015 01:18:03 +0100 Subject: Replace deprecated tmpnam() call From Perl 5.22 onwards, POSIX::tmpnam() has been deprecated (without the usual 2 year deprecation cycle), using the File::Temp module instead preserves compatibility while allowing compilation on 5.22 and later. --- make/utilities.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'make') diff --git a/make/utilities.pm b/make/utilities.pm index ae16ce3dc..baba584ad 100644 --- a/make/utilities.pm +++ b/make/utilities.pm @@ -29,6 +29,7 @@ use warnings FATAL => qw(all); use Exporter 'import'; use POSIX; +use File::Temp; use Getopt::Long; use Fcntl; our @EXPORT = qw(make_rpath pkgconfig_get_include_dirs pkgconfig_get_lib_dirs pkgconfig_check_version translate_functions promptstring); @@ -404,7 +405,7 @@ sub translate_functions($$) my $tmpfile; do { - $tmpfile = tmpnam(); + $tmpfile = File::Temp::tmpnam(); } until sysopen(TF, $tmpfile, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, 0700); print "(Created and executed \e[1;32m$tmpfile\e[0m)\n"; print TF $1; -- cgit v1.2.3 From 7da9057946af3f82f846547b31c208de1e57237c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 29 Jul 2015 23:45:39 +0100 Subject: Fix "make -jX debug install" causing linker errors. --- make/template/main.mk | 2 ++ 1 file changed, 2 insertions(+) (limited to 'make') diff --git a/make/template/main.mk b/make/template/main.mk index 1dff0fc20..fa2375ac1 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -314,4 +314,6 @@ help: @echo ' deinstall Removes the files created by "make install"' @echo +.NOTPARALLEL: + .PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall squeakyclean configureclean help -- cgit v1.2.3 From 7d0b4a4a07d01b4800833a635510c297b863bad7 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 20 Oct 2015 15:16:52 +0100 Subject: Generate a 2048-bit dhparams unless explicitly specified. --- make/opensslcert.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'make') diff --git a/make/opensslcert.pm b/make/opensslcert.pm index 1bf27df15..20da704f7 100644 --- a/make/opensslcert.pm +++ b/make/opensslcert.pm @@ -46,6 +46,7 @@ sub make_openssl_cert() my $state = promptstring_s('What state are you located in?', 'Example State'); my $country = promptstring_s('What is the ISO 3166-1 code for the country you are located in?', 'XZ'); my $time = promptstring_s('How many days do you want your certificate to be valid for?', '365'); + my $use_1024 = promptstring_s('Do you want to generate less secure dhparams which are compatible with old versions of Java?', 'n'); print FH <<__END__; $country $state @@ -56,8 +57,9 @@ $commonname $email __END__ close(FH); -system("cat openssl.template | openssl req -x509 -nodes -newkey rsa:1024 -keyout key.pem -out cert.pem -days $time 2>/dev/null"); -system("openssl dhparam -out dhparams.pem 1024"); +my $dhbits = $use_1024 =~ /^(1|on|true|yes|y)$/ ? 1024 : 2048; +system("cat openssl.template | openssl req -x509 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem -days $time 2>/dev/null"); +system("openssl dhparam -out dhparams.pem $dhbits"); unlink("openssl.template"); } -- cgit v1.2.3