diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b9eff42..976270ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,7 +78,9 @@ jobs: with: { python-version: "3.11" } - name: Install Dependencies - run: scripts/install-dependencies.sh + run: | + brew install bash + pip3 install meson ninja - name: Build & Package Mac (Bundle) run: | @@ -110,7 +112,9 @@ jobs: with: { python-version: "3.11" } - name: Install Dependencies - run: scripts/install-dependencies.sh + run: | + brew install bash + pip3 install dmgbuild - name: Download Artifacts uses: actions/download-artifact@v4 @@ -148,19 +152,23 @@ jobs: name: Linux (x86_64) needs: [version] runs-on: ubuntu-latest - env: - BUILDER: docker run -v .:/build -w /build ghcr.io/lite-xl/lite-xl-build-box-manylinux:v3.0.2 -- /entrypoint.sh steps: - uses: actions/checkout@v4 - name: Build - run: $BUILDER scripts/build.sh --addons --debug --forcefallback --portable -b build + uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:v3 + with: + entrypoint: /entrypoint.sh + args: bash scripts/build.sh --addons --debug --forcefallback --portable -b build - name: Package Linux (Portable) - run: cd build && tar -czvf ../lite-xl-${{ needs.version.outputs.ref }}-x86_64-linux-portable.tar.gz lite-xl && cd .. + run: tar -C build -czvf lite-xl-${{ needs.version.outputs.ref }}-x86_64-linux-portable.tar.gz lite-xl - name: Package Linux (AppImage) - run: $BUILDER scripts/package-appimage.sh --debug --version ${{ needs.version.outputs.ref }} -b build + uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:v3 + with: + entrypoint: /entrypoint.sh + run: bash scripts/package-appimage.sh --debug --version ${{ needs.version.outputs.ref }} -b build - name: Upload (Release) uses: actions/upload-artifact@v4 @@ -180,13 +188,21 @@ jobs: needs: [version] steps: - uses: msys2/setup-msys2@v2 - with: { msystem: MINGW64 } - + with: + msystem: MINGW64 + install: >- + git + zip + patch + pacboy: >- + gcc:p + meson:p + ca-certificates:p + ninja:p + pkg-config:p + - uses: actions/checkout@v4 - - name: Install Dependencies - run: bash scripts/install-dependencies.sh - - name: Build run: bash scripts/build.sh --addons --debug --forcefallback --portable -b build diff --git a/README.md b/README.md index 0dceeb46..fcb19735 100644 --- a/README.md +++ b/README.md @@ -45,19 +45,85 @@ These color themes are bundled with all releases of Lite XL by default. ## Quick Build Guide -If you compile Lite XL yourself, it is recommended to use the script -`build-packages.sh`: +To compile Lite XL yourself, you must have the following dependencies installed +via your desired package manager, or manually. + +### Prerequisites + +- Meson (>=0.63) +- Ninja +- SDL2 +- PCRE2 +- FreeType2 +- Lua 5.4 +- A working C compiler (GCC / Clang / MSVC) + +SDL2, PCRE2, FreeType2 and Lua will be downloaded by Meson +if `--wrap-mode=forcefallback` or `--wrap-mode=default` is specified. + +> [!NOTE] +> MSVC is used in the CI, but MSVC-compiled binaries are not distributed officially +> or tested extensively for bugs. + +On Linux, you may install the following dependencies for the SDL2 X11 and/or Wayland backend to work properly: + +- `libX11-devel` +- `libXi-devel` +- `libXcursor-devel` +- `libxkbcommon-devel` +- `libXrandr-devel` +- `wayland-devel` +- `wayland-protocols-devel` +- `dbus-devel` +- `ibus-devel` + +The following command can be used to install the dependencies in Ubuntu: ```sh -bash build-packages.sh -h +apt-get install python3.8 python3-pip build-essential git cmake wayland-protocols libsdl2-dev +pip3 install meson ninja ``` -The script will run Meson and create a tar compressed archive with the application or, -for Windows, a zip file. Lite XL can be easily installed -by unpacking the archive in any directory of your choice. +Please refer to [lite-xl-build-box] for a working Linux build environment used to package official Lite XL releases. -Otherwise the following is an example of basic commands if you want to customize -the build: +On macOS, you must install bash via Brew, as the default bash version on macOS is antiquated +and may not run the build script correctly. + +### Building + +You can use `scripts/build.sh` to set up Lite XL and build it. + +```sh +$ bash build.sh --help +# Usage: scripts/build.sh +# +# Available options: +# +# -b --builddir DIRNAME Sets the name of the build directory (not path). +# Default: 'build-x86_64-linux'. +# --debug Debug this script. +# -f --forcefallback Force to build dependencies statically. +# -h --help Show this help and exit. +# -d --debug-build Builds a debug build. +# -p --prefix PREFIX Install directory prefix. Default: '/'. +# -B --bundle Create an App bundle (macOS only) +# -A --addons Add in addons +# -P --portable Create a portable binary package. +# -r --reconfigure Tries to reuse the meson build directory, if possible. +# Default: Deletes the build directory and recreates it. +# -O --pgo Use profile guided optimizations (pgo). +# macOS: disabled when used with --bundle, +# Windows: Implicit being the only option. +# --cross-platform PLATFORM Cross compile for this platform. +# The script will find the appropriate +# cross file in 'resources/cross'. +# --cross-arch ARCH Cross compile for this architecture. +# The script will find the appropriate +# cross file in 'resources/cross'. +# --cross-file CROSS_FILE Cross compile with the given cross file. +``` + +Alternatively, you can use the following commands to customize the build: ```sh meson setup --buildtype=release --prefix build @@ -237,3 +303,4 @@ See the [licenses] file for details on licenses used by the required dependencie [colors repository]: https://github.com/lite-xl/lite-xl-colors [LICENSE]: LICENSE [licenses]: licenses/licenses.md +[lite-xl-build-box]: https://github.com/lite-xl/lite-xl-build-box \ No newline at end of file diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh deleted file mode 100755 index 41e4f7ae..00000000 --- a/scripts/install-dependencies.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -set -ex - -if [ ! -e "src/api/api.h" ]; then - echo "Please run this script from the root directory of Lite XL."; exit 1 -fi - -show_help() { - echo - echo "Lite XL dependecies installer. Mainly used for CI but can also work on users systems." - echo "USE IT AT YOUR OWN RISK!" - echo - echo "Usage: $0 " - echo - echo "Available options:" - echo - echo " --debug Debug this script." - echo -} - -main() { - for i in "$@"; do - case $i in - -s|--lhelper) - echo "error: support for lhelper has been deprecated" >> /dev/stderr - exit 1 - ;; - --debug) - set -x - shift - ;; - *) - # unknown option - ;; - esac - done - - if [[ -n $1 ]]; then - show_help - exit 1 - fi - - if [[ "$OSTYPE" == "linux"* ]]; then - sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6 desktop-file-utils - pip3 install meson - elif [[ "$OSTYPE" == "darwin"* ]]; then - brew install bash ninja sdl2 - pip3 install meson dmgbuild - elif [[ "$OSTYPE" == "msys" ]]; then - pacman --noconfirm -S \ - ${MINGW_PACKAGE_PREFIX}-{ca-certificates,gcc,meson,ninja,ntldd,pkg-config,mesa,freetype,pcre2,SDL2} unzip patch zip - fi -} - -main "$@"