[go: nahoru, domu]

Skip to content

Commit

Permalink
cmake,external_deps: unify architecture names
Browse files Browse the repository at this point in the history
also name sel_ldr as nacl_loader everywhere
  • Loading branch information
illwieckz committed Jan 29, 2023
1 parent c8a692e commit a98be26
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 29 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ else()
endif()

# Dependencies version, this must match the number in external_deps/build.sh
set(DEPS_VERSION 7)
set(DEPS_VERSION 8)

if (NOT NACL)
set(EXTERNAL_DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external_deps" CACHE STRING "Directory in which to store the downloaded dependencies.")
Expand Down Expand Up @@ -930,7 +930,7 @@ if (BUILD_CLIENT OR BUILD_TTY_CLIENT OR BUILD_SERVER OR BUILD_DUMMY_APP)
# The NaCl loader and IRT are required to load .nexe files
add_custom_command(TARGET runtime_deps PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DEPS_DIR}/sel_ldr${CMAKE_EXECUTABLE_SUFFIX}
${DEPS_DIR}/nacl_loader${CMAKE_EXECUTABLE_SUFFIX}
${FULL_OUTPUT_DIR}/nacl_loader${CMAKE_EXECUTABLE_SUFFIX}
)

Expand Down Expand Up @@ -965,17 +965,17 @@ if (BUILD_CLIENT OR BUILD_TTY_CLIENT OR BUILD_SERVER OR BUILD_DUMMY_APP)
)
endif()

# Win32 requires nacl_loader64.exe in order to run on Win64
# Win32 requires nacl_loader_amd64.exe in order to run on Win64
if (WIN32 AND ARCH STREQUAL i686)
add_custom_command(TARGET runtime_deps PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DEPS_DIR}/sel_ldr64${CMAKE_EXECUTABLE_SUFFIX}
${FULL_OUTPUT_DIR}/nacl_loader64${CMAKE_EXECUTABLE_SUFFIX}
${DEPS_DIR}/nacl_loader-amd64${CMAKE_EXECUTABLE_SUFFIX}
${FULL_OUTPUT_DIR}/nacl_loader-amd64${CMAKE_EXECUTABLE_SUFFIX}
)
add_custom_command(TARGET runtime_deps PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${DEPS_DIR}/irt_core-x86_64.nexe
${FULL_OUTPUT_DIR}/irt_core-x86_64.nexe
${DEPS_DIR}/irt_core-amd64.nexe
${FULL_OUTPUT_DIR}/irt_core-amd64.nexe
)
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/DaemonGame.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ function(GAMEMODULE)
# TODO(0.54): Unify all arch strings using i686 and amd64 strings.
foreach(NACL_TARGET ${NACL_TARGETS})
if (NACL_TARGET STREQUAL "i686")
pnacl_translate(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${GAMEMODULE_NAME} "i686" "x86")
pnacl_translate(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${GAMEMODULE_NAME} "i686" "i686")
elseif (NACL_TARGET STREQUAL "amd64")
pnacl_translate(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${GAMEMODULE_NAME} "x86-64" "x86_64")
pnacl_translate(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${GAMEMODULE_NAME} "x86-64" "amd64")
elseif (NACL_TARGET STREQUAL "armhf")
pnacl_translate(${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${GAMEMODULE_NAME} "arm" "armhf")
else()
Expand Down
21 changes: 9 additions & 12 deletions external_deps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -u
# This should match the DEPS_VERSION in CMakeLists.txt.
# This is mostly to ensure the path the files end up at if you build deps yourself
# are the same as the ones when extracting from the downloaded packages.
DEPS_VERSION=7
DEPS_VERSION=8

# Package versions
PKGCONFIG_VERSION=0.29.2
Expand Down Expand Up @@ -538,21 +538,19 @@ build_naclsdk() {
case "${PLATFORM}" in
*-i686-*)
local NACLSDK_ARCH=x86_32
# TODO(0.54): Unify all arch strings using i686 and amd64 strings.
local DAEMON_ARCH=x86
local DAEMON_ARCH=i686
;;
*-amd64-*)
local NACLSDK_ARCH=x86_64
# TODO(0.54): Unify all arch strings using i686 and amd64 strings.
local DAEMON_ARCH=x86_64
local DAEMON_ARCH=amd64
;;
*-armhf-*|linux-arm64-*)
local NACLSDK_ARCH=arm
local DAEMON_ARCH=armhf
;;
esac
download "naclsdk_${NACLSDK_PLATFORM}-${NACLSDK_VERSION}.${TAR_EXT}.bz2" "https://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/${NACLSDK_VERSION}/naclsdk_${NACLSDK_PLATFORM}.tar.bz2" naclsdk
cp pepper_*"/tools/sel_ldr_${NACLSDK_ARCH}${EXE}" "${PREFIX}/sel_ldr${EXE}"
cp pepper_*"/tools/sel_ldr_${NACLSDK_ARCH}${EXE}" "${PREFIX}/nacl_loader${EXE}"
cp pepper_*"/tools/irt_core_${NACLSDK_ARCH}.nexe" "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe"
case "${PLATFORM}" in
windows-i686-*|*-amd64-*)
Expand All @@ -575,29 +573,28 @@ build_naclsdk() {
esac
case "${PLATFORM}" in
windows-i686-*)
cp pepper_*"/tools/sel_ldr_x86_64.exe" "${PREFIX}/sel_ldr64.exe"
# TODO(0.54): Unify all arch strings using i686 and amd64 strings.
cp pepper_*"/tools/irt_core_x86_64.nexe" "${PREFIX}/irt_core-x86_64.nexe"
cp pepper_*"/tools/sel_ldr_x86_64.exe" "${PREFIX}/nacl_loader-amd64.exe"
cp pepper_*"/tools/irt_core_x86_64.nexe" "${PREFIX}/irt_core-amd64.nexe"
;;
linux-amd64-*|linux-i686-*)
cp pepper_*"/tools/nacl_helper_bootstrap_${NACLSDK_ARCH}" "${PREFIX}/nacl_helper_bootstrap"
# Fix permissions on a few files which deny access to non-owner
chmod 644 "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe"
chmod 755 "${PREFIX}/nacl_helper_bootstrap" "${PREFIX}/sel_ldr"
chmod 755 "${PREFIX}/nacl_helper_bootstrap" "${PREFIX}/nacl_loader"
;;
linux-armhf-*|linux-arm64-*)
cp pepper_*"/tools/nacl_helper_bootstrap_arm" "${PREFIX}/nacl_helper_bootstrap"
# Fix permissions on a few files which deny access to non-owner
chmod 644 "${PREFIX}/irt_core-${DAEMON_ARCH}.nexe"
chmod 755 "${PREFIX}/nacl_helper_bootstrap" "${PREFIX}/sel_ldr"
chmod 755 "${PREFIX}/nacl_helper_bootstrap" "${PREFIX}/nacl_loader"
;;
esac
case "${PLATFORM}" in
linux-arm64-*)
mkdir -p "${PREFIX}/lib-armhf"
cp -a pepper_*"/tools/lib/arm_trusted/lib/." "${PREFIX}/lib-armhf/."
mv "${PREFIX}/lib-armhf/ld-linux-armhf.so.3" "${PREFIX}/lib-armhf/ld-linux-armhf"
sed -e 's|/lib/ld-linux-armhf.so.3|lib-armhf/ld-linux-armhf|' -i "${PREFIX}/sel_ldr"
sed -e 's|/lib/ld-linux-armhf.so.3|lib-armhf/ld-linux-armhf|' -i "${PREFIX}/nacl_loader"
;;
esac
}
Expand Down
6 changes: 3 additions & 3 deletions src/engine/framework/VirtualMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ std::pair<Sys::OSHandle, IPC::Socket> CreateNaClVM(std::pair<IPC::Socket, IPC::S
#endif

// Extract the nexe from the pak so that nacl_loader can load it
module = win32Force64Bit ? name + "-x86_64.nexe" : name + "-" XSTRING(NACL_ARCH_STRING) ".nexe";
module = win32Force64Bit ? name + "-amd64.nexe" : name + "-" XSTRING(NACL_ARCH_STRING) ".nexe";
if (extract) {
try {
FS::File out = FS::HomePath::OpenWrite(module);
Expand All @@ -240,8 +240,8 @@ std::pair<Sys::OSHandle, IPC::Socket> CreateNaClVM(std::pair<IPC::Socket, IPC::S

// Generate command line
Q_snprintf(rootSocketRedir, sizeof(rootSocketRedir), "%d:%d", ROOT_SOCKET_FD, (int)(intptr_t)pair.second.GetHandle());
irt = FS::Path::Build(naclPath, win32Force64Bit ? "irt_core-x86_64.nexe" : "irt_core-" XSTRING(NACL_ARCH_STRING) ".nexe");
nacl_loader = FS::Path::Build(naclPath, win32Force64Bit ? "nacl_loader64" EXE_EXT : "nacl_loader" EXE_EXT);
irt = FS::Path::Build(naclPath, win32Force64Bit ? "irt_core-amd64.nexe" : "irt_core-" XSTRING(NACL_ARCH_STRING) ".nexe");
nacl_loader = FS::Path::Build(naclPath, win32Force64Bit ? "nacl_loader-amd64" EXE_EXT : "nacl_loader" EXE_EXT);
if (!FS::RawPath::FileExists(modulePath))
Log::Warn("VM module file not found: %s", modulePath);
if (!FS::RawPath::FileExists(nacl_loader))
Expand Down
6 changes: 1 addition & 5 deletions tools/DaemonArchitecture/DaemonArchitecture.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ add_definitions(-DARCH_STRING=${ARCH})
# them breaks engine compatibility with published nexe game binaries.
# TODO(0.54): Unify all arch strings using i686 and amd64 strings by using
# ARCH_STRING define and setting NACL_ARCH to ARCH in all cases.
if (ARCH STREQUAL "i686")
set(NACL_ARCH "x86")
elseif(ARCH STREQUAL "amd64")
set(NACL_ARCH "x86_64")
elseif(ARCH STREQUAL "arm64")
if(ARCH STREQUAL "arm64")
if (LINUX)
# Load 32-bit armhf nexe on 64-bit arm64 engine on Linux with multiarch.
set(NACL_ARCH "armhf")
Expand Down

0 comments on commit a98be26

Please sign in to comment.