6848bd6ca3ef070586527d5522a4fa0904bbb456
[feed/packages.git] / utils / syncthing / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=syncthing
4 PKG_VERSION:=1.22.2
5 PKG_RELEASE:=1
6
7 PKG_SOURCE:=syncthing-source-v$(PKG_VERSION).tar.gz
8 PKG_SOURCE_URL:=https://github.com/syncthing/syncthing/releases/download/v$(PKG_VERSION)
9 PKG_HASH:=211704904788808ef2818994fb36e33c3e33ed1b52267f7adbf1411fa5ee2d2f
10
11 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/$(PKG_NAME)
12
13 PKG_MAINTAINER:=Paul Spooren <mail@aparcar.org>
14 PKG_LICENSE:=MPL-2.0
15 PKG_LICENSE_FILES:=LICENSE
16 PKG_CPE_ID:=cpe:/a:syncthing:syncthing
17
18 PKG_BUILD_DEPENDS:=golang/host
19 PKG_BUILD_PARALLEL:=1
20 PKG_USE_MIPS16:=0
21
22 GO_PKG:=github.com/syncthing/syncthing/
23 GO_PKG_BUILD_PKG:=\
24 $(if $(CONFIG_PACKAGE_syncthing),github.com/syncthing/syncthing/cmd/syncthing/) \
25 $(if $(CONFIG_PACKAGE_stdiscosrv),github.com/syncthing/syncthing/cmd/stdiscosrv/) \
26 $(if $(CONFIG_PACKAGE_strelaysrv),github.com/syncthing/syncthing/cmd/strelaysrv/)
27 GO_PKG_INSTALL_EXTRA:=^gui/
28
29 GO_PKG_LDFLAGS_X:=\
30 github.com/syncthing/syncthing/lib/build.Version=v$(PKG_VERSION) \
31 github.com/syncthing/syncthing/lib/build.Stamp=$(SOURCE_DATE_EPOCH) \
32 github.com/syncthing/syncthing/lib/build.User=openwrt \
33 github.com/syncthing/syncthing/lib/build.Host=openwrt \
34 github.com/syncthing/syncthing/lib/build.Tags=noupgrade
35 GO_PKG_TAGS:=noupgrade
36
37 include $(INCLUDE_DIR)/package.mk
38 include ../../lang/golang/golang-package.mk
39
40 define Package/syncthing/Default
41 URL:=https://syncthing.net
42 DEPENDS:=$(GO_ARCH_DEPENDS)
43 SECTION:=utils
44 CATEGORY:=Utilities
45 endef
46
47 define Package/syncthing
48 $(call Package/syncthing/Default)
49 TITLE:=Continuous file synchronization program
50 USERID:=syncthing=499:syncthing=499
51 endef
52
53 define Package/stdiscosrv
54 $(call Package/syncthing/Default)
55 TITLE:=Discovery server for syncthing
56 endef
57
58 define Package/strelaysrv
59 $(call Package/syncthing/Default)
60 TITLE:=Relay server for syncthing
61 endef
62
63 define Package/syncthing/conffiles
64 /etc/config/syncthing
65 /etc/syncthing
66 endef
67
68 define Package/stdiscosrv/conffiles
69 /etc/config/stdiscosrv
70 /etc/stdiscosrv
71 endef
72
73 define Package/strelaysrv/conffiles
74 /etc/config/strelaysrv
75 /etc/strelaysrv
76 endef
77
78 define Package/syncthing/description
79 Syncthing replaces proprietary sync and cloud services with something
80 open, trustworthy and decentralized. Your data is your data alone and
81 you deserve to choose where it is stored, if it is shared with some
82 third party and how it's transmitted over the Internet.
83 endef
84
85 define Package/stdiscosrv/description
86 Relay server for syncthing
87 endef
88
89 define Package/strelaysrv/description
90 Relay server for syncthing
91 endef
92
93 define Build/Install
94 $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
95 endef
96
97 define SyncthingInstall
98 $(INSTALL_DIR) $(1)/etc/config/
99 $(INSTALL_CONF) $(CURDIR)/files/$(2).conf $(1)/etc/config/$(2)
100
101 $(INSTALL_DIR) $(1)/etc/init.d/
102 $(INSTALL_BIN) $(CURDIR)/files/$(2).init $(1)/etc/init.d/$(2)
103
104 $(INSTALL_DIR) $(1)/usr/bin/
105 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $(1)/usr/bin
106 endef
107
108
109 define Package/syncthing/install
110 $(call SyncthingInstall,$(1),syncthing)
111
112 $(INSTALL_DIR) $(1)/etc/sysctl.d/
113 $(INSTALL_BIN) $(CURDIR)/files/syncthing-sysctl.conf $(1)/etc/sysctl.d/90-syncthing-inotify.conf
114 endef
115
116 define Package/stdiscosrv/install
117 $(call SyncthingInstall,$(1),stdiscosrv)
118 endef
119
120 define Package/strelaysrv/install
121 $(call SyncthingInstall,$(1),strelaysrv)
122 endef
123
124 $(eval $(call BuildPackage,syncthing))
125 $(eval $(call BuildPackage,stdiscosrv))
126 $(eval $(call BuildPackage,strelaysrv))