Streamlined and simplified CI, and made it use lpm to install addons. (#1649)

* Streamlined and simplified CI, and made it use lpm to install addons.

Removed universal-dmg packager, as it is not necessary under the new workflow; a regular fat binary being packaged with the normal dmg works.

Incoprorated Guldo's suggestions.

Fixed minor issue.

Fixed slight issues.

Reverted to master.

Fixed nit.

Split up packaging steps.

Sigh,.

?

Fixed up x86 build.

Split Mac into two workers with a matrix.

Sigh.

Removed unecessary lines.

More descriptive name.

Split arch workflow for Mac.

Syntax error.

Spaced things out.

Fixed mac build.

Removed unecessary steps.

Takase's suggestions.

Removed unecessary `..`.

Modified patch to reference the new lua version (hopefully no other modifications needed).

Restored logic to create bundle.

New release workflow.

Changed to welcome plugin.

Changed build.

Added in package-portable to make this easier.

Corrected compiling arch.

Harmonized formats.

Remove package portable.

Fixed universal build.

Fix mispelling.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

Sigh.

* Expanded things as per Takase's request.

* Renamed Mac to Darwin.

* Fixed missing variable.
This commit is contained in:
Adam 2024-10-22 11:53:17 -04:00 committed by GitHub
parent e8a4ed2a21
commit 82d78350e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 327 additions and 1542 deletions

View File

@ -2,80 +2,67 @@ name: CI
on: on:
push: push:
branches:
- "*"
pull_request: pull_request:
branches: branches:
- "*" - '*'
workflow_dispatch: workflow_dispatch:
inputs:
version:
description: Release Version
required: false
# Builds & Uploads:
# * Linux x86_64 Portable
# * Linux App Image
# * Mac Universal Portable
# * Mac Universal DMG
# * Windows x86_64 Portable
# * Windows x86_64 Installer
jobs: jobs:
build_linux: # Checks to see if we have an input, and stamps that onto the repo.
name: Linux # Determines if this is a release, and determines the official ref.
runs-on: ubuntu-22.04 version:
strategy: name: Compute Version & Check for Release
matrix: runs-on: ubuntu-latest
config:
- { name: "GCC", cc: gcc, cxx: g++ }
- { name: "clang", cc: clang, cxx: clang++ }
env: env:
CC: ${{ matrix.config.cc }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CXX: ${{ matrix.config.cxx }} outputs:
release: ${{ steps.check_release.outputs.release }}
ref: ${{ steps.check_release.outputs.ref }}
steps: steps:
- name: Set Environment Variables - name: Update Tag
if: ${{ matrix.config.cc == 'gcc' }} uses: richardsimko/update-tag@v1
run: | if: ${{ github.event.inputs.version }}
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-linux-$(uname -m)-portable" >> "$GITHUB_ENV"
- name: Checkout code
uses: actions/checkout@v4
- name: Python Setup
uses: actions/setup-python@v5
with: with:
python-version: "3.11" tag_name: ${{ github.event.inputs.version }}
env:
- name: Update Packages GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sudo apt-get update - uses: actions/checkout@v4
- name: Install Dependencies
run: bash scripts/install-dependencies.sh --debug
- name: Build
run: |
bash --version
bash scripts/build.sh --debug --forcefallback --portable
- name: Package
if: ${{ matrix.config.cc == 'gcc' }}
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --binary
- name: Upload Artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.config.cc == 'gcc' }}
with: with:
name: Linux Artifacts fetch-depth: 0
path: ${{ env.INSTALL_NAME }}.tar.gz fetch-tags: true
compression-level: 0 - name: Check Release
id: check_release
run: |
export REF=`git describe --match v[0-9]* HEAD --tags`
echo "Build Version: $REF"
[[ "$REF" != "" ]] && echo "ref=$REF" >> $GITHUB_OUTPUT
if [[ `git describe --exact-match --match v[0-9]* HEAD --tags` ]]; then
echo "release=$REF" >> $GITHUB_OUTPUT
echo "Release Version: $REF"
fi
build_macos: build_darwin:
name: macOS name: Darwin
needs: [version]
strategy: strategy:
matrix: matrix:
config: config:
- { arch: x86_64, runner: macos-13 } # macos-13 uses x86_64 - { runner: macos-13, type: bundle, arch: x86_64-darwin }
- { arch: arm64, runner: macos-14 } # macos-14 / latest uses M1 - { runner: macos-13, type: portable, arch: x86_64-darwin }
- { runner: macos-14, type: bundle, arch: aarch64-darwin }
- { runner: macos-14, type: portable, arch: aarch64-darwin }
runs-on: ${{ matrix.config.runner }} runs-on: ${{ matrix.config.runner }}
env:
CC: clang
CXX: clang++
steps: steps:
- name: System Information - name: System Information
run: | run: |
@ -84,203 +71,230 @@ jobs:
gcc -v gcc -v
xcodebuild -version xcodebuild -version
- name: Set Environment Variables - uses: actions/checkout@v4
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-${{ matrix.config.arch }}" >> "$GITHUB_ENV"
- name: Checkout code
uses: actions/checkout@v4
- name: Python Setup - name: Python Setup
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with: { python-version: "3.11" }
python-version: "3.11"
# installing md5sha1sum will eliminate a warning with arm64 and libusb
- name: Install Dependencies - name: Install Dependencies
run: | run: scripts/install-dependencies.sh
brew install bash md5sha1sum
pip install meson ninja dmgbuild
- name: Build - name: Build
run: | run: scripts/build.sh --addons --debug --forcefallback --${{ matrix.config.type }} -b build
bash --version
bash scripts/build.sh --bundle --debug --forcefallback
- name: Create DMG Image - name: Package Mac (Bundle)
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg if: ${{ matrix.config.type == 'bundle' }}
run: cd build && tar -czvf ../lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}}-${{ matrix.config.type }}.tar.gz lite-xl Info.plist
- name: Upload DMG Image - name: Package Mac (Portable)
if: ${{ matrix.config.type == 'portable' }}
run: cd build && tar -czvf ../lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}}-${{ matrix.config.type }}.tar.gz lite-xl
- name: Upload (Intermediate)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: macOS DMG Images (${{ matrix.config.arch }}) name: lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}-${{ matrix.config.type }}
path: ${{ env.INSTALL_NAME }}.dmg path: |
compression-level: 0 *.tar.gz
build_macos_universal:
name: macOS (Universal) build_darwin_universal:
name: Darwin (Universal)
needs: [version, build_darwin]
runs-on: macos-14 runs-on: macos-14
needs: build_macos
steps: steps:
- name: System Information - uses: actions/checkout@v4
run: |
system_profiler SPSoftwareDataType
bash --version
gcc -v
xcodebuild -version
- name: Set Environment Variables - name: Python Setup
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-universal" >> "$GITHUB_ENV"
- name: Setup Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with: { python-version: "3.11" }
python-version: "3.11"
- name: Install dmgbuild - name: Install Dependencies
run: pip install dmgbuild run: scripts/install-dependencies.sh
- name: Checkout code - name: Download Artifacts
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
id: download
with: with:
pattern: macOS DMG Images * pattern: '*darwin*'
merge-multiple: true
path: dmgs-original
- name: Make universal bundles - name: Create Universal Binaries
run: | run: |
bash --version for TYPE in bundle portable; do
bash scripts/make-universal-binaries.sh ${{ steps.download.outputs.download-path }} "${INSTALL_NAME}" mkdir -p lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-$TYPE/lite-xl
cd lite-xl-${{ needs.version.outputs.ref }}-x86_64-darwin-$TYPE && tar -zxvf *.tar.gz && cd .. && cd lite-xl-${{ needs.version.outputs.ref }}-aarch64-darwin-$TYPE && tar -zxvf *.tar.gz && cd ..
cp -r lite-xl-${{ needs.version.outputs.ref }}-*-$TYPE/lite-xl/data lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-$TYPE/lite-xl
lipo -create -output lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-$TYPE/lite-xl/lite-xl lite-xl-${{ needs.version.outputs.ref }}-*-darwin-$TYPE/lite-xl/lite-xl
done
cp lite-xl-${{ needs.version.outputs.ref }}-x86_64-darwin-bundle/Info.plist lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-bundle/Info.plist
- name: Upload DMG Image - name: Package Darwin (Universal DMG Image)
run: scripts/package-dmg.sh lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-bundle lite-xl-${{ needs.version.outputs.ref }}-universal-darwin
- name: Package Darwin (Universal Portable)
run: cd lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-portable && tar -zcvf ../lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-portable.tar.gz *
- name: Upload (Release)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: macOS DMG Images (Universal) name: lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-release
path: ${{ env.INSTALL_NAME }}.dmg path: |
compression-level: 0 *.dmg
*.tar.gz
build_windows_msys2:
name: Windows build_linux:
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
- name: Package Linux (Portable)
run: cd build && tar -czvf ../lite-xl-${{ needs.version.outputs.ref }}-x86_64-linux-portable.tar.gz lite-xl && cd ..
- name: Package Linux (AppImage)
run: $BUILDER scripts/package-appimage.sh --debug --version ${{ needs.version.outputs.ref }} -b build
- name: Upload (Release)
uses: actions/upload-artifact@v4
with:
name: lite-xl-${{ needs.version.outputs.ref }}-x86_64-linux-portable-release
path: |
*.tar.gz
*.AppImage
build_windows:
name: Windows (x86_64) (MSYS)
runs-on: windows-2019 runs-on: windows-2019
strategy:
matrix:
config:
- { msystem: MINGW32, arch: i686 }
- { msystem: MINGW64, arch: x86_64 }
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
needs: [version]
steps: steps:
- name: Checkout code - uses: msys2/setup-msys2@v2
uses: actions/checkout@v4 with: { msystem: MINGW64 }
- name: Setup MSYS2 - uses: actions/checkout@v4
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msystem }}
install: >-
base-devel
git
zip
mingw-w64-${{ matrix.config.arch }}-gcc
mingw-w64-${{ matrix.config.arch }}-meson
mingw-w64-${{ matrix.config.arch }}-ninja
mingw-w64-${{ matrix.config.arch }}-ca-certificates
mingw-w64-${{ matrix.config.arch }}-ntldd
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
if [[ "${MSYSTEM}" == "MINGW64" ]]; then
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-x86_64" >> "$GITHUB_ENV"
else
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-i686" >> "$GITHUB_ENV"
fi
- name: Install Dependencies - name: Install Dependencies
if: false run: bash scripts/install-dependencies.sh
run: bash scripts/install-dependencies.sh --debug
- name: Build - name: Build
run: | run: bash scripts/build.sh -U --addons --debug --forcefallback --portable -b build
bash --version
bash scripts/build.sh -U --debug --forcefallback
- name: Package - name: Package Windows (Portable)
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --binary run: cd build && zip -r ../lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows-portable.zip lite-xl && cd ..
- name: Upload Artifacts - name: Package Windows (InnoSetup)
run: bash scripts/package-innosetup.sh --debug --version ${{ needs.version.outputs.ref }} -b build
- name: Upload (Release)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Windows Artifacts (${{ matrix.config.msystem }}) name: lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows-portable-release
path: ${{ env.INSTALL_NAME }}.zip path: |
compression-level: 0 *.zip
*.exe
build_windows_msvc: build_windows_msvc:
name: Windows (MSVC) name: Windows (x86_64) (MSVC)
needs: [version]
runs-on: windows-2019 runs-on: windows-2019
strategy:
matrix:
arch:
- { target: x86, name: i686 }
- { target: x64, name: x86_64 }
steps: steps:
- name: Checkout code - uses: actions/checkout@v4
uses: actions/checkout@v4
- name: Setup MSVC - name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: ${{ matrix.arch.target }} arch: x86_64
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with: { python-version: "3.11" }
python-version: "3.11"
- name: Install meson and ninja - name: Install meson and ninja
run: pip install meson ninja run: pip install meson ninja
- name: Set up environment variables - name: Set up environment variables
run: | run: |
"INSTALL_NAME=lite-xl-$($env:GITHUB_REF -replace ".*/")-windows-msvc-${{ matrix.arch.name }}" >> $env:GITHUB_ENV
"INSTALL_REF=$($env:GITHUB_REF -replace ".*/")" >> $env:GITHUB_ENV
"LUA_SUBPROJECT_PATH=subprojects/$(awk -F ' *= *' '/directory/ { printf $2 }' subprojects/lua.wrap)" >> $env:GITHUB_ENV "LUA_SUBPROJECT_PATH=subprojects/$(awk -F ' *= *' '/directory/ { printf $2 }' subprojects/lua.wrap)" >> $env:GITHUB_ENV
- name: Download and patch subprojects - name: Download subprojects
shell: bash shell: bash
run: | run: |
meson subprojects download meson subprojects download
cat resources/windows/001-lua-unicode.diff | patch -Np1 -d "$LUA_SUBPROJECT_PATH" cat resources/windows/001-lua-unicode.diff | patch -Np1 -d "$LUA_SUBPROJECT_PATH"
- name: Configure - name: Configure
run: | run: meson setup --wrap-mode=forcefallback build
meson setup --wrap-mode=forcefallback build
- name: Build - name: Build
run: | run: meson install -C build --destdir="../lite-xl"
meson install -C build --destdir="../lite-xl"
- name: Package - name: Package
run: | run: |
Remove-Item -Recurse -Force -Path "lite-xl/lib","lite-xl/include" Remove-Item -Recurse -Force -Path "lite-xl/lib","lite-xl/include"
Compress-Archive -Path lite-xl -DestinationPath "$env:INSTALL_NAME.zip" Compress-Archive -Path lite-xl -DestinationPath "lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows.zip"
- name: Upload Artifacts - name: Upload Artifacts (Intermediate)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: Windows Artifacts (MSVC ${{ matrix.arch.target }}) name: lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows (MSVC)
path: ${{ env.INSTALL_NAME }}.zip
compression-level: 0 compression-level: 0
path: |
*.zip
release:
name: Create Release
needs: [version, build_linux, build_windows, build_darwin_universal]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: lite-xl-*-release
path: .
- name: Versioned Release
uses: softprops/action-gh-release@v1
if: ${{ needs.version.outputs.release }}
with:
tag_name: ${{ needs.version.outputs.release }}
name: Lite XL ${{ needs.version.outputs.release }}
draft: true
body_path: changelog.md
generate_release_notes: true
files: |
*/*.tar.gz
*/*.zip
*/*.exe
*/*.dmg
*/*.AppImage
- name: Update Tag
uses: richardsimko/update-tag@v1
if: github.ref == 'refs/heads/master'
with:
tag_name: continuous
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Continuous Release
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/master'
with:
name: Lite XL Continuous Release
tag_name: continuous
prerelease: true
files: |
*/*.tar.gz
*/*.zip
*/*.exe
*/*.dmg
*/*.AppImage

View File

@ -1,342 +0,0 @@
name: Release
on:
push:
tags:
- v[0-9]+.*
workflow_dispatch:
inputs:
version:
description: Release Version
default: v2.1.5
required: true
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.tag.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch Version
id: tag
run: |
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
fi
- name: Update Tag
uses: richardsimko/update-tag@v1
with:
tag_name: ${{ steps.tag.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Release Notes
env:
GH_TOKEN: ${{ github.token }}
run: bash scripts/generate-release-notes.sh --debug --version ${{ steps.tag.outputs.version }}
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
name: Lite XL ${{ steps.tag.outputs.version }}
tag: ${{ steps.tag.outputs.version }}
draft: true
bodyFile: release-notes.md
allowUpdates: true
build_linux:
name: Linux
needs: release
runs-on: ubuntu-latest
steps:
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
echo "CCACHE_DIR=$PWD/.ccache" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
# disabled because this will break our own Python install
- name: Python Setup
if: false
uses: actions/setup-python@v5
with:
python-version: "3.11"
# disabled because the container has up-to-date packages
- name: Update Packages
if: false
run: sudo apt-get update
# disabled as the dependencies are already installed
- name: Install Dependencies
if: false
run: |
bash scripts/install-dependencies.sh --debug
sudo apt-get install -y ccache
- name: Build Portable
uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:v3.0.2
with:
entrypoint: /entrypoint.sh
args: |
bash --version
bash scripts/build.sh --debug --forcefallback --portable --release
- name: Package Portables
uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:v3.0.2
with:
entrypoint: /entrypoint.sh
args: |
bash scripts/package.sh --version ${INSTALL_REF} --debug --binary --release
bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary --release
- name: Build AppImages
uses: docker://ghcr.io/lite-xl/lite-xl-build-box-manylinux:v3.0.2
with:
entrypoint: /entrypoint.sh
args: |
bash scripts/appimage.sh --debug --static --version ${INSTALL_REF} --release
bash scripts/appimage.sh --debug --nobuild --addons --version ${INSTALL_REF}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Linux Artifacts
path: |
lite-xl-${{ env.INSTALL_REF }}-linux-x86_64-portable.tar.gz
lite-xl-${{ env.INSTALL_REF }}-addons-linux-x86_64-portable.tar.gz
LiteXL-${{ env.INSTALL_REF }}-x86_64.AppImage
LiteXL-${{ env.INSTALL_REF }}-addons-x86_64.AppImage
build_macos:
name: macOS
needs: release
strategy:
matrix:
config:
- { arch: x86_64, runner: macos-13 } # macos-13 uses x86_64
- { arch: arm64, runner: macos-14 } # macos-14 / latest uses M1
runs-on: ${{ matrix.config.runner }}
env:
CC: clang
CXX: clang++
steps:
- name: System Information
run: |
system_profiler SPSoftwareDataType
bash --version
gcc -v
xcodebuild -version
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-macos-${{ matrix.config.arch }}" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos-${{ matrix.config.arch }}" >> "$GITHUB_ENV"
- name: Checkout code
uses: actions/checkout@v4
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Dependencies
run: |
brew install bash md5sha1sum
pip install meson ninja dmgbuild
- name: Build
run: |
bash --version
bash scripts/build.sh --bundle --debug --forcefallback --release
- name: Create DMG Image
run: |
bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg --release
bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg --release
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: macOS DMG Images (${{ matrix.config.arch }})
path: |
${{ env.INSTALL_NAME }}.dmg
${{ env.INSTALL_NAME_ADDONS }}.dmg
build_macos_universal:
name: macOS (Universal)
needs: [release, build_macos]
runs-on: macos-14
steps:
- name: System Information
run: |
system_profiler SPSoftwareDataType
bash --version
gcc -v
xcodebuild -version
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_BASE=lite-xl-${{ needs.release.outputs.version }}-macos" >> "$GITHUB_ENV"
echo "INSTALL_BASE_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
id: download
with:
pattern: macOS DMG Images *
merge-multiple: true
path: dmgs-original
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dmgbuild
run: pip install dmgbuild
- name: Prepare DMG Images
run: |
mkdir -p dmgs-addons dmgs-normal
mv -v "${{ steps.download.outputs.download-path }}/$INSTALL_BASE-"{x86_64,arm64}.dmg dmgs-normal
mv -v "${{ steps.download.outputs.download-path }}/$INSTALL_BASE_ADDONS-"{x86_64,arm64}.dmg dmgs-addons
- name: Create Universal DMGs
run: |
bash --version
bash scripts/make-universal-binaries.sh dmgs-normal "$INSTALL_BASE-universal"
bash scripts/make-universal-binaries.sh dmgs-addons "$INSTALL_BASE_ADDONS-universal"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: macOS DMG Images (Universal)
path: |
${{ env.INSTALL_BASE }}-universal.dmg
${{ env.INSTALL_BASE_ADDONS }}-universal.dmg
build_windows_msys2:
name: Windows
needs: release
runs-on: windows-2019
strategy:
matrix:
config:
- { msystem: MINGW32, arch: i686 }
- { msystem: MINGW64, arch: x86_64 }
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msystem }}
update: true
install: >-
base-devel
git
zip
unzip
mingw-w64-${{ matrix.config.arch }}-gcc
mingw-w64-${{ matrix.config.arch }}-meson
mingw-w64-${{ matrix.config.arch }}-ninja
mingw-w64-${{ matrix.config.arch }}-ca-certificates
mingw-w64-${{ matrix.config.arch }}-ntldd
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
if [[ "${MSYSTEM}" == "MINGW64" ]]; then
echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-windows-x86_64" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-windows-x86_64" >> "$GITHUB_ENV"
else
echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-windows-i686" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-windows-i686" >> "$GITHUB_ENV"
fi
- name: Install Dependencies
if: false
run: bash scripts/install-dependencies.sh --debug
- name: Build
run: |
bash --version
bash scripts/build.sh -U --debug --forcefallback --release
- name: Package
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --binary --release
- name: Build Installer
run: bash scripts/innosetup/innosetup.sh --debug --version ${INSTALL_REF}
- name: Package With Addons
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary --release
- name: Build Installer With Addons
run: bash scripts/innosetup/innosetup.sh --debug --version ${INSTALL_REF} --addons
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Windows Builds (${{ matrix.config.msystem }})
path: |
${{ env.INSTALL_NAME }}.zip
${{ env.INSTALL_NAME_ADDONS }}.zip
LiteXL-${{ env.INSTALL_REF }}-${{ matrix.config.arch }}-setup.exe
LiteXL-${{ env.INSTALL_REF }}-addons-${{ matrix.config.arch }}-setup.exe
upload_artifacts:
name: Upload Release Artifacts
runs-on: ubuntu-latest
needs:
[release, build_linux, build_macos, build_macos_universal, build_windows_msys2]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Update Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.release.outputs.version }}
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
allowUpdates: true
artifacts: "*.exe,*.zip,*.tar.gz,*.dmg,*.AppImage"

View File

@ -1,206 +0,0 @@
#!/bin/bash
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."; exit 1
fi
source scripts/common.sh
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Common options:"
echo
echo "-h --help Show this help and exit."
echo "-b --builddir DIRNAME Set the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'."
echo "-p --prefix PREFIX Install directory prefix."
echo " Default: '/'."
echo " --cross-platform PLATFORM The platform to cross compile for."
echo " --cross-arch ARCH The architecture to cross compile for."
echo " --debug Debug this script."
echo
echo "Build options:"
echo
echo "-f --forcefallback Force to build subprojects dependencies statically."
echo "-B --bundle Create an App bundle (macOS only)"
echo "-P --portable Create a portable package."
echo "-O --pgo Use profile guided optimizations (pgo)."
echo " Requires running the application iteractively."
echo " --cross-file CROSS_FILE The cross file used for compiling."
echo
echo "Package options:"
echo
echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
echo " Default: 'lite-xl'."
echo "-v --version VERSION Sets the version on the package name."
echo "-A --appimage Create an AppImage (Linux only)."
echo "-D --dmg Create a DMG disk image (macOS only)."
echo " Requires dmgbuild."
echo "-I --innosetup Create an InnoSetup installer (Windows only)."
echo "-r --release Compile in release mode."
echo "-S --source Create a source code package,"
echo " including subprojects dependencies."
echo
}
main() {
local build_dir
local build_dir_option=()
local dest_dir
local dest_dir_option=()
local prefix
local prefix_option=()
local version
local version_option=()
local debug
local force_fallback
local appimage
local bundle
local innosetup
local portable
local pgo
local release
local cross_platform
local cross_platform_option=()
local cross_arch
local cross_arch_option=()
local cross_file
local cross_file_option=()
for i in "$@"; do
case $i in
-h|--help)
show_help
exit 0
;;
-b|--builddir)
build_dir="$2"
shift
shift
;;
-d|--destdir)
dest_dir="$2"
shift
shift
;;
-f|--forcefallback)
force_fallback="--forcefallback"
shift
;;
-p|--prefix)
prefix="$2"
shift
shift
;;
-v|--version)
version="$2"
shift
shift
;;
-A|--appimage)
appimage="--appimage"
shift
;;
-B|--bundle)
bundle="--bundle"
shift
;;
-D|--dmg)
dmg="--dmg"
shift
;;
-I|--innosetup)
innosetup="--innosetup"
shift
;;
-P|--portable)
portable="--portable"
shift
;;
-r|--release)
release="--release"
shift
;;
-S|--source)
source="--source"
shift
;;
-O|--pgo)
pgo="--pgo"
shift
;;
--cross-platform)
cross_platform="$2"
shift
shift
;;
--cross-arch)
cross_arch="$2"
shift
shift
;;
--cross-file)
cross_file="$2"
shift
shift
;;
--debug)
debug="--debug"
set -x
shift
;;
*)
# unknown option
;;
esac
done
if [[ -n $1 ]]; then
show_help
exit 1
fi
if [[ -n $build_dir ]]; then build_dir_option=("--builddir" "${build_dir}"); fi
if [[ -n $dest_dir ]]; then dest_dir_option=("--destdir" "${dest_dir}"); fi
if [[ -n $prefix ]]; then prefix_option=("--prefix" "${prefix}"); fi
if [[ -n $version ]]; then version_option=("--version" "${version}"); fi
if [[ -n $cross_platform ]]; then cross_platform_option=("--cross-platform" "${cross_platform}"); fi
if [[ -n $cross_arch ]]; then cross_arch_option=("--cross-arch" "${cross_arch}"); fi
if [[ -n $cross_file ]]; then cross_file_option=("--cross-file" "${cross_file}"); fi
source scripts/build.sh \
${build_dir_option[@]} \
${prefix_option[@]} \
${cross_platform_option[@]} \
${cross_arch_option[@]} \
${cross_file_option[@]} \
$debug \
$force_fallback \
$bundle \
$portable \
$release \
$pgo
source scripts/package.sh \
${build_dir_option[@]} \
${dest_dir_option[@]} \
${prefix_option[@]} \
${version_option[@]} \
${cross_platform_option[@]} \
${cross_arch_option[@]} \
--binary \
--addons \
$debug \
$appimage \
$dmg \
$innosetup \
$release \
$source
}
main "$@"

View File

@ -1,5 +1,5 @@
# cross file for compiling on MacOS ARM (Apple Sillicon). # cross file for compiling on MacOS ARM (Apple Sillicon).
# use this file by running meson setup --cross-file resources/cross/macos_arm64.txt <builddir> # use this file by running meson setup --cross-file resources/cross/darwin-aarch64.txt <builddir>
[host_machine] [host_machine]
system = 'darwin' system = 'darwin'

View File

@ -1,6 +1,6 @@
diff -ruN lua-5.4.4/meson.build lua-5.4.4-patched/meson.build diff -ruN lua-5.4.6/meson.build lua-5.4.6-patched/meson.build
--- lua-5.4.4/meson.build Wed Feb 22 18:16:56 2023 --- lua-5.4.6/meson.build Wed Feb 22 18:16:56 2023
+++ lua-5.4.4-patched/meson.build Wed Feb 22 04:10:01 2023 +++ lua-5.4.6-patched/meson.build Wed Feb 22 04:10:01 2023
@@ -85,6 +85,7 @@ @@ -85,6 +85,7 @@
'src/lutf8lib.c', 'src/lutf8lib.c',
'src/lvm.c', 'src/lvm.c',
@ -9,9 +9,9 @@ diff -ruN lua-5.4.4/meson.build lua-5.4.4-patched/meson.build
dependencies: lua_lib_deps, dependencies: lua_lib_deps,
version: meson.project_version(), version: meson.project_version(),
soversion: lua_versions[0] + '.' + lua_versions[1], soversion: lua_versions[0] + '.' + lua_versions[1],
diff -ruN lua-5.4.4/src/luaconf.h lua-5.4.4-patched/src/luaconf.h diff -ruN lua-5.4.6/src/luaconf.h lua-5.4.6-patched/src/luaconf.h
--- lua-5.4.4/src/luaconf.h Thu Jan 13 19:24:43 2022 --- lua-5.4.6/src/luaconf.h Thu Jan 13 19:24:43 2022
+++ lua-5.4.4-patched/src/luaconf.h Wed Feb 22 04:10:02 2023 +++ lua-5.4.6-patched/src/luaconf.h Wed Feb 22 04:10:02 2023
@@ -782,5 +782,15 @@ @@ -782,5 +782,15 @@
@ -28,9 +28,9 @@ diff -ruN lua-5.4.4/src/luaconf.h lua-5.4.4-patched/src/luaconf.h
+ +
#endif #endif
diff -ruN lua-5.4.4/src/Makefile lua-5.4.4-patched/src/Makefile diff -ruN lua-5.4.6/src/Makefile lua-5.4.6-patched/src/Makefile
--- lua-5.4.4/src/Makefile Thu Jul 15 22:01:52 2021 --- lua-5.4.6/src/Makefile Thu Jul 15 22:01:52 2021
+++ lua-5.4.4-patched/src/Makefile Wed Feb 22 04:10:02 2023 +++ lua-5.4.6-patched/src/Makefile Wed Feb 22 04:10:02 2023
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
@ -40,9 +40,9 @@ diff -ruN lua-5.4.4/src/Makefile lua-5.4.4-patched/src/Makefile
LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
diff -ruN lua-5.4.4/src/utf8_wrappers.c lua-5.4.4-patched/src/utf8_wrappers.c diff -ruN lua-5.4.6/src/utf8_wrappers.c lua-5.4.6-patched/src/utf8_wrappers.c
--- lua-5.4.4/src/utf8_wrappers.c Thu Jan 01 08:00:00 1970 --- lua-5.4.6/src/utf8_wrappers.c Thu Jan 01 08:00:00 1970
+++ lua-5.4.4-patched/src/utf8_wrappers.c Wed Feb 22 18:13:45 2023 +++ lua-5.4.6-patched/src/utf8_wrappers.c Wed Feb 22 18:13:45 2023
@@ -0,0 +1,129 @@ @@ -0,0 +1,129 @@
+/** +/**
+ * Wrappers to provide Unicode (UTF-8) support on Windows. + * Wrappers to provide Unicode (UTF-8) support on Windows.
@ -173,9 +173,9 @@ diff -ruN lua-5.4.4/src/utf8_wrappers.c lua-5.4.4-patched/src/utf8_wrappers.c
+ return env_value; + return env_value;
+} +}
+#endif +#endif
diff -ruN lua-5.4.4/src/utf8_wrappers.h lua-5.4.4-patched/src/utf8_wrappers.h diff -ruN lua-5.4.6/src/utf8_wrappers.h lua-5.4.6-patched/src/utf8_wrappers.h
--- lua-5.4.4/src/utf8_wrappers.h Thu Jan 01 08:00:00 1970 --- lua-5.4.6/src/utf8_wrappers.h Thu Jan 01 08:00:00 1970
+++ lua-5.4.4-patched/src/utf8_wrappers.h Wed Feb 22 18:09:48 2023 +++ lua-5.4.6-patched/src/utf8_wrappers.h Wed Feb 22 18:09:48 2023
@@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
+/** +/**
+ * Wrappers to provide Unicode (UTF-8) support on Windows. + * Wrappers to provide Unicode (UTF-8) support on Windows.

View File

@ -4,16 +4,13 @@ Various scripts and configurations used to configure, build, and package Lite XL
### Build ### Build
- **build.sh** - **build.sh**: Runs meson in a standard way across platforms.
- **build-packages.sh**: In root directory, as all in one script; relies to the
ones in this directory.
### Package ### Package
- **appdmg.sh**: Create a macOS DMG image using [dmgbuild][1]. - **package-appdmg.sh**: Create a macOS DMG image using [dmgbuild][1].
- **appimage.sh**: [AppImage][2] builder. - **package-appimage.sh**: [AppImage][2] builder.
- **innosetup.sh**: Creates a 32/64 bit [InnoSetup][3] installer package. - **package-innosetup.sh**: Creates a 32/64 bit [InnoSetup][3] installer package.
- **package.sh**: Creates all binary / DMG image / installer / source packages.
### Utility ### Utility

View File

@ -1,9 +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
dmgbuild -s resources/macos/lite-xl-dmg.py "Lite XL" "$1.dmg"

49
scripts/build.sh Normal file → Executable file
View File

@ -18,14 +18,15 @@ show_help() {
echo " --debug Debug this script." echo " --debug Debug this script."
echo "-f --forcefallback Force to build dependencies statically." echo "-f --forcefallback Force to build dependencies statically."
echo "-h --help Show this help and exit." echo "-h --help Show this help and exit."
echo "-d --debug-build Builds a debug build."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'." echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-B --bundle Create an App bundle (macOS only)" echo "-B --bundle Create an App bundle (macOS only)"
echo "-A --addons Add in addons"
echo "-P --portable Create a portable binary package." echo "-P --portable Create a portable binary package."
echo "-O --pgo Use profile guided optimizations (pgo)." echo "-O --pgo Use profile guided optimizations (pgo)."
echo "-U --windows-lua-utf Use the UTF8 patch for Lua." echo "-U --windows-lua-utf Use the UTF8 patch for Lua."
echo " macOS: disabled when used with --bundle," echo " macOS: disabled when used with --bundle,"
echo " Windows: Implicit being the only option." echo " Windows: Implicit being the only option."
echo "-r --release Compile in release mode."
echo " --cross-platform PLATFORM Cross compile for this platform." echo " --cross-platform PLATFORM Cross compile for this platform."
echo " The script will find the appropriate" echo " The script will find the appropriate"
echo " cross file in 'resources/cross'." echo " cross file in 'resources/cross'."
@ -39,9 +40,11 @@ show_help() {
main() { main() {
local platform="$(get_platform_name)" local platform="$(get_platform_name)"
local arch="$(get_platform_arch)" local arch="$(get_platform_arch)"
local build_dir="$(get_default_build_dir)" local build_dir
local build_type="debug" local plugins="welcome"
local prefix=/ local prefix=/
local addons
local build_type="release"
local force_fallback local force_fallback
local bundle local bundle
local portable local portable
@ -65,6 +68,10 @@ main() {
shift shift
shift shift
;; ;;
-d|--debug-build)
build_type="debug"
shift
;;
--debug) --debug)
set -x set -x
shift shift
@ -78,8 +85,12 @@ main() {
shift shift
shift shift
;; ;;
-A|--addons)
addons="1"
shift
;;
-B|--bundle) -B|--bundle)
if [[ "$platform" != "macos" ]]; then if [[ "$platform" != "darwin" ]]; then
echo "Warning: ignoring --bundle option, works only under macOS." echo "Warning: ignoring --bundle option, works only under macOS."
else else
bundle="-Dbundle=true" bundle="-Dbundle=true"
@ -116,10 +127,6 @@ main() {
shift shift
shift shift
;; ;;
-r|--release)
build_type="release"
shift
;;
*) *)
# unknown option # unknown option
;; ;;
@ -157,9 +164,13 @@ main() {
fi fi
platform="${cross_platform:-$platform}" platform="${cross_platform:-$platform}"
arch="${cross_arch:-$arch}" arch="${cross_arch:-$arch}"
cross_file=("--cross-file" "${cross_file:-resources/cross/$platform-$arch.txt}") cross_file="--cross-file ${cross_file:-resources/cross/$platform-$arch.txt}"
# reload build_dir because platform and arch might change # reload build_dir because platform and arch might change
build_dir="$(get_default_build_dir "$platform" "$arch")" if [[ "$build_dir" == "" ]]; then
build_dir="$(get_default_build_dir "$platform" "$arch")"
fi
elif [[ "$build_dir" == "" ]]; then
build_dir="$(get_default_build_dir)"
fi fi
# arch and platform specific stuff # arch and platform specific stuff
@ -188,24 +199,34 @@ main() {
fi fi
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \ CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=$build_type \ "${build_dir}" \
--buildtype "$build_type" \
--prefix "$prefix" \ --prefix "$prefix" \
"${cross_file[@]}" \ $cross_file \
$force_fallback \ $force_fallback \
$bundle \ $bundle \
$portable \ $portable \
$pgo \ $pgo \
"${build_dir}"
meson compile -C "${build_dir}" meson compile -C "${build_dir}"
cp -r data "${build_dir}/src"
if [[ $pgo != "" ]]; then if [[ $pgo != "" ]]; then
cp -r data "${build_dir}/src"
"${build_dir}/src/lite-xl" "${build_dir}/src/lite-xl"
meson configure -Db_pgo=use "${build_dir}" meson configure -Db_pgo=use "${build_dir}"
meson compile -C "${build_dir}" meson compile -C "${build_dir}"
rm -fr "${build_dir}/data" rm -fr "${build_dir}/data"
fi fi
rm -fr $build_dir/src/lite-xl.*p $build_dir/src/*.o
if [[ $addons != "" ]]; then
[[ ! -e "$build_dir/lpm" ]] && curl --insecure -L "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/latest/lpm.$(get_platform_tuple)$(get_executable_extension)" -o "$build_dir/lpm$(get_executable_extension)" && chmod +x "$build_dir/lpm$(get_executable_extension)"
"$build_dir/lpm$(get_executable_extension)" install --datadir ${build_dir}/src/data --userdir ${build_dir}/src/data --arch $(get_platform_tuple) $plugins --assume-yes; "$build_dir/lpm$(get_executable_extension)" purge --datadir ${build_dir}/src/data --userdir ${build_dir}/src/data && chmod -R a+r ${build_dir}
fi
mv "${build_dir}/src" "${build_dir}/lite-xl"
} }
main "$@" main "$@"

View File

@ -2,70 +2,11 @@
set -e set -e
addons_download() {
local build_dir="$1"
if [[ -d "${build_dir}/third/data/colors" ]]; then
echo "Warning: found previous addons installation, skipping."
echo " addons path: ${build_dir}/third/data/colors"
return 0
fi
# Download third party color themes
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-colors/archive/master.zip" \
-o "${build_dir}/lite-xl-colors.zip"
mkdir -p "${build_dir}/third/data/colors"
unzip "${build_dir}/lite-xl-colors.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-colors-master/colors" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-xl-colors-master"
# Download widgets library
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-widgets/archive/master.zip" \
-o "${build_dir}/lite-xl-widgets.zip"
unzip "${build_dir}/lite-xl-widgets.zip" -d "${build_dir}"
mkdir -p "${build_dir}/third/data/libraries"
mv "${build_dir}/lite-xl-widgets-master" "${build_dir}/third/data/libraries/widget"
# Downlaod thirdparty plugins
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-plugins/archive/master.zip" \
-o "${build_dir}/lite-xl-plugins.zip"
unzip "${build_dir}/lite-xl-plugins.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-plugins-master/plugins" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-xl-plugins-master"
}
# Addons installation: some distributions forbid external downloads
# so make it as optional module.
addons_install() {
local build_dir="$1"
local data_dir="$2"
for module_name in colors libraries; do
cp -r "${build_dir}/third/data/$module_name" "${data_dir}"
done
mkdir -p "${data_dir}/plugins"
for plugin_name in settings open_ext; do
cp -r "${build_dir}/third/data/plugins/${plugin_name}.lua" \
"${data_dir}/plugins/"
done
cp "${build_dir}/third/data/plugins/"language_* \
"${data_dir}/plugins/"
}
get_platform_name() { get_platform_name() {
if [[ "$OSTYPE" == "msys" ]]; then if [[ "$OSTYPE" == "msys" ]]; then
echo "windows" echo "windows"
elif [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "macos" echo "darwin"
elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then
echo "linux" echo "linux"
else else
@ -73,8 +14,15 @@ get_platform_name() {
fi fi
} }
get_executable_extension() {
if [[ "$OSTYPE" == "msys" ]]; then
echo ".exe"
else
echo ""
fi
}
get_platform_arch() { get_platform_arch() {
platform=$(get_platform_name)
arch=${CROSS_ARCH:-$(uname -m)} arch=${CROSS_ARCH:-$(uname -m)}
if [[ $MSYSTEM != "" ]]; then if [[ $MSYSTEM != "" ]]; then
case "$MSYSTEM" in case "$MSYSTEM" in
@ -89,13 +37,20 @@ get_platform_arch() {
;; ;;
esac esac
fi fi
[[ $arch == "arm64" ]] && arch="aarch64"
echo "$arch" echo "$arch"
} }
get_platform_tuple() {
platform="$(get_platform_name)"
arch="$(get_platform_arch)"
echo "$arch-$platform"
}
get_default_build_dir() { get_default_build_dir() {
platform="${1:-$(get_platform_name)}" platform="${1:-$(get_platform_name)}"
arch="${2:-$(get_platform_arch)}" arch="${2:-$(get_platform_arch)}"
echo "build-$platform-$arch" echo "build-$arch-$platform"
} }
if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then

View File

@ -78,7 +78,7 @@ Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
Name: "envPath"; Description: "Add lite-xl to the PATH variable, allowing it to be run from a command line." Name: "envPath"; Description: "Add lite-xl to the PATH variable, allowing it to be run from a command line."
[Files] [Files]
Source: "{#SourceDir}/lite-xl/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs Source: "{#BuildDir}/lite-xl/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]

2
scripts/install-dependencies.sh Normal file → Executable file
View File

@ -48,7 +48,7 @@ main() {
pip3 install meson dmgbuild pip3 install meson dmgbuild
elif [[ "$OSTYPE" == "msys" ]]; then elif [[ "$OSTYPE" == "msys" ]]; then
pacman --noconfirm -S \ pacman --noconfirm -S \
${MINGW_PACKAGE_PREFIX}-{ca-certificates,gcc,meson,ninja,ntldd,pkg-config,mesa,freetype,pcre2,SDL2} unzip ${MINGW_PACKAGE_PREFIX}-{ca-certificates,gcc,meson,ninja,ntldd,pkg-config,mesa,freetype,pcre2,SDL2} unzip patch zip
fi fi
} }

View File

@ -1,38 +0,0 @@
#!/usr/bin/env 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
WORKDIR="work"
DMGDIR="$1"
if [[ -z "$DMGDIR" ]]; then
echo "Please provide a path containing the dmg files."
exit 1
fi
rm -rf "$WORKDIR"
mkdir -p "$WORKDIR"
for dmg_path in "$DMGDIR"/*.dmg; do
dmg="${dmg_path##*/}"
dmg="${dmg%.dmg}"
hdiutil attach -mountpoint "/Volumes/$dmg" "$dmg_path"
if [[ ! -d "$WORKDIR/dmg" ]]; then
ditto "/Volumes/$dmg/Lite XL.app" "Lite XL.app"
fi
cp "/Volumes/$dmg/Lite XL.app/Contents/MacOS/lite-xl" "$WORKDIR/$dmg-lite-xl"
hdiutil detach "/Volumes/$dmg"
done
lipo -create -output "Lite XL.app/Contents/MacOS/lite-xl" "$WORKDIR/"*-lite-xl
# https://eclecticlight.co/2019/01/17/code-signing-for-the-concerned-3-signing-an-app/
# https://wiki.lazarus.freepascal.org/Code_Signing_for_macOS#Big_Sur_and_later_on_Apple_M1_ARM64_processors
# codesign all the files again, hopefully this would fix signature validation
codesign --force --deep --digest-algorithm=sha1,sha256 -s - "Lite XL.app"
source scripts/appdmg.sh "$2"

99
scripts/appimage.sh → scripts/package-appimage.sh Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/bin/env bash #!/usr/bin/env bash
set -e set -e
if [ ! -e "src/api/api.h" ]; then if [ ! -e "src/api/api.h" ]; then
@ -10,10 +10,7 @@ source scripts/common.sh
ARCH="$(uname -m)" ARCH="$(uname -m)"
BUILD_DIR="$(get_default_build_dir)" BUILD_DIR="$(get_default_build_dir)"
RUN_BUILD=true
STATIC_BUILD=false
ADDONS=false ADDONS=false
BUILD_TYPE="debug"
show_help(){ show_help(){
echo echo
@ -26,15 +23,10 @@ show_help(){
echo " Default: '${BUILD_DIR}'." echo " Default: '${BUILD_DIR}'."
echo " --debug Debug this script." echo " --debug Debug this script."
echo "-n --nobuild Skips the build step, use existing files." echo "-n --nobuild Skips the build step, use existing files."
echo "-s --static Specify if building using static libraries."
echo "-v --version VERSION Specify a version, non whitespace separated string." echo "-v --version VERSION Specify a version, non whitespace separated string."
echo "-a --addons Install 3rd party addons."
echo "-r --release Compile in release mode."
echo echo
} }
initial_arg_count=$#
for i in "$@"; do for i in "$@"; do
case $i in case $i in
-h|--help) -h|--help)
@ -46,26 +38,10 @@ for i in "$@"; do
shift shift
shift shift
;; ;;
-a|--addons)
ADDONS=true
shift
;;
--debug) --debug)
set -x set -x
shift shift
;; ;;
-n|--nobuild)
RUN_BUILD=false
shift
;;
-r|--release)
BUILD_TYPE="release"
shift
;;
-s|--static)
STATIC_BUILD=true
shift
;;
-v|--version) -v|--version)
VERSION="$2" VERSION="$2"
shift shift
@ -77,12 +53,6 @@ for i in "$@"; do
esac esac
done done
# show help if no valid argument was found
if [ $initial_arg_count -eq $# ]; then
show_help
exit 1
fi
setup_appimagetool() { setup_appimagetool() {
if [ ! -e appimagetool ]; then if [ ! -e appimagetool ]; then
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
@ -105,86 +75,31 @@ download_appimage_apprun() {
fi fi
} }
build_litexl() {
if [ -e build ]; then
rm -rf build
fi
if [ -e ${BUILD_DIR} ]; then
rm -rf ${BUILD_DIR}
fi
echo "Build lite-xl..."
sleep 1
if [[ $STATIC_BUILD == false ]]; then
meson setup --buildtype=$BUILD_TYPE --prefix=/usr ${BUILD_DIR}
else
meson setup --wrap-mode=forcefallback \
--buildtype=$BUILD_TYPE \
--prefix=/usr \
${BUILD_DIR}
fi
meson compile -C ${BUILD_DIR}
}
generate_appimage() { generate_appimage() {
[[ ! -e $BUILD_DIR ]] && scripts/build.sh $@
if [ -e LiteXL.AppDir ]; then if [ -e LiteXL.AppDir ]; then
rm -rf LiteXL.AppDir rm -rf LiteXL.AppDir
fi fi
echo "Creating LiteXL.AppDir..." echo "Creating LiteXL.AppDir..."
DESTDIR="$(realpath LiteXL.AppDir)" meson install --skip-subprojects -C ${BUILD_DIR} DESTDIR="$(realpath LiteXL.AppDir)" meson install -C ${BUILD_DIR}
mv AppRun LiteXL.AppDir/ mv AppRun LiteXL.AppDir/
# These could be symlinks but it seems they doesn't work with AppimageLauncher # These could be symlinks but it seems they doesn't work with AppimageLauncher
cp resources/icons/lite-xl.svg LiteXL.AppDir/ cp resources/icons/lite-xl.svg LiteXL.AppDir/
cp resources/linux/com.lite_xl.LiteXL.desktop LiteXL.AppDir/ cp resources/linux/com.lite_xl.LiteXL.desktop LiteXL.AppDir/
if [[ $ADDONS == true ]]; then
addons_download "${BUILD_DIR}"
addons_install "${BUILD_DIR}" "LiteXL.AppDir/usr/share/lite-xl"
fi
if [[ $STATIC_BUILD == false ]]; then
echo "Copying libraries..."
mkdir -p LiteXL.AppDir/usr/lib/
local allowed_libs=(
libfreetype
libpcre2
libSDL2
libsndio
liblua
)
while read line; do
local libname="$(echo $line | cut -d' ' -f1)"
local libpath="$(echo $line | cut -d' ' -f2)"
for lib in "${allowed_libs[@]}" ; do
if echo "$libname" | grep "$lib" > /dev/null ; then
cp "$libpath" LiteXL.AppDir/usr/lib/
continue 2
fi
done
echo " Ignoring: $libname"
done < <(ldd build/src/lite-xl | awk '{print $1 " " $3}')
fi
echo "Generating AppImage..." echo "Generating AppImage..."
local version="" local version=""
if [ -n "$VERSION" ]; then if [ -n "$VERSION" ]; then
version="-$VERSION" version="-$VERSION"
fi fi
if [[ $ADDONS == true ]]; then ./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage
version="${version}-addons" rm -rf LiteXL.AppDir
fi
./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}.AppImage
} }
setup_appimagetool setup_appimagetool
download_appimage_apprun download_appimage_apprun
if [[ $RUN_BUILD == true ]]; then build_litexl; fi generate_appimage
generate_appimage $1

18
scripts/package-dmg.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env 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
mkdir -p "Lite XL.app/Contents/MacOS" "Lite XL.app/Contents/Resources"
cp -r $1/lite-xl/lite-xl "Lite XL.app/Contents/MacOS"
cp -r $1/lite-xl/data/* "Lite XL.app/Contents/Resources"
cp resources/icons/icon.icns "Lite XL.app/Contents/Resources"
cp -r $1/Info.plist "Lite XL.app/Contents/Resources"
dmgbuild -s resources/macos/lite-xl-dmg.py "Lite XL" "$2.dmg"
rm -rf "Lite XL.app"

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
set -e set -e
if [ ! -e "src/api/api.h" ]; then if [ ! -e "src/api/api.h" ]; then
@ -16,7 +16,6 @@ show_help() {
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)." echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'." echo " Default: '$(get_default_build_dir)'."
echo "-v --version VERSION Sets the version on the package name." echo "-v --version VERSION Sets the version on the package name."
echo "-a --addons Tell the script we are packaging an install with addons."
echo " --debug Debug this script." echo " --debug Debug this script."
echo echo
} }
@ -56,17 +55,13 @@ main() {
show_help show_help
exit 0 exit 0
;; ;;
-a|--addons)
addons=true
shift
;;
-b|--builddir) -b|--builddir)
build_dir="$2" build_dir="$2"
shift shift
shift shift
;; ;;
-v|--version) -v|--version)
if [[ -n $2 ]]; then version="-$2"; fi if [[ -n $2 ]]; then version="$2"; fi
shift shift
shift shift
;; ;;
@ -80,20 +75,12 @@ main() {
esac esac
done done
# show help if no valid argument was found [[ ! -e $build_dir ]] && scripts/build.sh $@
if [ $initial_arg_count -eq $# ]; then
show_help
exit 1
fi
if [[ $addons == true ]]; then output="lite-xl-${version}-${arch_file}-windows-setup"
version="${version}-addons"
fi
output="LiteXL${version}-${arch_file}-setup"
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch //F"${output}" "${build_dir}/scripts/innosetup.iss" "/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch //F"${output}" "${build_dir}/scripts/innosetup.iss"
pushd "${build_dir}/scripts"; mv LiteXL*.exe "./../../"; popd pushd "${build_dir}/scripts"; mv lite-xl*.exe "./../../"; popd
} }
main "$@" main "$@"

View File

@ -1,300 +0,0 @@
#!/bin/bash
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."; exit 1
fi
source scripts/common.sh
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'."
echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
echo " Default: 'lite-xl'."
echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-v --version VERSION Sets the version on the package name."
echo "-a --addons Install 3rd party addons."
echo " --debug Debug this script."
echo "-A --appimage Create an AppImage (Linux only)."
echo "-B --binary Create a normal / portable package or macOS bundle,"
echo " depending on how the build was configured. (Default.)"
echo "-D --dmg Create a DMG disk image with dmgbuild (macOS only)."
echo "-I --innosetup Create a InnoSetup package (Windows only)."
echo "-r --release Strip debugging symbols."
echo "-S --source Create a source code package,"
echo " including subprojects dependencies."
echo " --cross-platform PLATFORM The platform to package for."
echo " --cross-arch ARCH The architecture to package for."
echo
}
source_package() {
local build_dir=build-src
local package_name=$1
rm -rf ${build_dir}
rm -rf ${package_name}
rm -f ${package_name}.tar.gz
meson subprojects download
meson setup ${build_dir} -Dsource-only=true
# Note: not using git-archive(-all) because it can't include subprojects ignored by git
rsync -arv \
--exclude /*build*/ \
--exclude *.git* \
--exclude lhelper \
--exclude lite-xl* \
--exclude submodules \
. ${package_name}
cp "${build_dir}/start.lua" "${package_name}/data/core"
tar rf ${package_name}.tar ${package_name}
gzip -9 ${package_name}.tar
}
main() {
local arch="$(get_platform_arch)"
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local dest_dir=lite-xl
local prefix=/
local version
local addons=false
local appimage=false
local binary=false
local dmg=false
local innosetup=false
local release=false
local source=false
local cross
local cross_arch
local cross_platform
# store the current flags to easily pass them to appimage script
local flags="$@"
for i in "$@"; do
case $i in
-b|--builddir)
build_dir="$2"
shift
shift
;;
-d|--destdir)
dest_dir="$2"
shift
shift
;;
-h|--help)
show_help
exit 0
;;
-p|--prefix)
prefix="$2"
shift
shift
;;
-v|--version)
if [[ -n $2 ]]; then version="-$2"; fi
shift
shift
;;
-A|--appimage)
if [[ "$platform" != "linux" ]]; then
echo "Warning: ignoring --appimage option, works only under Linux."
else
appimage=true
fi
shift
;;
-B|--binary)
binary=true
shift
;;
-D|--dmg)
if [[ "$platform" != "macos" ]]; then
echo "Warning: ignoring --dmg option, works only under macOS."
else
dmg=true
fi
shift
;;
-I|--innosetup)
if [[ "$platform" != "windows" ]]; then
echo "Warning: ignoring --innosetup option, works only under Windows."
else
innosetup=true
fi
shift
;;
-r|--release)
release=true
shift
;;
-S|--source)
source=true
shift
;;
-a|--addons)
addons=true
shift
;;
--cross-platform)
cross=true
cross_platform="$2"
shift
shift
;;
--cross-arch)
cross=true
cross_arch="$2"
shift
shift
;;
--debug)
set -x
shift
;;
*)
# unknown option
;;
esac
done
if [[ $addons == true ]]; then
version="$version-addons"
fi
if [[ -n $1 ]]; then show_help; exit 1; fi
if [[ -n "$cross" ]]; then
platform="${cross_platform:-$platform}"
arch="${cross_arch:-$arch}"
build_dir="$(get_default_build_dir "$platform" "$arch")"
fi
# The source package doesn't require a previous build,
# nor the following install step, so run it now.
if [[ $source == true ]]; then source_package "lite-xl$version-src"; fi
# No packages request
if [[ $appimage == false && $binary == false && $dmg == false && $innosetup == false ]]; then
# Source only, return.
if [[ $source == true ]]; then return 0; fi
# Build the binary package as default instead doing nothing.
binary=true
fi
rm -rf "${dest_dir}"
DESTDIR="$(pwd)/${dest_dir}" meson install --skip-subprojects -C "${build_dir}"
local data_dir="$(pwd)/${dest_dir}/data"
local exe_file="$(pwd)/${dest_dir}/lite-xl"
local package_name=lite-xl$version-$platform-$arch
local bundle=false
local portable=false
local stripcmd="strip"
if [[ -d "${data_dir}" ]]; then
echo "Creating a portable, compressed archive..."
portable=true
exe_file="$(pwd)/${dest_dir}/lite-xl"
if [[ $platform == "windows" ]]; then
exe_file="${exe_file}.exe"
stripcmd="strip --strip-all"
if command -v ntldd >/dev/null 2>&1; then
# Copy MinGW libraries dependencies.
# MSYS2 ldd command seems to be only 64bit, so use ntldd
# see https://github.com/msys2/MINGW-packages/issues/4164
ntldd -R "${exe_file}" \
| grep mingw \
| awk '{print $3}' \
| sed 's#\\#/#g' \
| xargs -I '{}' cp -v '{}' "$(pwd)/${dest_dir}/"
else
echo "WARNING: ntldd not found; assuming program is static"
fi
else
# Windows archive is always portable
package_name+="-portable"
fi
elif [[ $platform == "macos" && ! -d "${data_dir}" ]]; then
data_dir="$(pwd)/${dest_dir}/Contents/Resources"
if [[ -d "${data_dir}" ]]; then
echo "Creating a macOS bundle application..."
bundle=true
# Specify "bundle" on compressed archive only, implicit on images
if [[ $dmg == false ]]; then package_name+="-bundle"; fi
rm -rf "Lite XL.app"; mv "${dest_dir}" "Lite XL.app"
dest_dir="Lite XL.app"
exe_file="$(pwd)/${dest_dir}/Contents/MacOS/lite-xl"
data_dir="$(pwd)/${dest_dir}/Contents/Resources"
fi
fi
if [[ $bundle == false && $portable == false ]]; then
data_dir="$(pwd)/${dest_dir}/$prefix/share/lite-xl"
exe_file="$(pwd)/${dest_dir}/$prefix/bin/lite-xl"
fi
mkdir -p "${data_dir}"
if [[ $addons == true ]]; then
addons_download "${build_dir}"
addons_install "${build_dir}" "${data_dir}"
fi
# TODO: use --skip-subprojects when 0.58.0 will be available on supported
# distributions to avoid subprojects' include and lib directories to be copied.
# Install Meson with PIP to get the latest version is not always possible.
pushd "${dest_dir}"
find . -type d -name 'include' -prune -exec rm -rf {} \;
find . -type d -name 'lib' -prune -exec rm -rf {} \;
find . -type d -empty -delete
popd
if [[ $release == true ]]; then
$stripcmd "${exe_file}"
fi
if [[ $bundle == true ]]; then
# https://eclecticlight.co/2019/01/17/code-signing-for-the-concerned-3-signing-an-app/
# https://wiki.lazarus.freepascal.org/Code_Signing_for_macOS#Big_Sur_and_later_on_Apple_M1_ARM64_processors
codesign --force --deep --digest-algorithm=sha1,sha256 -s - "${dest_dir}"
fi
echo "Creating a compressed archive ${package_name}"
if [[ $binary == true ]]; then
rm -f "${package_name}".tar.gz
rm -f "${package_name}".zip
if [[ $platform == "windows" ]]; then
zip -9rv ${package_name}.zip ${dest_dir}/*
else
tar czvf "${package_name}".tar.gz "${dest_dir}"
fi
fi
if [[ $appimage == true ]]; then
source scripts/appimage.sh $flags --static
fi
if [[ $bundle == true && $dmg == true ]]; then
source scripts/appdmg.sh "${package_name}"
fi
if [[ $innosetup == true ]]; then
source scripts/innosetup/innosetup.sh $flags
fi
}
main "$@"

View File

@ -1,106 +0,0 @@
#!/bin/bash
# strip-components is normally set to 1 to strip the initial "data" from the
# directory path.
copy_directory_from_repo () {
local tar_options=()
if [[ $1 == --strip-components=* ]]; then
tar_options+=($1)
shift
fi
local dirname="$1"
local destdir="$2"
git archive "$lite_branch" "$dirname" --format=tar | tar xf - -C "$destdir" "${tar_options[@]}"
}
lite_copy_third_party_modules () {
local build="$1"
curl --retry 5 --retry-delay 3 --insecure -L "https://github.com/lite-xl/lite-xl-colors/archive/master.zip" -o "$build/lite-xl-colors.zip" || exit 1
mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
unzip -qq "$build/lite-xl-colors.zip" -d "$build"
mv "$build/lite-xl-colors-master/colors" "$build/third/data"
rm -fr "$build/lite-xl-colors-master"
rm "$build/lite-xl-colors.zip"
}
lite_branch=master
while [ ! -z ${1+x} ]; do
case "$1" in
-dir)
use_dir="$(realpath $2)"
shift 2
;;
-branch)
lite_branch="$2"
shift 2
;;
*)
echo "unknown option: $1"
exit 1
;;
esac
done
wget="wget --retry-connrefused --waitretry=1 --read-timeout=20 --no-check-certificate"
workdir=".repackage"
rm -fr "$workdir" && mkdir "$workdir" && pushd "$workdir"
fetch_packages_from_github () {
assets=($($wget -q -nv -O- https://api.github.com/repos/lite-xl/lite-xl/releases/latest | grep "browser_download_url" | cut -d '"' -f 4))
for url in "${assets[@]}"; do
echo "getting: $url"
$wget -q "$url" || exit 1
done
}
fetch_packages_from_dir () {
for file in "$1"/*.zip "$1"/*.tar.* ; do
echo "copying file $file"
cp "$file" .
done
}
if [ -z ${use_dir+x} ]; then
fetch_packages_from_github
else
fetch_packages_from_dir "$use_dir"
fi
lite_copy_third_party_modules "."
for filename in $(ls -1 *.zip *.tar.*); do
if [[ $filename == *".zip" ]]; then
unzip -qq "$filename"
elif [[ $filename == *".tar."* ]]; then
tar xf "$filename"
fi
rm "$filename"
find lite-xl -name lite -exec chmod a+x '{}' \;
start_file=$(find lite-xl -name start.lua)
lite_version=$(cat "$start_file" | awk 'match($0, /^\s*VERSION\s*=\s*"(.+)"/, a) { print(a[1]) }')
xcoredir="$(find lite-xl -type d -name 'core')"
coredir="$(dirname $xcoredir)"
echo "coredir: $coredir"
cp -r "lite-xl" "lite-xl.original"
for module_name in core plugins colors; do
rm -fr "$coredir/$module_name"
(cd .. && copy_directory_from_repo --strip-components=1 "data/$module_name" "$workdir/$coredir")
done
sed -i "s/@PROJECT_VERSION@/$lite_version/g" "$start_file"
for module_name in plugins colors; do
cp -r "third/data/$module_name" "$coredir"
done
if [[ $filename == *".zip" ]]; then
zip -qq -r -9 "$filename" lite-xl
diff -U 4 -r lite-xl.original lite-xl > "${filename/%.zip/.diff}"
elif [[ $filename == *".tar."* ]]; then
tar czf "${filename/%.tar.*/.tar.gz}" lite-xl
diff -U 4 -r lite-xl.original lite-xl > "${filename/%.tar.*/.diff}"
fi
rm -fr lite-xl lite-xl.original
done
popd

View File

@ -1,121 +0,0 @@
#!/bin/bash
set -o errexit
# accept argument in the form
github_raw_content () {
echo "https://raw.githubusercontent.com/$1"
}
option_portable=off
option_copy=on
pargs=()
plugins=()
while [[ "$#" -gt 0 ]]; do
case $1 in
-portable)
option_portable=on
;;
-keep)
option_copy=off
;;
-plugin=*)
# should be like -plugin=franko/lite-plugins/master/plugins/autowrap.lua
plugins+=("${1#-plugin=}")
;;
-global)
option_global=on
;;
-*)
echo "error: unknown option \"$1\""
exit 1
;;
*)
pargs+=("$1")
;;
esac
shift
done
if [ "${#pargs[@]}" -lt 1 ]; then
echo "usage: $0 [options] <build-dir>"
exit 1
fi
if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "mingw"* ]]; then
run_windows=yes
fi
rundir=".run"
if [ "$option_portable" == on ]; then
bindir="$rundir"
datadir="$rundir/data"
else
bindir="$rundir/bin"
datadir="$rundir/share/lite-xl"
fi
userdir="$(realpath "$rundir")"
builddir="${pargs[0]}"
build_lite () {
echo "running ninja"
ninja -C "$builddir"
}
copy_lite_build () {
echo "copying lite executable and data"
rm -fr "$rundir"
mkdir -p "$bindir" "$datadir"
if [ ! -z ${run_windows+x} ]; then
cp "$builddir/src/lite-xl.exe" "$bindir"
else
cp "$builddir/src/lite-xl" "$bindir"
fi
mkdir -p "$datadir/core"
for module_name in core plugins colors fonts; do
cp -r "data/$module_name" "$datadir"
done
# The start.lua file is generated by meson in $builddir but
# there is already a start.lua file in data/core so the command below
# should be executed after we copy the data/core directory.
cp "$builddir/start.lua" "$datadir/core"
}
run_lite () {
if [ ! -z ${option_global+x} ]; then
echo "running \"lite-xl ${pargs[@]:1}\""
exec "$bindir/lite-xl" "${pargs[@]:1}"
else
echo "running \"lite-xl ${pargs[@]:1}\" with local HOME"
if [ ! -z ${run_windows+x} ]; then
USERPROFILE="$userdir" exec "$bindir/lite-xl" "${pargs[@]:1}"
else
HOME="$userdir" exec "$bindir/lite-xl" "${pargs[@]:1}"
fi
fi
}
github_raw_content () {
echo "https://raw.githubusercontent.com/$1"
}
fetch_plugins () {
for name in "$@"; do
local url="$(github_raw_content "$name")"
local modname="${url##*/}"
if [ "$modname" == init.lua ]; then
local m1="${name#*/}"
modname="${m1%%/*}.lua"
fi
echo "installed $name as $modname from $url"
curl --insecure -L "$url" -o "$datadir/plugins/${modname}"
done
}
if [ $option_copy == on ]; then
build_lite
copy_lite_build
fi
fetch_plugins "${plugins[@]}"
run_lite