32 bit Linux and Windows support added.
This commit is contained in:
parent
951e9e94b0
commit
3a47372ff0
11 changed files with 140 additions and 14 deletions
|
@ -84,7 +84,9 @@ LTO="lto=none" # Use "lto=full" for releases.
|
|||
# Embed edge binaries.
|
||||
pushd bin
|
||||
mkdir -p ../modules/embedded/embeds
|
||||
createEmbeddedBinary x86_64-linux-gnu-edge ../modules/embedded/embeds/linux_x86_64.h EDGE_H
|
||||
createEmbeddedBinary i386-linux-gnu-edge ../modules/embedded/embeds/linux_i386.h EDGE_H
|
||||
createEmbeddedBinary x86_64-linux-gnu-edge ../modules/embedded/embeds/linux_x86_64.h EDGE_H
|
||||
createEmbeddedBinary i686-w64-mingw32-edge.exe ../modules/embedded/embeds/windows_i686.h EDGE_H
|
||||
createEmbeddedBinary x86_64-w64-mingw32-edge.exe ../modules/embedded/embeds/windows_x86_64.h EDGE_H
|
||||
popd
|
||||
|
||||
|
@ -93,9 +95,6 @@ pushd godot
|
|||
# Use Our Custom Settings.
|
||||
ln -f -s ../custom.py .
|
||||
|
||||
# Clean Prior Builds.
|
||||
scons --clean
|
||||
|
||||
# Build Editor.
|
||||
scons platform=linuxbsd target=editor arch=x86_64 ${LTO}
|
||||
|
||||
|
@ -103,8 +102,15 @@ scons platform=linuxbsd target=editor arch=x86_64 ${LTO}
|
|||
scons compiledb=yes
|
||||
|
||||
# Build Templates.
|
||||
scons platform=linuxbsd target=template_debug arch=x86_32 ${TEMPLATE} ${LTO}
|
||||
scons platform=linuxbsd target=template_release arch=x86_32 ${TEMPLATE} ${LTO}
|
||||
|
||||
scons platform=linuxbsd target=template_debug arch=x86_64 ${TEMPLATE} ${LTO}
|
||||
scons platform=linuxbsd target=template_release arch=x86_64 ${TEMPLATE} ${LTO}
|
||||
|
||||
scons platform=windows target=template_debug arch=x86_32 ${TEMPLATE} ${LTO}
|
||||
scons platform=windows target=template_release arch=x86_32 ${TEMPLATE} ${LTO}
|
||||
|
||||
scons platform=windows target=template_debug arch=x86_64 ${TEMPLATE} ${LTO}
|
||||
scons platform=windows target=template_release arch=x86_64 ${TEMPLATE} ${LTO}
|
||||
|
||||
|
|
|
@ -67,5 +67,7 @@ function buildn2n() {
|
|||
}
|
||||
|
||||
|
||||
buildn2n "i386-linux-gnu"
|
||||
buildn2n "x86_64-linux-gnu"
|
||||
buildn2n "i686-w64-mingw32" ".exe"
|
||||
buildn2n "x86_64-w64-mingw32" ".exe"
|
||||
|
|
30
clean-godot.sh
Executable file
30
clean-godot.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Ham'n'Cheese
|
||||
# Copyright (C) 2023-2024 Scott Duensing <scott@kangaroopunch.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 3
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
#
|
||||
|
||||
|
||||
pushd godot
|
||||
|
||||
# Remove our config.
|
||||
rm custom.py
|
||||
|
||||
# Clean Prior Builds.
|
||||
scons --clean
|
||||
|
||||
popd
|
25
cmake/i386-linux-gnu.cmake
Normal file
25
cmake/i386-linux-gnu.cmake
Normal file
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# Ham'n'Cheese
|
||||
# Copyright (C) 2023-2024 Scott Duensing <scott@kangaroopunch.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 3
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
#
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
set(CMAKE_C_COMPILER gcc)
|
||||
set(CMAKE_C_FLAGS -m32)
|
||||
set(CMAKE_CXX_COMPILER g++)
|
||||
set(CMAKE_CXX_FLAGS -m32)
|
31
cmake/i686-w64-mingw32.cmake
Normal file
31
cmake/i686-w64-mingw32.cmake
Normal file
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# Ham'n'Cheese
|
||||
# Copyright (C) 2023-2024 Scott Duensing <scott@kangaroopunch.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 3
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
#
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||
|
||||
set(triple i686-w64-mingw32)
|
||||
|
||||
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc-10-posix)
|
||||
set(CMAKE_C_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_CXX_COMPILER i686-w64-mingw32-c++-posix)
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
||||
|
||||
set(CMAKE_C_FLAGS -m32)
|
||||
set(CMAKE_CXX_FLAGS -m32)
|
|
@ -16,6 +16,7 @@ unique_name_in_owner = true
|
|||
title = "Disclaimer"
|
||||
initial_position = 2
|
||||
size = Vector2i(300, 340)
|
||||
transient = true
|
||||
exclusive = true
|
||||
unresizable = true
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ func _on_button_pressed():
|
|||
|
||||
|
||||
func show_disclaimer():
|
||||
# ***DEBUG*** Is not modal on Windows!
|
||||
Disclaimer.disclaimer_window.visible = true
|
||||
Disclaimer.disclaimer_window.move_to_center()
|
||||
await _disclaimer_closed
|
||||
|
|
|
@ -116,7 +116,9 @@ func set_supernode(supernode: String, port: int = 7777):
|
|||
|
||||
func shutdown():
|
||||
if _edge_pid >= 0:
|
||||
print("Edge PID is ", _edge_pid)
|
||||
if OS.is_process_running(_edge_pid):
|
||||
print("Edge is running - killing ", _edge_pid)
|
||||
OS.kill(_edge_pid)
|
||||
_edge_pid = -1
|
||||
_edge_running = false
|
||||
|
|
|
@ -28,25 +28,34 @@ var _root_password = null
|
|||
|
||||
|
||||
func _elevate_unix(program: String, arguments: PackedStringArray):
|
||||
# Ask user for sudo password.
|
||||
_root_password = await Dialog.password("Root Access Needed", "Password:")
|
||||
if _root_password == null:
|
||||
return -1
|
||||
# Generate a random password for this request.
|
||||
_ask_pass_password = Util.generate_password()
|
||||
# Generate an ASKPASS program to request the entered password over the network.
|
||||
_ask_pass_script = OS.get_user_data_dir() + "/ask_pass.sh"
|
||||
var ask_pass := FileAccess.open(_ask_pass_script, FileAccess.WRITE)
|
||||
ask_pass.store_line("#!/usr/bin/env bash")
|
||||
ask_pass.store_line("echo " + _ask_pass_password + " | nc -w1 -u 127.0.0.1 " + str(_ask_pass_port))
|
||||
ask_pass.close()
|
||||
# Make ASKPASS executable.
|
||||
OS.execute("chmod", ["+x", _ask_pass_script])
|
||||
# Let sudo know about ASKPASS.
|
||||
OS.set_environment("SUDO_ASKPASS", _ask_pass_script)
|
||||
var options := ["-A", program]
|
||||
options.append_array(arguments)
|
||||
# Attempt to run our program. Rest of password/sudo magic is in _process.
|
||||
var pid = OS.create_process("sudo", options, false)
|
||||
return pid
|
||||
|
||||
|
||||
func _elevate_windows(program: String, arguments: PackedStringArray):
|
||||
# powershell.exe -Command (Start-Process 'edge.exe' -ArgumentList 'stuff here' -Verb runAs -PassThru).Id
|
||||
# First, if we're elevated, we don't need to deal with elevating the child process.
|
||||
if is_elevated():
|
||||
return OS.create_process(program, arguments, OS.is_debug_build())
|
||||
# We need to elevate the child. What a mess. ***DEBUG*** This still doesn't work quite right.
|
||||
var pidFile := OS.get_user_data_dir() + "/elevate.pid"
|
||||
var cmdFile := OS.get_user_data_dir() + "/elevate.cmd"
|
||||
# Build the script to run.
|
||||
|
@ -58,7 +67,8 @@ func _elevate_windows(program: String, arguments: PackedStringArray):
|
|||
handle.store_line(power)
|
||||
handle.close()
|
||||
# Run it.
|
||||
var cmdPid := OS.create_process(cmdFile, [], true)
|
||||
var cmdPid := OS.create_process(cmdFile, [], OS.is_debug_build())
|
||||
print("cmdPid is ", cmdPid)
|
||||
# Wait for PID to be created.
|
||||
var pid := -1
|
||||
var count := 5
|
||||
|
@ -69,8 +79,11 @@ func _elevate_windows(program: String, arguments: PackedStringArray):
|
|||
if count > 0:
|
||||
# Read PID.
|
||||
handle = FileAccess.open(pidFile, FileAccess.READ)
|
||||
pid = int(handle.get_line())
|
||||
var line = handle.get_line()
|
||||
print("Raw PID line: [", line, "]")
|
||||
pid = int(line)
|
||||
handle.close()
|
||||
print("pid is ", pid)
|
||||
# Wait for batch to exit.
|
||||
if cmdPid > 0:
|
||||
while OS.is_process_running(cmdPid):
|
||||
|
@ -80,18 +93,24 @@ func _elevate_windows(program: String, arguments: PackedStringArray):
|
|||
DirAccess.remove_absolute(cmdFile)
|
||||
if FileAccess.file_exists(pidFile):
|
||||
DirAccess.remove_absolute(pidFile)
|
||||
print(program, " - PID ", pid)
|
||||
return pid
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
# If we've got UDP listening for password requests, check for one.
|
||||
if _udp.is_listening():
|
||||
_udp.poll()
|
||||
if _udp.is_connection_available():
|
||||
# Accept the connection.
|
||||
var peer: PacketPeerUDP = _udp.take_connection()
|
||||
# Get the request.
|
||||
var data := peer.get_packet().get_string_from_ascii()
|
||||
if peer.get_packet_error() == OK:
|
||||
# Does this request have the correct random password we generated earlier?
|
||||
if data.strip_edges() == _ask_pass_password:
|
||||
if _root_password != null:
|
||||
# Send the sudo password the user entered to the ASKPASS program.
|
||||
peer.put_packet(_root_password.to_ascii_buffer())
|
||||
_root_password = null
|
||||
peer.close()
|
||||
|
@ -110,7 +129,7 @@ func is_elevated():
|
|||
var result := OS.execute("net.exe", [ "sessions" ])
|
||||
return true if result == 0 else false
|
||||
else:
|
||||
return false # We don't support this on UNIX.
|
||||
return false # We don't need/support this on UNIX.
|
||||
|
||||
|
||||
func shutdown():
|
||||
|
|
|
@ -30,15 +30,25 @@ extern "C" {
|
|||
#ifdef __linux__
|
||||
#ifdef __arm__
|
||||
#include "embeds/linux_arm64.h"
|
||||
#else
|
||||
#elif __x86_64__
|
||||
#include "embeds/linux_x86_64.h"
|
||||
unsigned char *data = x86_64_linux_gnu_edge;
|
||||
size_t length = (size_t)x86_64_linux_gnu_edge_len;
|
||||
#else
|
||||
#include "embeds/linux_i386.h"
|
||||
unsigned char *data = i386_linux_gnu_edge;
|
||||
size_t length = (size_t)i386_linux_gnu_edge_len;
|
||||
#endif
|
||||
#elif _WIN32
|
||||
#ifdef __x86_64__
|
||||
#include "embeds/windows_x86_64.h"
|
||||
unsigned char *data = x86_64_w64_mingw32_edge_exe;
|
||||
size_t length = (size_t)x86_64_w64_mingw32_edge_exe_len;
|
||||
#else
|
||||
#include "embeds/windows_i686.h"
|
||||
unsigned char *data = i686_w64_mingw32_edge_exe;
|
||||
size_t length = (size_t)i686_w64_mingw32_edge_exe_len;
|
||||
#endif
|
||||
#elif __APPLE__
|
||||
#ifdef __arm__
|
||||
#include "embeds/macos_arm64.h"
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
#
|
||||
|
||||
|
||||
#
|
||||
# These only provide 64 bit targets.
|
||||
#
|
||||
|
||||
# Linux Support
|
||||
apt-get -y install \
|
||||
autotools \
|
||||
build-essential \
|
||||
gcc-multilib \
|
||||
g++-multilib \
|
||||
scons \
|
||||
pkg-config \
|
||||
xxd \
|
||||
|
@ -43,7 +41,8 @@ apt-get -y install \
|
|||
libxrandr-dev
|
||||
|
||||
# Windows Support
|
||||
apt-get -y install mingw-w64
|
||||
apt-get -y install \
|
||||
mingw-w64
|
||||
|
||||
# Update Windows Compiler Settings
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue