Add support for compiling under MinGW + fix Windows compiling in general

This commit is contained in:
wuggy 2026-04-17 15:05:11 -07:00
commit a5cf494890
56 changed files with 243 additions and 76 deletions

View file

@ -4,6 +4,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['COMPILE_ENVIRONMENT']: if CONFIG['COMPILE_ENVIRONMENT']:
if CONFIG['CC_TYPE'] == 'msvc':
DIRS += ['typelib'] DIRS += ['typelib']
# With --disable-accessibility, we need to compile PDocAccessible.ipdl (which # With --disable-accessibility, we need to compile PDocAccessible.ipdl (which

View file

@ -3,10 +3,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
FINAL_TARGET_FILES += [ if CONFIG['CC_TYPE'] == 'msvc':
FINAL_TARGET_FILES += [
'!Accessible.tlb', '!Accessible.tlb',
] ]
GENERATED_FILES += [ GENERATED_FILES += [
'Accessible.tlb', 'Accessible.tlb',
] ]

View file

@ -7,9 +7,9 @@
#include "mozilla/AppData.h" #include "mozilla/AppData.h"
#include "application.ini.h" #include "application.ini.h"
#include "nsXPCOMGlue.h" #include "nsXPCOMGlue.h"
#include <stdlib.h>
#if defined(XP_WIN) #if defined(XP_WIN)
#include <windows.h> #include <windows.h>
#include <stdlib.h>
#elif defined(XP_UNIX) #elif defined(XP_UNIX)
#include <sys/resource.h> #include <sys/resource.h>
#include <unistd.h> #include <unistd.h>

View file

@ -5,6 +5,8 @@
#include "nsWindowsShellService.h" #include "nsWindowsShellService.h"
#include <stdlib.h>
#include "imgIContainer.h" #include "imgIContainer.h"
#include "imgIRequest.h" #include "imgIRequest.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"

View file

@ -14,13 +14,14 @@ if CONFIG['ENABLE_TESTS']:
NO_PGO = True NO_PGO = True
if CONFIG['WIN32_REDIST_DIR'] and CONFIG['COMPILE_ENVIRONMENT']: if CONFIG['CC_TYPE'] == 'msvc':
if CONFIG['WIN32_REDIST_DIR'] and CONFIG['COMPILE_ENVIRONMENT']:
for f in ['MSVC_C_RUNTIME_DLL', 'MSVC_CMP_RUNTIME_DLL', 'MSVC_CXX_RUNTIME_DLL']: for f in ['MSVC_C_RUNTIME_DLL', 'MSVC_CMP_RUNTIME_DLL', 'MSVC_CXX_RUNTIME_DLL']:
FINAL_TARGET_FILES += [ FINAL_TARGET_FILES += [
'%%%s/%s' % (CONFIG['WIN32_REDIST_DIR'], CONFIG[f]) '%%%s/%s' % (CONFIG['WIN32_REDIST_DIR'], CONFIG[f])
] ]
if CONFIG['WIN_UCRT_REDIST_DIR'] and CONFIG['COMPILE_ENVIRONMENT']: if CONFIG['WIN_UCRT_REDIST_DIR'] and CONFIG['COMPILE_ENVIRONMENT']:
for f in ['api-ms-win-*.dll', 'ucrtbase.dll']: for f in ['api-ms-win-*.dll', 'ucrtbase.dll']:
FINAL_TARGET_FILES += [ FINAL_TARGET_FILES += [
'%%%s/%s' % (CONFIG['WIN_UCRT_REDIST_DIR'], f) '%%%s/%s' % (CONFIG['WIN_UCRT_REDIST_DIR'], f)

View file

@ -20,7 +20,7 @@
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "VideoUtils.h" #include "VideoUtils.h"
const CLSID CLSID_VideoProcessorMFT = const CLSID sCLSID_VideoProcessorMFT =
{ {
0x88753b26, 0x88753b26,
0x5b24, 0x5b24,
@ -666,7 +666,7 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor,
} }
mTransform = new MFTDecoder(); mTransform = new MFTDecoder();
hr = mTransform->Create(CLSID_VideoProcessorMFT); hr = mTransform->Create(sCLSID_VideoProcessorMFT);
if (!SUCCEEDED(hr)) { if (!SUCCEEDED(hr)) {
aFailureReason = nsPrintfCString("MFTDecoder::Create(CLSID_VideoProcessorMFT) failed with code %X", hr); aFailureReason = nsPrintfCString("MFTDecoder::Create(CLSID_VideoProcessorMFT) failed with code %X", hr);
return hr; return hr;

View file

@ -18,6 +18,7 @@ which makes Windows Media Foundation unavailable.
#undef WINVER #undef WINVER
#define WINVER _WIN32_WINNT_WIN7 #define WINVER _WIN32_WINNT_WIN7
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <mfapi.h> #include <mfapi.h>
#include <mfidl.h> #include <mfidl.h>

View file

@ -21,12 +21,6 @@ WIN_LIBS= \
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
#include "plstr.h" #include "plstr.h"
#include <windows.h>
#include <tchar.h>
#include <unknwn.h>
#include <commdlg.h>
#include "nsIWebBrowserPrint.h" #include "nsIWebBrowserPrint.h"
#include "nsString.h" #include "nsString.h"
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
@ -43,7 +37,13 @@ WIN_LIBS= \
#include "nsCRT.h" #include "nsCRT.h"
#include "prenv.h" /* for PR_GetEnv */ #include "prenv.h" /* for PR_GetEnv */
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <tchar.h>
#include <unknwn.h>
#include <commdlg.h>
#include <winspool.h> #include <winspool.h>
// For Localization // For Localization

View file

@ -6,6 +6,7 @@
#ifndef GFX_READBACKMANAGERD3D11_H #ifndef GFX_READBACKMANAGERD3D11_H
#define GFX_READBACKMANAGERD3D11_H #define GFX_READBACKMANAGERD3D11_H
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <d3d10_1.h> #include <d3d10_1.h>

View file

@ -238,7 +238,7 @@ public:
virtual ID3D11ShaderResourceView* GetShaderResourceView() override; virtual ID3D11ShaderResourceView* GetShaderResourceView() override;
// Returns nullptr if this texture was created by a DXGI TextureHost. // Returns nullptr if this texture was created by a DXGI TextureHost.
virtual DataTextureSource* AsDataTextureSource() override { return mAllowTextureUploads ? this : false; } virtual DataTextureSource* AsDataTextureSource() override { return mAllowTextureUploads ? this : nullptr; }
virtual void DeallocateDeviceData() override { mTexture = nullptr; } virtual void DeallocateDeviceData() override { mTexture = nullptr; }

View file

@ -709,7 +709,11 @@ GenerateRandomSeed()
{ {
uint64_t seed = 0; uint64_t seed = 0;
#if defined(__linux__) #if defined(XP_WIN)
if (SystemFunction036(&seed, sizeof(seed)))
return seed;
#elif defined(__linux__)
// Linux does not provide arc4random(), so use /dev/urandom. // Linux does not provide arc4random(), so use /dev/urandom.
int fd = open("/dev/urandom", O_RDONLY); int fd = open("/dev/urandom", O_RDONLY);
if (fd >= 0) { if (fd >= 0) {
@ -732,8 +736,10 @@ GenerateRandomSeed()
#else #else
// Generic fallback // Generic fallback
uint32_t lo = random(); uint32_t lo = 0;
uint32_t hi = random(); uint32_t hi = 0;
lo = static_cast<uint32_t>(rand());
hi = static_cast<uint32_t>(rand());
return (static_cast<uint64_t>(hi) << 32) | lo; return (static_cast<uint64_t>(hi) << 32) | lo;
#endif #endif
} }

View file

@ -17,6 +17,7 @@
*/ */
#ifdef XP_WIN #ifdef XP_WIN
#include <stdlib.h>
#include <windows.h> #include <windows.h>
// mmsystem isn't part of WIN32_LEAN_AND_MEAN, so we have // mmsystem isn't part of WIN32_LEAN_AND_MEAN, so we have
// to manually include it // to manually include it

View file

@ -1 +1,13 @@
// Intentionally left blank /*
* Stagefright's win32 include path shadows the toolchain <pthread.h>.
* On MinGW we need the real pthread declarations for libstdc++ gthr.
*/
#ifndef stagefright_win32_pthread_h
#define stagefright_win32_pthread_h
#if defined(__MINGW32__)
# include_next <pthread.h>
#endif
#endif

View file

@ -43,9 +43,9 @@ public:
} }
addr_ = buf; addr_ = buf;
is_vpn_ = (local_addr.interface.type & NR_INTERFACE_TYPE_VPN) != 0 ? 1 : 0; is_vpn_ = (local_addr.if_info.type & NR_INTERFACE_TYPE_VPN) != 0 ? 1 : 0;
estimated_speed_ = local_addr.interface.estimated_speed; estimated_speed_ = local_addr.if_info.estimated_speed;
type_preference_ = GetNetworkTypePreference(local_addr.interface.type); type_preference_ = GetNetworkTypePreference(local_addr.if_info.type);
ip_version_ = local_addr.addr.ip_version; ip_version_ = local_addr.addr.ip_version;
return true; return true;
} }

View file

@ -1996,8 +1996,8 @@ class WebRtcIcePrioritizerTest : public StunTest {
std::string str_addr = "10.0.0." + num; std::string str_addr = "10.0.0." + num;
std::string ifname = "eth" + num; std::string ifname = "eth" + num;
nr_local_addr local_addr; nr_local_addr local_addr;
local_addr.interface.type = type; local_addr.if_info.type = type;
local_addr.interface.estimated_speed = estimated_speed; local_addr.if_info.estimated_speed = estimated_speed;
int r = nr_str_port_to_transport_addr(str_addr.c_str(), 0, int r = nr_str_port_to_transport_addr(str_addr.c_str(), 0,
IPPROTO_UDP, &(local_addr.addr)); IPPROTO_UDP, &(local_addr.addr));

View file

@ -40,13 +40,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from) int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from)
{ {
nr_transport_addr_copy(&(to->addr), &(from->addr)); nr_transport_addr_copy(&(to->addr), &(from->addr));
to->interface = from->interface; to->if_info = from->if_info;
return(0); return(0);
} }
int nr_local_addr_fmt_info_string(nr_local_addr *addr, char *buf, int len) int nr_local_addr_fmt_info_string(nr_local_addr *addr, char *buf, int len)
{ {
int addr_type = addr->interface.type; int addr_type = addr->if_info.type;
const char *vpn = (addr_type & NR_INTERFACE_TYPE_VPN) ? "VPN on " : ""; const char *vpn = (addr_type & NR_INTERFACE_TYPE_VPN) ? "VPN on " : "";
const char *type = (addr_type & NR_INTERFACE_TYPE_WIRED) ? "wired" : const char *type = (addr_type & NR_INTERFACE_TYPE_WIRED) ? "wired" :
@ -55,7 +55,7 @@ int nr_local_addr_fmt_info_string(nr_local_addr *addr, char *buf, int len)
"unknown"; "unknown";
snprintf(buf, len, "%s%s, estimated speed: %d kbps", snprintf(buf, len, "%s%s, estimated speed: %d kbps",
vpn, type, addr->interface.estimated_speed); vpn, type, addr->if_info.estimated_speed);
buf[len - 1] = '\0'; buf[len - 1] = '\0';
return (0); return (0);
} }

View file

@ -50,7 +50,7 @@ typedef struct nr_interface_ {
typedef struct nr_local_addr_ { typedef struct nr_local_addr_ {
nr_transport_addr addr; nr_transport_addr addr;
nr_interface interface; nr_interface if_info;
} nr_local_addr; } nr_local_addr;
int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from); int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from);

View file

@ -220,18 +220,18 @@ stun_get_win32_addrs(nr_local_addr addrs[], int maxaddrs, int *count)
strlcpy(addrs[n].addr.ifname, hex_hashed_ifname, sizeof(addrs[n].addr.ifname)); strlcpy(addrs[n].addr.ifname, hex_hashed_ifname, sizeof(addrs[n].addr.ifname));
if (tmpAddress->IfType == IF_TYPE_ETHERNET_CSMACD) { if (tmpAddress->IfType == IF_TYPE_ETHERNET_CSMACD) {
addrs[n].interface.type = NR_INTERFACE_TYPE_WIRED; addrs[n].if_info.type = NR_INTERFACE_TYPE_WIRED;
} else if (tmpAddress->IfType == IF_TYPE_IEEE80211) { } else if (tmpAddress->IfType == IF_TYPE_IEEE80211) {
/* Note: this only works for >= Win Vista */ /* Note: this only works for >= Win Vista */
addrs[n].interface.type = NR_INTERFACE_TYPE_WIFI; addrs[n].if_info.type = NR_INTERFACE_TYPE_WIFI;
} else { } else {
addrs[n].interface.type = NR_INTERFACE_TYPE_UNKNOWN; addrs[n].if_info.type = NR_INTERFACE_TYPE_UNKNOWN;
} }
#if (_WIN32_WINNT >= 0x0600) #if (_WIN32_WINNT >= 0x0600)
/* Note: only >= Vista provide link speed information */ /* Note: only >= Vista provide link speed information */
addrs[n].interface.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000; addrs[n].if_info.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000;
#else #else
addrs[n].interface.estimated_speed = 0; addrs[n].if_info.estimated_speed = 0;
#endif #endif
if (++n >= maxaddrs) if (++n >= maxaddrs)
goto done; goto done;
@ -300,11 +300,11 @@ stun_getifaddrs(nr_local_addr addrs[], int maxaddrs, int *count)
{ {
/* For wireless network, we won't get ethtool, it's a wired /* For wireless network, we won't get ethtool, it's a wired
* connection */ * connection */
addrs[*count].interface.type = NR_INTERFACE_TYPE_WIRED; addrs[*count].if_info.type = NR_INTERFACE_TYPE_WIRED;
#ifdef DONT_HAVE_ETHTOOL_SPEED_HI #ifdef DONT_HAVE_ETHTOOL_SPEED_HI
addrs[*count].interface.estimated_speed = ecmd.speed; addrs[*count].if_info.estimated_speed = ecmd.speed;
#else #else
addrs[*count].interface.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000; addrs[*count].if_info.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000;
#endif #endif
} }
@ -312,20 +312,20 @@ stun_getifaddrs(nr_local_addr addrs[], int maxaddrs, int *count)
e = ioctl(s, SIOCGIWRATE, &wrq); e = ioctl(s, SIOCGIWRATE, &wrq);
if (e == 0) if (e == 0)
{ {
addrs[*count].interface.type = NR_INTERFACE_TYPE_WIFI; addrs[*count].if_info.type = NR_INTERFACE_TYPE_WIFI;
addrs[*count].interface.estimated_speed = wrq.u.bitrate.value / 1000; addrs[*count].if_info.estimated_speed = wrq.u.bitrate.value / 1000;
} }
close(s); close(s);
if (if_addr->ifa_flags & IFF_POINTOPOINT) if (if_addr->ifa_flags & IFF_POINTOPOINT)
{ {
addrs[*count].interface.type = NR_INTERFACE_TYPE_UNKNOWN | NR_INTERFACE_TYPE_VPN; addrs[*count].if_info.type = NR_INTERFACE_TYPE_UNKNOWN | NR_INTERFACE_TYPE_VPN;
/* TODO (Bug 896913): find backend network type of this VPN */ /* TODO (Bug 896913): find backend network type of this VPN */
} }
#else #else
addrs[*count].interface.type = NR_INTERFACE_TYPE_UNKNOWN; addrs[*count].if_info.type = NR_INTERFACE_TYPE_UNKNOWN;
addrs[*count].interface.estimated_speed = 0; addrs[*count].if_info.estimated_speed = 0;
#endif #endif
strlcpy(addrs[*count].addr.ifname, if_addr->ifa_name, sizeof(addrs[*count].addr.ifname)); strlcpy(addrs[*count].addr.ifname, if_addr->ifa_name, sizeof(addrs[*count].addr.ifname));
++(*count); ++(*count);

View file

@ -73,11 +73,17 @@ void SetCurrentThreadName(const char* name) {
DWORD dwFlags; DWORD dwFlags;
} threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0}; } threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
#if defined(_MSC_VER)
__try { __try {
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD), ::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
reinterpret_cast<ULONG_PTR*>(&threadname_info)); reinterpret_cast<ULONG_PTR*>(&threadname_info));
} __except (EXCEPTION_EXECUTE_HANDLER) { } __except (EXCEPTION_EXECUTE_HANDLER) {
} }
#else
// MinGW does not support MSVC's __try/__except syntax.
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
reinterpret_cast<ULONG_PTR*>(&threadname_info));
#endif
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name)); prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)

View file

@ -605,7 +605,7 @@ BOOL MyWinHttpGetProxyForUrl(pfnWinHttpGetProxyForUrl pWHGPFU,
// error. // error.
BOOL success = FALSE; BOOL success = FALSE;
#if (_HAS_EXCEPTIONS == 0) #if (_HAS_EXCEPTIONS == 0) && defined(_MSC_VER)
__try { __try {
success = pWHGPFU(hWinHttp, url, options, info); success = pWHGPFU(hWinHttp, url, options, info);
} __except(EXCEPTION_EXECUTE_HANDLER) { } __except(EXCEPTION_EXECUTE_HANDLER) {

View file

@ -60,7 +60,7 @@ protected:
int32_t capabilityIndex); int32_t capabilityIndex);
int32_t DisconnectGraph(); int32_t DisconnectGraph();
HRESULT VideoCaptureDS::ConnectDVCamera(); HRESULT ConnectDVCamera();
DeviceInfoDS _dsInfo; DeviceInfoDS _dsInfo;
VideoCaptureCapability _activeCapability; VideoCaptureCapability _activeCapability;

View file

@ -12,6 +12,8 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#ifdef WIN32 #ifdef WIN32
#include <direct.h> #include <direct.h>
#include <tchar.h> #include <tchar.h>
@ -33,7 +35,6 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "webrtc/typedefs.h" // For architecture defines #include "webrtc/typedefs.h" // For architecture defines

View file

@ -212,6 +212,7 @@ static unsigned long tlsIndex = 0xffffffff;
#define _pthread_self() __threadid() #define _pthread_self() __threadid()
/* use MSVC intrinsics */ /* use MSVC intrinsics */
#if defined(_MSC_VER)
#pragma intrinsic(_BitScanForward) #pragma intrinsic(_BitScanForward)
static __forceinline int static __forceinline int
ffs(int x) ffs(int x)
@ -223,6 +224,16 @@ ffs(int x)
return (0); return (0);
} }
#else
static inline int
ffs(int x)
{
if (x == 0)
return (0);
return (__builtin_ctz((unsigned int)x) + 1);
}
#endif
/* Implement getenv without using malloc */ /* Implement getenv without using malloc */
static char mozillaMallocOptionsBuf[64]; static char mozillaMallocOptionsBuf[64];
@ -243,11 +254,13 @@ typedef unsigned char uint8_t;
typedef unsigned uint32_t; typedef unsigned uint32_t;
typedef unsigned long long uint64_t; typedef unsigned long long uint64_t;
typedef unsigned long long uintmax_t; typedef unsigned long long uintmax_t;
#if !defined(_SSIZE_T_) && !defined(_SSIZE_T_DEFINED)
#if defined(_WIN64) #if defined(_WIN64)
typedef long long ssize_t; typedef long long ssize_t;
#else #else
typedef long ssize_t; typedef long ssize_t;
#endif #endif
#endif
#define MALLOC_DECOMMIT #define MALLOC_DECOMMIT
#endif #endif

View file

@ -36,6 +36,12 @@ typedef __m128i z_vec128i_t;
#error chunkcopy.h inflate chunk SIMD is not defined for your build target #error chunkcopy.h inflate chunk SIMD is not defined for your build target
#endif #endif
#if defined(_MSC_VER)
#define Z_ALIGN16(type, name) __declspec(align(16)) type name
#else
#define Z_ALIGN16(type, name) type name __attribute__((aligned(16)))
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#if _MSC_VER < 1900 #if _MSC_VER < 1900
#define inline #define inline
@ -222,7 +228,7 @@ static inline z_vec128i_t v_load64_dup(const void* src) {
#if 0//def _WIN64 #if 0//def _WIN64
return _mm_set1_epi64x(i64); return _mm_set1_epi64x(i64);
#else #else
_declspec(align(16)) uint64_t temp[2] = {i64, i64}; Z_ALIGN16(uint64_t, temp[2]) = {i64, i64};
return _mm_load_si128((const __m128i*)temp); return _mm_load_si128((const __m128i*)temp);
#endif #endif
} }

View file

@ -88,4 +88,8 @@ else:
'inflate.c', 'inflate.c',
] ]
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['GNU_CC']:
SOURCES['crc32_simd.c'].flags += ['-msse4.2', '-mpclmul']
SOURCES['crc_folding.c'].flags += ['-msse4.2', '-mpclmul']

View file

@ -0,0 +1,85 @@
## UXP mozconfig thing based off roytam1's config and r3dfox config
##Uncomment PGO for release build
# 16 jobs for 16 cores
mk_add_options MOZ_MAKE_FLAGS="-j6"
# x86 build
ac_add_options --host=i686-pc-mingw32
ac_add_options --target=i686-pc-mingw32
WIN32_REDIST_DIR=$VCINSTALLDIR/Redist/MSVC/14.16.27012/x86
WIN_UCRT_REDIST_DIR=$WINDOWSSDKDIR/Redist/10.0.19041.0/ucrt/DLLs/r86
CC=gcc
CXX=g++
LD=g++
AR=ar
AS=as
RANLIB=ranlib
# Build only Hydra
ac_add_options --enable-application=basilisk
ac_add_options --disable-artifact-builds
# Updater stuffs
ac_add_options --disable-updater
# Enable if update server and signatures are figured out
#ac_add_options --enable-nss-mar
# Optimization settings
ac_add_options --disable-accessibility
ac_add_options --disable-debug
ac_add_options --disable-debug-js-modules
ac_add_options --disable-debug-symbols
ac_add_options --disable-tests
ac_add_options --enable-devtools
#ac_add_options --enable-install-strip
ac_add_options --enable-jemalloc
ac_add_options --enable-js-lto
ac_add_options --enable-optimize="-O2"
ac_add_options --enable-phoenix-extensions
ac_add_options --enable-release
ac_add_options --enable-shared-js
ac_add_options --enable-strip
MOZ_OPTIMIZE=1
export MOZ_OPTIMIZE=1
mk_add_options MOZ_OPTIMIZE=1
export MOZILLA_OFFICIAL=1
export STRIP_FLAGS="--strip-debug --strip-unneeded"
# Media settings
ac_add_options --enable-av1
ac_add_options --enable-jxl
ac_add_options --enable-raw
ac_add_options --disable-webrtc
# Client settings
ac_add_options --disable-crashreporter
ac_add_options --disable-eme
ac_add_options --disable-maintenance-service
ac_add_options --disable-parental-controls
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
export CROSS_COMPILE=0
export MOZ_CRASHREPORTER=0
export MOZ_DATA_REPORTING=0
export MOZ_INCLUDE_SOURCE_INFO=1
export MOZ_REQUIRE_SIGNING=
export MOZ_SOURCE_CHANGESET=iloveneedingtobodgechangesetfornoreason
export MOZ_TELEMETRY_REPORTING=
export MOZ_PACKAGE_JSSHELL=1
# Set -Copt-level=3
export OPT_LEVEL="3"
ac_add_options OPT_LEVEL="3"
# Enable LTO
export MOZ_LTO=1
ac_add_options MOZ_LTO=1
# Stops the compiler from bitching
export CFLAGS="-O2 -std=gnu++17"
export CPPFLAGS="-O2 -std=gnu++17"
export CXXFLAGS="-O2 -std=gnu++17"
export VERBOSE=0

View file

@ -3,11 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2ipdef.h> #include <ws2ipdef.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtrExtensions.h"
#include "NetworkInfoServiceImpl.h" #include "NetworkInfoServiceImpl.h"
@ -17,7 +18,7 @@ namespace net {
nsresult nsresult
DoListAddresses(AddrMapType& aAddrMap) DoListAddresses(AddrMapType& aAddrMap)
{ {
UniquePtr<MIB_IPADDRTABLE> ipAddrTable; UniqueFreePtr<MIB_IPADDRTABLE> ipAddrTable;
DWORD size = sizeof(MIB_IPADDRTABLE); DWORD size = sizeof(MIB_IPADDRTABLE);
ipAddrTable.reset((MIB_IPADDRTABLE*) malloc(size)); ipAddrTable.reset((MIB_IPADDRTABLE*) malloc(size));

View file

@ -6,6 +6,7 @@
#if defined(XP_MACOSX) || defined(XP_LINUX) #if defined(XP_MACOSX) || defined(XP_LINUX)
#include <unistd.h> #include <unistd.h>
#elif defined(XP_WIN) #elif defined(XP_WIN)
#include <stdlib.h>
#include <winsock2.h> #include <winsock2.h>
#endif #endif

View file

@ -8,6 +8,7 @@
// inet_ntop() doesn't exist on Windows XP. // inet_ntop() doesn't exist on Windows XP.
#define _WINSOCK_DEPRECATED_NO_WARNINGS #define _WINSOCK_DEPRECATED_NO_WARNINGS
#include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <windef.h> #include <windef.h>
#include <winbase.h> #include <winbase.h>

View file

@ -66,7 +66,7 @@ class VisualStudioBackend(CommonBackend):
self._out_dir = os.path.join(self.environment.topobjdir, 'msvc') self._out_dir = os.path.join(self.environment.topobjdir, 'msvc')
self._projsubdir = 'projects' self._projsubdir = 'projects'
self._version = self.environment.substs.get('MSVS_VERSION', '2015') self._version = self.environment.substs.get('MSVS_VERSION')
self._paths_to_sources = {} self._paths_to_sources = {}
self._paths_to_includes = {} self._paths_to_includes = {}
@ -132,6 +132,12 @@ class VisualStudioBackend(CommonBackend):
out_dir = self._out_dir out_dir = self._out_dir
out_proj_dir = os.path.join(self._out_dir, self._projsubdir) out_proj_dir = os.path.join(self._out_dir, self._projsubdir)
# If we do not have an MSVC version, we should not generate Visual
# Studio projects.
version = self._version
if not version:
return
projects = self._write_projects_for_sources(self._libs_to_paths, projects = self._write_projects_for_sources(self._libs_to_paths,
"library", out_proj_dir) "library", out_proj_dir)
projects.update(self._write_projects_for_sources(self._progs_to_paths, projects.update(self._write_projects_for_sources(self._progs_to_paths,

View file

@ -3,13 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if defined(XP_WIN) #if defined(XP_WIN)
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "updatecommon.h" #include "updatecommon.h"

View file

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <ras.h> #include <ras.h>
#include <wininet.h> #include <wininet.h>

View file

@ -93,6 +93,7 @@
#ifdef XP_WIN #ifdef XP_WIN
#include "nsIWinAppHelper.h" #include "nsIWinAppHelper.h"
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <intrin.h> #include <intrin.h>
#include <math.h> #include <math.h>
@ -136,7 +137,6 @@
#include "mozilla/StartupTimeline.h" #include "mozilla/StartupTimeline.h"
#include "mozilla/LateWriteChecks.h" #include "mozilla/LateWriteChecks.h"
#include <stdlib.h>
#include <locale.h> #include <locale.h>
#ifdef XP_UNIX #ifdef XP_UNIX

View file

@ -41,11 +41,11 @@
#include "nsNativeCharsetUtils.h" #include "nsNativeCharsetUtils.h"
#include "nsIAppStartup.h" #include "nsIAppStartup.h"
#include <stdlib.h>
#include <stdio.h>
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
#include <ddeml.h> #include <ddeml.h>
#include <stdlib.h>
#include <stdio.h>
#include <io.h> #include <io.h>
#include <direct.h> #include <direct.h>
#include <fcntl.h> #include <fcntl.h>

View file

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <audiopolicy.h> #include <audiopolicy.h>
#include <mmdeviceapi.h> #include <mmdeviceapi.h>

View file

@ -6,6 +6,8 @@
#ifndef __JumpListBuilder_h__ #ifndef __JumpListBuilder_h__
#define __JumpListBuilder_h__ #define __JumpListBuilder_h__
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#undef NTDDI_VERSION #undef NTDDI_VERSION

View file

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include "TaskbarPreview.h" #include "TaskbarPreview.h"
#include <nsITaskbarPreviewController.h> #include <nsITaskbarPreviewController.h>
#include <windows.h> #include <windows.h>

View file

@ -4,6 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include "WinTaskbar.h" #include "WinTaskbar.h"
#include "TaskbarPreview.h" #include "TaskbarPreview.h"
#include <nsITaskbarPreviewController.h> #include <nsITaskbarPreviewController.h>

View file

@ -39,7 +39,7 @@
// Starting with version 10.0.22621.0 of the Windows SDK the AR_STATE enum and // Starting with version 10.0.22621.0 of the Windows SDK the AR_STATE enum and
// types are only defined when building for Windows 8 instead of Windows 7. // types are only defined when building for Windows 8 instead of Windows 7.
#if (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602) #if (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602) && !defined(MOZ_AR_STATE_DEFINED)
enum tagAR_STATE { enum tagAR_STATE {
AR_ENABLED = 0x0, AR_ENABLED = 0x0,
@ -57,6 +57,8 @@ typedef enum tagAR_STATE AR_STATE;
using PAR_STATE = enum tagAR_STATE*; using PAR_STATE = enum tagAR_STATE*;
#define MOZ_AR_STATE_DEFINED 1
#endif // (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602) #endif // (WDK_NTDDI_VERSION >= 0x0A00000C) && (WINVER < 0x0602)
/** /**

View file

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <winsdkver.h> #include <winsdkver.h>
#include "mozwrlbase.h" #include "mozwrlbase.h"

View file

@ -7,6 +7,7 @@
#ifndef nsFilePicker_h__ #ifndef nsFilePicker_h__
#define nsFilePicker_h__ #define nsFilePicker_h__
#include <stdlib.h>
#include <windows.h> #include <windows.h>
// For Vista IFileDialog interfaces which aren't exposed // For Vista IFileDialog interfaces which aren't exposed

View file

@ -42,6 +42,7 @@ typedef enum _AR_STATE
AR_DOCKED = 0x40, AR_DOCKED = 0x40,
AR_LAPTOP = 0x80 AR_LAPTOP = 0x80
} AR_STATE, *PAR_STATE; } AR_STATE, *PAR_STATE;
#define MOZ_AR_STATE_DEFINED 1
#endif #endif
class nsLookAndFeel: public nsXPLookAndFeel { class nsLookAndFeel: public nsXPLookAndFeel {

View file

@ -10,9 +10,9 @@
#error This file only makes sense on Windows. #error This file only makes sense on Windows.
#endif #endif
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <nscore.h> #include <nscore.h>
#include <stdlib.h>
namespace mozilla { namespace mozilla {

View file

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if defined(XP_WIN) #if defined(XP_WIN)
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <objbase.h> #include <objbase.h>
#elif defined(XP_MACOSX) #elif defined(XP_MACOSX)

View file

@ -6,6 +6,7 @@
/***************************** /*****************************
Windows implementation of probes, using xperf Windows implementation of probes, using xperf
*****************************/ *****************************/
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <wmistr.h> #include <wmistr.h>
#include <evntrace.h> #include <evntrace.h>

View file

@ -3,9 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <stdlib.h>
#include "nsWindowsRegKey.h" #include "nsWindowsRegKey.h"
#include "nsString.h" #include "nsString.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"

View file

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FileUtilsWin.h" #include "FileUtilsWin.h"
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <psapi.h> #include <psapi.h>

View file

@ -6,6 +6,7 @@
#ifndef mozilla_FileUtilsWin_h #ifndef mozilla_FileUtilsWin_h
#define mozilla_FileUtilsWin_h #define mozilla_FileUtilsWin_h
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include "mozilla/Scoped.h" #include "mozilla/Scoped.h"

View file

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <stdlib.h>
#include "SpecialSystemDirectory.h" #include "SpecialSystemDirectory.h"
#include "nsString.h" #include "nsString.h"
#include "nsDependentString.h" #include "nsDependentString.h"
@ -10,9 +11,9 @@
#if defined(XP_WIN) #if defined(XP_WIN)
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <direct.h> #include <direct.h>

View file

@ -19,11 +19,11 @@
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include "nsILocalFileMac.h" #include "nsILocalFileMac.h"
#elif defined(XP_WIN) #elif defined(XP_WIN)
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
#elif defined(XP_UNIX) #elif defined(XP_UNIX)
#include <unistd.h> #include <unistd.h>
#include <stdlib.h>
#include <sys/param.h> #include <sys/param.h>
#endif #endif

View file

@ -19,9 +19,9 @@
#include "nsIStringEnumerator.h" #include "nsIStringEnumerator.h"
#if defined(XP_WIN) #if defined(XP_WIN)
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#elif defined(XP_UNIX) #elif defined(XP_UNIX)
#include <unistd.h> #include <unistd.h>

View file

@ -29,16 +29,16 @@
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
#include <direct.h> #include <direct.h>
#include <windows.h> #include <stdlib.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <aclapi.h> #include <aclapi.h>
#include <windows.h>
#include "shellapi.h" #include "shellapi.h"
#include "shlguid.h" #include "shlguid.h"
#include <io.h> #include <io.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <mbstring.h> #include <mbstring.h>
#include "nsXPIDLString.h" #include "nsXPIDLString.h"

View file

@ -9,7 +9,7 @@
// Windows // Windows
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if defined(XP_WIN) #if defined(XP_WIN)
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include "nsString.h" #include "nsString.h"
#include "nsAString.h" #include "nsAString.h"

View file

@ -519,14 +519,16 @@ nsTimerImpl::Fire(int32_t aGeneration)
this, (TimeStamp::Now() - now).ToMilliseconds())); this, (TimeStamp::Now() - now).ToMilliseconds()));
} }
#if defined(HAVE_DLADDR) && defined(HAVE___CXA_DEMANGLE) #if defined(HAVE_DLADDR) && defined(HAVE___CXA_DEMANGLE) && !defined(XP_WIN)
#define USE_DLADDR 1 #define USE_DLADDR 1
#endif #endif
#ifdef USE_DLADDR #ifdef USE_DLADDR
#if !defined(XP_WIN)
#include <cxxabi.h> #include <cxxabi.h>
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
#endif
// See the big comment above GetTimerFiringsLog() to understand this code. // See the big comment above GetTimerFiringsLog() to understand this code.
void void

View file

@ -4,8 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Windows only app to show a modal debug dialog - launched by nsDebug.cpp */ /* Windows only app to show a modal debug dialog - launched by nsDebug.cpp */
#include <windows.h>
#include <stdlib.h> #include <stdlib.h>
#include <windows.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <strsafe.h> #include <strsafe.h>
#endif #endif