28 changed files with 553 additions and 103 deletions
-
75.ci/wasm/build.sh
-
55.patch/openssl-cmake/0005-wasm-support.patch
-
108.patch/openssl/0002-wasm-support.patch
-
18CMakeLists.txt
-
3cpmfile.json
-
14externals/cmake-modules/DetectArchitecture.cmake
-
3externals/cmake-modules/DetectPlatform.cmake
-
87externals/ffmpeg/CMakeLists.txt
-
2externals/tz/tz/tz.cpp
-
26src/CMakeLists.txt
-
2src/audio_core/CMakeLists.txt
-
8src/common/CMakeLists.txt
-
95src/common/fiber.cpp
-
3src/common/fiber.h
-
19src/core/CMakeLists.txt
-
6src/core/arm/dynarmic/arm_dynarmic.h
-
27src/core/debugger/debugger.cpp
-
13src/core/hle/kernel/k_process.cpp
-
2src/hid_core/CMakeLists.txt
-
5src/hid_core/resources/abstracted_pad/abstract_mcu_handler.h
-
10src/hid_core/resources/shared_memory_holder.h
-
12src/input_common/CMakeLists.txt
-
22src/input_common/main.cpp
-
5src/shader_recompiler/CMakeLists.txt
-
12src/shader_recompiler/environment.h
-
11src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch_swizzled.cpp
-
11src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp
-
2src/video_core/CMakeLists.txt
@ -0,0 +1,75 @@ |
|||||
|
#!/bin/sh -ex |
||||
|
|
||||
|
# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project |
||||
|
# SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
NUM_JOBS=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2) |
||||
|
|
||||
|
: "${CCACHE:=false}" |
||||
|
RETURN=0 |
||||
|
|
||||
|
usage() { |
||||
|
cat <<EOF |
||||
|
Usage: $0 [-b|--build-type BUILD_TYPE] [-o|--outdir OUTPUT_DIRECTORY] |
||||
|
|
||||
|
Build script for Emscripten (using wasm64). |
||||
|
|
||||
|
Options: |
||||
|
--build-type Set the CMake build type (Release|RelWithDebInfo|MinSizeRel|Debug) |
||||
|
Default: Release |
||||
|
--outdir Set the output directory |
||||
|
Default: build |
||||
|
|
||||
|
EOF |
||||
|
exit "$RETURN" |
||||
|
} |
||||
|
|
||||
|
die() { |
||||
|
echo "-- ! $*" >&2 |
||||
|
RETURN=1 usage |
||||
|
} |
||||
|
|
||||
|
type() { |
||||
|
[ -z "$1" ] && die "You must specify a valid type." |
||||
|
TYPE="$1" |
||||
|
} |
||||
|
|
||||
|
outdir() { |
||||
|
[ -z "$1" ] && die "You must specify a valid output directory." |
||||
|
OUTDIR="$1" |
||||
|
} |
||||
|
|
||||
|
while true; do |
||||
|
case "$1" in |
||||
|
-r|--release) DEVEL=false ;; |
||||
|
-b|--build-type) type "$2"; shift ;; |
||||
|
-o|--outdir) outdir "$2"; shift ;; |
||||
|
-h|--help) usage ;; |
||||
|
*) break ;; |
||||
|
esac |
||||
|
shift |
||||
|
done |
||||
|
|
||||
|
: "${TYPE:=Release}" |
||||
|
: "${DEVEL:=true}" |
||||
|
: "${OUTDIR:=build}" |
||||
|
|
||||
|
emcmake cmake -B "$OUTDIR" -G "Unix Makefiles" \ |
||||
|
-DCMAKE_BUILD_TYPE=${TYPE} \ |
||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ |
||||
|
-DENABLE_OPENGL=OFF \ |
||||
|
-DENABLE_LTO=OFF \ |
||||
|
-DENABLE_QT=OFF \ |
||||
|
-DENABLE_UNITY_BUILD=OFF \ |
||||
|
-DENABLE_QT_TRANSLATION=OFF \ |
||||
|
-DENABLE_CUBEB=OFF \ |
||||
|
-DENABLE_LIBUSB=OFF \ |
||||
|
-DENABLE_UPDATE_CHECKER=OFF \ |
||||
|
-DENABLE_WEB_SERVICE=OFF \ |
||||
|
-DUSE_DISCORD_PRESENCE=OFF \ |
||||
|
-DUSE_FASTER_LINKER=ON \ |
||||
|
-DYUZU_USE_BUNDLED_OPENSSL=OFF \ |
||||
|
-DYUZU_USE_EXTERNAL_FFMPEG=ON \ |
||||
|
-Dzstd_FORCE_BUNDLED=ON \ |
||||
|
-DOpenSSL_FORCE_BUNDLED=ON |
||||
|
cmake --build "$OUTDIR" -- -j$NUM_JOBS |
||||
@ -0,0 +1,55 @@ |
|||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
|
index 1ca57e1..d38c0c6 100644
|
||||
|
--- a/CMakeLists.txt
|
||||
|
+++ b/CMakeLists.txt
|
||||
|
@@ -113,9 +113,10 @@ elseif(MINGW)
|
||||
|
find_program(MAKE mingw32-make REQUIRED) |
||||
|
set(OPENSSL_BUILD_TOOL ${MAKE}) |
||||
|
else() |
||||
|
- find_program(MAKE make REQUIRED)
|
||||
|
+ find_program(MAKE gmake REQUIRED)
|
||||
|
set(OPENSSL_BUILD_TOOL ${MAKE}) |
||||
|
endif() |
||||
|
+set(OPENSSL_BUILD_TOOL gmake)
|
||||
|
|
||||
|
# Modify configure/build options |
||||
|
if(OPENSSL_TEST AND NOT CMAKE_CROSSCOMPILING) |
||||
|
@@ -140,7 +141,7 @@ if(NUMBER_OF_THREADS GREATER 1)
|
||||
|
list(APPEND OPENSSL_CONFIGURE_OPTIONS /FS) |
||||
|
list(APPEND OPENSSL_BUILD_OPTIONS /J ${NUMBER_OF_THREADS}) |
||||
|
else() |
||||
|
- list(APPEND OPENSSL_BUILD_OPTIONS -j ${NUMBER_OF_THREADS})
|
||||
|
+# list(APPEND OPENSSL_BUILD_OPTIONS -j ${NUMBER_OF_THREADS})
|
||||
|
endif() |
||||
|
endif() |
||||
|
|
||||
|
diff --git a/cmake/ConfigureOpenSSL.cmake b/cmake/ConfigureOpenSSL.cmake
|
||||
|
index 3012e05..9862aa0 100644
|
||||
|
--- a/cmake/ConfigureOpenSSL.cmake
|
||||
|
+++ b/cmake/ConfigureOpenSSL.cmake
|
||||
|
@@ -134,10 +134,24 @@ function(configure_openssl)
|
||||
|
set(VERBOSE_OPTION OUTPUT_QUIET) |
||||
|
endif() |
||||
|
|
||||
|
+ if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
|
+ set(EMSCRIPTEN_CMAKE_WRAPPER "emcmake")
|
||||
|
+ find_program(EMCC emcc REQUIRED)
|
||||
|
+ set(EMSCRIPTEN_LINKER ${EMCC})
|
||||
|
+ list(APPEND CONFIGURE_COMMAND wasm64)
|
||||
|
+ else()
|
||||
|
+ set(EMSCRIPTEN_CMAKE_WRAPPER "")
|
||||
|
+ set(EMSCRIPTEN_LINKER ${CMAKE_LINKER})
|
||||
|
+ endif ()
|
||||
|
+
|
||||
|
execute_process( |
||||
|
- COMMAND ${CMAKE_COMMAND} -E env
|
||||
|
+ COMMAND ${EMSCRIPTEN_CMAKE_WRAPPER} ${CMAKE_COMMAND} -E env
|
||||
|
"CFLAGS=${CMAKE_C_FLAGS}" |
||||
|
"CXXFLAGS=${CMAKE_CXX_FLAGS}" |
||||
|
+ "LDFLAGS=${CMAKE_CXX_LINKER_FLAGS}"
|
||||
|
+ "CC=${CMAKE_C_COMPILER}"
|
||||
|
+ "CXX=${CMAKE_CXX_COMPILER}"
|
||||
|
+ "LD=${EMSCRIPTEN_LINKER}"
|
||||
|
${CONFIGURE_COMMAND} |
||||
|
WORKING_DIRECTORY ${CONFIGURE_BUILD_DIR} |
||||
|
${VERBOSE_OPTION} |
||||
@ -0,0 +1,108 @@ |
|||||
|
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
|
||||
|
index e62721e..6fcea0d 100644
|
||||
|
--- a/Configurations/10-main.conf
|
||||
|
+++ b/Configurations/10-main.conf
|
||||
|
@@ -1970,6 +1970,26 @@ my %targets = (
|
||||
|
multilib => "64", |
||||
|
}, |
||||
|
|
||||
|
+ "wasm32" => {
|
||||
|
+ inherit_from => [ "BASE_unix" ],
|
||||
|
+ CC => "emcc",
|
||||
|
+ CXX => "emc++",
|
||||
|
+ cflags => add("--target=wasm32-unknown-emscripten"),
|
||||
|
+ cxxflags => add("--target=wasm32-unknown-emscripten"),
|
||||
|
+ lib_cppflags => add("-DL_ENDIAN"),
|
||||
|
+ bn_ops => "THIRTY_TWO_BIT",
|
||||
|
+ },
|
||||
|
+ "wasm64" => {
|
||||
|
+ inherit_from => [ "BASE_unix" ],
|
||||
|
+ CC => "emcc",
|
||||
|
+ CXX => "emc++",
|
||||
|
+ cflags => add("--target=wasm64-unknown-emscripten"),
|
||||
|
+ cxxflags => add("--target=wasm64-unknown-emscripten"),
|
||||
|
+ lib_cppflags => add("-DL_ENDIAN"),
|
||||
|
+ bn_ops => "SIXTY_FOUR_BIT_LONG",
|
||||
|
+ },
|
||||
|
+
|
||||
|
+
|
||||
|
#### uClinux |
||||
|
"uClinux-dist" => { |
||||
|
inherit_from => [ "BASE_unix" ], |
||||
|
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
|
||||
|
index d9e8f02..0bd63b0 100644
|
||||
|
--- a/crypto/rand/rand_lib.c
|
||||
|
+++ b/crypto/rand/rand_lib.c
|
||||
|
@@ -379,17 +379,25 @@ void RAND_add(const void *buf, int num, double randomness)
|
||||
|
#if !defined(OPENSSL_NO_DEPRECATED_1_1_0) |
||||
|
int RAND_pseudo_bytes(unsigned char *buf, int num) |
||||
|
{ |
||||
|
+#ifdef __EMSCRIPTEN__
|
||||
|
+ arc4random_buf(buf, num);
|
||||
|
+ return 1;
|
||||
|
+#else
|
||||
|
const RAND_METHOD *meth = RAND_get_rand_method(); |
||||
|
|
||||
|
if (meth != NULL && meth->pseudorand != NULL) |
||||
|
return meth->pseudorand(buf, num); |
||||
|
ERR_raise(ERR_LIB_RAND, RAND_R_FUNC_NOT_IMPLEMENTED); |
||||
|
return -1; |
||||
|
+#endif
|
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
int RAND_status(void) |
||||
|
{ |
||||
|
+#ifdef __EMSCRIPTEN__
|
||||
|
+ return 1;
|
||||
|
+#else
|
||||
|
EVP_RAND_CTX *rand; |
||||
|
#ifndef OPENSSL_NO_DEPRECATED_3_0 |
||||
|
const RAND_METHOD *meth = RAND_get_rand_method(); |
||||
|
@@ -401,6 +409,7 @@ int RAND_status(void)
|
||||
|
if ((rand = RAND_get0_primary(NULL)) == NULL) |
||||
|
return 0; |
||||
|
return EVP_RAND_get_state(rand) == EVP_RAND_STATE_READY; |
||||
|
+#endif
|
||||
|
} |
||||
|
#else /* !FIPS_MODULE */ |
||||
|
|
||||
|
@@ -420,6 +429,10 @@ const RAND_METHOD *RAND_get_rand_method(void)
|
||||
|
int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num, |
||||
|
unsigned int strength) |
||||
|
{ |
||||
|
+#ifdef __EMSCRIPTEN__
|
||||
|
+ arc4random_buf(buf, num);
|
||||
|
+ return 1;
|
||||
|
+#else
|
||||
|
RAND_GLOBAL *dgbl; |
||||
|
EVP_RAND_CTX *rand; |
||||
|
#if !defined(OPENSSL_NO_DEPRECATED_3_0) && !defined(FIPS_MODULE) |
||||
|
@@ -451,6 +464,7 @@ int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
|
||||
|
return EVP_RAND_generate(rand, buf, num, strength, 0, NULL, 0); |
||||
|
|
||||
|
return 0; |
||||
|
+#endif
|
||||
|
} |
||||
|
|
||||
|
int RAND_priv_bytes(unsigned char *buf, int num) |
||||
|
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
|
||||
|
index 3d21801..e026f8f 100644
|
||||
|
--- a/ssl/ssl_cert.c
|
||||
|
+++ b/ssl/ssl_cert.c
|
||||
|
@@ -941,6 +941,7 @@ done:
|
||||
|
return ret; |
||||
|
} |
||||
|
|
||||
|
+#ifndef OPENSSL_NO_POSIX_IO
|
||||
|
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, |
||||
|
const char *dir) |
||||
|
{ |
||||
|
@@ -1016,6 +1017,7 @@ err:
|
||||
|
|
||||
|
return ret; |
||||
|
} |
||||
|
+#endif
|
||||
|
|
||||
|
static int add_uris_recursive(STACK_OF(X509_NAME) *stack, |
||||
|
const char *uri, int depth) |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue