From afc187cc3f907947453b428f857acf16b2b0774e Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 06:07:31 -0500 Subject: MoonchildProductions#1251 - Part 1: Restore initial Solaris support, fixed up. Compared with what Pale Moon had for Solaris originally, this is mostly the same zero point I started patching from, but I've made the following changes here after reviewing all this initial code I never looked at closely before. 1. In package-manifest.in for both Basilisk and Pale Moon, I've made the SPARC code for libfreebl not interefere with the x86 code, use the proper build flags, and also updated it to allow a SPARC64 build which is more likely to be used than the 32-bit SPARC code we had there. 2. See Mozilla bug #832272 and the old rules.mk patch from around Firefox 30 in oracle/solaris-userland. I believe they screwed up NSINSTALL on Solaris when they were trying to streamline the NSS buildsystem, because they started having unexplained issues with it around that time after Firefox 22 that they never properly resolved until Mozilla began building NSS with gyp files. I'm actually not even sure how relevant the thing they broke actually is to Solaris at this point, bug 665509 is so old it predates Firefox itself and goes back to the Mozilla suite days. I believe $(INSTALL) -t was wrong, and they meant $(NSINSTALL) -t because that makes more sense and is closer to what was there originally. It's what they have for WINNT, and it's possible a fix more like that could serve for Solaris as well. Alternatively, we could get rid of all these half-broken Makefiles and start building NSS with gyp files like Mozilla did. 3. I've completely cut out support for the Sun compiler and taken into account the reality that everyone builds Firefox (and therefore its forks) with GCC now on Solaris. This alone helped clean up a lot of the uglier parts of the code. 4. I've updated all remaining SOLARIS build flags to the newer XP_SOLARIS, because the SOLARIS flag is no longer set when building Solaris. 5. I've confirmed the workaround in gtxFontconfigFonts.cpp is no longer necessary. The Solaris people got impatient about implementing a half-baked patch for a fontconfig feature that wasn't ready yet back in 2009, and somehow convinced Mozilla to patch their software to work around it when really they should have just fixed or removed their broken fontconfig patch. The feature they wanted has since been implemented properly, and no version of Solaris still uses the broken patch that required this fix. If anyone had ever properly audited this code, it would have been removed a long time ago. --- dom/base/nsContentUtils.h | 4 ++++ dom/plugins/base/nptypes.h | 13 +++++++++++++ dom/plugins/base/nsPluginsDirUnix.cpp | 16 +++++++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-) (limited to 'dom') diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 299a8e859..26635acd6 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -13,6 +13,10 @@ #include #endif +#if defined(XP_SOLARIS) +#include +#endif + #include "js/TypeDecls.h" #include "js/Value.h" #include "js/RootingAPI.h" diff --git a/dom/plugins/base/nptypes.h b/dom/plugins/base/nptypes.h index c36532472..d0cef6540 100644 --- a/dom/plugins/base/nptypes.h +++ b/dom/plugins/base/nptypes.h @@ -22,6 +22,19 @@ typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; +#elif defined(__sun) + /* + * SunOS ships an inttypes.h header that defines [u]int32_t, + * but not bool for C. + */ + #include + + + #ifndef __cplusplus + typedef int bool; + #define true 1 + #define false 0 + #endif #elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD) /* * BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index e6956c34c..22d6bd44b 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -19,7 +19,9 @@ #include "nsIPrefService.h" #define LOCAL_PLUGIN_DLL_SUFFIX ".so" -#if defined(LINUX) +#if defined(XP_SOLARIS) +#define DEFAULT_X11_PATH "/usr/openwin/lib" +#elif defined(LINUX) #define DEFAULT_X11_PATH "/usr/X11R6/lib/" #elif defined(__APPLE__) #define DEFAULT_X11_PATH "/usr/X11R6/lib" @@ -92,7 +94,11 @@ static bool LoadExtraSharedLib(const char *name, char **soname, bool tryToGetSon #define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32 #define PREF_PLUGINS_SONAME "plugin.soname.list" +#if defined (XP_SOLARIS) +#define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX ":libXm" LOCAL_PLUGIN_DLL_SUFFIX +#else #define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX +#endif /* this function looks for user_pref("plugin.soname.list", "/usr/X11R6/lib/libXt.so.6:libXext.so"); @@ -264,11 +270,15 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary) // at runtime. Explicitly opening Xt/Xext into the global // namespace before attempting to load the plug-in seems to // work fine. - - +#if defined(XP_SOLARIS) + // Acrobat/libXm: Lazy resolving might cause crash later (bug 211587) + *outLibrary = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW); + pLibrary = *outLibrary; +#else // Some dlopen() doesn't recover from a failed PR_LD_NOW (bug 223744) *outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); pLibrary = *outLibrary; +#endif if (!pLibrary) { LoadExtraSharedLibs(); // try reload plugin once more -- cgit v1.2.3 From 4105ebb6ed85aaffec5e4469a939945fb9eea066 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 18:28:10 -0500 Subject: MoonchildProductions#1251 - Part 4: Core build system changes, lots of libevent/IPC junk. This is mostly ifdefs, but as you can see, Solaris is actually a lot like Linux. They're both more SysV than BSD at core, and most of the differences have more to do with Solaris not using glibc than anything else. I still need to audit a lot of these changes and understand why they're needed and what the alternative approaches are. After this patch, most of the core functionality needed to build Solaris is here. --- dom/media/AudioStream.h | 4 ++++ dom/plugins/ipc/PluginMessageUtils.cpp | 6 +++--- dom/plugins/ipc/PluginModuleChild.cpp | 4 ++-- dom/plugins/ipc/PluginModuleChild.h | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'dom') diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index acc38b93d..13cbb0c75 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -17,6 +17,10 @@ #include "mozilla/UniquePtr.h" #include "CubebUtils.h" #include "soundtouch/SoundTouchFactory.h" +#if defined(XP_SOLARIS) +#include "soundtouch/SoundTouch.h" +#endif + namespace mozilla { diff --git a/dom/plugins/ipc/PluginMessageUtils.cpp b/dom/plugins/ipc/PluginMessageUtils.cpp index 47653fe6e..5b1d1667f 100644 --- a/dom/plugins/ipc/PluginMessageUtils.cpp +++ b/dom/plugins/ipc/PluginMessageUtils.cpp @@ -82,7 +82,7 @@ MediateRace(const MessageChannel::MessageInfo& parent, } } -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) static string ReplaceAll(const string& haystack, const string& needle, const string& with) { @@ -101,7 +101,7 @@ ReplaceAll(const string& haystack, const string& needle, const string& with) string MungePluginDsoPath(const string& path) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) // https://bugzilla.mozilla.org/show_bug.cgi?id=519601 return ReplaceAll(path, "netscape", "netsc@pe"); #else @@ -112,7 +112,7 @@ MungePluginDsoPath(const string& path) string UnmungePluginDsoPath(const string& munged) { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) return ReplaceAll(munged, "netsc@pe", "netscape"); #else return munged; diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index cbf6e509f..102c44a5e 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -1821,7 +1821,7 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval) AssertPluginThread(); MOZ_ASSERT(mIsChrome); -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) return true; #elif defined(OS_WIN) || defined(OS_MACOSX) *_retval = mGetEntryPointsFunc(&mFunctions); @@ -1866,7 +1866,7 @@ PluginModuleChild::DoNP_Initialize(const PluginSettings& aSettings) #endif NPError result; -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) result = mInitializeFunc(&sBrowserFuncs, &mFunctions); #elif defined(OS_WIN) || defined(OS_MACOSX) result = mInitializeFunc(&sBrowserFuncs); diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 681743582..5e4fa7d20 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -258,7 +258,7 @@ private: // we get this from the plugin NP_PLUGINSHUTDOWN mShutdownFunc; -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) NP_PLUGINUNIXINIT mInitializeFunc; #elif defined(OS_WIN) || defined(OS_MACOSX) NP_PLUGININIT mInitializeFunc; -- cgit v1.2.3 From 575f51a27d6b3627ae5675cc8e920c8dcae073bd Mon Sep 17 00:00:00 2001 From: athenian200 Date: Fri, 4 Oct 2019 04:37:51 -0500 Subject: Fix a bunch of dumb typos and omissions. --- dom/plugins/ipc/PluginModuleChild.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dom') diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 102c44a5e..f943dfc42 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -286,7 +286,7 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename, // TODO: use PluginPRLibrary here -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) mShutdownFunc = (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown"); -- cgit v1.2.3 From 5a4a4990cd9f5d0b56d515b0246bc09da7109eb3 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Mon, 7 Oct 2019 03:09:28 -0500 Subject: MoonchildProductions#1251 - Part 21: Fix Flash player and some extensions being incompatible. https://github.com/oracle/solaris-userland/blob/82dd4adb0eca729372074d62435e00a783d95b1f/components/desktop/firefox/patches/firefox-49-npapi.patch The first fix was something I found on Oracle's patchset and allowed me to use the last Flash Player compiled for Solaris, from all the way back in 2012. Still works with most Flash content. The second is an evolution of what I had to do to get Interlink to compile. For Interlink, I basically had to copy the contents of any boolean values from confvars.sh into the empty moz.configure file, otherwise nothing would get configured. I decided to test whether Pale Moon had the same issue, and it turned out that it wasn't as bad as on Interlink, but it was still pure luck that the browser component built at all, because MOZ_PHOENIX and other important flags were apparently not being defined at all, hence why I couldn't get half the extensions to be compatible at first. I don't know why this is the case, but apparently configure.in isn't able to import values from confvars.sh. old-configure.in seems immune to the problem that application-specific configure.in files were experiencing, though. confvars.sh itself seems to work fine with values that aren't passed along via configure.in, though. So it's the interface between those two files that is messed up. --- dom/plugins/base/npapi.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'dom') diff --git a/dom/plugins/base/npapi.h b/dom/plugins/base/npapi.h index 12ac635c7..e554aaabc 100644 --- a/dom/plugins/base/npapi.h +++ b/dom/plugins/base/npapi.h @@ -327,9 +327,12 @@ typedef enum { #define NP_ABI_GCC3_MASK 0x10000000 /* * gcc 3.x generated vtables on UNIX and OSX are incompatible with - * previous compilers. + * previous compilers. Flash plugin binaries for Solaris were compiled + * with Sun Studio, so this has to be false to make things work. This may + * become a problem in the future when/if new plugins are compiled with + * GCC, however. */ -#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3)) +#if (defined(XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_SOLARIS)) #define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK #else #define _NP_ABI_MIXIN_FOR_GCC3 0 -- cgit v1.2.3 From 687a798e6dedacb8b42826debcd8e89baa69ce94 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sat, 19 Oct 2019 14:24:49 -0500 Subject: MoonchildProductions#1251 - Part 27: Fix ifdef style. This should do it for all the commits to files I changed, but while I'm in here I could probably go ahead and turn ALL the singular if defined statements into ifdef statements by using grep/find on the tree. On the other hand, perhaps we should do that as a separate issue so that this doesn't become a case of scope creep. --- dom/base/nsContentUtils.h | 4 ++-- dom/media/AudioStream.h | 2 +- dom/plugins/base/nsPluginsDirUnix.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'dom') diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 26635acd6..606d67de9 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -9,11 +9,11 @@ #ifndef nsContentUtils_h___ #define nsContentUtils_h___ -#if defined(XP_WIN) +#ifdef XP_WIN #include #endif -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #include #endif diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index 13cbb0c75..199314d4b 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -17,7 +17,7 @@ #include "mozilla/UniquePtr.h" #include "CubebUtils.h" #include "soundtouch/SoundTouchFactory.h" -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #include "soundtouch/SoundTouch.h" #endif diff --git a/dom/plugins/base/nsPluginsDirUnix.cpp b/dom/plugins/base/nsPluginsDirUnix.cpp index 22d6bd44b..de3b7a2d1 100644 --- a/dom/plugins/base/nsPluginsDirUnix.cpp +++ b/dom/plugins/base/nsPluginsDirUnix.cpp @@ -19,7 +19,7 @@ #include "nsIPrefService.h" #define LOCAL_PLUGIN_DLL_SUFFIX ".so" -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS #define DEFAULT_X11_PATH "/usr/openwin/lib" #elif defined(LINUX) #define DEFAULT_X11_PATH "/usr/X11R6/lib/" @@ -94,7 +94,7 @@ static bool LoadExtraSharedLib(const char *name, char **soname, bool tryToGetSon #define PLUGIN_MAX_NUMBER_OF_EXTRA_LIBS 32 #define PREF_PLUGINS_SONAME "plugin.soname.list" -#if defined (XP_SOLARIS) +#ifdef XP_SOLARIS #define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX ":libXm" LOCAL_PLUGIN_DLL_SUFFIX #else #define DEFAULT_EXTRA_LIBS_LIST "libXt" LOCAL_PLUGIN_DLL_SUFFIX ":libXext" LOCAL_PLUGIN_DLL_SUFFIX -- cgit v1.2.3