灵符lingfu

lingdev

↓ 0 downloads

LingDev: a Godot / Unity-style game editor written in Ling. 2-D and 3-D scenes, Flash-style timeline and cutscenes, HUDs over 3-D, Ling scripting, audio / music / MIDI, builds for Windows, Linux, macOS, web, Raspberry Pi and LingOS. Ships with Ling Agent (an N64-style spy FPS), Ling Breaker (a 3-D breakout) and Moko's Picture Book (a kawaii storybook platformer).

Windows · x86-64Linux · x86-64LingOS · x86-64LingOS · Pi 5 ARM64Web · WASM
Keywords game-engine, editor, 3d, 2d, cutscene, timeline, ling, lingos, raspberry-pi
lingfu install lingdev
LicenseApache-2.0 OR MIT
Authorsling-lin
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (136)

tools/build_dist.sh
#!/usr/bin/env bash
# build_dist.sh - builds LingDev into dist/ for every target that can be built from this machine.
#
#   tools/build_dist.sh [win] [linux] [lingos-x86_64] [lingos-rpi5]     (default: all four)
#
# Run it from the LingDev folder (Git Bash on Windows, or bash on Linux / macOS) with
# ../ling built (cargo build --release --bin ling) and ../LingOS checked out.
#
#   win            dist/windows/lingdev.exe + ling/ + assets/   (needs the MSVC Rust toolchain)
#   linux          dist/linux/lingdev + ling/ + assets/          (built natively inside Docker,
#                  rust:1-bookworm, because the audio / window crates need Linux's ALSA, udev
#                  and X11 / Wayland libraries - cross-compiling them from Windows does not work)
#   lingos-x86_64  dist/lingos-x86_64/kernel/lingos-lingdev-x86_64   (../LingOS/kernel/x86_64-lingdev)
#   lingos-rpi5    dist/lingos-rpi5/rpi/kernel8.img                   (../LingOS/kernel/rpi-lingdev)
#   macOS          not buildable here: it needs Apple's SDK. On a Mac run:
#                  LING_APP_INTERP=ling ling build . --platform mac --out dist
#
# The desktop builds use ling build's portable launcher (LING_APP_INTERP=ling): the exe runs
# ling/main.ling on the interpreter from the ling/ folder next to it, so the editor's
# use "rt/..." layout stays intact. Keep the exe next to its ling/ and assets/ folders.
set -euo pipefail
cd "$(dirname "$0")/.."
ROOT="$(pwd)"
LING="${LING:-../ling/target/release/ling}"
[ -x "$LING" ] || LING="../ling/target/release/ling.exe"
what=("$@")
[ ${#what[@]} -eq 0 ] && what=(win linux lingos-x86_64 lingos-rpi5)
want() { local t; for t in "${what[@]}"; do [ "$t" = "$1" ] && return 0; done; return 1; }
winpath() { if command -v cygpath >/dev/null; then cygpath -w "$1"; else echo "$1"; fi; }
mkdir -p dist

if want win; then
    echo "== Windows"
    rm -rf dist/.win && LING_APP_INTERP=ling "$LING" build . --platform win --out "$(winpath "$ROOT/dist/.win")"
    rm -rf dist/windows && mv dist/.win/windows dist/windows && rm -rf dist/.win
fi

if want linux; then
    echo "== Linux (Docker)"
    command -v docker >/dev/null || { echo "docker not found"; exit 1; }
    # ling build writes the wrapper crate to .ling-build/lingdev; build that crate natively in Linux
    if [ ! -f .ling-build/lingdev/src/main.rs ] || ! grep -q 'ling/main.ling' .ling-build/lingdev/src/main.rs; then
        echo "run the win target first (it generates .ling-build/lingdev with the portable launcher)"; exit 1
    fi
    W="$ROOT/dist/.linux-crate"
    rm -rf "$W" && mkdir -p "$W" dist/.linux-out
    cp -r .ling-build/lingdev/Cargo.toml .ling-build/lingdev/Cargo.lock .ling-build/lingdev/build.rs .ling-build/lingdev/src "$W/"
    sed -i 's#ling = { path = "[^"]*"#ling = { path = "/ling"#' "$W/Cargo.toml"
    LING_SRC="$(cd ../ling && pwd)"
    MSYS_NO_PATHCONV=1 docker run --rm \
        -v "$(winpath "$LING_SRC"):/ling:ro" -v "$(winpath "$W"):/work" -v "$(winpath "$ROOT/dist/.linux-out"):/out" \
        -v lingdev-linux-target:/work/target -w /work rust:1-bookworm bash -c \
        'apt-get update -qq && apt-get install -y -qq pkg-config libasound2-dev libudev-dev libx11-dev libxkbcommon-dev libwayland-dev libxcursor-dev libxrandr-dev libxi-dev >/dev/null && cargo build --release && cp target/release/lingdev /out/'
    rm -rf dist/linux && mkdir -p dist/linux
    cp dist/.linux-out/lingdev dist/linux/ && chmod +x dist/linux/lingdev
    # the same ling/ and assets/ tree the Windows build ships
    if [ -d dist/windows/ling ]; then cp -r dist/windows/ling dist/windows/assets dist/linux/; fi
    rm -rf "$W" dist/.linux-out
fi

if want lingos-x86_64; then
    echo "== LingOS x86-64"
    (cd ../LingOS && "$LING" build kernel/x86_64-lingdev --platform kernel --out "$(winpath "$ROOT/dist/lingos-x86_64")")
fi

if want lingos-rpi5; then
    echo "== LingOS Raspberry Pi"
    (cd ../LingOS && "$LING" build kernel/rpi-lingdev --platform rpi --out "$(winpath "$ROOT/dist/lingos-rpi5")")
fi
echo "done: $(ls dist)"

← Back to index