mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
[BETA] GNU/Linux support
This commit is contained in:
parent
071805cddb
commit
4898f49c28
5 changed files with 117 additions and 4 deletions
|
|
@ -108,7 +108,7 @@ if test "$echo_libdir" = "yes"; then
|
|||
fi
|
||||
|
||||
if test "$echo_cflags" = "yes"; then
|
||||
echo "-std=gnu++11 -include $includedir/$JS_LIBRARY_NAME/js/RequiredDefines.h -I$includedir/$JS_LIBRARY_NAME $NSPR_CFLAGS"
|
||||
echo "-std=gnu++17 -include $includedir/$JS_LIBRARY_NAME/js/RequiredDefines.h -I$includedir/$JS_LIBRARY_NAME $NSPR_CFLAGS"
|
||||
fi
|
||||
|
||||
if test "$echo_libs" = "yes"; then
|
||||
|
|
|
|||
|
|
@ -132,7 +132,8 @@ uint32_t av_get_random_seed(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_ARC4RANDOM
|
||||
/* Don’t use arc4random() on Linux – glibc doesn’t provide it */
|
||||
#if HAVE_ARC4RANDOM && !defined(__linux__)
|
||||
return arc4random();
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,15 @@ if CONFIG['INTEL_ARCHITECTURE']:
|
|||
SOURCES += [
|
||||
'simd_darwin_stub.c',
|
||||
]
|
||||
if CONFIG['OS_ARCH'] == 'Linux':
|
||||
# Keep SIMD/chunkcopy paths disabled on Linux, but provide fallback
|
||||
# helper symbols used by crc32/deflate call sites.
|
||||
DEFINES['ADLER32_SIMD_SSSE3'] = False
|
||||
DEFINES['INFLATE_CHUNK_SIMD_SSE2'] = False
|
||||
DEFINES['CRC32_SIMD_SSE42_PCLMUL'] = False
|
||||
SOURCES += [
|
||||
'simd_darwin_stub.c',
|
||||
]
|
||||
else:
|
||||
DEFINES['INFLATE_CHUNK_SIMD_SSE2'] = True
|
||||
SOURCES += [
|
||||
|
|
@ -68,7 +77,8 @@ SOURCES += [
|
|||
'zutil.c',
|
||||
]
|
||||
|
||||
if CONFIG['CPU_ARCH'] == 'arm' or (CONFIG['INTEL_ARCHITECTURE'] and CONFIG['OS_ARCH'] != 'Darwin'):
|
||||
# Enable SIMD inflate only on Windows (WINNT). Disable on Linux, BSD, Darwin, etc.
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
SOURCES += [
|
||||
'inflate_simd.c',
|
||||
]
|
||||
|
|
@ -77,3 +87,4 @@ else:
|
|||
'inflate.c',
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
70
mozconfigs/uxp-linux-x64
Normal file
70
mozconfigs/uxp-linux-x64
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# Clear this if not a 64bit build
|
||||
_BUILD_64=1
|
||||
|
||||
# 16 jobs for 16 cores
|
||||
mk_add_options MOZ_MAKE_FLAGS="-j6"
|
||||
|
||||
# Set GTK Version to 2 or 3
|
||||
_GTK_VERSION=3
|
||||
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
export CXXFLAGS="-std=gnu++17 -DNO_SIMD -DHAVE_ARC4RANDOM=0 -DHAVE_ARC4RANDOM_BUF=0"
|
||||
export CFLAGS="-std=gnu17 -DNO_SIMD -DHAVE_ARC4RANDOM=0 -DHAVE_ARC4RANDOM_BUF=0"
|
||||
|
||||
ac_add_options --enable-application=basilisk
|
||||
|
||||
# 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 -w"
|
||||
ac_add_options --enable-phoenix-extensions
|
||||
ac_add_options --enable-release
|
||||
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 --enable-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
|
||||
|
||||
# Processor architecture specific build options
|
||||
if [ -n "$_BUILD_64" ]; then
|
||||
ac_add_options --x-libraries=/usr/lib64
|
||||
else
|
||||
ac_add_options --x-libraries=/usr/lib
|
||||
fi
|
||||
|
||||
export MOZ_PKG_SPECIAL=gtk$_GTK_VERSION
|
||||
|
|
@ -125,6 +125,31 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId)
|
|||
setstate(mState);
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
// Linux does not provide arc4random_buf or arc4random.
|
||||
// Use /dev/urandom for secure UUID generation.
|
||||
int fd = open("/dev/urandom", O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
ssize_t n = read(fd, aId, sizeof(nsID));
|
||||
close(fd);
|
||||
if (n == sizeof(nsID)) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback if /dev/urandom fails
|
||||
size_t bytesLeft = sizeof(nsID);
|
||||
while (bytesLeft > 0) {
|
||||
long rval = random();
|
||||
const size_t mRBytes = 4;
|
||||
size_t toCopy = std::min(bytesLeft, mRBytes);
|
||||
memcpy(reinterpret_cast<char*>(aId) + (sizeof(nsID) - bytesLeft),
|
||||
&rval, toCopy);
|
||||
bytesLeft -= toCopy;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef HAVE_ARC4RANDOM_BUF
|
||||
arc4random_buf(aId, sizeof(nsID));
|
||||
#else /* HAVE_ARC4RANDOM_BUF */
|
||||
|
|
@ -135,8 +160,14 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId)
|
|||
const size_t mRBytes = 4;
|
||||
#else
|
||||
long rval = random();
|
||||
const size_t mRBytes = 4;
|
||||
#endif
|
||||
|
||||
size_t toCopy = std::min(bytesLeft, mRBytes);
|
||||
memcpy(reinterpret_cast<char*>(aId) + (sizeof(nsID) - bytesLeft),
|
||||
&rval, toCopy);
|
||||
bytesLeft -= toCopy;
|
||||
}
|
||||
#endif /* HAVE_ARC4RANDOM_BUF */
|
||||
|
||||
uint8_t* src = (uint8_t*)&rval;
|
||||
// We want to grab the mRBytes least significant bytes of rval, since
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue