From 4380f3820e5504b039d4a1ed0853c4442fa251b1 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 19 Nov 2018 13:58:51 +0000 Subject: [PATCH 1/5] Fix compilation of irc/core on AIX and IBM i There's a function in the standard library of these OSes that conflict with this function. Prefix it with `irc_`. --- src/irc/core/irc-cap.c | 2 +- src/irc/core/irc-cap.h | 3 ++- src/irc/core/irc-core.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/irc/core/irc-cap.c b/src/irc/core/irc-cap.c index 5ab8d94f..898a4a20 100644 --- a/src/irc/core/irc-cap.c +++ b/src/irc/core/irc-cap.c @@ -296,7 +296,7 @@ static void event_invalid_cap (IRC_SERVER_REC *server, const char *data, const c irc_send_cmd_now(server, "CAP END"); } -void cap_init (void) +void irc_cap_init (void) { signal_add_first("event cap", (SIGNAL_FUNC) event_cap); signal_add_first("event 410", (SIGNAL_FUNC) event_invalid_cap); diff --git a/src/irc/core/irc-cap.h b/src/irc/core/irc-cap.h index df957cd2..cbfeae62 100644 --- a/src/irc/core/irc-cap.h +++ b/src/irc/core/irc-cap.h @@ -1,7 +1,8 @@ #ifndef __IRC_CAP_H #define __IRC_CAP_H -void cap_init(void); +/* this is prefixed as to not conflict with an AIX/i function in their stdlib */ +void irc_cap_init(void); void cap_deinit(void); int cap_toggle (IRC_SERVER_REC *server, char *cap, int enable); void cap_finish_negotiation (IRC_SERVER_REC *server); diff --git a/src/irc/core/irc-core.c b/src/irc/core/irc-core.c index a9221e02..ccd84027 100644 --- a/src/irc/core/irc-core.c +++ b/src/irc/core/irc-core.c @@ -119,7 +119,7 @@ void irc_core_init(void) lag_init(); netsplit_init(); irc_expandos_init(); - cap_init(); + irc_cap_init(); sasl_init(); settings_check(); From 795e7ec16240613dd13e8378128bb5fa66b6dc93 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 19 Nov 2018 14:18:34 +0000 Subject: [PATCH 2/5] Fix build on IBM i * Lots of warnings about subdirectories. Set an automake option to deal with this. * Set an ar flag for explicit 64-bit when on IBM i, due to it defaulting to 64-bit output with official gcc by default. --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 03e05847..82af3a20 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AC_PREREQ(2.50) AC_CONFIG_HEADERS([irssi-config.h]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([1.9 no-define foreign]) +AM_INIT_AUTOMAKE([1.9 no-define foreign subdir-objects]) AM_SILENT_RULES([yes]) @@ -199,6 +199,12 @@ case "$host_os" in hpux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" ;; + os400*) + dnl IBM i uses ppc64 gcc by default, but binutils defaults to 32-bit. Force + dnl IBM binutils, and force it into ppc64 mode. This isn't set for AIX + dnl because gcc there defaults to ppc32. + AR="/usr/bin/ar -X64" + ;; *) ;; esac From a634b34ba48d7e050bb125d86205e58a5dc00c3d Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Sun, 25 Nov 2018 14:50:47 +0000 Subject: [PATCH 3/5] Rename cap_* funcs to irc_cap_* Some systems often "namespace" cap_ for themselves, and so irssi's usage can conflict with their own. Bump ABI for this. --- src/common.h | 2 +- src/irc/core/irc-cap.c | 14 +++++++------- src/irc/core/irc-cap.h | 6 +++--- src/irc/core/irc-core.c | 2 +- src/irc/core/irc-servers.c | 4 ++-- src/irc/core/sasl.c | 10 +++++----- src/perl/irc/Server.xs | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/common.h b/src/common.h index c8fb54df..14bfe42b 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 18 +#define IRSSI_ABI_VERSION 19 #define DEFAULT_SERVER_ADD_PORT 6667 #define DEFAULT_SERVER_ADD_TLS_PORT 6697 diff --git a/src/irc/core/irc-cap.c b/src/irc/core/irc-cap.c index 898a4a20..2d740c59 100644 --- a/src/irc/core/irc-cap.c +++ b/src/irc/core/irc-cap.c @@ -24,7 +24,7 @@ #include "irc-cap.h" #include "irc-servers.h" -int cap_toggle (IRC_SERVER_REC *server, char *cap, int enable) +int irc_cap_toggle (IRC_SERVER_REC *server, char *cap, int enable) { if (cap == NULL || *cap == '\0') return FALSE; @@ -65,7 +65,7 @@ int cap_toggle (IRC_SERVER_REC *server, char *cap, int enable) return FALSE; } -void cap_finish_negotiation (IRC_SERVER_REC *server) +void irc_cap_finish_negotiation (IRC_SERVER_REC *server) { if (server->cap_complete) return; @@ -130,7 +130,7 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add } /* Malformed request, terminate the negotiation */ else { - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); g_warn_if_reached(); return; } @@ -177,7 +177,7 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add if (multiline == FALSE) { /* No CAP has been requested */ if (server->cap_queue == NULL) { - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); } else { cmd = g_string_new("CAP REQ :"); @@ -204,7 +204,7 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add signal_emit("server cap req", 2, server, cmd->str + sizeof("CAP REQ :") - 1); irc_send_cmd_now(server, cmd->str); } else { - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); } g_string_free(cmd, TRUE); @@ -233,7 +233,7 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add * negotiation, unless sasl was requested. In this case we must not terminate the negotiation * until the sasl handshake is over. */ if (got_sasl == FALSE) - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); } else if (!g_ascii_strcasecmp(evt, "NAK")) { g_warning("The server answered with a NAK to our CAP request, this should not happen"); @@ -302,7 +302,7 @@ void irc_cap_init (void) signal_add_first("event 410", (SIGNAL_FUNC) event_invalid_cap); } -void cap_deinit (void) +void irc_cap_deinit (void) { signal_remove("event cap", (SIGNAL_FUNC) event_cap); signal_remove("event 410", (SIGNAL_FUNC) event_invalid_cap); diff --git a/src/irc/core/irc-cap.h b/src/irc/core/irc-cap.h index cbfeae62..716239e2 100644 --- a/src/irc/core/irc-cap.h +++ b/src/irc/core/irc-cap.h @@ -3,8 +3,8 @@ /* this is prefixed as to not conflict with an AIX/i function in their stdlib */ void irc_cap_init(void); -void cap_deinit(void); -int cap_toggle (IRC_SERVER_REC *server, char *cap, int enable); -void cap_finish_negotiation (IRC_SERVER_REC *server); +void irc_cap_deinit(void); +int irc_cap_toggle (IRC_SERVER_REC *server, char *cap, int enable); +void irc_cap_finish_negotiation (IRC_SERVER_REC *server); #endif diff --git a/src/irc/core/irc-core.c b/src/irc/core/irc-core.c index ccd84027..950e5029 100644 --- a/src/irc/core/irc-core.c +++ b/src/irc/core/irc-core.c @@ -131,7 +131,7 @@ void irc_core_deinit(void) signal_emit("chat protocol deinit", 1, chat_protocol_find("IRC")); sasl_deinit(); - cap_deinit(); + irc_cap_deinit(); irc_expandos_deinit(); netsplit_deinit(); lag_deinit(); diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 02d971dc..03c73312 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -236,9 +236,9 @@ static void server_init(IRC_SERVER_REC *server) } if (conn->sasl_mechanism != SASL_MECHANISM_NONE) - cap_toggle(server, "sasl", TRUE); + irc_cap_toggle(server, "sasl", TRUE); - cap_toggle(server, "multi-prefix", TRUE); + irc_cap_toggle(server, "multi-prefix", TRUE); irc_send_cmd_now(server, "CAP LS"); diff --git a/src/irc/core/sasl.c b/src/irc/core/sasl.c index b7abe748..92eb6244 100644 --- a/src/irc/core/sasl.c +++ b/src/irc/core/sasl.c @@ -45,7 +45,7 @@ static gboolean sasl_timeout(IRC_SERVER_REC *server) { /* The authentication timed out, we can't do much beside terminating it */ irc_send_cmd_now(server, "AUTHENTICATE *"); - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); server->sasl_timeout = 0; server->sasl_success = FALSE; @@ -96,7 +96,7 @@ static void sasl_fail(IRC_SERVER_REC *server, const char *data, const char *from signal_emit("server sasl failure", 2, server, error); /* Terminate the negotiation */ - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); g_free(params); } @@ -110,7 +110,7 @@ static void sasl_already(IRC_SERVER_REC *server, const char *data, const char *f signal_emit("server sasl success", 1, server); /* We're already authenticated, do nothing */ - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); } static void sasl_success(IRC_SERVER_REC *server, const char *data, const char *from) @@ -122,7 +122,7 @@ static void sasl_success(IRC_SERVER_REC *server, const char *data, const char *f signal_emit("server sasl success", 1, server); /* The authentication succeeded, time to finish the CAP negotiation */ - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); } /* @@ -263,7 +263,7 @@ static void sasl_step_complete(IRC_SERVER_REC *server, GString *data) static void sasl_step_fail(IRC_SERVER_REC *server) { irc_send_cmd_now(server, "AUTHENTICATE *"); - cap_finish_negotiation(server); + irc_cap_finish_negotiation(server); sasl_timeout_stop(server); diff --git a/src/perl/irc/Server.xs b/src/perl/irc/Server.xs index 33417bf5..a42f5c82 100644 --- a/src/perl/irc/Server.xs +++ b/src/perl/irc/Server.xs @@ -155,6 +155,6 @@ irc_server_cap_toggle(server, cap, enable) char *cap int enable CODE: - RETVAL = cap_toggle(server, cap, enable); + RETVAL = irc_cap_toggle(server, cap, enable); OUTPUT: RETVAL From bed0a3309f4f452f5ebf6d5d5becf869da190d7a Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Sun, 25 Nov 2018 15:00:34 +0000 Subject: [PATCH 4/5] Revert back to using original version of the configure script * IBM i rpmbuild environments set the magic variables for building w/ 64-bit binutils automatically, and one can set this for themselves with `OBJECT_MODE=64` when buildings. Remove this. * The subdir-objects change will need to be made due to upstream autotools making it mandatory in the future, but that isn't my decision to make. --- configure.ac | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 82af3a20..03e05847 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AC_PREREQ(2.50) AC_CONFIG_HEADERS([irssi-config.h]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([1.9 no-define foreign subdir-objects]) +AM_INIT_AUTOMAKE([1.9 no-define foreign]) AM_SILENT_RULES([yes]) @@ -199,12 +199,6 @@ case "$host_os" in hpux*) CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" ;; - os400*) - dnl IBM i uses ppc64 gcc by default, but binutils defaults to 32-bit. Force - dnl IBM binutils, and force it into ppc64 mode. This isn't set for AIX - dnl because gcc there defaults to ppc32. - AR="/usr/bin/ar -X64" - ;; *) ;; esac From 482a3a5bdd7bf3755c67d678b7e74f72cfbaaecb Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 26 Nov 2018 09:56:04 -0400 Subject: [PATCH 5/5] Remove unneeded comment --- src/irc/core/irc-cap.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/irc/core/irc-cap.h b/src/irc/core/irc-cap.h index 716239e2..96efbbee 100644 --- a/src/irc/core/irc-cap.h +++ b/src/irc/core/irc-cap.h @@ -1,7 +1,6 @@ #ifndef __IRC_CAP_H #define __IRC_CAP_H -/* this is prefixed as to not conflict with an AIX/i function in their stdlib */ void irc_cap_init(void); void irc_cap_deinit(void); int irc_cap_toggle (IRC_SERVER_REC *server, char *cap, int enable);