Adapt all scripts to work together with build-packages.sh
This commit is contained in:
parent
9e5d404b29
commit
38d85f2483
|
@ -1,10 +1,12 @@
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
|
# All builds use lhelper only for releases,
|
||||||
|
# otherwise for normal builds dependencies are dynamically linked.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- '*'
|
||||||
# Temporarily disabled
|
|
||||||
# tags:
|
# tags:
|
||||||
# - 'v[0-9]*'
|
# - 'v[0-9]*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
@ -12,15 +14,12 @@ on:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Note: not using git-archive(-all) because it can't include subprojects ignored by git
|
|
||||||
archive_source_code:
|
archive_source_code:
|
||||||
name: Source Code Tarball
|
name: Source Code Tarball
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
# Only on tags/releases
|
# Only on tags/releases
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
- name: Set Environment Variables
|
|
||||||
run: echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-src" >> "$GITHUB_ENV"
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Python Setup
|
- name: Python Setup
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
|
@ -30,16 +29,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -qq ninja-build
|
sudo apt-get install -qq ninja-build
|
||||||
pip3 install meson
|
pip3 install meson
|
||||||
- name: Archive source code
|
- name: Package
|
||||||
shell: bash
|
shell: bash
|
||||||
run: bash scripts/source-package.sh --destdir "${INSTALL_NAME}"
|
run: bash scripts/package.sh --version ${GITHUB_REF##*/} --debug --source
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Source Code Tarball
|
name: Source Code Tarball
|
||||||
path: ${{ env.INSTALL_NAME }}.tar.gz
|
path: "lite-xl-*-src.tar.gz"
|
||||||
|
|
||||||
# All builds use lhelper only for releases, using --static build argument,
|
|
||||||
# otherwise for normal builds dependencies are dynamically linked.
|
|
||||||
build_linux:
|
build_linux:
|
||||||
name: Linux
|
name: Linux
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
@ -52,11 +49,12 @@ jobs:
|
||||||
CC: ${{ matrix.config.cc }}
|
CC: ${{ matrix.config.cc }}
|
||||||
CXX: ${{ matrix.config.cxx }}
|
CXX: ${{ matrix.config.cxx }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set Archive Name
|
- name: Set Environment Variables
|
||||||
if: ${{ matrix.config.cc == 'gcc' }}
|
if: ${{ matrix.config.cc == 'gcc' }}
|
||||||
run: |
|
run: |
|
||||||
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
||||||
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-linux" >> "$GITHUB_ENV"
|
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-linux-$(uname -m)" >> "$GITHUB_ENV"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Python Setup
|
- name: Python Setup
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
|
@ -64,27 +62,24 @@ jobs:
|
||||||
python-version: 3.6
|
python-version: 3.6
|
||||||
- name: Update Packages
|
- name: Update Packages
|
||||||
run: sudo apt-get update
|
run: sudo apt-get update
|
||||||
- name: Install Meson
|
|
||||||
run: |
|
|
||||||
sudo apt-get install -qq ninja-build
|
|
||||||
pip3 install meson
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: sudo apt-get install -qq libsdl2-dev libfreetype6
|
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
|
- name: Build
|
||||||
if: ${{ matrix.config.cc == 'gcc' && !startsWith(github.ref, 'refs/tags/') }}
|
run: |
|
||||||
run: bash scripts/build.sh --prefix /
|
bash --version
|
||||||
- name: Release Build
|
bash scripts/build.sh --debug --forcefallback
|
||||||
if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
run: bash scripts/build.sh --prefix / --static
|
|
||||||
- name: Package
|
- name: Package
|
||||||
if: ${{ matrix.config.cc == 'gcc' }}
|
if: ${{ matrix.config.cc == 'gcc' }}
|
||||||
run: |
|
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
|
||||||
DESTDIR="$(pwd)/$INSTALL_NAME" meson install --skip-subprojects -C build
|
|
||||||
tar czvf "${INSTALL_NAME}".tar.gz "${INSTALL_NAME}"
|
|
||||||
- name: AppImage
|
- name: AppImage
|
||||||
if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: bash scripts/appimage.sh --nobuild --static --version ${{ env.INSTALL_REF }}
|
run: bash scripts/appimage.sh --nobuild --version ${INSTALL_REF}
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
if: ${{ matrix.config.cc == 'gcc' }}
|
if: ${{ matrix.config.cc == 'gcc' }}
|
||||||
|
@ -104,47 +99,42 @@ jobs:
|
||||||
- name: System Information
|
- name: System Information
|
||||||
run: |
|
run: |
|
||||||
system_profiler SPSoftwareDataType
|
system_profiler SPSoftwareDataType
|
||||||
|
bash --version
|
||||||
gcc -v
|
gcc -v
|
||||||
xcodebuild -version
|
xcodebuild -version
|
||||||
- name: Set Archive Name
|
- name: Set Environment Variables
|
||||||
run: |
|
run: |
|
||||||
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos" >> "$GITHUB_ENV"
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
bash --version
|
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
||||||
|
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-$(uname -m)" >> "$GITHUB_ENV"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Python Setup
|
- name: Python Setup
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: 3.9
|
||||||
- name: Install Build Tools
|
|
||||||
run: |
|
|
||||||
brew install ninja
|
|
||||||
pip3 install meson
|
|
||||||
cd ~; npm install appdmg; cd -
|
|
||||||
~/node_modules/appdmg/bin/appdmg.js --version
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: brew install sdl2
|
run: bash scripts/install-dependencies.sh --debug
|
||||||
- name: Install LHelper Dependencies
|
- name: Install Release Dependencies
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
run: brew install bash md5sha1sum
|
|
||||||
- name: Build
|
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
run: bash scripts/build.sh --prefix "${GITHUB_WORKSPACE}/Lite XL.app"
|
|
||||||
- name: Release Build
|
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
run: |
|
||||||
|
bash scripts/install-dependencies.sh --debug --lhelper
|
||||||
|
bash scripts/lhelper.sh --debug
|
||||||
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
bash --version
|
bash --version
|
||||||
bash scripts/build.sh --prefix "${GITHUB_WORKSPACE}/Lite XL.app" --static
|
bash scripts/build.sh --bundle --debug --forcefallback
|
||||||
- name: Error Logs
|
- name: Error Logs
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
mkdir ${INSTALL_NAME}
|
mkdir ${INSTALL_NAME}
|
||||||
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
|
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
|
||||||
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
|
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
|
||||||
- name: Install
|
# - name: Package
|
||||||
run: meson install --skip-subprojects -C build
|
# if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
# run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons
|
||||||
- name: Create DMG Image
|
- name: Create DMG Image
|
||||||
run: bash scripts/appdmg.sh ${{ env.INSTALL_NAME }}
|
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg
|
||||||
- name: Upload DMG Image
|
- name: Upload DMG Image
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
@ -178,34 +168,20 @@ jobs:
|
||||||
git
|
git
|
||||||
zip
|
zip
|
||||||
- name: Set Environment Variables
|
- name: Set Environment Variables
|
||||||
run: echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-$(echo $MSYSTEM | awk '{print tolower($0)}')" >> "$GITHUB_ENV"
|
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"
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: |
|
run: bash scripts/install-dependencies.sh --debug
|
||||||
pacman --noconfirm -S \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-gcc \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-meson \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-ninja \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-pkg-config \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-freetype \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-pcre2 \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-SDL2
|
|
||||||
- name: Install Release Dependencies
|
- name: Install Release Dependencies
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: |
|
run: bash scripts/install-dependencies.sh --debug --lhelper
|
||||||
pacman --noconfirm -S \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-gcc \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-meson \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-ninja \
|
|
||||||
${MINGW_PACKAGE_PREFIX}-pkg-config
|
|
||||||
- name: Build
|
- name: Build
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
run: bash scripts/build.sh --prefix /
|
|
||||||
- name: Release Build
|
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
run: |
|
run: |
|
||||||
bash --version
|
bash --version
|
||||||
bash scripts/build.sh --prefix / --static
|
bash scripts/build.sh --debug --forcefallback
|
||||||
- name: Error Logs
|
- name: Error Logs
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
|
@ -213,10 +189,10 @@ jobs:
|
||||||
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
|
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
|
||||||
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
|
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
|
||||||
- name: Package
|
- name: Package
|
||||||
run: bash scripts/msys2-package.sh --destdir ${INSTALL_NAME}
|
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
|
||||||
- name: Build Installer
|
- name: Build Installer
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
run: bash scripts/innosetup/innosetup.sh
|
run: bash scripts/innosetup/innosetup.sh --debug
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
@ -234,9 +210,8 @@ jobs:
|
||||||
deploy:
|
deploy:
|
||||||
name: Deployment
|
name: Deployment
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
# Temporarily disabled
|
|
||||||
if: false
|
|
||||||
# if: startsWith(github.ref, 'refs/tags/')
|
# if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
if: false
|
||||||
needs:
|
needs:
|
||||||
- archive_source_code
|
- archive_source_code
|
||||||
- build_linux
|
- build_linux
|
||||||
|
|
|
@ -10,6 +10,7 @@ subprojects/reproc/
|
||||||
.lite-debug.log
|
.lite-debug.log
|
||||||
.run*
|
.run*
|
||||||
*.diff
|
*.diff
|
||||||
|
*.exe
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zip
|
*.zip
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
@ -17,3 +18,4 @@ subprojects/reproc/
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
error.txt
|
error.txt
|
||||||
lite-xl*
|
lite-xl*
|
||||||
|
LiteXL*
|
||||||
|
|
16
README.md
16
README.md
|
@ -49,11 +49,11 @@ If you compile Lite XL yourself, it is recommended to use the script
|
||||||
`build-packages.sh`:
|
`build-packages.sh`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bash build-packages.sh <arch>
|
bash build-packages.sh -h
|
||||||
```
|
```
|
||||||
|
|
||||||
The script will run Meson and create a zip file with the application or,
|
The script will run Meson and create a tar compressed archive with the application or,
|
||||||
for Linux, a tar compressed archive. Lite XL can be easily installed
|
for Windows, a zip file. Lite XL can be easily installed
|
||||||
by unpacking the archive in any directory of your choice.
|
by unpacking the archive in any directory of your choice.
|
||||||
|
|
||||||
Otherwise the following is an example of basic commands if you want to customize
|
Otherwise the following is an example of basic commands if you want to customize
|
||||||
|
@ -65,7 +65,15 @@ meson compile -C build
|
||||||
DESTDIR="$(pwd)/lite-xl" meson install --skip-subprojects -C build
|
DESTDIR="$(pwd)/lite-xl" meson install --skip-subprojects -C build
|
||||||
```
|
```
|
||||||
|
|
||||||
where `<prefix>` might be one of `/`, `/usr` or `/opt`, the default is `/usr/local`.
|
where `<prefix>` might be one of `/`, `/usr` or `/opt`, the default is `/`.
|
||||||
|
To build a bundle application on macOS:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
meson setup --buildtype=release --Dbundle=true --prefix / build
|
||||||
|
meson compile -C build
|
||||||
|
DESTDIR="$(pwd)/Lite XL.app" meson install --skip-subprojects -C build
|
||||||
|
```
|
||||||
|
|
||||||
Please note that the package is relocatable to any prefix and the option prefix
|
Please note that the package is relocatable to any prefix and the option prefix
|
||||||
affects only the place where the application is actually installed.
|
affects only the place where the application is actually installed.
|
||||||
|
|
||||||
|
|
|
@ -1,259 +1,156 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
# strip-components is normally set to 1 to strip the initial "data" from the
|
if [ ! -e "src/api/api.h" ]; then
|
||||||
# directory path.
|
echo "Please run this script from the root directory of Lite XL."; exit 1
|
||||||
copy_directory_from_repo () {
|
fi
|
||||||
local tar_options=()
|
|
||||||
if [[ $1 == --strip-components=* ]]; then
|
source scripts/common.sh
|
||||||
tar_options+=($1)
|
|
||||||
|
show_help() {
|
||||||
|
echo
|
||||||
|
echo "Usage: $0 <OPTIONS>"
|
||||||
|
echo
|
||||||
|
echo "Common options:"
|
||||||
|
echo
|
||||||
|
echo "-h --help Show this help and exit."
|
||||||
|
echo "-b --builddir DIRNAME Set the name of the build directory (not path)."
|
||||||
|
echo " Default: '$(get_default_build_dir)'."
|
||||||
|
echo "-p --prefix PREFIX Install directory prefix."
|
||||||
|
echo " Default: '/'."
|
||||||
|
echo " --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
|
||||||
|
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 NPM and AppDMG."
|
||||||
|
echo "-I --innosetup Create an InnoSetup installer (Windows only)."
|
||||||
|
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
|
||||||
|
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
-h|--help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-b|--builddir)
|
||||||
|
build_dir="$2"
|
||||||
shift
|
shift
|
||||||
fi
|
|
||||||
local dirname="$1"
|
|
||||||
local destdir="$2"
|
|
||||||
_archive "$use_branch" "$dirname" "$destdir" "${tar_options[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
_archive () {
|
|
||||||
if [[ $git_available -eq 1 ]]; then
|
|
||||||
git archive "$1" "$2" --format=tar | tar xf - -C "$3" "$4"
|
|
||||||
else
|
|
||||||
cp -r "$2" "$3"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check if build directory is ok to be used to build.
|
|
||||||
build_dir_is_usable () {
|
|
||||||
local build="$1"
|
|
||||||
if [[ $build == */* || -z "$build" ]]; then
|
|
||||||
echo "invalid build directory, no path allowed: \"$build\""
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
if [[ $git_available -eq 1 ]]; then
|
|
||||||
git ls-files --error-unmatch "$build" &> /dev/null
|
|
||||||
if [ $? == 0 ]; then
|
|
||||||
echo "invalid path, \"$build\" is under revision control"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Ordinary release build
|
|
||||||
lite_build () {
|
|
||||||
local build="$1"
|
|
||||||
build_dir_is_usable "$build" || exit 1
|
|
||||||
rm -fr "$build"
|
|
||||||
setup_options=("${@:2}")
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
setup_options+=(-Dbundle=true)
|
|
||||||
fi
|
|
||||||
meson setup --buildtype=release "${setup_options[@]}" "$build" || exit 1
|
|
||||||
ninja -C "$build" || exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build using Profile Guided Optimizations (PGO)
|
|
||||||
lite_build_pgo () {
|
|
||||||
local build="$1"
|
|
||||||
build_dir_is_usable "$build" || exit 1
|
|
||||||
rm -fr "$build"
|
|
||||||
echo meson setup --buildtype=release "${@:2}" -Db_pgo=generate "$build"
|
|
||||||
meson setup --buildtype=release "${@:2}" -Db_pgo=generate "$build" || exit 1
|
|
||||||
ninja -C "$build" || exit 1
|
|
||||||
copy_directory_from_repo data "$build/src"
|
|
||||||
"$build/src/lite-xl"
|
|
||||||
meson configure -Db_pgo=use "$build"
|
|
||||||
ninja -C "$build" || exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
lite_build_package_windows () {
|
|
||||||
local portable="-msys"
|
|
||||||
if [ "$1" == "-portable" ]; then
|
|
||||||
portable=""
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
local build="$1"
|
|
||||||
local arch="$2"
|
|
||||||
local os="win"
|
|
||||||
local pdir=".package-build/lite-xl"
|
|
||||||
if [ -z "$portable" ]; then
|
|
||||||
local bindir="$pdir"
|
|
||||||
local datadir="$pdir/data"
|
|
||||||
else
|
|
||||||
local bindir="$pdir/bin"
|
|
||||||
local datadir="$pdir/share/lite-xl"
|
|
||||||
fi
|
|
||||||
mkdir -p "$bindir"
|
|
||||||
mkdir -p "$datadir"
|
|
||||||
for module_name in core plugins colors fonts; do
|
|
||||||
copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
|
|
||||||
done
|
|
||||||
# copy the meson generated start.lua file
|
|
||||||
cp "$build/start.lua" "$datadir/core"
|
|
||||||
for module_name in plugins colors; do
|
|
||||||
cp -r "$build/third/data/$module_name" "$datadir"
|
|
||||||
done
|
|
||||||
cp "$build/src/lite-xl.exe" "$bindir"
|
|
||||||
strip --strip-all "$bindir/lite-xl.exe"
|
|
||||||
pushd ".package-build"
|
|
||||||
local package_name="lite-xl-$os-$arch$portable.zip"
|
|
||||||
zip "$package_name" -r "lite-xl"
|
|
||||||
mv "$package_name" ..
|
|
||||||
popd
|
|
||||||
rm -fr ".package-build"
|
|
||||||
echo "created package $package_name"
|
|
||||||
}
|
|
||||||
|
|
||||||
lite_build_package_macos () {
|
|
||||||
local build="$1"
|
|
||||||
local arch="$2"
|
|
||||||
local os="macos"
|
|
||||||
|
|
||||||
local appdir=".package-build/lite-xl.app"
|
|
||||||
local bindir="$appdir/Contents/MacOS"
|
|
||||||
local datadir="$appdir/Contents/Resources"
|
|
||||||
mkdir -p "$bindir" "$datadir"
|
|
||||||
for module_name in core plugins colors fonts; do
|
|
||||||
copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
|
|
||||||
done
|
|
||||||
# copy the meson generated start.lua file
|
|
||||||
cp "$build/start.lua" "$datadir/core"
|
|
||||||
for module_name in plugins colors; do
|
|
||||||
cp -r "$build/third/data/$module_name" "$datadir"
|
|
||||||
done
|
|
||||||
cp resources/icons/icon.icns "$appdir/Contents/Resources/icon.icns"
|
|
||||||
cp "$build/Info.plist" "$appdir/Contents/Info.plist"
|
|
||||||
cp "$build/src/lite-xl" "$bindir/lite-xl"
|
|
||||||
strip "$bindir/lite-xl"
|
|
||||||
pushd ".package-build"
|
|
||||||
local package_name="lite-xl-$os-$arch.zip"
|
|
||||||
zip "$package_name" -r "lite-xl.app"
|
|
||||||
mv "$package_name" ..
|
|
||||||
popd
|
|
||||||
rm -fr ".package-build"
|
|
||||||
echo "created package $package_name"
|
|
||||||
}
|
|
||||||
|
|
||||||
lite_build_package_linux () {
|
|
||||||
local portable=""
|
|
||||||
if [ "$1" == "-portable" ]; then
|
|
||||||
portable="-portable"
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
local build="$1"
|
|
||||||
local arch="$2"
|
|
||||||
local os="linux"
|
|
||||||
local pdir=".package-build/lite-xl"
|
|
||||||
if [ "$portable" == "-portable" ]; then
|
|
||||||
local bindir="$pdir"
|
|
||||||
local datadir="$pdir/data"
|
|
||||||
local docdir="$pdir/doc"
|
|
||||||
else
|
|
||||||
local bindir="$pdir/bin"
|
|
||||||
local datadir="$pdir/share/lite-xl"
|
|
||||||
local docdir="$pdir/share/doc/lite-xl"
|
|
||||||
fi
|
|
||||||
mkdir -p "$bindir"
|
|
||||||
mkdir -p "$datadir"
|
|
||||||
mkdir -p "$docdir"
|
|
||||||
for module_name in core plugins colors fonts; do
|
|
||||||
copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
|
|
||||||
done
|
|
||||||
# copy the meson generated start.lua file
|
|
||||||
cp "$build/start.lua" "$datadir/core"
|
|
||||||
for module_name in plugins colors; do
|
|
||||||
cp -r "$build/third/data/$module_name" "$datadir"
|
|
||||||
done
|
|
||||||
cp "$build/src/lite-xl" "$bindir"
|
|
||||||
cp "licenses/licenses.md" "$docdir"
|
|
||||||
strip "$bindir/lite-xl"
|
|
||||||
if [ -z "$portable" ]; then
|
|
||||||
mkdir -p "$pdir/share/applications" "$pdir/share/icons/hicolor/scalable/apps" "$pdir/share/metainfo"
|
|
||||||
cp "resources/linux/org.lite_xl.lite_xl.desktop" "$pdir/share/applications"
|
|
||||||
cp "resources/linux/org.lite_xl.lite_xl.appdata.xml" "$pdir/share/metainfo"
|
|
||||||
cp "resources/icons/lite-xl.svg" "$pdir/share/icons/hicolor/scalable/apps/lite-xl.svg"
|
|
||||||
fi
|
|
||||||
pushd ".package-build"
|
|
||||||
local package_name="lite-xl-$os-$arch$portable.tar.gz"
|
|
||||||
tar czf "$package_name" "lite-xl"
|
|
||||||
mv "$package_name" ..
|
|
||||||
popd
|
|
||||||
rm -fr ".package-build"
|
|
||||||
echo "created package $package_name"
|
|
||||||
}
|
|
||||||
|
|
||||||
lite_build_package () {
|
|
||||||
if [[ "$OSTYPE" == msys || "$OSTYPE" == win32 ]]; then
|
|
||||||
lite_build_package_windows "$@"
|
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
lite_build_package_macos "$@"
|
|
||||||
elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then
|
|
||||||
lite_build_package_linux "$@"
|
|
||||||
else
|
|
||||||
echo "Unknown OS type \"$OSTYPE\""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
lite_copy_third_party_modules () {
|
|
||||||
local build="$1"
|
|
||||||
curl --insecure -L "https://github.com/rxi/lite-colors/archive/master.zip" -o "$build/rxi-lite-colors.zip"
|
|
||||||
mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
|
|
||||||
unzip "$build/rxi-lite-colors.zip" -d "$build"
|
|
||||||
mv "$build/lite-colors-master/colors" "$build/third/data"
|
|
||||||
rm -fr "$build/lite-colors-master"
|
|
||||||
}
|
|
||||||
|
|
||||||
build_opts=()
|
|
||||||
unset arch
|
|
||||||
while [ ! -z {$1+x} ]; do
|
|
||||||
case $1 in
|
|
||||||
-renderer)
|
|
||||||
build_opts+=("-Drenderer=true")
|
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-pgo)
|
-d|--destdir)
|
||||||
pgo=true
|
dest_dir="$2"
|
||||||
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-branch=*)
|
-f|--forcefallback)
|
||||||
use_branch="${1#-branch=}"
|
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
|
||||||
|
;;
|
||||||
|
-S|--source)
|
||||||
|
source="--source"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--debug)
|
||||||
|
debug="--debug"
|
||||||
|
set -x
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
arch="$1"
|
# unknown option
|
||||||
break
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z ${arch+set} ]; then
|
if [[ -n $1 ]]; then
|
||||||
echo "usage: $0 [options] <arch>"
|
show_help
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d ".git" || $BUILD_PROHIBIT_GIT -ne 0 ]]; then
|
if [[ -n $build_dir ]]; then build_dir_option=("--builddir" "${build_dir}"); fi
|
||||||
git_available=1;
|
if [[ -n $dest_dir ]]; then dest_dir_option=("--destdir" "${dest_dir}"); fi
|
||||||
else
|
if [[ -n $prefix ]]; then prefix_option=("--prefix" "${prefix}"); fi
|
||||||
echo "Use of git prohibited. Either '.git' wasn't found or BUILD_PROHIBIT_GIT was set."
|
if [[ -n $version ]]; then version_option=("--version" "${version}"); fi
|
||||||
git_available=0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z ${use_branch+set} ]; then
|
source scripts/build.sh \
|
||||||
if [[ $git_available -eq 1 ]]; then
|
${build_dir_option[@]} \
|
||||||
use_branch="$(git rev-parse --abbrev-ref HEAD)"
|
${prefix_option[@]} \
|
||||||
else
|
$debug \
|
||||||
# it really doesn't matter if git isn't present
|
$force_fallback \
|
||||||
use_branch="master"
|
$bundle \
|
||||||
fi
|
$portable
|
||||||
fi
|
|
||||||
|
|
||||||
build_dir=".build-$arch"
|
source scripts/package.sh \
|
||||||
|
${build_dir_option[@]} \
|
||||||
|
${dest_dir_option[@]} \
|
||||||
|
${prefix_option[@]} \
|
||||||
|
${version_option[@]} \
|
||||||
|
--binary \
|
||||||
|
--addons \
|
||||||
|
$debug \
|
||||||
|
$appimage \
|
||||||
|
$dmg \
|
||||||
|
$innosetup \
|
||||||
|
$source
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z ${pgo+set} ]; then
|
main "$@"
|
||||||
lite_build "$build_dir" "${build_opts[@]}"
|
|
||||||
else
|
|
||||||
lite_build_pgo "$build_dir" "${build_opts[@]}"
|
|
||||||
fi
|
|
||||||
lite_copy_third_party_modules "$build_dir"
|
|
||||||
lite_build_package "$build_dir" "$arch"
|
|
||||||
if [[ ! ( "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* || "$OSTYPE" == "darwin"* ) ]]; then
|
|
||||||
lite_build_package -portable "$build_dir" "$arch"
|
|
||||||
fi
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ endif
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Dependencies
|
# Dependencies
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
if not get_option('source-only')
|
||||||
libm = cc.find_library('m', required : false)
|
libm = cc.find_library('m', required : false)
|
||||||
libdl = cc.find_library('dl', required : false)
|
libdl = cc.find_library('dl', required : false)
|
||||||
lua_dep = dependency('lua5.2', fallback: ['lua', 'lua_dep'],
|
lua_dep = dependency('lua5.2', fallback: ['lua', 'lua_dep'],
|
||||||
|
@ -63,6 +64,7 @@ if host_machine.system() == 'windows'
|
||||||
# the pkg-config file from reproc does not include it.
|
# the pkg-config file from reproc does not include it.
|
||||||
lite_deps += meson.get_compiler('cpp').find_library('ws2_32', required: true)
|
lite_deps += meson.get_compiler('cpp').find_library('ws2_32', required: true)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Install Configuration
|
# Install Configuration
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
@ -118,6 +120,8 @@ configure_file(
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# Targets
|
# Targets
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
if not get_option('source-only')
|
||||||
subdir('lib/font_renderer')
|
subdir('lib/font_renderer')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('scripts')
|
subdir('scripts')
|
||||||
|
endif
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
option('bundle', type : 'boolean', value : false, description: 'Build a macOS bundle')
|
option('bundle', type : 'boolean', value : false, description: 'Build a macOS bundle')
|
||||||
|
option('source-only', type : 'boolean', value : false, description: 'Configure source files only, doesn\'t checks for dependencies')
|
||||||
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
||||||
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
|
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Scripts
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### Package
|
||||||
|
|
||||||
|
- **appdmg.sh**: Create a macOS DMG image using [AppDMG][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.
|
||||||
|
|
||||||
|
### Utility
|
||||||
|
|
||||||
|
- **common.sh**: Common functions used by other scripts.
|
||||||
|
- **install-dependencies.sh**: Installs required applications to build, package
|
||||||
|
and run Lite XL, mainly useful for CI and documentation purpose.
|
||||||
|
Preferably not to be used in user systems.
|
||||||
|
- **fontello-config.json**: Used by the icons generator.
|
||||||
|
|
||||||
|
[1]: https://github.com/LinusU/node-appdmg
|
||||||
|
[2]: https://docs.appimage.org/
|
||||||
|
[3]: https://jrsoftware.org/isinfo.php
|
|
@ -6,9 +6,11 @@ if [ ! -e "src/api/api.h" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
source scripts/common.sh
|
||||||
|
|
||||||
show_help(){
|
show_help(){
|
||||||
echo
|
echo
|
||||||
echo $0
|
echo "Usage: $0 <OPTIONS>"
|
||||||
echo
|
echo
|
||||||
echo "Available options:"
|
echo "Available options:"
|
||||||
echo
|
echo
|
||||||
|
@ -23,7 +25,7 @@ show_help(){
|
||||||
}
|
}
|
||||||
|
|
||||||
ARCH="$(uname -m)"
|
ARCH="$(uname -m)"
|
||||||
BUILD_DIR=build
|
BUILD_DIR="$(get_default_build_dir)"
|
||||||
RUN_BUILD=true
|
RUN_BUILD=true
|
||||||
STATIC_BUILD=false
|
STATIC_BUILD=false
|
||||||
|
|
||||||
|
|
115
scripts/build.sh
115
scripts/build.sh
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -ex
|
set -e
|
||||||
|
|
||||||
if [ ! -e "src/api/api.h" ]; then
|
if [ ! -e "src/api/api.h" ]; then
|
||||||
echo "Please run this script from the root directory of Lite XL."
|
echo "Please run this script from the root directory of Lite XL."; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
source scripts/common.sh
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
echo
|
echo
|
||||||
echo "Usage: $0 <OPTIONS>"
|
echo "Usage: $0 <OPTIONS>"
|
||||||
|
@ -13,71 +14,60 @@ show_help(){
|
||||||
echo "Available options:"
|
echo "Available options:"
|
||||||
echo
|
echo
|
||||||
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
||||||
echo " Default: 'build'."
|
echo " Default: '$(get_default_build_dir)'."
|
||||||
echo "-p --prefix Install directory prefix. Mandatory."
|
echo " --debug Debug this script."
|
||||||
echo "-s --static Specify if building using static libraries"
|
echo "-f --forcefallback Force to build dependencies statically."
|
||||||
echo " by using lhelper tool."
|
echo "-h --help Show this help and exit."
|
||||||
|
echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
|
||||||
|
echo "-B --bundle Create an App bundle (macOS only)"
|
||||||
|
echo "-P --portable Create a portable binary package."
|
||||||
|
echo " macOS: disabled when used with --bundle,"
|
||||||
|
echo " Windows: Implicit being the only option."
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
install_lhelper() {
|
main() {
|
||||||
if [[ ! -d lhelper ]]; then
|
local platform="$(get_platform_name)"
|
||||||
git clone https://github.com/franko/lhelper.git
|
local build_dir="$(get_default_build_dir)"
|
||||||
pushd lhelper; bash install-github; popd
|
local prefix=/
|
||||||
|
local force_fallback
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
local bundle
|
||||||
CC=clang CXX=clang++ lhelper create lite-xl -n
|
local portable
|
||||||
else
|
|
||||||
lhelper create lite-xl -n
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Not using `lhelper activate lite-xl`
|
|
||||||
source "$(lhelper env-source lite-xl)"
|
|
||||||
|
|
||||||
lhelper install freetype2
|
|
||||||
lhelper install sdl2 2.0.14-wait-event-timeout-1
|
|
||||||
lhelper install pcre2
|
|
||||||
|
|
||||||
# Help MSYS2 to find the SDL2 include and lib directories to avoid errors
|
|
||||||
# during build and linking when using lhelper.
|
|
||||||
if [[ "$OSTYPE" == "msys" ]]; then
|
|
||||||
CFLAGS=-I${LHELPER_ENV_PREFIX}/include/SDL2
|
|
||||||
LDFLAGS=-L${LHELPER_ENV_PREFIX}/lib
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
|
|
||||||
--buildtype=release \
|
|
||||||
--prefix "$PREFIX" \
|
|
||||||
--wrap-mode=forcefallback \
|
|
||||||
"${BUILD_DIR}"
|
|
||||||
|
|
||||||
meson compile -C build
|
|
||||||
}
|
|
||||||
|
|
||||||
BUILD_DIR=build
|
|
||||||
STATIC_BUILD=false
|
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
-h|--belp)
|
-h|--help)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-b|--builddir)
|
-b|--builddir)
|
||||||
BUILD_DIR="$2"
|
build_dir="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--debug)
|
||||||
|
set -x
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-f|--forcefallback)
|
||||||
|
force_fallback="--wrap-mode=forcefallback"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-p|--prefix)
|
-p|--prefix)
|
||||||
PREFIX="$2"
|
prefix="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-s|--static)
|
-B|--bundle)
|
||||||
STATIC_BUILD=true
|
if [[ "$platform" != "macos" ]]; then
|
||||||
|
echo "Warning: ignoring --bundle option, works only under macOS."
|
||||||
|
else
|
||||||
|
bundle="-Dbundle=true"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-P|--portable)
|
||||||
|
portable="-Dportable=true"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -91,13 +81,22 @@ if [[ -n $1 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $PREFIX ]]; then
|
if [[ $platform == "macos" && -n $bundle && -n $portable ]]; then
|
||||||
echo "ERROR: prefix argument is missing."
|
echo "Warning: \"bundle\" and \"portable\" specified; excluding portable package."
|
||||||
exit 1
|
portable=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $STATIC_BUILD == true ]]; then
|
rm -rf "${build_dir}"
|
||||||
install_lhelper
|
|
||||||
fi
|
|
||||||
|
|
||||||
build
|
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
|
||||||
|
--buildtype=release \
|
||||||
|
--prefix "$prefix" \
|
||||||
|
$force_fallback \
|
||||||
|
$bundle \
|
||||||
|
$portable \
|
||||||
|
"${build_dir}"
|
||||||
|
|
||||||
|
meson compile -C "${build_dir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
get_platform_name() {
|
||||||
|
if [[ "$OSTYPE" == "msys" ]]; then
|
||||||
|
echo "windows"
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
echo "macos"
|
||||||
|
elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then
|
||||||
|
echo "linux"
|
||||||
|
else
|
||||||
|
echo "UNSUPPORTED-OS"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_default_build_dir() {
|
||||||
|
platform=$(get_platform_name)
|
||||||
|
echo "build-$platform-$(uname -m)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then
|
||||||
|
echo "Error: unknown OS type: \"$OSTYPE\""
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -28,7 +28,10 @@ AppUpdatesURL={#MyAppURL}
|
||||||
|
|
||||||
#if Arch=="x64"
|
#if Arch=="x64"
|
||||||
ArchitecturesAllowed=x64
|
ArchitecturesAllowed=x64
|
||||||
ArchitecturesInstallIn64BitMode={#Arch}
|
ArchitecturesInstallIn64BitMode=x64
|
||||||
|
#define ArchInternal "x86_64"
|
||||||
|
#else
|
||||||
|
#define ArchInternal "i686"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AllowNoIcons=yes
|
AllowNoIcons=yes
|
||||||
|
@ -48,7 +51,7 @@ PrivilegesRequiredOverridesAllowed=dialog
|
||||||
UsedUserAreasWarning=no
|
UsedUserAreasWarning=no
|
||||||
|
|
||||||
OutputDir=.
|
OutputDir=.
|
||||||
OutputBaseFilename=LiteXL-{#MyAppVersion}-{#Arch}-setup
|
OutputBaseFilename=LiteXL-{#MyAppVersion}-{#ArchInternal}-setup
|
||||||
;DisableDirPage=yes
|
;DisableDirPage=yes
|
||||||
;DisableProgramGroupPage=yes
|
;DisableProgramGroupPage=yes
|
||||||
|
|
||||||
|
@ -67,18 +70,16 @@ Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
; MSYS2 produces no external dlls on 32 bit builds when using lhelper
|
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion ; Check: DirExists(ExpandConstant('{#BuildDir}/mingwLibs{#Arch}'))
|
||||||
#if Arch=="x64"
|
|
||||||
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion
|
|
||||||
#endif
|
|
||||||
Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs
|
Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
||||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: not WizardIsTaskSelected('portablemode')
|
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: not WizardIsTaskSelected('portablemode')
|
||||||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: not WizardIsTaskSelected('portablemode')
|
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: not WizardIsTaskSelected('portablemode')
|
||||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
|
||||||
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Check: not WizardIsTaskSelected('portablemode')
|
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Check: not WizardIsTaskSelected('portablemode')
|
||||||
|
; Name: "{usersendto}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -ex
|
set -e
|
||||||
|
|
||||||
if [ ! -e "src/api/api.h" ]; then
|
if [ ! -e "src/api/api.h" ]; then
|
||||||
echo "Please run this script from the root directory of Lite XL."
|
echo "Please run this script from the root directory of Lite XL."; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
source scripts/common.sh
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
echo
|
echo
|
||||||
echo "Usage: $0 <OPTIONS>"
|
echo "Usage: $0 <OPTIONS>"
|
||||||
|
@ -13,23 +14,32 @@ show_help(){
|
||||||
echo "Available options:"
|
echo "Available options:"
|
||||||
echo
|
echo
|
||||||
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
||||||
echo " Default: 'build'."
|
echo " Default: '$(get_default_build_dir)'."
|
||||||
|
echo " --debug Debug this script."
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
BUILD_DIR=build
|
main() {
|
||||||
|
local build_dir=$(get_default_build_dir)
|
||||||
|
local arch
|
||||||
|
|
||||||
|
if [[ $MSYSTEM == "MINGW64" ]]; then arch=x64; else arch=Win32; fi
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
-h|--belp)
|
-h|--help)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-b|--BUILD_DIR)
|
-b|--builddir)
|
||||||
BUILD_DIR="$2"
|
build_dir="$2"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--debug)
|
||||||
|
set -x
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# unknown option
|
# unknown option
|
||||||
;;
|
;;
|
||||||
|
@ -41,15 +51,15 @@ if [[ -n $1 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Required MinGW dlls are built only (?) when using lhelper on 64 bit
|
# Copy MinGW libraries dependencies.
|
||||||
if [[ $MSYSTEM == "MINGW64" ]]; then
|
# MSYS2 ldd command seems to be only 64bit, so use ntldd
|
||||||
ARCH=x64;
|
# see https://github.com/msys2/MINGW-packages/issues/4164
|
||||||
mingwLibsDir=$BUILD_DIR/mingwLibs$ARCH
|
local mingwLibsDir="${build_dir}/mingwLibs$arch"
|
||||||
mkdir -p "$mingwLibsDir"
|
mkdir -p "$mingwLibsDir"
|
||||||
ldd "$BUILD_DIR/src/lite-xl.exe" | grep mingw | awk '{print $3}' | xargs -I '{}' cp -v '{}' $mingwLibsDir
|
ntldd -R "${build_dir}/src/lite-xl.exe" | grep mingw | awk '{print $3}' | sed 's#\\#/#g' | xargs -I '{}' cp -v '{}' $mingwLibsDir
|
||||||
else
|
|
||||||
ARCH=Win32
|
|
||||||
fi
|
|
||||||
|
|
||||||
/c/Program\ Files\ \(x86\)/Inno\ Setup\ 6/ISCC.exe -dARCH=$ARCH $BUILD_DIR/scripts/innosetup.iss
|
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch "${build_dir}/scripts/innosetup.iss"
|
||||||
mv $BUILD_DIR/LiteXL*.exe $(pwd)
|
pushd "${build_dir}/scripts"; mv LiteXL*.exe "./../../"; popd
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
if [ ! -e "src/api/api.h" ]; then
|
||||||
|
echo "Please run this script from the root directory of Lite XL."; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
show_help() {
|
||||||
|
echo
|
||||||
|
echo "Lite XL dependecies installer. Mainly used for CI but can also work on users systems."
|
||||||
|
echo "USE IT AT YOUR OWN RISK!"
|
||||||
|
echo
|
||||||
|
echo "Usage: $0 <OPTIONS>"
|
||||||
|
echo
|
||||||
|
echo "Available options:"
|
||||||
|
echo
|
||||||
|
echo "-l --lhelper Install tools required by LHelper and doesn't"
|
||||||
|
echo " install external libraries."
|
||||||
|
echo " --debug Debug this script."
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local lhelper=false
|
||||||
|
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
-s|--lhelper)
|
||||||
|
lhelper=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--debug)
|
||||||
|
set -x
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# unknown option
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
show_help
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "linux"* ]]; then
|
||||||
|
if [[ $lhelper == true ]]; then
|
||||||
|
sudo apt-get install -qq ninja-build
|
||||||
|
else
|
||||||
|
sudo apt-get install -qq ninja-build libsdl2-dev libfreetype6
|
||||||
|
fi
|
||||||
|
pip3 install meson
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
if [[ $lhelper == true ]]; then
|
||||||
|
brew install bash md5sha1sum ninja
|
||||||
|
else
|
||||||
|
brew install ninja sdl2
|
||||||
|
fi
|
||||||
|
pip3 install meson
|
||||||
|
cd ~; npm install appdmg; cd -
|
||||||
|
~/node_modules/appdmg/bin/appdmg.js --version
|
||||||
|
elif [[ "$OSTYPE" == "msys" ]]; then
|
||||||
|
if [[ $lhelper == true ]]; then
|
||||||
|
pacman --noconfirm -S \
|
||||||
|
${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config} unzip
|
||||||
|
else
|
||||||
|
pacman --noconfirm -S \
|
||||||
|
${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config,freetype,pcre2,SDL2} unzip
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
|
@ -0,0 +1,75 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
show_help() {
|
||||||
|
echo
|
||||||
|
echo "Usage: $0 <OPTIONS>"
|
||||||
|
echo
|
||||||
|
echo "Available options:"
|
||||||
|
echo
|
||||||
|
echo " --debug Debug this script."
|
||||||
|
echo "-h --help Show this help and exit."
|
||||||
|
echo "-p --prefix PREFIX Install directory prefix."
|
||||||
|
echo " Default: '$HOME/.local'."
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
local lhelper_prefix="$HOME/.local"
|
||||||
|
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
-h|--help)
|
||||||
|
show_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-p|--prefix)
|
||||||
|
lhelper_prefix="$2"
|
||||||
|
echo "LHelper prefix set to: \"${lhelper_prefix}\""
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--debug)
|
||||||
|
set -x
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# unknown option
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n $1 ]]; then show_help; exit 1; fi
|
||||||
|
|
||||||
|
if [[ ! -f ${lhelper_prefix}/bin/lhelper ]]; then
|
||||||
|
|
||||||
|
git clone https://github.com/franko/lhelper.git
|
||||||
|
|
||||||
|
# FIXME: This should be set in ~/.bash_profile if not using CI
|
||||||
|
# export PATH="${HOME}/.local/bin:${PATH}"
|
||||||
|
mkdir -p "${lhelper_prefix}/bin"
|
||||||
|
pushd lhelper; bash install "${lhelper_prefix}"; popd
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
CC=clang CXX=clang++ lhelper create lite-xl -n
|
||||||
|
else
|
||||||
|
lhelper create lite-xl -n
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Not using $(lhelper activate lite-xl) to support CI
|
||||||
|
source "$(lhelper env-source lite-xl)"
|
||||||
|
|
||||||
|
lhelper install freetype2
|
||||||
|
lhelper install sdl2 2.0.14-wait-event-timeout-1
|
||||||
|
lhelper install pcre2
|
||||||
|
|
||||||
|
# Help MSYS2 to find the SDL2 include and lib directories to avoid errors
|
||||||
|
# during build and linking when using lhelper.
|
||||||
|
if [[ "$OSTYPE" == "msys" ]]; then
|
||||||
|
CFLAGS=-I${LHELPER_ENV_PREFIX}/include/SDL2
|
||||||
|
LDFLAGS=-L${LHELPER_ENV_PREFIX}/lib
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
|
@ -1,56 +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
|
|
||||||
|
|
||||||
# FIXME: For some strange reason sometimes an error occurs randomly on the
|
|
||||||
# MINGW32 build of GitHub Actions; the environment variable $INSTALL_NAME
|
|
||||||
# is correct, but it expands with a drive letter at the end (all builds).
|
|
||||||
|
|
||||||
show_help(){
|
|
||||||
echo
|
|
||||||
echo "Usage: $0 <OPTIONS>"
|
|
||||||
echo
|
|
||||||
echo "Available options:"
|
|
||||||
echo
|
|
||||||
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
|
||||||
echo " Default: 'build'."
|
|
||||||
echo "-d --destdir DIRNAME Sets the name of the install directory (not path)."
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
BUILD_DIR=build
|
|
||||||
|
|
||||||
for i in "$@"; do
|
|
||||||
case $i in
|
|
||||||
-h|--belp)
|
|
||||||
show_help
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
-b|--builddir)
|
|
||||||
BUILD_DIR="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-d|--destdir)
|
|
||||||
DEST_DIR="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# unknown option
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -n $1 ]]; then
|
|
||||||
show_help
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DESTDIR="$(pwd)/${DEST_DIR}" meson install --skip-subprojects -C ${BUILD_DIR}
|
|
||||||
|
|
||||||
zip -9rv ${DEST_DIR}.zip ${DEST_DIR}/*
|
|
|
@ -0,0 +1,252 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -e "src/api/api.h" ]; then
|
||||||
|
echo "Please run this script from the root directory of Lite XL."; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
source scripts/common.sh
|
||||||
|
|
||||||
|
show_help() {
|
||||||
|
echo
|
||||||
|
echo "Usage: $0 <OPTIONS>"
|
||||||
|
echo
|
||||||
|
echo "Available options:"
|
||||||
|
echo
|
||||||
|
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
||||||
|
echo " Default: '$(get_default_build_dir)'."
|
||||||
|
echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
|
||||||
|
echo " Default: 'lite-xl'."
|
||||||
|
echo "-h --help Show this help and exit."
|
||||||
|
echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
|
||||||
|
echo "-v --version VERSION Sets the version on the package name."
|
||||||
|
echo " --addons Install 3rd party addons (currently RXI colors)."
|
||||||
|
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 "-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/rxi/lite-colors/archive/master.zip" \
|
||||||
|
-o "${build_dir}/rxi-lite-colors.zip"
|
||||||
|
|
||||||
|
mkdir -p "${build_dir}/third/data/colors"
|
||||||
|
unzip "${build_dir}/rxi-lite-colors.zip" -d "${build_dir}"
|
||||||
|
mv "${build_dir}/lite-colors-master/colors" "${build_dir}/third/data"
|
||||||
|
rm -rf "${build_dir}/lite-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
|
||||||
|
|
||||||
|
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="$(uname -m)"
|
||||||
|
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 source=false
|
||||||
|
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
-S|--source)
|
||||||
|
source=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--addons)
|
||||||
|
addons=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--debug)
|
||||||
|
set -x
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# unknown option
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n $1 ]]; then show_help; exit 1; 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 -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 stripcmd="strip"
|
||||||
|
|
||||||
|
if [[ -d "${data_dir}" ]]; then
|
||||||
|
# Portable archive
|
||||||
|
exe_file="$(pwd)/${dest_dir}/lite-xl"
|
||||||
|
if [[ $platform == "windows" ]]; then
|
||||||
|
exe_file="${exe_file}.exe"
|
||||||
|
stripcmd="strip --strip-all"
|
||||||
|
else
|
||||||
|
# Windows archive is always portable
|
||||||
|
package_name+="-portable"
|
||||||
|
fi
|
||||||
|
elif [[ $platform == "macos" && ! -d "${data_dir}" ]]; then
|
||||||
|
# macOS bundle app
|
||||||
|
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"
|
||||||
|
data_dir="$(pwd)/${dest_dir}/Contents/Resources"
|
||||||
|
exe_file="$(pwd)/${dest_dir}/Contents/MacOS/lite-xl"
|
||||||
|
else
|
||||||
|
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 install_addons "${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
|
||||||
|
|
||||||
|
$stripcmd "${exe_file}"
|
||||||
|
|
||||||
|
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; 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
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
|
@ -1,69 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
if [ ! -e "src/api/api.h" ]; then
|
|
||||||
echo "Please run this script from the root directory of Lite XL."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
show_help(){
|
|
||||||
echo
|
|
||||||
echo "Usage: $0 <OPTIONS>"
|
|
||||||
echo
|
|
||||||
echo "Available options:"
|
|
||||||
echo
|
|
||||||
echo "-b --builddir DIRNAME Sets the name of the build directory (no path)."
|
|
||||||
echo " Default: 'build'."
|
|
||||||
echo "-d --destdir DIRNAME Sets the name of the install directory (no path)."
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
BUILD_DIR=build
|
|
||||||
DEST_DIR=lite-xl-src
|
|
||||||
|
|
||||||
for i in "$@"; do
|
|
||||||
case $i in
|
|
||||||
-h|--belp)
|
|
||||||
show_help
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
-b|--builddir)
|
|
||||||
BUILD_DIR="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-d|--destdir)
|
|
||||||
DEST_DIR="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# unknown option
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [[ -n $1 ]]; then
|
|
||||||
show_help
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -d ${BUILD_DIR}; then rm -rf ${BUILD_DIR}; fi
|
|
||||||
if test -d ${DEST_DIR}; then rm -rf ${DEST_DIR}; fi
|
|
||||||
if test -f ${DEST_DIR}.tar.gz; then rm ${DEST_DIR}.tar.gz; fi
|
|
||||||
|
|
||||||
meson subprojects download
|
|
||||||
meson setup ${BUILD_DIR}
|
|
||||||
|
|
||||||
rsync -arv \
|
|
||||||
--exclude /*build*/ \
|
|
||||||
--exclude *.git* \
|
|
||||||
--exclude lhelper \
|
|
||||||
--exclude lite-xl* \
|
|
||||||
--exclude submodules \
|
|
||||||
. ${DEST_DIR}
|
|
||||||
|
|
||||||
cp "${BUILD_DIR}/start.lua" "${DEST_DIR}/data/core"
|
|
||||||
|
|
||||||
tar rf ${DEST_DIR}.tar ${DEST_DIR}
|
|
||||||
gzip -9 ${DEST_DIR}.tar
|
|
Loading…
Reference in New Issue