mirror of
https://github.com/SchildiChat/schildichat-desktop.git
synced 2025-03-25 17:50:00 +01:00
Makefile: Add release targets
This commit is contained in:
parent
1efd1b0ffe
commit
7cfef33376
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
release.mk
|
||||
/release
|
||||
|
63
Makefile
63
Makefile
@ -1,16 +1,43 @@
|
||||
.PHONY: all web desktop desktop-common linux windows windows-portable clean
|
||||
.PHONY: all setup web desktop desktop-common linux windows windows-portable
|
||||
.PHONY: web-release debian-release pacman-release windows-setup-release windows-unpacked-release windows-portable-release windows-release release
|
||||
.PHONY: clean
|
||||
|
||||
CFGDIR ?= configs/sc
|
||||
|
||||
all: desktop
|
||||
all: release
|
||||
|
||||
YARN ?= yarnpkg
|
||||
|
||||
VERSION := $(shell grep version element-desktop/package.json | sed 's|.*: \"\(.*\)\",|\1|')
|
||||
APP_NAME := $(shell grep '"name"' element-desktop/package.json | head -n 1 | sed 's|.*: \"\(.*\)\",|\1|')
|
||||
PRODUCT_NAME := $(shell grep '"productName"' element-desktop/package.json | sed 's|.*: \"\(.*\)\",|\1|')
|
||||
|
||||
WEB_OUT := element-web/dist
|
||||
WEB_OUT_DIST_VERSION := web
|
||||
OUT_WEB := $(WEB_OUT)/riot-$(WEB_OUT_DIST_VERSION).tar.gz
|
||||
OUT_WEB_BETTER_NAME := schildichat-web-$(VERSION).tar.gz
|
||||
|
||||
DESKTOP_OUT := element-desktop/dist
|
||||
OUT_DEB64 := $(DESKTOP_OUT)/$(APP_NAME)_$(VERSION)_amd64.deb
|
||||
OUT_PAC64 := $(DESKTOP_OUT)/$(APP_NAME)-$(VERSION).pacman
|
||||
OUT_TARXZ64 := $(DESKTOP_OUT)/$(APP_NAME)-$(VERSION).tar.xz
|
||||
OUT_WIN64 := $(DESKTOP_OUT)/$(PRODUCT_NAME)\ Setup\ $(VERSION).exe
|
||||
OUT_WIN64_PORTABLE := $(DESKTOP_OUT)/$(PRODUCT_NAME)\ $(VERSION).exe
|
||||
OUT_WIN64_BETTER_NAME := $(PRODUCT_NAME)_Setup_v$(VERSION).exe
|
||||
OUT_WIN64_UNPACKED_BETTER_NAME := $(PRODUCT_NAME)_win-unpacked_v$(VERSION).zip
|
||||
OUT_WIN64_PORTABLE_BETTER_NAME := $(PRODUCT_NAME)_win-portable_v$(VERSION)
|
||||
|
||||
RELEASE_DIR := release
|
||||
CURRENT_RELEASE_DIR := $(RELEASE_DIR)/$(VERSION)
|
||||
|
||||
|
||||
-include release.mk
|
||||
|
||||
setup:
|
||||
if [ ! -L "element-desktop/webapp" ]; then ./setup.sh; fi
|
||||
|
||||
web:
|
||||
web: export DIST_VERSION=$(WEB_OUT_DIST_VERSION)
|
||||
web: setup
|
||||
cp $(CFGDIR)/config.json element-web/
|
||||
$(YARN) --cwd element-web dist
|
||||
|
||||
@ -35,8 +62,38 @@ windows: desktop-common
|
||||
windows-portable: desktop-common
|
||||
$(YARN) --cwd element-desktop run build64windows-portable
|
||||
|
||||
web-release: web
|
||||
mkdir -p $(CURRENT_RELEASE_DIR)
|
||||
cp $(OUT_WEB) $(CURRENT_RELEASE_DIR)/$(OUT_WEB_BETTER_NAME)
|
||||
|
||||
debian-release: debian
|
||||
mkdir -p $(CURRENT_RELEASE_DIR)
|
||||
cp $(OUT_DEB64) $(CURRENT_RELEASE_DIR)
|
||||
|
||||
pacman-release: pacman
|
||||
mkdir -p $(CURRENT_RELEASE_DIR)
|
||||
cp $(OUT_PAC64) $(CURRENT_RELEASE_DIR)
|
||||
|
||||
windows-setup-release: windows
|
||||
mkdir -p $(CURRENT_RELEASE_DIR)
|
||||
cp $(OUT_WIN64) $(CURRENT_RELEASE_DIR)/$(OUT_WIN64_BETTER_NAME)
|
||||
|
||||
windows-unpacked-release: windows
|
||||
mkdir -p $(CURRENT_RELEASE_DIR)
|
||||
cd element-desktop/dist/win-unpacked && zip -r ../../../$(CURRENT_RELEASE_DIR)/$(OUT_WIN64_UNPACKED_BETTER_NAME) *
|
||||
|
||||
windows-portable-release: windows-portable
|
||||
./windowsportable.sh $(OUT_WIN64_PORTABLE) $(OUT_WIN64_PORTABLE_BETTER_NAME) $(CURRENT_RELEASE_DIR) $(VERSION)
|
||||
|
||||
windows-release: windows-setup-release windows-unpacked-release windows-portable-release
|
||||
|
||||
release: web-release debian-release pacman-release windows-release
|
||||
|
||||
clean:
|
||||
$(YARN) --cwd matrix-js-sdk clean
|
||||
$(YARN) --cwd matrix-react-sdk clean
|
||||
$(YARN) --cwd element-web clean
|
||||
$(YARN) --cwd element-desktop clean
|
||||
rm -f element-desktop/webapp
|
||||
rm -rf element-web/dist
|
||||
rm -rf $(RELEASE_DIR)
|
||||
|
63
windowsportable.sh
Executable file
63
windowsportable.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
portable_exe=$1
|
||||
dest_name=$2
|
||||
release_dir=$3
|
||||
version=$4
|
||||
|
||||
dest_path=$release_dir/$dest_name/SchildiChat
|
||||
|
||||
mkdir -p $dest_path/app
|
||||
cp "$portable_exe" $dest_path/app/dontclick.exe
|
||||
|
||||
cat >$dest_path/SchildiChat_Portable.bat <<EOL
|
||||
REM -- Adapted from: https://superuser.com/a/1226026
|
||||
|
||||
REM -- Path to the directory of this script (make sure to remove ending slash)
|
||||
set CURRENT_DIR=%~dp0
|
||||
REM -- Great example from Strawberry Perl's portable shell launcher:
|
||||
if not "" == "%CURRENT_DIR%" if #%CURRENT_DIR:~-1%# == #\# set CURRENT_DIR=%CURRENT_DIR:~0,-1%
|
||||
|
||||
REM -- Path to data directory
|
||||
set DATA_DIR=%CURRENT_DIR%\data
|
||||
|
||||
REM -- Ensure directories exists
|
||||
if not exist %DATA_DIR%\AppData\Roaming mkdir %DATA_DIR%\AppData\Roaming
|
||||
|
||||
REM -- OVERRIDE the user environment variable to point to a portable directory
|
||||
set USERPROFILE=%DATA_DIR%
|
||||
|
||||
REM -- (Optional) Some programs do not use these environment variables
|
||||
set APPDATA=%DATA_DIR%\AppData\Roaming>nul
|
||||
set ALLUSERSPROFILE=%DATA_DIR%\AppData\Roaming>nul
|
||||
set PROGRAMDATA=%DATA_DIR%\AppData\Roaming>nul
|
||||
|
||||
REM -- Start the application
|
||||
start "" /D"%CURRENT_DIR%\app" "dontclick.exe"
|
||||
EOL
|
||||
|
||||
cat >$dest_path/README.txt <<EOL
|
||||
Just extract this zip file to a folder of your choice (e.g. on a USB-Stick).
|
||||
The .\app\dontclick.exe file is the real portable executable.
|
||||
SchildiChat_Portable.bat is a batch script to run this executable but with the data in the .\data folder instead of the system's %APPDATA%.
|
||||
Thus you can move your data along with this portable app.
|
||||
To update just extract the new zip file to the same folder as the previous version whilst merging folders and overwriting files.
|
||||
EOL
|
||||
|
||||
# if $version looks like semver with leading v, strip it before writing to file
|
||||
if [[ ${version} =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-.+)?$ ]]; then
|
||||
echo ${version:1} > $dest_path/app/version
|
||||
else
|
||||
echo ${version} > $dest_path/app/version
|
||||
fi
|
||||
|
||||
pushd $dest_path/..
|
||||
zip -r ../$dest_name.zip *
|
||||
popd
|
||||
|
||||
rm -r $release_dir/$dest_name
|
||||
|
||||
echo
|
||||
echo "Packaged $release_dir/$dest_name.zip"
|
Loading…
x
Reference in New Issue
Block a user