mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-06-04 15:13:00 +00:00
Merge branch 'dev' into rubicon
This commit is contained in:
commit
968f2a4f91
2
.github/workflows/build-doxygen.yml
vendored
2
.github/workflows/build-doxygen.yml
vendored
|
|
@ -9,6 +9,8 @@ on:
|
|||
- "minecraft/**"
|
||||
- "docs/**"
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
|
|
|
|||
28
.github/workflows/build-linux.yml
vendored
28
.github/workflows/build-linux.yml
vendored
|
|
@ -19,6 +19,8 @@ on:
|
|||
pull_request:
|
||||
paths: *workflow_paths
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -41,43 +43,31 @@ jobs:
|
|||
sudo apt-get install -y libc++-20-dev libc++abi-20-dev
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.ccache
|
||||
path: ${{ runner.temp }}/ccache
|
||||
key: ${{ runner.os }}-ccache-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Restore meson cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/meson
|
||||
key: ${{ runner.os }}-meson-${{ hashFiles('**/meson.build') }}
|
||||
restore-keys: ${{ runner.os }}-ccache-
|
||||
|
||||
- name: Configure Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
CC_LD: lld
|
||||
CXX_LD: lld
|
||||
run: |
|
||||
mkdir -p "$CCACHE_DIR"
|
||||
export CCACHE_DIR="$CCACHE_DIR"
|
||||
meson setup build --wipe --native-file=./scripts/llvm_native.txt
|
||||
meson setup build --wipe
|
||||
|
||||
- name: Build with Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
export CCACHE_DIR="${{ runner.temp }}/ccache"
|
||||
# Use all available cores for faster parallel builds
|
||||
meson compile -C build -j $(nproc) -v Minecraft.Client
|
||||
|
||||
- name: Install patchelf
|
||||
run: sudo apt-get install -y patchelf
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft-client-linux-${{ github.sha }}
|
||||
path: build/targets/app/Minecraft.Client
|
||||
retention-days: 7
|
||||
retention-days: 7
|
||||
|
|
|
|||
2
.github/workflows/clang-format.yml
vendored
2
.github/workflows/clang-format.yml
vendored
|
|
@ -19,6 +19,8 @@ on:
|
|||
pull_request:
|
||||
paths: *workflow_paths
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
87
.github/workflows/release-linux.yml
vendored
Normal file
87
.github/workflows/release-linux.yml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: Nightly (Linux, x86-64)
|
||||
|
||||
on:
|
||||
push:
|
||||
paths: &workflow_paths
|
||||
- '**.cpp'
|
||||
- '**.h'
|
||||
- '**.c'
|
||||
- '**.cc'
|
||||
- '**.cxx'
|
||||
- '**.hh'
|
||||
- '**.hpp'
|
||||
- '**.hxx'
|
||||
- '**.inl'
|
||||
- "**meson.build"
|
||||
- "flake.nix"
|
||||
- '.github/workflows/build-linux.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential ccache python3 python3-pip ninja-build libsdl2-dev libgl-dev libglu1-mesa-dev libpthread-stubs0-dev libglm-dev
|
||||
python -m pip install meson
|
||||
ccache -M 5G || true
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ runner.os }}-ccache-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Restore meson cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/meson
|
||||
key: ${{ runner.os }}-meson-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Configure Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
mkdir -p "$CCACHE_DIR"
|
||||
export CCACHE_DIR="$CCACHE_DIR"
|
||||
meson setup build --wipe --native-file=./scripts/llvm_native.txt
|
||||
|
||||
- name: Build with Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
export CCACHE_DIR="${{ runner.temp }}/ccache"
|
||||
meson compile -C build -j $(nproc)
|
||||
|
||||
- name: Install patchelf
|
||||
run: sudo apt-get install -y patchelf
|
||||
|
||||
- name: Package artifact
|
||||
run: |
|
||||
cd build
|
||||
zip -r ../minecraft-client-linux.zip Minecraft.Client --exclude "Minecraft.Client/Minecraft.Client.p/*"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft-client-linux-${{ github.sha }}
|
||||
path: minecraft-client-linux.zip
|
||||
retention-days: 7
|
||||
|
||||
- name: Create nightly release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: nightly
|
||||
name: Nightly
|
||||
prerelease: true
|
||||
files: minecraft-client-linux.zip
|
||||
|
|
@ -12,11 +12,11 @@ At the moment, we're aiming to support the following platforms:
|
|||
|
||||
Please note that these percentages are **estimates** and do not necessarily reflect the final playability of the game on each platform.
|
||||
|
||||
- Linux (~85%)
|
||||
- Linux (~90%)
|
||||
- Emscripten (~10%) [[Check the Emscripten Branch](https://github.com/4jcraft/4jcraft/tree/feat/emscripten)]
|
||||
- macOS (not started) [No official support but people have been able to run the game on MacOS]
|
||||
- iOS (not started)
|
||||
- Android (~5%)
|
||||
- Android (~35%)
|
||||
|
||||
> [!WARNING]
|
||||
> There is NO Windows support, for that, go to [smartcmd/MinecraftConsoles](https://github.com/smartcmd/MinecraftConsoles/).
|
||||
|
|
|
|||
80
flake.nix
80
flake.nix
|
|
@ -20,6 +20,7 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# patches only get applied if they follow <subproject_to_patch>-patch naming
|
||||
miniaudio-patch = {
|
||||
url = "https://wrapdb.mesonbuild.com/v2/miniaudio_0.11.22-2/get_patch";
|
||||
flake = false;
|
||||
|
|
@ -37,16 +38,51 @@
|
|||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}@inputs:
|
||||
{ self, nixpkgs, flake-utils, ... }@inputs:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
lib = pkgs.lib;
|
||||
|
||||
subprojectNames = [
|
||||
"shiggy"
|
||||
"4jlibs"
|
||||
"stb"
|
||||
"simdutf"
|
||||
"miniaudio"
|
||||
];
|
||||
|
||||
# helper: copy all subproject sources
|
||||
copySubprojects = ''
|
||||
mkdir -p $sourceRoot/subprojects
|
||||
${lib.concatMapStringsSep "\n" (name: "cp -r ${inputs.${name}} $sourceRoot/subprojects/${name}") subprojectNames}
|
||||
chmod -R u+w $sourceRoot/subprojects
|
||||
'';
|
||||
|
||||
# helper: copy packagefiles
|
||||
copyPackagefiles = ''
|
||||
for proj in ${builtins.toString subprojectNames}; do
|
||||
if [ -d "subprojects/packagefiles/$proj" ]; then
|
||||
cp -r subprojects/packagefiles/$proj/* subprojects/$proj/
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
# helper: apply patches from '-patch' inputs
|
||||
applyPatches = lib.concatMapStringsSep "\n" (name: ''
|
||||
patch_input="${inputs.${name + "-patch"} or ""}"
|
||||
if [ -n "$patch_input" ]; then
|
||||
unzip "$patch_input" -d ${name}-patch-tmp
|
||||
if [ $(ls -1 ${name}-patch-tmp | wc -l) -eq 1 ] && [ -d ${name}-patch-tmp/* ]; then
|
||||
cp -r ${name}-patch-tmp/*/* subprojects/${name}/
|
||||
else
|
||||
cp -r ${name}-patch-tmp/* subprojects/${name}/
|
||||
fi
|
||||
rm -rf ${name}-patch-tmp
|
||||
fi
|
||||
'') subprojectNames;
|
||||
|
||||
in
|
||||
{
|
||||
packages.default = pkgs.clangStdenv.mkDerivation {
|
||||
|
|
@ -57,34 +93,18 @@
|
|||
dontFixup = true;
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
# 4jcraft - Meson expects this subprojects structure
|
||||
postUnpack = ''
|
||||
mkdir -p $sourceRoot/subprojects
|
||||
|
||||
cp -r ${inputs.shiggy} $sourceRoot/subprojects/shiggy
|
||||
cp -r ${inputs."4jlibs"} $sourceRoot/subprojects/4jlibs
|
||||
cp -r ${inputs.stb} $sourceRoot/subprojects/stb
|
||||
cp -r ${inputs.simdutf} $sourceRoot/subprojects/simdutf
|
||||
cp -r ${inputs.miniaudio} $sourceRoot/subprojects/miniaudio
|
||||
|
||||
chmod -R u+w $sourceRoot/subprojects
|
||||
${copySubprojects}
|
||||
'';
|
||||
|
||||
# 4jcraft - `stb` and `simdutf` patches
|
||||
postPatch = ''
|
||||
cp subprojects/packagefiles/stb/meson.build subprojects/stb/meson.build
|
||||
cp subprojects/packagefiles/simdutf/meson.build subprojects/simdutf/meson.build
|
||||
cp subprojects/packagefiles/simdutf/meson.options subprojects/simdutf/meson.options
|
||||
# Remove wrap files so Meson doesn't try to download them
|
||||
for proj in ${builtins.toString subprojectNames}; do
|
||||
rm -f subprojects/$proj.wrap
|
||||
done
|
||||
|
||||
unzip ${inputs.miniaudio-patch} -d miniaudio-patch-tmp
|
||||
cp -r miniaudio-patch-tmp/*/. subprojects/miniaudio/
|
||||
|
||||
cat > subprojects/miniaudio.wrap <<EOF
|
||||
[wrap-file]
|
||||
directory = miniaudio
|
||||
[provide]
|
||||
dependency_names = miniaudio
|
||||
EOF
|
||||
${copyPackagefiles}
|
||||
${applyPatches}
|
||||
'';
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
|
|
@ -117,7 +137,7 @@
|
|||
|
||||
meta = {
|
||||
description = "4JCraft";
|
||||
platforms = pkgs.lib.platforms.unix;
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue