Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build-all.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
name: build-all

name: Build Oolite package for various platforms
on:
workflow_dispatch:
push:
Expand Down Expand Up @@ -35,7 +33,7 @@ jobs:

- name: Install packages
run: |
sudo oolite/ShellScripts/Linux/install_deps_root.sh
sudo oolite/ShellScripts/Linux/install_deps_root.sh --skip-wayland

- name: Build Oolite
run: |
Expand Down
61 changes: 53 additions & 8 deletions .github/workflows/test_builds.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Oolite package on various platforms
name: Test Oolite package on various platforms
on:
push:
pull_request:
Expand All @@ -23,7 +23,7 @@ jobs:
sudo ShellScripts/Linux/install_deps_root.sh
- name: Build Oolite
run: |
ShellScripts/common/build_oolite.sh pkg-appimage
ShellScripts/common/build_oolite.sh test

fedora:
runs-on: ubuntu-latest
Expand All @@ -38,10 +38,15 @@ jobs:
run: |
dnf -y update
dnf -y install git
- name: Checkout Oolite
- name: Pre-setup ownership
run: |
# This must run before the checkout action if the action tries to do git commands
mkdir -p "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git clone --recursive https://github.com/${{ github.repository }} .
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Checkout dependencies
run: |
ShellScripts/Linux/checkout_deps.sh
Expand All @@ -50,7 +55,7 @@ jobs:
ShellScripts/Linux/install_deps_root.sh
- name: Build Oolite
run: |
ShellScripts/common/build_oolite.sh pkg-appimage
ShellScripts/common/build_oolite.sh test

arch:
runs-on: ubuntu-latest
Expand All @@ -65,10 +70,15 @@ jobs:
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm --needed git
- name: Checkout Oolite
- name: Pre-setup ownership
run: |
# This must run before the checkout action if the action tries to do git commands
mkdir -p "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git clone --recursive https://github.com/${{ github.repository }} .
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Checkout dependencies
run: |
ShellScripts/Linux/checkout_deps.sh
Expand All @@ -77,4 +87,39 @@ jobs:
ShellScripts/Linux/install_deps_root.sh
- name: Build Oolite
run: |
ShellScripts/common/build_oolite.sh pkg-appimage
ShellScripts/common/build_oolite.sh test

windows:
runs-on: windows-latest
steps:
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
update: true

- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true

- name: Download latest release assets
uses: robinraju/release-downloader@v1
with:
repository: OoliteProject/oolite_windeps_build
latest: true
fileName: "*"
out-file-path: build/packages

- name: Install packages
shell: msys2 {0}
env:
msystem: UCRT64
run: |
ShellScripts/Windows/install_deps.sh clang

- name: Build Oolite
shell: msys2 {0}
env:
msystem: UCRT64
run: |
ShellScripts/common/build_oolite.sh test
10 changes: 10 additions & 0 deletions DebugOXP/Debug.oxp/Scripts/oolite-debug-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,16 @@ this.evaluate = function evaluate(command, PARAM)
}
}

this.quit = function() {
log("debugConsole.automation", "Triggering global quitGame bridge...");

// This calls the native function in OOJSGlobal.m, which in turn calls [Universe quitGame]
if (typeof quitGame === "function") {
quitGame();
} else {
log("debugConsole.automation", "Error: quitGame() global function not found. Did you recompile?");
}
};

// Identify the location of the eval() command above for the debug location formatter.
this.markConsoleEntryPoint = special.markConsoleEntryPoint;
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ help:
.PHONY: release
release:
$(MAKE) -f GNUmakefile debug=no strip=yes lto=yes
mkdir -p build/AddOns && rm -rf build/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp build/AddOns/Basic-debug.oxp
mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp

.PHONY: release-deployment
release-deployment:
Expand All @@ -42,18 +42,21 @@ release-deployment:
.PHONY: release-snapshot
release-snapshot:
$(MAKE) -f GNUmakefile SNAPSHOT_BUILD=yes debug=no
mkdir -p build/AddOns && rm -rf build/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp build/AddOns/Basic-debug.oxp
mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp

.PHONY: debug
debug:
$(MAKE) -f GNUmakefile debug=yes strip=no
mkdir -p build/AddOns && rm -rf build/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp build/AddOns/Basic-debug.oxp
mkdir -p oolite.app/AddOns && rm -rf oolite.app/AddOns/Basic-debug.oxp && cp -rf DebugOXP/Debug.oxp oolite.app/AddOns/Basic-debug.oxp

.PHONY: test
test: release-snapshot
tests/run_test.sh

.PHONY: clean
clean:
$(MAKE) -f GNUmakefile clean
$(RM) -rf oolite.app
$(RM) -rf build/AddOns

.PHONY: all
all: release release-deployment release-snapshot debug
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ sudo ShellScripts/Linux/install_deps_root.sh

### Building Oolite

Next run this in your bash or MSYS2 prompt to build Oolite:
Next run this in your Bash or MSYS2 prompt to build Oolite:

```bash
ShellScripts/common/build_oolite.sh release
```

The completed build (executable and games files) can be found in the Oolite.app directory.
The completed build (executable and games files) can be found in the oolite.app directory.

Subsequently, you can clean and build as follows:

Expand All @@ -116,6 +116,12 @@ make -f Makefile clean
make -f Makefile release -j$(nproc)
```

You can run a test from your Bash or MSYS2 prompt as follows:

```bash
make -f Makefile test
```

On Linux, you will need to run this beforehand: `source /usr/local/share/GNUstep/Makefiles/GNUstep.sh`

On Windows, this is set up be default in the shell: `source $MINGW_PREFIX/share/GNUstep/Makefiles/GNUstep.sh`
Expand Down
21 changes: 21 additions & 0 deletions ShellScripts/Linux/install_deps_root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@


run_script() {
local skip_wayland=false

# Parse arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
-s|--skip-wayland) skip_wayland=true; shift ;;
*) shift ;;
esac
done

# If current user ID is NOT 0 (root)
if [[ $EUID -ne 0 ]]; then
echo "This script requires root to install dependencies. Rerun and escalate privileges (eg. sudo ...)"
Expand All @@ -30,6 +40,17 @@ run_script() {
if ! install_package gnutls-dev; then
return 1
fi
# Check Python
if ! python3 --version >/dev/null 2>&1; then
if ! install_package python; then
return 1
fi
fi
if [[ $skip_wayland == false ]]; then
if ! install_package xwfb-run; then
return 1
fi
fi
if ! install_package icu-dev; then
return 1
fi
Expand Down
16 changes: 11 additions & 5 deletions ShellScripts/Linux/install_freedesktop_fn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ install_freedesktop() {
# $1: app folder (destination)
# $2: appdata or metainfo

local err_msg="❌ Error: Failed to install "
local err_msg="❌ Error: Failed to"

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
pushd "$SCRIPT_DIR"
Expand All @@ -19,13 +19,19 @@ install_freedesktop() {
APPSHR="$1/share"

# Install binaries and scripts
install -D "$PROGDIR/oolite" "$APPBIN/oolite" || { echo "$err_msg oolite binary" >&2; return 1; }
install -D "$PROGDIR/run_oolite.sh" "$APPBIN/run_oolite.sh" || { echo "$err_msg run_oolite.sh" >&2; return 1; }
install -D "$PROGDIR/splash-launcher" "$APPBIN/splash-launcher" || { echo "$err_msg splash-launcher" >&2; return 1; }
install -D "$PROGDIR/oolite" "$APPBIN/oolite" || { echo "$err_msg install oolite binary" >&2; return 1; }
install -D "$PROGDIR/run_oolite.sh" "$APPBIN/run_oolite.sh" || { echo "$err_msg install run_oolite.sh" >&2; return 1; }
install -D "$PROGDIR/splash-launcher" "$APPBIN/splash-launcher" || { echo "$err_msg install splash-launcher" >&2; return 1; }

# Resources copy
mkdir -p "$APPBIN/Resources"
cp -rf "$PROGDIR/Resources/." "$APPBIN/Resources/" || { echo "$err_msg Copying Resources folder" >&2; return 1; }
cp -rf "$PROGDIR/Resources/." "$APPBIN/Resources/" || { echo "$err_msg copy Resources folder" >&2; return 1; }

# AddOns copy if folder exists in oolite.app
if [ -d "$PROGDIR/AddOns" ]; then
mkdir -p "$APPBIN/AddOns"
cp -rf "$PROGDIR/AddOns/." "$APPBIN/AddOns/" || { echo "$err_msg copy AddOns folder" >&2; return 1; }
fi

install -D "GNUstep.conf.template" "$APPBIN/Resources/GNUstep.conf.template" || { echo "$err_msg GNUstep template" >&2; return 1; }

Expand Down
9 changes: 9 additions & 0 deletions ShellScripts/Linux/install_package_fn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ install_package() {
arch) PKG_NAME="gnutls" ;;
esac ;;

"python")
case "$CURRENT_DISTRO" in
debian) PKG_NAME="python3-pip" ;;
redhat) PKG_NAME="python3-pip" ;;
arch) PKG_NAME="python-pip" ;;
esac ;;

"xwfb-run") PKG_NAME="xwayland-run weston" ;;

"icu-dev")
case "$CURRENT_DISTRO" in
debian) PKG_NAME="libicu-dev" ;;
Expand Down
2 changes: 2 additions & 0 deletions ShellScripts/Windows/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ run_script() {
pacman -S pactoys --noconfirm
pacboy -S binutils --noconfirm
pacboy -S uutils-coreutils --noconfirm
pacboy -S python-pip --noconfirm
pacboy -S mesa --noconfirm

source ../common/checkout_submodules_fn.sh
checkout_submodules
Expand Down
2 changes: 1 addition & 1 deletion ShellScripts/common/post_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ run_script() {
for resdir in "${RESOURCE_DIRS[@]}"; do
cp -rfu "$resdir" "$PROGDIR/Resources"
done

cp -fu Resources/README.TXT "$PROGDIR/Resources"
cp -fu Resources/InfoPlist.strings "$PROGDIR/Resources"
cp -fu src/Cocoa/Info-Oolite.plist "$PROGDIR/Resources/Info-gnustep.plist"
Expand Down
5 changes: 0 additions & 5 deletions installers/appimage/create_appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ run_script() {
return 1
fi

if (( $# == 1 )); then
echo "Including Basic-debug.oxp"
cp -rf AddOns "$APPBIN"
fi

LINUXDEPLOY_BIN="./linuxdeploy"
if [ ! -x "$LINUXDEPLOY_BIN" ]; then
echo "📥 linuxdeploy not found or not executable. Downloading..."
Expand Down
4 changes: 2 additions & 2 deletions installers/win32/OOlite.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ SectionEnd
Section "Basic-debug.OXP" ooDebugOXP
; Do not use any of the Debug OXP files when we are building Deployment
SetOutPath $INSTDIR
File /r "..\..\build\AddOns"
File /r "${DST}\AddOns"
SectionEnd

; Below are the descriptions of the two component sections
Expand Down Expand Up @@ -251,7 +251,7 @@ File "Privacy.pdf"
${If} ${ADDCHANGELOG} == "1"
File "..\..\Doc\CHANGELOG.TXT"
${EndIf}
File /r /x .git /x .svn /x *~ "${DST}"
File /r /x AddOns /x .git /x .svn /x *~ "${DST}"

; Generate version info
FileOpen $9 release.txt w ;Opens a Empty File and fills it
Expand Down
2 changes: 0 additions & 2 deletions src/Core/ResourceManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ + (NSArray *)userRootPaths
stringByDeletingLastPathComponent]
stringByAppendingPathComponent:@"AddOns"],
#endif
#if !OOLITE_WINDOWS
@"AddOns",
#endif
[[OOOXZManager sharedManager] extractAddOnsPath],
nil];
sUserRootPaths = [[[[OOOXZManager sharedManager] additionalAddOnsPaths] arrayByAddingObjectsFromArray:defaultAddOnsPaths] retain];
Expand Down
16 changes: 16 additions & 0 deletions src/Core/Scripting/OOJSGlobal.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ - (void)sendMonitorLogMessage:(NSString *)message
static JSBool GlobalSetScreenBackgroundForKey(JSContext *context, uintN argc, jsval *vp);
static JSBool GlobalAutoAIForRole(JSContext *context, uintN argc, jsval *vp);
static JSBool GlobalPauseGame(JSContext *context, uintN argc, jsval *vp);
static JSBool GlobalQuitGame(JSContext *context, uintN argc, jsval *vp);
static JSBool GlobalGetGuiColorSettingForKey(JSContext *context, uintN argc, jsval *vp);
static JSBool GlobalSetGuiColorSettingForKey(JSContext *context, uintN argc, jsval *vp);
static JSBool GlobalSetExtraGuiScreenKeys(JSContext *context, uintN argc, jsval *vp);
Expand Down Expand Up @@ -151,6 +152,7 @@ - (void)sendMonitorLogMessage:(NSString *)message

#ifndef NDEBUG
{ "takeSnapShot", GlobalTakeSnapShot, 1 },
{ "quitGame", GlobalQuitGame, 0 },
#endif
{ "pauseGame", GlobalPauseGame, 0 },
{ 0 }
Expand Down Expand Up @@ -853,3 +855,17 @@ static JSBool GlobalPauseGame(JSContext *context, uintN argc, jsval *vp)

OOJS_NATIVE_EXIT
}

// quitGame() : Boolean
static JSBool GlobalQuitGame(JSContext *context, uintN argc, jsval *vp)
{
OOJS_NATIVE_ENTER(context)

OOLog(@"script.debug.quit", @"Quit requested via JavaScript global.quitGame()");

[UNIVERSE quitGame];

OOJS_RETURN_BOOL(YES);

OOJS_NATIVE_EXIT
}
1 change: 1 addition & 0 deletions src/Core/Universe.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ enum
#endif

- (void) pauseGame;
- (void) quitGame;

- (void) carryPlayerOn:(StationEntity*)carrier inWormhole:(WormholeEntity*)wormhole;
- (void) setUpUniverseFromStation;
Expand Down
5 changes: 5 additions & 0 deletions src/Core/Universe.m
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,11 @@ - (void) pauseGame
[[self gameController] setGamePaused:YES];
}

- (void) quitGame
{
OOLog(@"universe.quit", @"Quit command received by Universe.");
[[self gameController] exitAppWithContext:@"Universe Request"];
}

- (void) carryPlayerOn:(StationEntity*)carrier inWormhole:(WormholeEntity*)wormhole
{
Expand Down
Loading
Loading