Added Release Workflow and Fixed some build script issues (#1013)

* ci linux: make builds properly static
* test workflow_dispatch
* install wayland-protocols
* append missing portable
* make debug builds by default
* auto enable some video subsystems for proper wayland support
* added release workflow
* make line shorter in innosetup bash script
* disable some video subsystems on darwin and windows
* fix default build dir on msys
* print output of ntldd
* properly set msys arch
* disable opengl on windows
* copy mingw dependencies on package
* innosetup script copy from generated package dir
* changed license to reflect team work
* adjusted the ci windows install name
* add all language plugins to addons
* disabled generation of source tarballs
* removed language_cpp from plugins repo
* enabled lua utf8 patch for windows build
* added open_ext to addons
* moved away from deprecated virtual environments
* make minimal build and with addons
* simplified CI build.yml
This commit is contained in:
Jefferson González 2022-09-25 16:59:01 -04:00 committed by GitHub
parent a640360d0d
commit 9f1294fea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 475 additions and 265 deletions

View File

@ -1,45 +1,20 @@
name: CI
# All builds use lhelper only for releases,
# otherwise for normal builds dependencies are dynamically linked.
on:
push:
branches:
- '*'
# tags:
# - 'v[0-9]*'
- '*'
pull_request:
branches:
- '*'
- '*'
workflow_dispatch:
jobs:
archive_source_code:
name: Source Code Tarball
runs-on: ubuntu-18.04
# Only on tags/releases
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install Dependencies
run: |
sudo apt-get install -qq ninja-build
pip3 install meson
- name: Package
shell: bash
run: bash scripts/package.sh --version ${GITHUB_REF##*/} --debug --source
- uses: actions/upload-artifact@v2
with:
name: Source Code Tarball
path: "lite-xl-*-src.tar.gz"
build_linux:
name: Linux
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
matrix:
config:
@ -49,103 +24,71 @@ jobs:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
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)" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Update Packages
run: sudo apt-get update
- name: Install Dependencies
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/install-dependencies.sh --debug
- name: Install Release Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
bash scripts/install-dependencies.sh --debug --lhelper
bash scripts/lhelper.sh --debug
- name: Build
run: |
bash --version
bash scripts/build.sh --debug --forcefallback
- name: Package
if: ${{ matrix.config.cc == 'gcc' }}
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
- name: AppImage
if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/appimage.sh --nobuild --version ${INSTALL_REF}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
if: ${{ matrix.config.cc == 'gcc' }}
with:
name: Linux Artifacts
path: |
${{ env.INSTALL_NAME }}.tar.gz
LiteXL-${{ env.INSTALL_REF }}-x86_64.AppImage
- 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"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- 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@v2
if: ${{ matrix.config.cc == 'gcc' }}
with:
name: Linux Artifacts
path: ${{ env.INSTALL_NAME }}.tar.gz
build_macos:
name: macOS (x86_64)
runs-on: macos-10.15
runs-on: macos-11
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=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-$(uname -m)" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Dependencies
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/install-dependencies.sh --debug
- name: Install Release Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
bash scripts/install-dependencies.sh --debug --lhelper
bash scripts/lhelper.sh --debug
- name: Build
run: |
bash --version
bash scripts/build.sh --bundle --debug --forcefallback
- name: Error Logs
if: failure()
run: |
mkdir ${INSTALL_NAME}
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
# - name: Package
# if: ${{ !startsWith(github.ref, 'refs/tags/') }}
# run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons
- name: Create DMG Image
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg
- name: Upload DMG Image
uses: actions/upload-artifact@v2
with:
name: macOS DMG Image
path: ${{ env.INSTALL_NAME }}.dmg
- name: Upload Error Logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: Error Logs
path: ${{ env.INSTALL_NAME }}.tar.gz
- 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=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-$(uname -m)" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Dependencies
run: bash scripts/install-dependencies.sh --debug
- 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@v2
with:
name: macOS DMG Image
path: ${{ env.INSTALL_NAME }}.dmg
build_windows_msys2:
name: Windows
@ -160,7 +103,6 @@ jobs:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
#msystem: MINGW64
msystem: ${{ matrix.msystem }}
update: true
install: >-
@ -170,83 +112,22 @@ jobs:
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-$(uname -m)" >> "$GITHUB_ENV"
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
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/install-dependencies.sh --debug
- name: Install Release Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/install-dependencies.sh --debug --lhelper
- name: Build
run: |
bash --version
bash scripts/build.sh --debug --forcefallback
- name: Error Logs
if: failure()
run: |
mkdir ${INSTALL_NAME}
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
bash scripts/build.sh -U --debug --forcefallback
- name: Package
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
- name: Build Installer
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/innosetup/innosetup.sh --debug
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --binary
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: Windows Artifacts
path: |
LiteXL*.exe
${{ env.INSTALL_NAME }}.zip
- name: Upload Error Logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: Error Logs
path: ${{ env.INSTALL_NAME }}.tar.gz
deploy:
name: Deployment
runs-on: ubuntu-18.04
# if: startsWith(github.ref, 'refs/tags/')
if: false
needs:
- archive_source_code
- build_linux
- build_macos
- build_windows_msys2
steps:
- name: Set Environment Variables
run: echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v2
with:
name: Linux Artifacts
- uses: actions/download-artifact@v2
with:
name: macOS DMG Image
- uses: actions/download-artifact@v2
with:
name: Source Code Tarball
- uses: actions/download-artifact@v2
with:
name: Windows Artifacts
- name: Display File Information
shell: bash
run: ls -lR
# Note: not using `actions/create-release@v1`
# because it cannot update an existing release
# see https://github.com/actions/create-release/issues/29
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.INSTALL_REF }}
name: Release ${{ env.INSTALL_REF }}
draft: false
prerelease: false
files: |
lite-xl-${{ env.INSTALL_REF }}-*
LiteXL*.AppImage
LiteXL*.exe
path: ${{ env.INSTALL_NAME }}.zip

187
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,187 @@
name: Release
on:
push:
tags:
- v[0-9]+.*
workflow_dispatch:
inputs:
version:
description: Release Version
default: v2.1.0
required: true
jobs:
release:
name: Create Release
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.tag.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch Version
id: tag
run: |
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
echo ::set-output name=version::${{ github.event.inputs.version }}
else
echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
fi
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.version }}
name: Lite XL ${{ steps.tag.outputs.version }}
draft: true
prerelease: false
body_path: changelog.md
generate_release_notes: true
build_linux:
name: Linux
needs: release
runs-on: ubuntu-20.04
env:
CC: gcc
CXX: g++
steps:
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Update Packages
run: sudo apt-get update
- name: Install Dependencies
run: |
bash scripts/install-dependencies.sh --debug
sudo apt-get install -y ccache
- name: Build Portable
run: |
bash --version
bash scripts/build.sh --debug --forcefallback --portable --release
- name: Package Portables
run: |
bash scripts/package.sh --version ${INSTALL_REF} --debug --binary --release
bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary --release
- name: Build AppImages
run: |
bash scripts/appimage.sh --debug --static --version ${INSTALL_REF} --release
bash scripts/appimage.sh --debug --nobuild --addons --version ${INSTALL_REF}
- name: Upload Files
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.version }}
files: |
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 (x86_64)
needs: release
runs-on: macos-11
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-$(uname -m)" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos-$(uname -m)" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Dependencies
run: bash scripts/install-dependencies.sh --debug
- 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 Files
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.version }}
files: |
${{ env.INSTALL_NAME }}.dmg
${{ env.INSTALL_NAME_ADDONS }}.dmg
build_windows_msys2:
name: Windows
needs: release
runs-on: windows-2019
strategy:
matrix:
msystem: [MINGW32, MINGW64]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: >-
base-devel
git
zip
- 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 "BUILD_ARCH=x86_64" >> "$GITHUB_ENV"
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 "BUILD_ARCH=i686" >> "$GITHUB_ENV"
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
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 Files
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.version }}
files: |
${{ env.INSTALL_NAME }}.zip
${{ env.INSTALL_NAME_ADDONS }}.zip
LiteXL-${{ env.INSTALL_REF }}-${{ env.BUILD_ARCH }}-setup.exe
LiteXL-${{ env.INSTALL_REF }}-addons-${{ env.BUILD_ARCH }}-setup.exe

View File

@ -1,4 +1,4 @@
Copyright (c) 2020-2021 Francesco Abbate
Copyright (c) 2020-2021 Lite XL Team
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@ -37,6 +37,7 @@ show_help() {
echo "-D --dmg Create a DMG disk image (macOS only)."
echo " Requires NPM and AppDMG."
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
@ -58,6 +59,7 @@ main() {
local innosetup
local portable
local pgo
local release
for i in "$@"; do
case $i in
@ -109,6 +111,10 @@ main() {
portable="--portable"
shift
;;
-r|--release)
release="--release"
shift
;;
-S|--source)
source="--source"
shift
@ -145,6 +151,7 @@ main() {
$force_fallback \
$bundle \
$portable \
$release \
$pgo
source scripts/package.sh \
@ -158,6 +165,7 @@ main() {
$appimage \
$dmg \
$innosetup \
$release \
$source
}

View File

@ -1,5 +1,5 @@
#!/bin/env bash
set -ex
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."
@ -8,6 +8,13 @@ fi
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
echo "Usage: $0 <OPTIONS>"
@ -16,22 +23,21 @@ show_help(){
echo
echo "-h --help Show this help and exits."
echo "-b --builddir DIRNAME Sets the name of the build dir (no path)."
echo " Default: 'build'."
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 " by using lhelper tool."
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
}
ARCH="$(uname -m)"
BUILD_DIR="$(get_default_build_dir)"
RUN_BUILD=true
STATIC_BUILD=false
initial_arg_count=$#
for i in "$@"; do
case $i in
-h|--belp)
-h|--help)
show_help
exit 0
;;
@ -40,10 +46,22 @@ 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
@ -59,25 +77,19 @@ for i in "$@"; do
esac
done
# TODO: Versioning using git
#if [[ -z $VERSION && -d .git ]]; then
# VERSION=$(git describe --tags --long | sed 's/^v//; s/\([^-]*-g\)/r\1/; s/-/./g')
#fi
if [[ -n $1 ]]; then
# show help if no valid argument was found
if [ $initial_arg_count -eq $# ]; then
show_help
exit 1
fi
setup_appimagetool() {
if ! which appimagetool > /dev/null ; then
if [ ! -e appimagetool ]; then
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
echo "Could not download the appimagetool for the arch '${ARCH}'."
exit 1
else
chmod 0755 appimagetool
fi
if [ ! -e appimagetool ]; then
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
echo "Could not download the appimagetool for the arch '${ARCH}'."
exit 1
else
chmod 0755 appimagetool
fi
fi
}
@ -104,7 +116,14 @@ build_litexl() {
echo "Build lite-xl..."
sleep 1
meson setup --buildtype=release --prefix /usr ${BUILD_DIR}
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}
}
@ -121,6 +140,11 @@ generate_appimage() {
cp resources/icons/lite-xl.svg LiteXL.AppDir/
cp resources/linux/org.lite_xl.lite_xl.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..."
@ -153,6 +177,10 @@ generate_appimage() {
version="-$VERSION"
fi
if [[ $ADDONS == true ]]; then
version="${version}-addons"
fi
./appimagetool LiteXL.AppDir LiteXL${version}-${ARCH}.AppImage
}

View File

@ -25,12 +25,14 @@ show_help() {
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
}
main() {
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local build_type="debug"
local prefix=/
local force_fallback
local bundle
@ -84,6 +86,10 @@ main() {
patch_lua="true"
shift
;;
-r|--release)
build_type="release"
shift
;;
*)
# unknown option
;;
@ -103,7 +109,7 @@ main() {
rm -rf "${build_dir}"
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=release \
--buildtype=$build_type \
--prefix "$prefix" \
$force_fallback \
$bundle \

View File

@ -2,6 +2,64 @@
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}"
mv "${build_dir}/lite-xl-widgets-master" "${build_dir}/third/data/widget"
# Downlaod thirdparty plugins
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-plugins/archive/2.1.zip" \
-o "${build_dir}/lite-xl-plugins.zip"
unzip "${build_dir}/lite-xl-plugins.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-plugins-2.1/plugins" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-xl-plugins-2.1"
}
# 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 widget; 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"
@ -14,9 +72,23 @@ get_platform_name() {
fi
}
get_platform_arch() {
platform=$(get_platform_name)
arch=$(uname -m)
if [[ $MSYSTEM != "" ]]; then
if [[ $MSYSTEM == "MINGW64" ]]; then
arch=x86_64
else
arch=i686
fi
fi
echo "$arch"
}
get_default_build_dir() {
platform=$(get_platform_name)
echo "build-$platform-$(uname -m)"
arch=$(get_platform_arch)
echo "build-$platform-$arch"
}
if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then

View File

@ -69,9 +69,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip
Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
[Files]
Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion ; Check: DirExists(ExpandConstant('{#BuildDir}/mingwLibs{#Arch}'))
Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs
Source: "{#SourceDir}/lite-xl/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]

View File

@ -15,15 +15,29 @@ show_help() {
echo
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
}
main() {
local build_dir=$(get_default_build_dir)
local addons=false
local arch
local arch_file
local version
local output
if [[ $MSYSTEM == "MINGW64" ]]; then arch=x64; else arch=Win32; fi
if [[ $MSYSTEM == "MINGW64" ]]; then
arch=x64
arch_file=x86_64
else
arch=i686;
arch_file=i686
fi
initial_arg_count=$#
for i in "$@"; do
case $i in
@ -31,11 +45,20 @@ 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
shift
shift
;;
--debug)
set -x
shift
@ -46,19 +69,19 @@ main() {
esac
done
if [[ -n $1 ]]; then
# show help if no valid argument was found
if [ $initial_arg_count -eq $# ]; then
show_help
exit 1
fi
# Copy MinGW libraries dependencies.
# MSYS2 ldd command seems to be only 64bit, so use ntldd
# see https://github.com/msys2/MINGW-packages/issues/4164
local mingwLibsDir="${build_dir}/mingwLibs$arch"
mkdir -p "$mingwLibsDir"
ntldd -R "${build_dir}/src/lite-xl.exe" | grep mingw | awk '{print $3}' | sed 's#\\#/#g' | xargs -I '{}' cp -v '{}' $mingwLibsDir
if [[ $addons == true ]]; then
version="${version}-addons"
fi
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch "${build_dir}/scripts/innosetup.iss"
output="LiteXL${version}-${arch_file}-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
}

View File

@ -48,7 +48,7 @@ main() {
if [[ $lhelper == true ]]; then
sudo apt-get install -qq ninja-build
else
sudo apt-get install -qq ninja-build libsdl2-dev libfreetype6
sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6
fi
pip3 install meson
elif [[ "$OSTYPE" == "darwin"* ]]; then

View File

@ -20,44 +20,19 @@ show_help() {
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 " --addons Install 3rd party addons (currently Lite XL colors)."
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 AppDMG (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
}
# Addons installation: some distributions forbid external downloads
# so make it as optional module.
install_addons() {
local build_dir="$1"
local data_dir="$2"
if [[ -d "${build_dir}/third/data/colors" ]]; then
echo "Warning: found previous colors addons installation, skipping."
return 0
fi
# Copy 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"
for module_name in colors; do
cp -r "${build_dir}/third/data/$module_name" "${data_dir}"
done
}
source_package() {
local build_dir=build-src
local package_name=$1
@ -85,7 +60,7 @@ source_package() {
}
main() {
local arch="$(uname -m)"
local arch="$(get_platform_arch)"
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local dest_dir=lite-xl
@ -96,8 +71,12 @@ main() {
local binary=false
local dmg=false
local innosetup=false
local release=false
local source=false
# store the current flags to easily pass them to appimage script
local flags="$@"
for i in "$@"; do
case $i in
-b|--builddir)
@ -152,11 +131,15 @@ main() {
fi
shift
;;
-r|--release)
release=true
shift
;;
-S|--source)
source=true
shift
;;
--addons)
-a|--addons)
addons=true
shift
;;
@ -170,6 +153,10 @@ main() {
esac
done
if [[ $addons == true ]]; then
version="$version-addons"
fi
if [[ -n $1 ]]; then show_help; exit 1; fi
# The source package doesn't require a previous build,
@ -190,6 +177,7 @@ main() {
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
@ -202,6 +190,14 @@ main() {
if [[ $platform == "windows" ]]; then
exe_file="${exe_file}.exe"
stripcmd="strip --strip-all"
# 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
# Windows archive is always portable
package_name+="-portable"
@ -227,7 +223,10 @@ main() {
mkdir -p "${data_dir}"
if [[ $addons == true ]]; then install_addons "${build_dir}" "${data_dir}"; fi
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.
@ -238,7 +237,9 @@ main() {
find . -type d -empty -delete
popd
$stripcmd "${exe_file}"
if [[ $release == true ]]; then
$stripcmd "${exe_file}"
fi
echo "Creating a compressed archive ${package_name}"
if [[ $binary == true ]]; then
@ -252,9 +253,15 @@ main() {
fi
fi
if [[ $appimage == true ]]; then source scripts/appimage.sh; fi
if [[ $bundle == true && $dmg == true ]]; then source scripts/appdmg.sh "${package_name}"; fi
if [[ $innosetup == true ]]; then source scripts/innosetup/innosetup.sh -b "${build_dir}"; 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 "$@"