2023-01-03 12:18:02 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-03-06 17:32:21 +08:00
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
. version.inc
|
|
|
|
|
|
|
|
SRC_DIR="$PWD"
|
|
|
|
TEST_VERSION=$(git rev-list HEAD --count)
|
|
|
|
if [[ -n "$APP_VERSION_SUFFIX" ]]; then
|
|
|
|
VERSION="$APP_VERSION.$TEST_VERSION.$APP_VERSION_SUFFIX"
|
|
|
|
else
|
|
|
|
VERSION="$APP_VERSION.$TEST_VERSION"
|
|
|
|
fi
|
2023-01-03 12:18:02 +08:00
|
|
|
|
2023-04-06 15:48:58 +08:00
|
|
|
APPIMAGE_FILE=RedPandaIDE-$VERSION-$CARCH.AppImage
|
2023-08-13 20:56:46 +08:00
|
|
|
RUNTIME_FILE=/opt/appimage-runtime
|
|
|
|
RUNTIME_SIZE=$(wc -c <$RUNTIME_FILE)
|
2023-04-06 15:48:58 +08:00
|
|
|
|
2023-01-03 12:18:02 +08:00
|
|
|
# build RedPanda C++
|
2024-03-06 17:32:21 +08:00
|
|
|
mkdir -p /build
|
|
|
|
cd /build
|
|
|
|
qmake PREFIX=/usr "$SRC_DIR/Red_Panda_CPP.pro"
|
2023-07-03 14:06:10 +08:00
|
|
|
make LINUX_STATIC_IME_PLUGIN=ON -j$(nproc)
|
2023-01-03 12:18:02 +08:00
|
|
|
|
|
|
|
# install RedPanda C++ to AppDir
|
2024-03-06 17:32:21 +08:00
|
|
|
make INSTALL_ROOT=/RedPandaIDE.AppDir install
|
|
|
|
# remove unnecessary, huge files
|
|
|
|
rm /RedPandaIDE.AppDir/usr/libexec/RedPandaCPP/redpanda-git-askpass
|
2023-01-03 12:18:02 +08:00
|
|
|
|
|
|
|
# setup AppImage resource
|
2024-03-06 17:32:21 +08:00
|
|
|
cd /RedPandaIDE.AppDir
|
2024-03-10 08:04:41 +08:00
|
|
|
ln -s usr/share/applications/RedPandaIDE.desktop RedPandaIDE.desktop
|
2023-01-19 20:56:59 +08:00
|
|
|
ln -s usr/share/icons/hicolor/scalable/apps/redpandaide.svg redpandaide.svg
|
2023-04-06 15:48:58 +08:00
|
|
|
# following files may come from Windows filesystem, use `install` to preseve file permission
|
2024-03-06 17:32:21 +08:00
|
|
|
install -m755 "$SRC_DIR/packages/appimage/AppRun.sh" AppRun
|
|
|
|
install -m644 "$SRC_DIR/platform/linux/redpandaide.png" .DirIcon
|
2023-01-03 12:18:02 +08:00
|
|
|
|
|
|
|
# create AppImage
|
2024-03-06 17:32:21 +08:00
|
|
|
cd /
|
2023-08-13 20:56:46 +08:00
|
|
|
mksquashfs RedPandaIDE.AppDir $APPIMAGE_FILE -offset $RUNTIME_SIZE -comp zstd -root-owned -noappend -b 1M -mkfs-time 0
|
|
|
|
dd if=$RUNTIME_FILE of=$APPIMAGE_FILE conv=notrunc
|
|
|
|
chmod +x $APPIMAGE_FILE
|
2023-01-03 12:18:02 +08:00
|
|
|
|
|
|
|
# copy back to host
|
2024-03-06 17:32:21 +08:00
|
|
|
mkdir -p "$SRC_DIR/dist"
|
|
|
|
cp $APPIMAGE_FILE "$SRC_DIR/dist"
|