From 82d78350e29d05c1b82c45975c301252252a11eb Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 22 Oct 2024 11:53:17 -0400 Subject: [PATCH] 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. --- .github/workflows/build.yml | 420 +++++++++--------- .github/workflows/release.yml | 342 -------------- build-packages.sh | 206 --------- .../{macos-arm64.txt => darwin-aarch64.txt} | 2 +- resources/windows/001-lua-unicode.diff | 42 +- scripts/README.md | 11 +- scripts/appdmg.sh | 9 - scripts/build.sh | 49 +- scripts/common.sh | 79 +--- scripts/innosetup/innosetup.iss.in | 2 +- scripts/install-dependencies.sh | 2 +- scripts/make-universal-binaries.sh | 38 -- scripts/{appimage.sh => package-appimage.sh} | 99 +---- scripts/package-dmg.sh | 18 + .../innosetup.sh => package-innosetup.sh} | 23 +- scripts/package.sh | 300 ------------- scripts/repackage.sh | 106 ----- scripts/run-local | 121 ----- 18 files changed, 327 insertions(+), 1542 deletions(-) delete mode 100644 .github/workflows/release.yml delete mode 100755 build-packages.sh rename resources/cross/{macos-arm64.txt => darwin-aarch64.txt} (95%) delete mode 100644 scripts/appdmg.sh mode change 100644 => 100755 scripts/build.sh mode change 100644 => 100755 scripts/install-dependencies.sh delete mode 100644 scripts/make-universal-binaries.sh rename scripts/{appimage.sh => package-appimage.sh} (51%) mode change 100644 => 100755 create mode 100755 scripts/package-dmg.sh rename scripts/{innosetup/innosetup.sh => package-innosetup.sh} (74%) mode change 100644 => 100755 delete mode 100644 scripts/package.sh delete mode 100644 scripts/repackage.sh delete mode 100755 scripts/run-local diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6e7d1a6..ac6b6380 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,80 +2,67 @@ name: CI on: push: - branches: - - "*" - pull_request: branches: - - "*" - + - '*' 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: - build_linux: - name: Linux - runs-on: ubuntu-22.04 - strategy: - matrix: - config: - - { name: "GCC", cc: gcc, cxx: g++ } - - { name: "clang", cc: clang, cxx: clang++ } + # Checks to see if we have an input, and stamps that onto the repo. + # Determines if this is a release, and determines the official ref. + version: + name: Compute Version & Check for Release + runs-on: ubuntu-latest env: - CC: ${{ matrix.config.cc }} - CXX: ${{ matrix.config.cxx }} - + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + outputs: + release: ${{ steps.check_release.outputs.release }} + ref: ${{ steps.check_release.outputs.ref }} steps: - - name: Set Environment Variables - if: ${{ matrix.config.cc == 'gcc' }} - run: | - 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 + - name: Update Tag + uses: richardsimko/update-tag@v1 + if: ${{ github.event.inputs.version }} with: - python-version: "3.11" - - - name: Update Packages - run: sudo apt-get update - - - 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' }} + tag_name: ${{ github.event.inputs.version }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v4 with: - name: Linux Artifacts - path: ${{ env.INSTALL_NAME }}.tar.gz - compression-level: 0 - - build_macos: - name: macOS + fetch-depth: 0 + fetch-tags: true + - 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_darwin: + name: Darwin + needs: [version] strategy: matrix: config: - - { arch: x86_64, runner: macos-13 } # macos-13 uses x86_64 - - { arch: arm64, runner: macos-14 } # macos-14 / latest uses M1 - + - { runner: macos-13, type: bundle, arch: x86_64-darwin } + - { 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 }} - env: - CC: clang - CXX: clang++ - steps: - name: System Information run: | @@ -83,204 +70,231 @@ jobs: bash --version gcc -v xcodebuild -version + + - uses: actions/checkout@v4 + + - name: Python Setup + uses: actions/setup-python@v5 + with: { python-version: "3.11" } + + - name: Install Dependencies + run: scripts/install-dependencies.sh + + - name: Build + run: scripts/build.sh --addons --debug --forcefallback --${{ matrix.config.type }} -b build + + - name: Package Mac (Bundle) + 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: Set Environment Variables - 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: 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 + with: + name: lite-xl-${{ needs.version.outputs.ref }}-${{ matrix.config.arch }}-${{ matrix.config.type }} + path: | + *.tar.gz + - - name: Checkout code - uses: actions/checkout@v4 + build_darwin_universal: + name: Darwin (Universal) + needs: [version, build_darwin] + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 - name: Python Setup uses: actions/setup-python@v5 - with: - python-version: "3.11" + with: { python-version: "3.11" } - # installing md5sha1sum will eliminate a warning with arm64 and libusb - 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 - - - name: Create DMG Image - run: bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg - - - name: Upload DMG Image - uses: actions/upload-artifact@v4 - with: - name: macOS DMG Images (${{ matrix.config.arch }}) - path: ${{ env.INSTALL_NAME }}.dmg - compression-level: 0 - - build_macos_universal: - name: macOS (Universal) - runs-on: macos-14 - needs: build_macos - - 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_NAME=lite-xl-${GITHUB_REF##*/}-macos-universal" >> "$GITHUB_ENV" - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install dmgbuild - run: pip install dmgbuild - - - name: Checkout code - uses: actions/checkout@v4 - - - name: Download artifacts + run: scripts/install-dependencies.sh + + - name: Download Artifacts uses: actions/download-artifact@v4 - id: download with: - pattern: macOS DMG Images * - merge-multiple: true - path: dmgs-original + pattern: '*darwin*' - - name: Make universal bundles + - name: Create Universal Binaries run: | - bash --version - bash scripts/make-universal-binaries.sh ${{ steps.download.outputs.download-path }} "${INSTALL_NAME}" + for TYPE in bundle portable; do + 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: 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 DMG Image + - name: Upload (Release) uses: actions/upload-artifact@v4 with: - name: macOS DMG Images (Universal) - path: ${{ env.INSTALL_NAME }}.dmg - compression-level: 0 + name: lite-xl-${{ needs.version.outputs.ref }}-universal-darwin-release + path: | + *.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 - strategy: - matrix: - config: - - { msystem: MINGW32, arch: i686 } - - { msystem: MINGW64, arch: x86_64 } - defaults: + defaults: run: shell: msys2 {0} - + needs: [version] steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup MSYS2 - 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 - + - uses: msys2/setup-msys2@v2 + with: { msystem: MINGW64 } + + - uses: actions/checkout@v4 + - name: Install Dependencies - if: false - run: bash scripts/install-dependencies.sh --debug - + run: bash scripts/install-dependencies.sh + - name: Build - run: | - bash --version - bash scripts/build.sh -U --debug --forcefallback + run: bash scripts/build.sh -U --addons --debug --forcefallback --portable -b build - - name: Package - run: bash scripts/package.sh --version ${INSTALL_REF} --debug --binary - - - name: Upload Artifacts + - name: Package Windows (Portable) + run: cd build && zip -r ../lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows-portable.zip lite-xl && cd .. + + - 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 with: - name: Windows Artifacts (${{ matrix.config.msystem }}) - path: ${{ env.INSTALL_NAME }}.zip - compression-level: 0 + name: lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows-portable-release + path: | + *.zip + *.exe build_windows_msvc: - name: Windows (MSVC) + name: Windows (x86_64) (MSVC) + needs: [version] runs-on: windows-2019 - strategy: - matrix: - arch: - - { target: x86, name: i686 } - - { target: x64, name: x86_64 } - steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 with: - arch: ${{ matrix.arch.target }} + arch: x86_64 - name: Setup Python uses: actions/setup-python@v5 - with: - python-version: "3.11" + with: { python-version: "3.11" } - name: Install meson and ninja run: pip install meson ninja - name: Set up environment variables 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 - - name: Download and patch subprojects + - name: Download subprojects shell: bash run: | meson subprojects download cat resources/windows/001-lua-unicode.diff | patch -Np1 -d "$LUA_SUBPROJECT_PATH" - name: Configure - run: | - meson setup --wrap-mode=forcefallback build + run: meson setup --wrap-mode=forcefallback build - name: Build - run: | - meson install -C build --destdir="../lite-xl" + run: meson install -C build --destdir="../lite-xl" - name: Package run: | 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 with: - name: Windows Artifacts (MSVC ${{ matrix.arch.target }}) - path: ${{ env.INSTALL_NAME }}.zip + name: lite-xl-${{ needs.version.outputs.ref }}-x86_64-windows (MSVC) 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 234fa37a..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -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" diff --git a/build-packages.sh b/build-packages.sh deleted file mode 100755 index a95d3460..00000000 --- a/build-packages.sh +++ /dev/null @@ -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 " - 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 "$@" diff --git a/resources/cross/macos-arm64.txt b/resources/cross/darwin-aarch64.txt similarity index 95% rename from resources/cross/macos-arm64.txt rename to resources/cross/darwin-aarch64.txt index 3ccc6aa5..78f9c229 100644 --- a/resources/cross/macos-arm64.txt +++ b/resources/cross/darwin-aarch64.txt @@ -1,5 +1,5 @@ # cross file for compiling on MacOS ARM (Apple Sillicon). -# use this file by running meson setup --cross-file resources/cross/macos_arm64.txt +# use this file by running meson setup --cross-file resources/cross/darwin-aarch64.txt [host_machine] system = 'darwin' diff --git a/resources/windows/001-lua-unicode.diff b/resources/windows/001-lua-unicode.diff index e6a2ae44..f7dbc74e 100644 --- a/resources/windows/001-lua-unicode.diff +++ b/resources/windows/001-lua-unicode.diff @@ -1,6 +1,6 @@ -diff -ruN lua-5.4.4/meson.build lua-5.4.4-patched/meson.build ---- lua-5.4.4/meson.build Wed Feb 22 18:16:56 2023 -+++ lua-5.4.4-patched/meson.build Wed Feb 22 04:10:01 2023 +diff -ruN lua-5.4.6/meson.build lua-5.4.6-patched/meson.build +--- lua-5.4.6/meson.build Wed Feb 22 18:16:56 2023 ++++ lua-5.4.6-patched/meson.build Wed Feb 22 04:10:01 2023 @@ -85,6 +85,7 @@ 'src/lutf8lib.c', 'src/lvm.c', @@ -9,13 +9,13 @@ diff -ruN lua-5.4.4/meson.build lua-5.4.4-patched/meson.build dependencies: lua_lib_deps, version: meson.project_version(), soversion: lua_versions[0] + '.' + lua_versions[1], -diff -ruN lua-5.4.4/src/luaconf.h lua-5.4.4-patched/src/luaconf.h ---- lua-5.4.4/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 +diff -ruN lua-5.4.6/src/luaconf.h lua-5.4.6-patched/src/luaconf.h +--- lua-5.4.6/src/luaconf.h Thu Jan 13 19:24:43 2022 ++++ lua-5.4.6-patched/src/luaconf.h Wed Feb 22 04:10:02 2023 @@ -782,5 +782,15 @@ - - - + + + +#if defined(lua_c) || defined(luac_c) || (defined(LUA_LIB) && \ + (defined(lauxlib_c) || defined(liolib_c) || \ + defined(loadlib_c) || defined(loslib_c))) @@ -27,22 +27,22 @@ diff -ruN lua-5.4.4/src/luaconf.h lua-5.4.4-patched/src/luaconf.h + + #endif - -diff -ruN lua-5.4.4/src/Makefile lua-5.4.4-patched/src/Makefile ---- lua-5.4.4/src/Makefile Thu Jul 15 22:01:52 2021 -+++ lua-5.4.4-patched/src/Makefile Wed Feb 22 04:10:02 2023 + +diff -ruN lua-5.4.6/src/Makefile lua-5.4.6-patched/src/Makefile +--- lua-5.4.6/src/Makefile Thu Jul 15 22:01:52 2021 ++++ lua-5.4.6-patched/src/Makefile Wed Feb 22 04:10:02 2023 @@ -33,7 +33,7 @@ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris - + LUA_A= liblua.a -CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o +CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o utf8_wrappers.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) - -diff -ruN lua-5.4.4/src/utf8_wrappers.c lua-5.4.4-patched/src/utf8_wrappers.c ---- lua-5.4.4/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 + +diff -ruN lua-5.4.6/src/utf8_wrappers.c lua-5.4.6-patched/src/utf8_wrappers.c +--- lua-5.4.6/src/utf8_wrappers.c Thu Jan 01 08:00:00 1970 ++++ lua-5.4.6-patched/src/utf8_wrappers.c Wed Feb 22 18:13:45 2023 @@ -0,0 +1,129 @@ +/** + * 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; +} +#endif -diff -ruN lua-5.4.4/src/utf8_wrappers.h lua-5.4.4-patched/src/utf8_wrappers.h ---- lua-5.4.4/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 +diff -ruN lua-5.4.6/src/utf8_wrappers.h lua-5.4.6-patched/src/utf8_wrappers.h +--- lua-5.4.6/src/utf8_wrappers.h Thu Jan 01 08:00:00 1970 ++++ lua-5.4.6-patched/src/utf8_wrappers.h Wed Feb 22 18:09:48 2023 @@ -0,0 +1,46 @@ +/** + * Wrappers to provide Unicode (UTF-8) support on Windows. diff --git a/scripts/README.md b/scripts/README.md index 36e35479..d87073c5 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,16 +4,13 @@ Various scripts and configurations used to configure, build, and package Lite XL ### Build -- **build.sh** -- **build-packages.sh**: In root directory, as all in one script; relies to the - ones in this directory. +- **build.sh**: Runs meson in a standard way across platforms. ### Package -- **appdmg.sh**: Create a macOS DMG image using [dmgbuild][1]. -- **appimage.sh**: [AppImage][2] builder. -- **innosetup.sh**: Creates a 32/64 bit [InnoSetup][3] installer package. -- **package.sh**: Creates all binary / DMG image / installer / source packages. +- **package-appdmg.sh**: Create a macOS DMG image using [dmgbuild][1]. +- **package-appimage.sh**: [AppImage][2] builder. +- **package-innosetup.sh**: Creates a 32/64 bit [InnoSetup][3] installer package. ### Utility diff --git a/scripts/appdmg.sh b/scripts/appdmg.sh deleted file mode 100644 index 5ce4fe71..00000000 --- a/scripts/appdmg.sh +++ /dev/null @@ -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" diff --git a/scripts/build.sh b/scripts/build.sh old mode 100644 new mode 100755 index 0908ab19..2ee7e3e7 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -18,14 +18,15 @@ show_help() { echo " --debug Debug this script." echo "-f --forcefallback Force to build dependencies statically." 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 "-B --bundle Create an App bundle (macOS only)" + echo "-A --addons Add in addons" echo "-P --portable Create a portable binary package." echo "-O --pgo Use profile guided optimizations (pgo)." echo "-U --windows-lua-utf Use the UTF8 patch for Lua." echo " macOS: disabled when used with --bundle," echo " Windows: Implicit being the only option." - echo "-r --release Compile in release mode." echo " --cross-platform PLATFORM Cross compile for this platform." echo " The script will find the appropriate" echo " cross file in 'resources/cross'." @@ -39,9 +40,11 @@ show_help() { main() { local platform="$(get_platform_name)" local arch="$(get_platform_arch)" - local build_dir="$(get_default_build_dir)" - local build_type="debug" + local build_dir + local plugins="welcome" local prefix=/ + local addons + local build_type="release" local force_fallback local bundle local portable @@ -65,6 +68,10 @@ main() { shift shift ;; + -d|--debug-build) + build_type="debug" + shift + ;; --debug) set -x shift @@ -78,8 +85,12 @@ main() { shift shift ;; + -A|--addons) + addons="1" + shift + ;; -B|--bundle) - if [[ "$platform" != "macos" ]]; then + if [[ "$platform" != "darwin" ]]; then echo "Warning: ignoring --bundle option, works only under macOS." else bundle="-Dbundle=true" @@ -116,10 +127,6 @@ main() { shift shift ;; - -r|--release) - build_type="release" - shift - ;; *) # unknown option ;; @@ -157,9 +164,13 @@ main() { fi platform="${cross_platform:-$platform}" 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 - 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 # arch and platform specific stuff @@ -188,24 +199,34 @@ main() { fi CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \ - --buildtype=$build_type \ + "${build_dir}" \ + --buildtype "$build_type" \ --prefix "$prefix" \ - "${cross_file[@]}" \ + $cross_file \ $force_fallback \ $bundle \ $portable \ $pgo \ - "${build_dir}" meson compile -C "${build_dir}" + cp -r data "${build_dir}/src" + if [[ $pgo != "" ]]; then - cp -r data "${build_dir}/src" "${build_dir}/src/lite-xl" meson configure -Db_pgo=use "${build_dir}" meson compile -C "${build_dir}" rm -fr "${build_dir}/data" 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 "$@" diff --git a/scripts/common.sh b/scripts/common.sh index 831fee1b..3cc6836d 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -2,70 +2,11 @@ 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() { if [[ "$OSTYPE" == "msys" ]]; then echo "windows" elif [[ "$OSTYPE" == "darwin"* ]]; then - echo "macos" + echo "darwin" elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then echo "linux" else @@ -73,8 +14,15 @@ get_platform_name() { fi } +get_executable_extension() { + if [[ "$OSTYPE" == "msys" ]]; then + echo ".exe" + else + echo "" + fi +} + get_platform_arch() { - platform=$(get_platform_name) arch=${CROSS_ARCH:-$(uname -m)} if [[ $MSYSTEM != "" ]]; then case "$MSYSTEM" in @@ -89,13 +37,20 @@ get_platform_arch() { ;; esac fi + [[ $arch == "arm64" ]] && arch="aarch64" echo "$arch" } +get_platform_tuple() { + platform="$(get_platform_name)" + arch="$(get_platform_arch)" + echo "$arch-$platform" +} + get_default_build_dir() { platform="${1:-$(get_platform_name)}" arch="${2:-$(get_platform_arch)}" - echo "build-$platform-$arch" + echo "build-$arch-$platform" } if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then diff --git a/scripts/innosetup/innosetup.iss.in b/scripts/innosetup/innosetup.iss.in index e15d9631..00127054 100644 --- a/scripts/innosetup/innosetup.iss.in +++ b/scripts/innosetup/innosetup.iss.in @@ -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." [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 [Icons] diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh old mode 100644 new mode 100755 index fb593ca6..d6bb83ee --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -48,7 +48,7 @@ main() { 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 + ${MINGW_PACKAGE_PREFIX}-{ca-certificates,gcc,meson,ninja,ntldd,pkg-config,mesa,freetype,pcre2,SDL2} unzip patch zip fi } diff --git a/scripts/make-universal-binaries.sh b/scripts/make-universal-binaries.sh deleted file mode 100644 index 76989144..00000000 --- a/scripts/make-universal-binaries.sh +++ /dev/null @@ -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" \ No newline at end of file diff --git a/scripts/appimage.sh b/scripts/package-appimage.sh old mode 100644 new mode 100755 similarity index 51% rename from scripts/appimage.sh rename to scripts/package-appimage.sh index 0548450d..f3e98e92 --- a/scripts/appimage.sh +++ b/scripts/package-appimage.sh @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/usr/bin/env bash set -e if [ ! -e "src/api/api.h" ]; then @@ -10,10 +10,7 @@ source scripts/common.sh ARCH="$(uname -m)" BUILD_DIR="$(get_default_build_dir)" -RUN_BUILD=true -STATIC_BUILD=false ADDONS=false -BUILD_TYPE="debug" show_help(){ echo @@ -26,15 +23,10 @@ show_help(){ echo " Default: '${BUILD_DIR}'." echo " --debug Debug this script." 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 "-a --addons Install 3rd party addons." - echo "-r --release Compile in release mode." echo } -initial_arg_count=$# - for i in "$@"; do case $i in -h|--help) @@ -46,26 +38,10 @@ for i in "$@"; do shift shift ;; - -a|--addons) - ADDONS=true - shift - ;; --debug) set -x shift ;; - -n|--nobuild) - RUN_BUILD=false - shift - ;; - -r|--release) - BUILD_TYPE="release" - shift - ;; - -s|--static) - STATIC_BUILD=true - shift - ;; -v|--version) VERSION="$2" shift @@ -77,12 +53,6 @@ for i in "$@"; do esac done -# show help if no valid argument was found -if [ $initial_arg_count -eq $# ]; then - show_help - exit 1 -fi - setup_appimagetool() { if [ ! -e appimagetool ]; 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 } -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() { + [[ ! -e $BUILD_DIR ]] && scripts/build.sh $@ + if [ -e LiteXL.AppDir ]; then rm -rf LiteXL.AppDir fi 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/ # These could be symlinks but it seems they doesn't work with AppimageLauncher cp resources/icons/lite-xl.svg 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..." local version="" if [ -n "$VERSION" ]; then version="-$VERSION" fi - if [[ $ADDONS == true ]]; then - version="${version}-addons" - fi - - ./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}.AppImage + ./appimagetool --appimage-extract-and-run LiteXL.AppDir LiteXL${version}-${ARCH}-linux.AppImage + rm -rf LiteXL.AppDir } setup_appimagetool download_appimage_apprun -if [[ $RUN_BUILD == true ]]; then build_litexl; fi -generate_appimage $1 +generate_appimage diff --git a/scripts/package-dmg.sh b/scripts/package-dmg.sh new file mode 100755 index 00000000..0f47bddf --- /dev/null +++ b/scripts/package-dmg.sh @@ -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" + diff --git a/scripts/innosetup/innosetup.sh b/scripts/package-innosetup.sh old mode 100644 new mode 100755 similarity index 74% rename from scripts/innosetup/innosetup.sh rename to scripts/package-innosetup.sh index 86ab89d1..5b59a5cd --- a/scripts/innosetup/innosetup.sh +++ b/scripts/package-innosetup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e 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 " Default: '$(get_default_build_dir)'." 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 } @@ -56,17 +55,13 @@ main() { show_help exit 0 ;; - -a|--addons) - addons=true - shift - ;; -b|--builddir) build_dir="$2" shift shift ;; -v|--version) - if [[ -n $2 ]]; then version="-$2"; fi + if [[ -n $2 ]]; then version="$2"; fi shift shift ;; @@ -80,20 +75,12 @@ main() { esac done - # show help if no valid argument was found - if [ $initial_arg_count -eq $# ]; then - show_help - exit 1 - fi + [[ ! -e $build_dir ]] && scripts/build.sh $@ - if [[ $addons == true ]]; then - version="${version}-addons" - fi - - output="LiteXL${version}-${arch_file}-setup" + output="lite-xl-${version}-${arch_file}-windows-setup" "/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 "$@" diff --git a/scripts/package.sh b/scripts/package.sh deleted file mode 100644 index d4f47fdc..00000000 --- a/scripts/package.sh +++ /dev/null @@ -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 " - 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 "$@" diff --git a/scripts/repackage.sh b/scripts/repackage.sh deleted file mode 100644 index 80af45c8..00000000 --- a/scripts/repackage.sh +++ /dev/null @@ -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 - diff --git a/scripts/run-local b/scripts/run-local deleted file mode 100755 index 8a32e7fa..00000000 --- a/scripts/run-local +++ /dev/null @@ -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] " - 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