2021-08-29 10:15:55 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2022-09-25 22:59:01 +02:00
|
|
|
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}"
|
2023-01-06 16:43:14 +01:00
|
|
|
mkdir -p "${build_dir}/third/data/libraries"
|
|
|
|
mv "${build_dir}/lite-xl-widgets-master" "${build_dir}/third/data/libraries/widget"
|
2022-09-25 22:59:01 +02:00
|
|
|
|
|
|
|
# Downlaod thirdparty plugins
|
|
|
|
curl --insecure \
|
2023-01-08 07:32:31 +01:00
|
|
|
-L "https://github.com/lite-xl/lite-xl-plugins/archive/master.zip" \
|
2022-09-25 22:59:01 +02:00
|
|
|
-o "${build_dir}/lite-xl-plugins.zip"
|
|
|
|
|
|
|
|
unzip "${build_dir}/lite-xl-plugins.zip" -d "${build_dir}"
|
2023-01-08 07:32:31 +01:00
|
|
|
mv "${build_dir}/lite-xl-plugins-master/plugins" "${build_dir}/third/data"
|
|
|
|
rm -rf "${build_dir}/lite-xl-plugins-master"
|
2022-09-25 22:59:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Addons installation: some distributions forbid external downloads
|
|
|
|
# so make it as optional module.
|
|
|
|
addons_install() {
|
|
|
|
local build_dir="$1"
|
|
|
|
local data_dir="$2"
|
|
|
|
|
2023-01-06 16:43:14 +01:00
|
|
|
for module_name in colors libraries; do
|
2022-09-25 22:59:01 +02:00
|
|
|
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/"
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2022-09-25 22:59:01 +02:00
|
|
|
get_platform_arch() {
|
|
|
|
platform=$(get_platform_name)
|
|
|
|
arch=$(uname -m)
|
|
|
|
if [[ $MSYSTEM != "" ]]; then
|
|
|
|
if [[ $MSYSTEM == "MINGW64" ]]; then
|
|
|
|
arch=x86_64
|
|
|
|
else
|
|
|
|
arch=i686
|
|
|
|
fi
|
2022-10-30 16:48:20 +01:00
|
|
|
elif [[ $CROSS_ARCH != "" ]]; then
|
|
|
|
arch=$CROSS_ARCH
|
2022-09-25 22:59:01 +02:00
|
|
|
fi
|
|
|
|
echo "$arch"
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
get_default_build_dir() {
|
|
|
|
platform=$(get_platform_name)
|
2022-09-25 22:59:01 +02:00
|
|
|
arch=$(get_platform_arch)
|
|
|
|
echo "build-$platform-$arch"
|
2021-08-29 10:15:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then
|
|
|
|
echo "Error: unknown OS type: \"$OSTYPE\""
|
|
|
|
exit 1
|
|
|
|
fi
|