This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
100 lines (80 loc) · 2.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.PHONY: build clean dist install install_desktop img web create_windows_installer
SRC_DIR=DesktopClient
BIN_DIR=bin
PROJECT_NAME=KaraokeMusicVideoManager
VERSION=2.0.0
ifeq ($(PREFIX),)
PREFIX := /usr/bin
endif
ifeq ($(PREFIX_DESKTOP),)
PREFIX_DESKTOP := /usr/share/applications
endif
all: build dist
clean:
rm -rf $(BIN_DIR) pkg karaokemusicvideomanager.git src
rm -f *.pkg.tar.xz *.jar
cd $(SRC_DIR); \
mvn clean
# Build the program
build:
cd $(SRC_DIR); \
mvn install
# Clean up build and extract/rename executable
dist:
cd $(SRC_DIR); \
python3 format_exported_jar.py
mkdir -p $(BIN_DIR)
cp $(PROJECT_NAME)-portable-$(VERSION).jar $(BIN_DIR)/
echo -e "\
#!/usr/bin/env bash\n\
java -jar $(PROJECT_NAME)-portable-$(VERSION).jar\n\
" > $(BIN_DIR)/$(PROJECT_NAME)
chmod +x $(BIN_DIR)/$(PROJECT_NAME)
cp ImageResources/logo.svg $(BIN_DIR)/$(PROJECT_NAME).svg
echo -e "\
[Desktop Entry]\n\
Version=1.0\n\
Type=Application\n\
Terminal=false\n\
Exec=$(PROJECT_NAME)\n\
Name=$(PROJECT_NAME)\n\
Comment=Index local music videos to search and open them\n\
Icon=$(PROJECT_NAME).svg\n\
" > $(BIN_DIR)/$(PROJECT_NAME).desktop
# Update images
update_images:
cd ImageResources; \
python3 create_image_resources.py
# Update web data
update_web_interfaces:
cd WebInterfaces; \
python3 create_website_resources.py
# Install built program
install:
install -d $(DESTDIR)$(PREFIX)/
install -Dm 644 $(BIN_DIR)/$(PROJECT_NAME)-portable-$(VERSION).jar $(DESTDIR)$(PREFIX)/
sed -i s#$(PROJECT_NAME)-portable#$(PREFIX)/$(PROJECT_NAME)-portable# $(BIN_DIR)/$(PROJECT_NAME)
install -Dm 777 $(BIN_DIR)/$(PROJECT_NAME) $(DESTDIR)$(PREFIX)/
sed -i s#$(PREFIX)/$(PROJECT_NAME)-portable#$(PROJECT_NAME)-portable# $(BIN_DIR)/$(PROJECT_NAME)
# Install a desktop file for the installed program
install_desktop:
install -d $(DESTDIR)$(PREFIX_DESKTOP)/
sed -i s#Exec=#Exec=$(PREFIX)/# $(BIN_DIR)/$(PROJECT_NAME).desktop
sed -i s#Icon=#Icon=$(PREFIX_DESKTOP)/# $(BIN_DIR)/$(PROJECT_NAME).desktop
install -Dm 644 $(BIN_DIR)/$(PROJECT_NAME).desktop $(DESTDIR)$(PREFIX_DESKTOP)/
sed -i s#Exec=$(PREFIX)/#Exec=# $(BIN_DIR)/$(PROJECT_NAME).desktop
sed -i s#Icon=$(PREFIX_DESKTOP)/#Icon=# $(BIN_DIR)/$(PROJECT_NAME).desktop
install -Dm 644 $(BIN_DIR)/$(PROJECT_NAME).svg $(DESTDIR)$(PREFIX_DESKTOP)/
# Uninstall installed program
uninstall:
rm -f $(PREFIX)/$(PROJECT_NAME)-portable-$(VERSION).jar
rm -f $(PREFIX)/$(PROJECT_NAME)
rm -f $(PREFIX_DESKTOP)/$(PROJECT_NAME).desktop
rm -f $(PREFIX_DESKTOP)/$(PROJECT_NAME).svg
create_package:
makepkg .
# Install with
# pacman -U packagename.tar.gz
create_windows_installer:
cd WindowsInstaller; \
python3 build_windows_installer.py