Skip to content

Commit

Permalink
more linuxin'
Browse files Browse the repository at this point in the history
Co-authored-by: NotHyper <40342021+NotHyper-474@users.noreply.github.com>
Co-authored-by: Hyper_ <survivaltemer@gmail.com>
  • Loading branch information
3 people committed Jun 9, 2024
1 parent 3a031d8 commit 4b90f82
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 15 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: x64 Linux Build
on: workflow_dispatch
jobs:
build:
name: Linux Build
runs-on: ubuntu-20.04 # Distro with at least an suitable GLibC version
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true # IMPORTANT!

- name: Setup Haxe environment
uses: krdlab/setup-haxe@master
with:
haxe-version: 4.3.2

- name: Install VLC dependencies
run: |
sudo apt-get update
sudo apt-get install libvlc-dev libvlccore-dev
- name: Setup Haxe libraries
run: |
haxelib install hmm --quiet
haxelib run hmm setup --quiet
haxelib run hmm install --quiet
- name: Build Game
run: haxelib run lime build linux

- name: Upload!
uses: actions/upload-artifact@v4
with:
name: linuxBuild
path: export/release/linux/bin
if-no-files-found: error

51 changes: 51 additions & 0 deletions .github/workflows/rebuild-lime-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Rebuild Lime Linux NDLL
on:
workflow_dispatch

jobs:
rebuild_linux:
runs-on: ubuntu-20.04
steps:
- name: Setup Haxe
uses: krdlab/setup-haxe@v1.5.1
with:
haxe-version: 4.3.2

- name: Setup Lime
uses: actions/checkout@v4.1.5
with:
repository: FunkinCrew/lime
submodules: true
path: 'lime'

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev g++ g++-multilib gcc-multilib libasound2-dev libx11-dev libxext-dev libxi-dev libxrandr-dev libxinerama-dev
- name: Rebuild Lime
run: |
haxelib dev lime lime
haxelib install format --quiet
haxelib install hxp --quiet
haxelib install hxcpp --quiet
haxelib run lime rebuild linux -release -64 -clean
haxelib run lime rebuild linux -release -clean
# TODO: See if debug files need rebuilding as well

- name: Upload 32-bit NDLLs
uses: actions/upload-artifact@v4
with:
name: linuxNDLL
path: lime/ndll/Linux
compression-level: 0
if-no-files-found: error

- name: Upload 64-bit NDLLs
uses: actions/upload-artifact@v4
with:
name: linuxNDLL64
path: lime/ndll/Linux64
compression-level: 0
if-no-files-found: error

1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "assets"]
path = assets
url = https://github.com/FunkinCrew/funkin.assets
branch = 3b8235e953505a6fe7f4ff253f5a99b9a7b9857a
[submodule "art"]
path = art
url = https://github.com/FunkinCrew/funkin.art
6 changes: 3 additions & 3 deletions hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"name": "lime",
"type": "git",
"dir": null,
"ref": "872ff6db2f2d27c0243d4ff76802121ded550dd7",
"url": "https://github.com/FunkinCrew/lime"
"ref": "develop2",
"url": "https://github.com/NotHyper-474/lime"
},
{
"name": "mconsole",
Expand Down Expand Up @@ -183,4 +183,4 @@
"url": "https://github.com/FunkinCrew/thx.semver"
}
]
}
}
8 changes: 4 additions & 4 deletions source/funkin/util/FileUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ class FileUtil
};
}

public static function openFolder(pathFolder:String)
public static function openFolder(pathFolder:String):Void
{
#if windows
Sys.command('explorer', [pathFolder]);
Expand All @@ -656,10 +656,10 @@ class FileUtil
// FileUtil.hx note: this was originally used to open the logs specifically!
// thats why the above comment is there!
Sys.command('open', [pathFolder]);
// #end
#elseif linux
Sys.command('xdg-open $pathFolder &');
#end

// TODO: implement linux
// some shit with xdg-open :thinking: emoji...
}

static function convertTypeFilter(typeFilter:Array<FileFilter>):String
Expand Down
41 changes: 33 additions & 8 deletions source/funkin/util/WindowUtil.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package funkin.util;

import lime.app.Application;
import flixel.util.FlxSignal.FlxTypedSignal;

using StringTools;
Expand All @@ -23,12 +24,16 @@ class WindowUtil
public static function openURL(targetUrl:String):Void
{
#if CAN_OPEN_LINKS
#if linux
Sys.command('/usr/bin/xdg-open $targetUrl &');
#else
// This should work on Windows and HTML5.
FlxG.openURL(targetUrl);
#if (target.threaded)
sys.thread.Thread.create(() -> {
#end
FlxG.openURL(targetUrl);
#if (target.threaded)
});
#end
/*#else // Should work for HTML5
FlxG.openURL(targetUrl);
#end*/
#else
throw 'Cannot open URLs on this platform.';
#end
Expand All @@ -46,7 +51,8 @@ class WindowUtil
#elseif mac
Sys.command('open', [targetPath]);
#elseif linux
Sys.command('open', [targetPath]);
// For now just reuse FileUtil, why is there even two methods that do the same thing?
FileUtil.openFolder(targetPath);
#end
#else
throw 'Cannot open URLs on this platform.';
Expand All @@ -65,8 +71,15 @@ class WindowUtil
#elseif mac
Sys.command('open', ['-R', targetPath]);
#elseif linux
// TODO: unsure of the linux equivalent to opening a folder and then "selecting" a file.
Sys.command('open', [targetPath]);
// TODO: Is this consistent across distros?
Sys.command('dbus-send', [
'--session',
'--print-reply',
'--dest=org.freedesktop.FileManager1',
'--type=method_call /org/freedesktop/FileManager1',
'org.freedesktop.FileManager1.ShowItems array:string:"file://$targetPath"',
'string:""'
]);
#end
#else
throw 'Cannot open URLs on this platform.';
Expand Down Expand Up @@ -122,4 +135,16 @@ class WindowUtil
{
lime.app.Application.current.window.title = value;
}

/**
* Shows a message box if supported or logs message to the console
*/
public static function showMessageBox(message:String, title:String):Void
{
#if sys
lime.app.Application.current.window.alert(message, title);
#else
// TODO: Logging
#end
}
}

0 comments on commit 4b90f82

Please sign in to comment.