1################################################################################
2#
3# proftpd
4#
5################################################################################
6
7PROFTPD_VERSION = 1.3.8b
8PROFTPD_SITE = https://github.com/proftpd/proftpd/archive/v$(PROFTPD_VERSION)
9PROFTPD_LICENSE = GPL-2.0+
10PROFTPD_LICENSE_FILES = COPYING
11PROFTPD_CPE_ID_VENDOR = proftpd
12PROFTPD_SELINUX_MODULES = ftp
13
14PROFTPD_CONF_ENV = \
15	ac_cv_func_setpgrp_void=yes \
16	ac_cv_func_setgrent_void=yes
17
18PROFTPD_CONF_OPTS = \
19	--localstatedir=/var/run \
20	--disable-static \
21	--disable-curses \
22	--disable-ncurses \
23	--disable-facl \
24	--disable-dso \
25	--enable-sendfile \
26	--enable-shadow \
27	--with-gnu-ld \
28	--without-openssl-cmdline
29
30ifeq ($(BR2_PACKAGE_LIBIDN2),y)
31PROFTPD_DEPENDENCIES += libidn2
32endif
33
34ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
35PROFTPD_DEPENDENCIES += libxcrypt
36endif
37
38ifeq ($(BR2_PACKAGE_PCRE2),y)
39PROFTPD_CONF_OPTS += --enable-pcre2
40PROFTPD_DEPENDENCIES += pcre2
41else
42PROFTPD_CONF_OPTS += --disable-pcre2
43endif
44
45ifeq ($(BR2_PACKAGE_PROFTPD_MOD_CAP),y)
46PROFTPD_CONF_OPTS += --enable-cap
47PROFTPD_DEPENDENCIES += libcap
48else
49PROFTPD_CONF_OPTS += --disable-cap
50endif
51
52ifeq ($(BR2_PACKAGE_PROFTPD_MOD_REWRITE),y)
53PROFTPD_MODULES += mod_rewrite
54endif
55
56ifeq ($(BR2_PACKAGE_PROFTPD_MOD_REDIS),y)
57PROFTPD_CONF_OPTS += --enable-redis
58PROFTPD_DEPENDENCIES += hiredis
59else
60PROFTPD_CONF_OPTS += --disable-redis
61endif
62
63ifeq ($(BR2_PACKAGE_PROFTPD_MOD_SFTP),y)
64PROFTPD_CONF_OPTS += --enable-openssl
65PROFTPD_MODULES += mod_sftp
66PROFTPD_DEPENDENCIES += openssl
67else
68PROFTPD_CONF_OPTS += --disable-openssl
69endif
70
71ifeq ($(BR2_PACKAGE_PROFTPD_MOD_SQL),y)
72PROFTPD_MODULES += mod_sql
73endif
74
75ifeq ($(BR2_PACKAGE_PROFTPD_MOD_SQL_SQLITE),y)
76PROFTPD_MODULES += mod_sql_sqlite
77PROFTPD_DEPENDENCIES += sqlite
78endif
79
80ifeq ($(BR2_PACKAGE_PROFTPD_MOD_SFTP_SQL),y)
81PROFTPD_MODULES += mod_sftp_sql
82endif
83
84ifeq ($(BR2_PACKAGE_PROFTPD_MOD_QUOTATAB),y)
85PROFTPD_MODULES += mod_quotatab
86endif
87
88ifeq ($(BR2_PACKAGE_PROFTPD_MOD_QUOTATAB_FILE),y)
89PROFTPD_MODULES += mod_quotatab_file
90endif
91
92ifeq ($(BR2_PACKAGE_PROFTPD_MOD_QUOTATAB_LDAP),y)
93PROFTPD_MODULES += mod_quotatab_ldap
94endif
95
96ifeq ($(BR2_PACKAGE_PROFTPD_MOD_QUOTATAB_RADIUS),y)
97PROFTPD_MODULES += mod_quotatab_radius
98endif
99
100ifeq ($(BR2_PACKAGE_PROFTPD_MOD_QUOTATAB_SQL),y)
101PROFTPD_MODULES += mod_quotatab_sql
102endif
103
104PROFTPD_CONF_OPTS += --with-modules=$(subst $(space),:,$(PROFTPD_MODULES))
105
106# configure script doesn't handle detection of %llu format string
107# support for printing the file size when cross compiling, breaking
108# access for large files.
109# We unfortunately cannot AUTORECONF the package, so instead force it
110# on if we know we support it
111define PROFTPD_USE_LLU
112	$(SED) 's/HAVE_LU/HAVE_LLU/' $(@D)/configure
113endef
114PROFTPD_PRE_CONFIGURE_HOOKS += PROFTPD_USE_LLU
115
116PROFTPD_MAKE = $(MAKE1)
117
118# install Perl based scripts in target
119ifeq ($(BR2_PACKAGE_PERL),y)
120ifeq ($(BR2_PACKAGE_PROFTPD_MOD_QUOTATAB),y)
121define PROFTPD_INSTALL_FTPQUOTA
122	$(INSTALL) -D -m 0755 $(@D)/contrib/ftpquota $(TARGET_DIR)/usr/sbin/ftpquota
123endef
124endif
125define PROFTPD_INSTALL_FTPASSWD
126	$(INSTALL) -D -m 0755 $(@D)/contrib/ftpasswd $(TARGET_DIR)/usr/sbin/ftpasswd
127endef
128endif
129
130define PROFTPD_INSTALL_TARGET_CMDS
131	$(INSTALL) -D -m 0755 $(@D)/proftpd $(TARGET_DIR)/usr/sbin/proftpd
132	$(INSTALL) -m 0644 -D $(@D)/sample-configurations/basic.conf $(TARGET_DIR)/etc/proftpd.conf
133	$(PROFTPD_INSTALL_FTPQUOTA)
134	$(PROFTPD_INSTALL_FTPASSWD)
135endef
136
137define PROFTPD_USERS
138	ftp -1 ftp -1 * /home/ftp - - Anonymous FTP User
139endef
140
141define PROFTPD_INSTALL_INIT_SYSV
142	$(INSTALL) -D -m 0755 package/proftpd/S50proftpd $(TARGET_DIR)/etc/init.d/S50proftpd
143endef
144
145define PROFTPD_INSTALL_INIT_SYSTEMD
146	$(INSTALL) -D -m 644 package/proftpd/proftpd.service \
147		$(TARGET_DIR)/usr/lib/systemd/system/proftpd.service
148endef
149
150ifneq ($(BR2_PACKAGE_PROFTPD_BUFFER_SIZE),0)
151PROFTPD_CONF_OPTS += --enable-buffer-size=$(BR2_PACKAGE_PROFTPD_BUFFER_SIZE)
152endif
153
154$(eval $(autotools-package))
155