Subject: pkg/28696: databases/mysql4-client needs changes to compile on IRIX 5
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <georg.schwarz@freenet.de>
List: pkgsrc-bugs
Date: 12/17/2004 23:15:01
>Number:         28696
>Category:       pkg
>Synopsis:       databases/mysql4-client needs changes to compile on IRIX 5
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 17 23:15:00 +0000 2004
>Originator:     Georg Schwarz
>Release:        current pkgsrc
>Organization:
>Environment:
IRIX lorenz 5.3 08031225 IP20 mips
>Description:
databases/mysql4-client exhibits the following issues when being compiled on IRIX 5:
- ncurses.h and curses.h are both included and conflict
- -lgen is added but not needed.
- client/mysql.cc and client/completion_hash.cc make use of bzero() which is defined in bstring.h
- client/mysql.cc uses signal() which on IRIX 5 seems to have a somewhat different argument type for C++ than on other OSes (and g++ 3.4 seems to be quite picky about that...)


>How-To-Repeat:

>Fix:
Change Makefile.common as follows:

--- Makefile.common.orig        2004-12-12 15:37:39.000000000 +0100
+++ Makefile.common     2004-12-17 20:07:06.000000000 +0100
@@ -36,6 +36,12 @@
 CONFIGURE_ARGS+=       --without-libwrap
 CONFIGURE_ARGS+=       --with-named-curses-libs="-lcurses -ltermcap"
 
+.if !empty(LOWER_OPSYS:Mirix5*)
+CFLAGS+=               -DIRIX5 -DNEEDS_BSTRING_H
+CONFIGURE_ENV+=                ac_cv_header_curses_h="no"
+CONFIGURE_ENV+=                ac_cv_lib_gen_p2open="no"
+.endif
+
 # We always use our own readline, either system- or pkgsrc-supplied.
 CONFIGURE_ARGS+=       --without-readline
 

Maybe one should also add .include "../../devel/ncurses/buildlink3.mk" to ensure ncurses's ncurses.h is used?

Also, add the following two patches:

--- client/mysql.cc.orig1       2004-12-12 20:15:50.000000000 +0100
+++ client/mysql.cc     2004-12-17 20:12:21.000000000 +0100
@@ -39,6 +39,9 @@
 #include "my_readline.h"
 #include <signal.h>
 #include <violite.h>
+#ifdef NEEDS_BSTRING_H                 // defines bzero()
+#include <bstring.h>
+#endif
 
 #if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
 #include <locale.h>
@@ -398,8 +401,14 @@
   if (opt_sigint_ignore)
     signal(SIGINT, SIG_IGN);
   else
-    signal(SIGINT, mysql_end);                 // Catch SIGINT to clean up
-  signal(SIGQUIT, mysql_end);                  // Catch SIGQUIT to clean up
+#ifdef IRIX5
+#define _MYSQL_END_TYPE (void (*)(...))
+#else
+#define _MYSQL_END_TYPE
+#endif
+
+    signal(SIGINT, _MYSQL_END_TYPE mysql_end);                 // Catch SIGINT to clean up
+  signal(SIGQUIT, _MYSQL_END_TYPE mysql_end);                  // Catch SIGQUIT to clean up
 
   /*
     Run in interactive mode like the ingres/postgres monitor

--- client/completion_hash.cc.orig1     2004-12-12 23:01:38.000000000 +0100
+++ client/completion_hash.cc   2004-12-18 00:09:26.000000000 +0100
@@ -26,6 +26,9 @@
 #undef SAFEMALLOC                              // Speed things up
 #include <my_sys.h>
 #include "completion_hash.h"
+#ifdef NEEDS_BSTRING_H                         // defines bzero()
+#include <bstring.h>
+#endif
 
 uint hashpjw(const char *arKey, uint nKeyLength)
 {