Mirror of roytam1's UXP fork just in case Moonchild and Tobin decide to go after him
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.6 KiB

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
FINAL_LIBRARY = 'js'
if CONFIG['MOZ_SYSTEM_FFI']:
OS_LIBS += CONFIG['MOZ_FFI_LIBS']
else:
ALLOW_COMPILER_WARNINGS = True
NO_VISIBILITY_FLAGS = True
CONFIGURE_DEFINE_FILES += [
'../../../js/src/ctypes/libffi/fficonfig.h',
]
GENERATED_FILES += [
'../../../js/src/ctypes/libffi/include/ffi.h',
]
ffi_h = GENERATED_FILES['../../../js/src/ctypes/libffi/include/ffi.h']
ffi_h.script = 'subst_header.py'
ffi_h.inputs = ['../../../js/src/ctypes/libffi/include/ffi.h.in']
LOCAL_INCLUDES += [
'!/js/src/ctypes/libffi',
'!/js/src/ctypes/libffi/include',
'/js/src/ctypes/libffi/include',
'/js/src/ctypes/libffi/src/%s' % CONFIG['FFI_TARGET_DIR'],
]
DEFINES.update({
'TARGET': CONFIG['FFI_TARGET'],
CONFIG['FFI_TARGET']: True,
'FFI_NO_RAW_API': True,
'HAVE_AS_ASCII_PSEUDO_OP': True,
'HAVE_AS_STRING_PSEUDO_OP': True,
})
# This should NEVER be true on 32-bit x86 systems. It's called x86_64 unwind
# section type for a reason. By rights the way it was before should have broken
# all 32-bit builds on x86.
if CONFIG['FFI_TARGET'] == 'X86':
DEFINES['HAVE_AS_X86_64_UNWIND_SECTION_TYPE'] = False
else:
DEFINES['HAVE_AS_X86_64_UNWIND_SECTION_TYPE'] = True
if CONFIG['MOZ_DEBUG']:
DEFINES['FFI_DEBUG'] = True
if not CONFIG['MOZ_NO_DEBUG_RTL']:
DEFINES['USE_DEBUG_RTL'] = True
SOURCES += [
'/js/src/ctypes/libffi/src/debug.c',
]
if CONFIG['OS_TARGET'] not in ('WINNT', 'Darwin'):
DEFINES['HAVE_HIDDEN_VISIBILITY_ATTRIBUTE'] = True
# Solaris uses datarel encoding for x86. This causes a lot of really stupid
# problems, like the vast majority of x86 assembler not being considered PIC
# on Solaris.
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['OS_TARGET'] != 'SunOS':
DEFINES['HAVE_AS_X86_PCREL'] = True
MoonchildProductions#1251 - Part 23: Allow AMD64 build to work. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Compiling_32-bit_Firefox_on_a_Linux_64-bit_OS Setting this up turned out to be easier than I thought it would be. All I had to do was apply these instructions in reverse and add the following to my .mozconfig file: CC="gcc -m64" CXX="g++ -m64" AS="gas --64" ac_add_options --target=x86_64-pc-solaris2.11 export PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig ac_add_options --libdir=/usr/lib/amd64 ac_add_options --x-libraries=/usr/lib/amd64 Most of these changes were fairly trivial, just requiring me to make a few of the changes I made earlier conditional on a 32-bit build. The biggest challenge was figuring out why the JavaScript engine triggered a segfault everytime it tried to allocate memory. But this patch fixes it: https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/web/firefox/patches/patch-js_src_gc_Memory.cpp.patch Turns out that Solaris on AMD64 handles memory management in a fairly unusual way with a segmented memory model, but it's not that different from what we see on other 64-bit processors. In fact, I saw a SPARC crash for a similar reason, and noticed that it looked just like mine except the numbers in the first segment were reversed. Having played around with hex editors before, I had a feeling I might be dealing with a little-endian version of a big-endian problem, but I didn't expect that knowledge to actually yield an easy solution. https://bugzilla.mozilla.org/show_bug.cgi?id=577056 https://www.oracle.com/technetwork/server-storage/solaris10/solaris-memory-135224.html As far as I can tell, this was the last barrier to an AMD64 Solaris build of Pale Moon.
2 years ago
# Which is why they apparently don't do this anymore on amd64.
if CONFIG['FFI_TARGET'] == 'X86_64' and CONFIG['OS_TARGET'] == 'SunOS':
DEFINES['HAVE_AS_X86_PCREL'] = True
# Don't bother setting EH_FRAME_FLAGS on Windows.
# Quoted defines confuse msvcc.sh, and the value isn't used there.
if CONFIG['OS_TARGET'] != 'WINNT':
# Solaris seems to require EH_FRAME to be writable even on x86.
# It works fine most of the time and there's no rule against it,
# but it causes a lot of weird problems.
MoonchildProductions#1251 - Part 23: Allow AMD64 build to work. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Compiling_32-bit_Firefox_on_a_Linux_64-bit_OS Setting this up turned out to be easier than I thought it would be. All I had to do was apply these instructions in reverse and add the following to my .mozconfig file: CC="gcc -m64" CXX="g++ -m64" AS="gas --64" ac_add_options --target=x86_64-pc-solaris2.11 export PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig ac_add_options --libdir=/usr/lib/amd64 ac_add_options --x-libraries=/usr/lib/amd64 Most of these changes were fairly trivial, just requiring me to make a few of the changes I made earlier conditional on a 32-bit build. The biggest challenge was figuring out why the JavaScript engine triggered a segfault everytime it tried to allocate memory. But this patch fixes it: https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/web/firefox/patches/patch-js_src_gc_Memory.cpp.patch Turns out that Solaris on AMD64 handles memory management in a fairly unusual way with a segmented memory model, but it's not that different from what we see on other 64-bit processors. In fact, I saw a SPARC crash for a similar reason, and noticed that it looked just like mine except the numbers in the first segment were reversed. Having played around with hex editors before, I had a feeling I might be dealing with a little-endian version of a big-endian problem, but I didn't expect that knowledge to actually yield an easy solution. https://bugzilla.mozilla.org/show_bug.cgi?id=577056 https://www.oracle.com/technetwork/server-storage/solaris10/solaris-memory-135224.html As far as I can tell, this was the last barrier to an AMD64 Solaris build of Pale Moon.
2 years ago
if CONFIG['FFI_TARGET'] == 'ARM':
DEFINES['EH_FRAME_FLAGS'] = '"aw"'
elif CONFIG['FFI_TARGET'] == 'X86' and CONFIG['OS_TARGET'] == 'SunOS':
DEFINES['EH_FRAME_FLAGS'] = '"aw"'
else:
DEFINES['EH_FRAME_FLAGS'] = '"a"'
if CONFIG['CLANG_CL']:
ASFLAGS += ['-clang-cl']
# Common source files.
SOURCES += [
'/js/src/ctypes/libffi/src/closures.c',
'/js/src/ctypes/libffi/src/java_raw_api.c',
'/js/src/ctypes/libffi/src/prep_cif.c',
'/js/src/ctypes/libffi/src/raw_api.c',
'/js/src/ctypes/libffi/src/types.c',
]
# Per-platform sources and flags.
ffi_srcs = ()
if CONFIG['FFI_TARGET'] == 'ARM':
ffi_srcs = ('sysv.S', 'ffi.c')
if CONFIG['CLANG_CXX']:
ASFLAGS += ['-no-integrated-as']
elif CONFIG['FFI_TARGET'] == 'AARCH64':
ffi_srcs = ('sysv.S', 'ffi.c')
elif CONFIG['FFI_TARGET'] == 'X86':
ffi_srcs = ('ffi.c', 'sysv.S', 'win32.S')
elif CONFIG['FFI_TARGET'] == 'X86_64':
ffi_srcs = ('ffi64.c', 'unix64.S', 'ffi.c', 'sysv.S')
elif CONFIG['FFI_TARGET'] == 'X86_WIN32':
# MinGW Build for 32 bit
if CONFIG['CC_TYPE'] == 'gcc':
DEFINES['SYMBOL_UNDERSCORE'] = True
ffi_srcs = ('ffi.c', 'win32.S')
elif CONFIG['FFI_TARGET'] == 'X86_WIN64':
ffi_srcs = ('ffi.c', 'win64.S')
ASFLAGS += ['-m64']
elif CONFIG['FFI_TARGET'] == 'X86_DARWIN':
DEFINES['FFI_MMAP_EXEC_WRIT'] = True
if CONFIG['OS_TEST'] != 'x86_64':
ffi_srcs = ('ffi.c', 'darwin.S', 'ffi64.c', 'darwin64.S',
'win32.S')
DEFINES['SYMBOL_UNDERSCORE'] = True
else:
ffi_srcs = ('ffi.c', 'darwin.S', 'ffi64.c', 'darwin64.S')
SOURCES += [
'/js/src/ctypes/libffi/src/%s/%s' % (CONFIG['FFI_TARGET_DIR'], s)
for s in sorted(ffi_srcs)
]