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.
|
# Embed edge binaries.
|
||||||
pushd bin
|
pushd bin
|
||||||
mkdir -p ../modules/embedded/embeds
|
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
|
createEmbeddedBinary x86_64-w64-mingw32-edge.exe ../modules/embedded/embeds/windows_x86_64.h EDGE_H
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
@ -93,9 +95,6 @@ pushd godot
|
||||||
# Use Our Custom Settings.
|
# Use Our Custom Settings.
|
||||||
ln -f -s ../custom.py .
|
ln -f -s ../custom.py .
|
||||||
|
|
||||||
# Clean Prior Builds.
|
|
||||||
scons --clean
|
|
||||||
|
|
||||||
# Build Editor.
|
# Build Editor.
|
||||||
scons platform=linuxbsd target=editor arch=x86_64 ${LTO}
|
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
|
scons compiledb=yes
|
||||||
|
|
||||||
# Build Templates.
|
# 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_debug arch=x86_64 ${TEMPLATE} ${LTO}
|
||||||
scons platform=linuxbsd target=template_release 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_debug arch=x86_64 ${TEMPLATE} ${LTO}
|
||||||
scons platform=windows target=template_release 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 "x86_64-linux-gnu"
|
||||||
|
buildn2n "i686-w64-mingw32" ".exe"
|
||||||
buildn2n "x86_64-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"
|
title = "Disclaimer"
|
||||||
initial_position = 2
|
initial_position = 2
|
||||||
size = Vector2i(300, 340)
|
size = Vector2i(300, 340)
|
||||||
|
transient = true
|
||||||
exclusive = true
|
exclusive = true
|
||||||
unresizable = true
|
unresizable = true
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ func _on_button_pressed():
|
||||||
|
|
||||||
|
|
||||||
func show_disclaimer():
|
func show_disclaimer():
|
||||||
|
# ***DEBUG*** Is not modal on Windows!
|
||||||
Disclaimer.disclaimer_window.visible = true
|
Disclaimer.disclaimer_window.visible = true
|
||||||
Disclaimer.disclaimer_window.move_to_center()
|
Disclaimer.disclaimer_window.move_to_center()
|
||||||
await _disclaimer_closed
|
await _disclaimer_closed
|
||||||
|
|
|
@ -116,7 +116,9 @@ func set_supernode(supernode: String, port: int = 7777):
|
||||||
|
|
||||||
func shutdown():
|
func shutdown():
|
||||||
if _edge_pid >= 0:
|
if _edge_pid >= 0:
|
||||||
|
print("Edge PID is ", _edge_pid)
|
||||||
if OS.is_process_running(_edge_pid):
|
if OS.is_process_running(_edge_pid):
|
||||||
|
print("Edge is running - killing ", _edge_pid)
|
||||||
OS.kill(_edge_pid)
|
OS.kill(_edge_pid)
|
||||||
_edge_pid = -1
|
_edge_pid = -1
|
||||||
_edge_running = false
|
_edge_running = false
|
||||||
|
|
|
@ -28,25 +28,34 @@ var _root_password = null
|
||||||
|
|
||||||
|
|
||||||
func _elevate_unix(program: String, arguments: PackedStringArray):
|
func _elevate_unix(program: String, arguments: PackedStringArray):
|
||||||
|
# Ask user for sudo password.
|
||||||
_root_password = await Dialog.password("Root Access Needed", "Password:")
|
_root_password = await Dialog.password("Root Access Needed", "Password:")
|
||||||
if _root_password == null:
|
if _root_password == null:
|
||||||
return -1
|
return -1
|
||||||
|
# Generate a random password for this request.
|
||||||
_ask_pass_password = Util.generate_password()
|
_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"
|
_ask_pass_script = OS.get_user_data_dir() + "/ask_pass.sh"
|
||||||
var ask_pass := FileAccess.open(_ask_pass_script, FileAccess.WRITE)
|
var ask_pass := FileAccess.open(_ask_pass_script, FileAccess.WRITE)
|
||||||
ask_pass.store_line("#!/usr/bin/env bash")
|
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.store_line("echo " + _ask_pass_password + " | nc -w1 -u 127.0.0.1 " + str(_ask_pass_port))
|
||||||
ask_pass.close()
|
ask_pass.close()
|
||||||
|
# Make ASKPASS executable.
|
||||||
OS.execute("chmod", ["+x", _ask_pass_script])
|
OS.execute("chmod", ["+x", _ask_pass_script])
|
||||||
|
# Let sudo know about ASKPASS.
|
||||||
OS.set_environment("SUDO_ASKPASS", _ask_pass_script)
|
OS.set_environment("SUDO_ASKPASS", _ask_pass_script)
|
||||||
var options := ["-A", program]
|
var options := ["-A", program]
|
||||||
options.append_array(arguments)
|
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)
|
var pid = OS.create_process("sudo", options, false)
|
||||||
return pid
|
return pid
|
||||||
|
|
||||||
|
|
||||||
func _elevate_windows(program: String, arguments: PackedStringArray):
|
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 pidFile := OS.get_user_data_dir() + "/elevate.pid"
|
||||||
var cmdFile := OS.get_user_data_dir() + "/elevate.cmd"
|
var cmdFile := OS.get_user_data_dir() + "/elevate.cmd"
|
||||||
# Build the script to run.
|
# Build the script to run.
|
||||||
|
@ -58,7 +67,8 @@ func _elevate_windows(program: String, arguments: PackedStringArray):
|
||||||
handle.store_line(power)
|
handle.store_line(power)
|
||||||
handle.close()
|
handle.close()
|
||||||
# Run it.
|
# 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.
|
# Wait for PID to be created.
|
||||||
var pid := -1
|
var pid := -1
|
||||||
var count := 5
|
var count := 5
|
||||||
|
@ -69,8 +79,11 @@ func _elevate_windows(program: String, arguments: PackedStringArray):
|
||||||
if count > 0:
|
if count > 0:
|
||||||
# Read PID.
|
# Read PID.
|
||||||
handle = FileAccess.open(pidFile, FileAccess.READ)
|
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()
|
handle.close()
|
||||||
|
print("pid is ", pid)
|
||||||
# Wait for batch to exit.
|
# Wait for batch to exit.
|
||||||
if cmdPid > 0:
|
if cmdPid > 0:
|
||||||
while OS.is_process_running(cmdPid):
|
while OS.is_process_running(cmdPid):
|
||||||
|
@ -80,18 +93,24 @@ func _elevate_windows(program: String, arguments: PackedStringArray):
|
||||||
DirAccess.remove_absolute(cmdFile)
|
DirAccess.remove_absolute(cmdFile)
|
||||||
if FileAccess.file_exists(pidFile):
|
if FileAccess.file_exists(pidFile):
|
||||||
DirAccess.remove_absolute(pidFile)
|
DirAccess.remove_absolute(pidFile)
|
||||||
|
print(program, " - PID ", pid)
|
||||||
return pid
|
return pid
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
|
# If we've got UDP listening for password requests, check for one.
|
||||||
if _udp.is_listening():
|
if _udp.is_listening():
|
||||||
_udp.poll()
|
_udp.poll()
|
||||||
if _udp.is_connection_available():
|
if _udp.is_connection_available():
|
||||||
|
# Accept the connection.
|
||||||
var peer: PacketPeerUDP = _udp.take_connection()
|
var peer: PacketPeerUDP = _udp.take_connection()
|
||||||
|
# Get the request.
|
||||||
var data := peer.get_packet().get_string_from_ascii()
|
var data := peer.get_packet().get_string_from_ascii()
|
||||||
if peer.get_packet_error() == OK:
|
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 data.strip_edges() == _ask_pass_password:
|
||||||
if _root_password != null:
|
if _root_password != null:
|
||||||
|
# Send the sudo password the user entered to the ASKPASS program.
|
||||||
peer.put_packet(_root_password.to_ascii_buffer())
|
peer.put_packet(_root_password.to_ascii_buffer())
|
||||||
_root_password = null
|
_root_password = null
|
||||||
peer.close()
|
peer.close()
|
||||||
|
@ -110,7 +129,7 @@ func is_elevated():
|
||||||
var result := OS.execute("net.exe", [ "sessions" ])
|
var result := OS.execute("net.exe", [ "sessions" ])
|
||||||
return true if result == 0 else false
|
return true if result == 0 else false
|
||||||
else:
|
else:
|
||||||
return false # We don't support this on UNIX.
|
return false # We don't need/support this on UNIX.
|
||||||
|
|
||||||
|
|
||||||
func shutdown():
|
func shutdown():
|
||||||
|
|
|
@ -30,15 +30,25 @@ extern "C" {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
#include "embeds/linux_arm64.h"
|
#include "embeds/linux_arm64.h"
|
||||||
#else
|
#elif __x86_64__
|
||||||
#include "embeds/linux_x86_64.h"
|
#include "embeds/linux_x86_64.h"
|
||||||
unsigned char *data = x86_64_linux_gnu_edge;
|
unsigned char *data = x86_64_linux_gnu_edge;
|
||||||
size_t length = (size_t)x86_64_linux_gnu_edge_len;
|
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
|
#endif
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
|
#ifdef __x86_64__
|
||||||
#include "embeds/windows_x86_64.h"
|
#include "embeds/windows_x86_64.h"
|
||||||
unsigned char *data = x86_64_w64_mingw32_edge_exe;
|
unsigned char *data = x86_64_w64_mingw32_edge_exe;
|
||||||
size_t length = (size_t)x86_64_w64_mingw32_edge_exe_len;
|
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__
|
#elif __APPLE__
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
#include "embeds/macos_arm64.h"
|
#include "embeds/macos_arm64.h"
|
||||||
|
|
|
@ -19,14 +19,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# These only provide 64 bit targets.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Linux Support
|
# Linux Support
|
||||||
apt-get -y install \
|
apt-get -y install \
|
||||||
autotools \
|
autotools \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
gcc-multilib \
|
||||||
|
g++-multilib \
|
||||||
scons \
|
scons \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
xxd \
|
xxd \
|
||||||
|
@ -43,7 +41,8 @@ apt-get -y install \
|
||||||
libxrandr-dev
|
libxrandr-dev
|
||||||
|
|
||||||
# Windows Support
|
# Windows Support
|
||||||
apt-get -y install mingw-w64
|
apt-get -y install \
|
||||||
|
mingw-w64
|
||||||
|
|
||||||
# Update Windows Compiler Settings
|
# Update Windows Compiler Settings
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue