Skip to content

Commit

Permalink
OS-8326 Let smartos-live be buildable with gcc10
Browse files Browse the repository at this point in the history
Reviewed by: Mike Zeller <mike.zeller@joyent.com>
Approved by: Mike Zeller <mike.zeller@joyent.com>
  • Loading branch information
Dan McDonald committed Jan 10, 2022
1 parent 2ff6c46 commit fa938ac
Show file tree
Hide file tree
Showing 24 changed files with 387 additions and 102 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#

#
# Copyright (c) 2019, Joyent, Inc.
# Copyright 2022, Joyent, Inc.
#

#
Expand Down Expand Up @@ -121,6 +121,7 @@ LIBSTDCXXVER_4 = 6.0.13
LIBSTDCXXVER_6 = 6.0.22
LIBSTDCXXVER_7 = 6.0.24
LIBSTDCXXVER_9 = 6.0.28
LIBSTDCXXVER_10 = 6.0.28

all: $(SUBDIRS)

Expand Down
4 changes: 2 additions & 2 deletions gnupg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#
# CDDL HEADER END
#
# Copyright 2018 Joyent, Inc.
# Copyright 2022 Joyent, Inc.
#

VER = gnupg-1.4.11
VER = gnupg-1.4.23
PATCHES = Patches/*

include ../Makefile.defs
Expand Down

This file was deleted.

160 changes: 160 additions & 0 deletions gnupg/Patches/0001-gcc10-extern-adjustment.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
diff -ru a/g10/options.h b/g10/options.h
--- a/g10/options.h 2016-08-17 05:00:11.000000000 -0400
+++ b/g10/options.h 2021-11-17 14:56:25.000000000 -0500
@@ -27,7 +27,7 @@

#ifndef EXTERN_UNLESS_MAIN_MODULE
/* Norcraft can't cope with common symbols */
-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+#if !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern
#else
#define EXTERN_UNLESS_MAIN_MODULE
diff -ru a/include/cipher.h b/include/cipher.h
--- a/include/cipher.h 2016-04-22 03:30:18.000000000 -0400
+++ b/include/cipher.h 2021-11-17 10:38:42.000000000 -0500
@@ -115,7 +115,7 @@
typedef struct gcry_md_context *MD_HANDLE;

#ifndef EXTERN_UNLESS_MAIN_MODULE
-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+#if !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern
#else
#define EXTERN_UNLESS_MAIN_MODULE
diff -ru a/include/iobuf.h b/include/iobuf.h
--- a/include/iobuf.h 2016-04-22 03:30:18.000000000 -0400
+++ b/include/iobuf.h 2021-11-17 10:38:42.000000000 -0500
@@ -70,7 +70,7 @@
};

#ifndef EXTERN_UNLESS_MAIN_MODULE
-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+#if !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern
#else
#define EXTERN_UNLESS_MAIN_MODULE
diff -ru a/include/memory.h b/include/memory.h
--- a/include/memory.h 2016-04-22 03:30:18.000000000 -0400
+++ b/include/memory.h 2021-11-17 10:38:42.000000000 -0500
@@ -91,7 +91,7 @@
#define DBG_MEMSTAT memory_stat_debug_mode

#ifndef EXTERN_UNLESS_MAIN_MODULE
-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+#if !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern
#else
#define EXTERN_UNLESS_MAIN_MODULE
diff -ru a/include/mpi.h b/include/mpi.h
--- a/include/mpi.h 2016-04-22 03:30:18.000000000 -0400
+++ b/include/mpi.h 2021-11-17 10:38:42.000000000 -0500
@@ -36,7 +36,7 @@
#include "memory.h"

#ifndef EXTERN_UNLESS_MAIN_MODULE
-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
+#if !defined (INCLUDED_BY_MAIN_MODULE)
#define EXTERN_UNLESS_MAIN_MODULE extern
#else
#define EXTERN_UNLESS_MAIN_MODULE
diff -ru a/keyserver/gpgkeys_curl.c b/keyserver/gpgkeys_curl.c
--- a/keyserver/gpgkeys_curl.c 2016-04-22 03:30:18.000000000 -0400
+++ b/keyserver/gpgkeys_curl.c 2021-11-17 15:34:06.000000000 -0500
@@ -28,6 +28,7 @@
* wish to do so, delete this exception statement from your version.
*/

+#define INCLUDED_BY_MAIN_MODULE 1 /* XXX SmartOS, links to .a library, needed */
#include <config.h>
#include <stdio.h>
#include <string.h>
@@ -42,6 +43,7 @@
#else
#include "curl-shim.h"
#endif
+#include "util.h"
#include "compat.h"
#include "keyserver.h"
#include "ksutil.h"
Only in b/keyserver: gpgkeys_curl.c~
diff -ru a/keyserver/gpgkeys_hkp.c b/keyserver/gpgkeys_hkp.c
--- a/keyserver/gpgkeys_hkp.c 2016-04-22 03:30:18.000000000 -0400
+++ b/keyserver/gpgkeys_hkp.c 2021-11-17 15:34:19.000000000 -0500
@@ -29,6 +29,7 @@
* wish to do so, delete this exception statement from your version.
*/

+#define INCLUDED_BY_MAIN_MODULE 1 /* XXX SmartOS, links to .a library, needed */
#include <config.h>
#include <stdio.h>
#include <string.h>
@@ -60,6 +61,7 @@
#ifdef USE_DNS_SRV
# include "srv.h"
#endif
+#include "util.h"
#include "compat.h"
#include "keyserver.h"
#include "ksutil.h"
Only in b/keyserver: gpgkeys_hkp.c~
diff -ru a/keyserver/gpgkeys_ldap.c b/keyserver/gpgkeys_ldap.c
--- a/keyserver/gpgkeys_ldap.c 2016-04-22 03:30:18.000000000 -0400
+++ b/keyserver/gpgkeys_ldap.c 2021-11-17 15:34:40.000000000 -0500
@@ -29,6 +29,7 @@
* wish to do so, delete this exception statement from your version.
*/

+#define INCLUDED_BY_MAIN_MODULE 1 /* XXX SmartOS, links to .a library, needed */
#include <config.h>
#include <stdio.h>
#include <string.h>
@@ -57,14 +58,11 @@
#ifdef HAVE_LDAP_SSL_H
#include <ldap_ssl.h>
#endif
-
#include "compat.h"
#include "keyserver.h"
#include "ksutil.h"

-#ifdef __riscos__
#include "util.h"
-#endif

#if HAVE_W32_SYSTEM
# if !defined(__MINGW64_VERSION_MAJOR) || !defined(__MINGW32_MAJOR_VERSION)
Only in b/keyserver: gpgkeys_ldap.c~
diff -ru a/tools/bftest.c b/tools/bftest.c
--- a/tools/bftest.c 2016-04-22 03:30:18.000000000 -0400
+++ b/tools/bftest.c 2021-11-17 11:28:04.000000000 -0500
@@ -26,6 +26,7 @@
#include <fcntl.h>
#endif

+#define INCLUDED_BY_MAIN_MODULE 1 /* XXX SmartOS, links to .a library, needed */
#include "util.h"
#include "cipher.h"
#include "i18n.h"
diff -ru a/tools/mpicalc.c b/tools/mpicalc.c
--- a/tools/mpicalc.c 2016-04-22 03:30:18.000000000 -0400
+++ b/tools/mpicalc.c 2021-11-17 11:25:42.000000000 -0500
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <ctype.h>

+#define INCLUDED_BY_MAIN_MODULE 1 /* XXX SmartOS, links to .a library, needed */
#include "util.h"
#include "mpi.h"
#include "i18n.h"
diff -ru a/tools/shmtest.c b/tools/shmtest.c
--- a/tools/shmtest.c 2016-04-22 03:30:18.000000000 -0400
+++ b/tools/shmtest.c 2021-11-17 10:41:58.000000000 -0500
@@ -25,6 +25,7 @@
#ifdef HAVE_SYS_SHM_H
#include <sys/shm.h>
#endif
+#define INCLUDED_BY_MAIN_MODULE 1 /* XXX SmartOS, links to .a library, needed */
#include "util.h"
#include "ttyio.h"
#include "i18n.h"
21 changes: 9 additions & 12 deletions gnupg/Patches/0002-OS-8313-do-not-check.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
Remove checks from build-time for now, because gnupg needs to be able to cope
with the idea of a proto area's library for testing the freshly-compiled binary.

diff -ru gnupg-1.4.11/Makefile.in gnupg-1.4.11-OS-8313-1/Makefile.in
--- gnupg-1.4.11/Makefile.in Mon Oct 18 05:53:58 2010
+++ gnupg-1.4.11-OS-8313-1/Makefile.in Wed Aug 25 00:27:47 2021
@@ -291,8 +291,7 @@
diff -ru a/Makefile.in b/Makefile.in
--- a/Makefile.in Mon Jun 11 04:47:56 2018
+++ b/Makefile.in Tue Nov 16 22:44:35 2021
@@ -427,8 +427,7 @@
# selinux-support is enabled.
DISTCHECK_CONFIGURE_FLAGS = --enable-mailto
AUTOMAKE_OPTIONS = dist-bzip2 filename-length-max=99
GITLOG_TO_CHANGELOG = gitlog-to-changelog
-@CROSS_COMPILING_FALSE@checks = checks
-@CROSS_COMPILING_TRUE@checks =
+checks =
SUBDIRS = m4 intl zlib util mpi cipher tools g10 keyserver po doc ${checks}
EXTRA_DIST = scripts/config.rpath PROJECTS BUGS config.h.in autogen.sh
DISTCLEANFILES =
+checks =
@HAVE_W32_SYSTEM_FALSE@bzlib =
@HAVE_W32_SYSTEM_TRUE@bzlib = bzlib
SUBDIRS = m4 intl zlib ${bzlib} util mpi cipher tools \
Binary file removed gnupg/gnupg-1.4.11.tar.bz2
Binary file not shown.
Binary file added gnupg/gnupg-1.4.23.tar.bz2
Binary file not shown.
23 changes: 0 additions & 23 deletions ipmitool/Patches/MAX.diff

This file was deleted.

37 changes: 37 additions & 0 deletions ipmitool/Patches/ipmi_hpmfwupg-cleanup.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff -ru a/include/ipmitool/ipmi_hpmfwupg.h b/include/ipmitool/ipmi_hpmfwupg.h
--- a/include/ipmitool/ipmi_hpmfwupg.h 2016-06-29 14:01:49.000000000 -0400
+++ b/include/ipmitool/ipmi_hpmfwupg.h 2021-11-17 16:19:43.000000000 -0500
@@ -800,7 +800,7 @@
char descString[HPMFWUPG_DESC_STRING_LENGTH + 1];
}VERSIONINFO, *PVERSIONINFO;

-VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
+extern VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];

#define TARGET_VER (0x01)
#define ROLLBACK_VER (0x02)
diff -ru a/lib/ipmi_hpmfwupg.c b/lib/ipmi_hpmfwupg.c
--- a/lib/ipmi_hpmfwupg.c 2016-06-29 14:01:49.000000000 -0400
+++ b/lib/ipmi_hpmfwupg.c 2021-11-17 16:20:14.000000000 -0500
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2006 Kontron Canada, Inc. All Rights Reserved.
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2022 Joyent, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -56,6 +57,13 @@
uint16_t
ipmi_intf_get_max_request_data_size(struct ipmi_intf * intf);

+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/* XXX SmartOS - don't declare globals in header files post-gcc10. */
+VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
+
extern int verbose;

int HpmfwupgUpgrade(struct ipmi_intf *intf, char *imageFilename,
2 changes: 1 addition & 1 deletion ipmitool/Patches/ipmi_sdr_get_record.diff
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ index 2a9cbe3..767bdb3 100644
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+ * Copyright 2020 Joyent, Inc.
+ * Copyright 2022 Joyent, Inc.
*
* Based on code from
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
Expand Down
4 changes: 2 additions & 2 deletions less/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#
# CDDL HEADER END
#
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright 2022 Joyent, Inc.
#

VER = less-436
VER = less-590

include ../Makefile.defs
include ../Makefile.targ
Expand Down
Binary file removed less/less-436.tar.gz
Binary file not shown.
Binary file added less/less-590.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions mdb_v8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#

#
# Copyright 2020 Joyent, Inc.
# Copyright 2022 Joyent, Inc.
#

#
Expand All @@ -23,7 +23,7 @@
# 3. From one directory up, run tar cvzf mdb_v8-<ver>.tar.gz mdb_v8-<ver>
#

VER = mdb_v8-1.4.2
VER = mdb_v8-1.4.3

include ../Makefile.defs
include ../Makefile.targ
Expand Down
Binary file removed mdb_v8/mdb_v8-1.4.2.tar.gz
Binary file not shown.
Binary file added mdb_v8/mdb_v8-1.4.3.tar.gz
Binary file not shown.
15 changes: 15 additions & 0 deletions nss-nspr/Patches/sqlite.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@
+# sqlite needs C99 for access to newer SUS standards
+OS_CFLAGS += -std=gnu99
+endif
--- a/nss/lib/sqlite/sqlite3.c 2016-06-20 13:11:28.000000000 -0400
+++ b/nss/lib/sqlite/sqlite3.c 2021-11-15 23:21:35.000000000 -0500
@@ -109780,8 +109780,12 @@
pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
if( pNew==0 ){
assert( db->mallocFailed );
+#if 0
pNew = &standin;
memset(pNew, 0, sizeof(*pNew));
+#else
+ return NULL;
+#endif
}
if( pEList==0 ){
pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ASTERISK,0));

0 comments on commit fa938ac

Please sign in to comment.