aboutsummaryrefslogtreecommitdiff
path: root/turtetris/Makefile
blob: b962a92c0540c7c77ef5a66e72310e2a5332907c (plain)
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
101
102
103
104
105
#
# Copyright (C) 2017 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=turtetris
PKG_VERSION:=1.3
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.cynerd.cz/turris-tetris
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk
$(call include_mk, python3-package.mk)

define Package/Common
  SUBMENU:=Python
  SECTION:=lang
  CATEGORY:=Languages
  URL:=http://git.cynerd.cz/turris-tetris/
  MAINTAINER:=CZ.NIC <packaging@turris.cz>
endef

define Package/$(PKG_NAME)
  TITLE:=turtetris
  $(call Package/Common)
  DEPENDS:=+python3 +python3-usb +python3-zmq
endef

define Package/$(PKG_NAME)-master
  TITLE:=turtetris-master
  $(call Package/Common)
  DEPENDS:=+turtetris +turtetris-slave
endef

define Package/$(PKG_NAME)-slave
  TITLE:=turtetris-slave
  $(call Package/Common)
  DEPENDS:=+turtetris
endef

define Package/$(PKG_NAME)/description
  Tetris game played on ten Turris Omnias stacked on top of each other.
endef

define Build/Compile
	$(call Build/Compile/Py3Mod,,install --prefix="/usr" --root=$(PKG_INSTALL_DIR))
endef

define Package/$(PKG_NAME)-master/install
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/master.init $(1)/etc/init.d/turtetris-master
endef

define Package/$(PKG_NAME)-slave/install
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/slave.init $(1)/etc/init.d/turtetris-slave
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/uci $(1)/etc/config/turtetris
endef

define Package/$(PKG_NAME)-slave/conffiles
/etc/config/turtetris
endef

define Package/$(PKG_NAME)-master/postinst
[ -n "$$IPKG_INSTROOT" ] || {
	/etc/init.d/turtetris-master enable
	/etc/init.d/turtetris-master restart
}
endef

define Package/$(PKG_NAME)-slave/postinst
[ -n "$$IPKG_INSTROOT" ] || {
	/etc/init.d/turtetris-slave enable
	/etc/init.d/turtetris-slave restart
}
endef

define Package/$(PKG_NAME)-master/prerm
[ -n "$$IPKG_INSTROOT" ] || {
	/etc/init.d/turtetris-master stop
	/etc/init.d/turtetris-master disable
}
endef

define Package/$(PKG_NAME)-slave/prerm
[ -n "$$IPKG_INSTROOT" ] || {
	/etc/init.d/turtetris-slave stop
	/etc/init.d/turtetris-slave disable
}
endef

$(eval $(call Py3Package,turtetris))
$(eval $(call BuildPackage,turtetris))
$(eval $(call BuildPackage,turtetris-master))
$(eval $(call BuildPackage,turtetris-slave))