netatalk: create small and full variants
authorAntonio Pastor <antonio.pastor@gmail.com>
Sun, 26 Jan 2025 20:45:59 +0000 (15:45 -0500)
committerTianling Shen <cnsztl@gmail.com>
Sun, 2 Feb 2025 11:12:30 +0000 (19:12 +0800)
Small version includes only AFP file sharing to minimize size.
Base version adds AppleTalk. This matches the contents of the
existing package.
Full version includes everything that OpenWrt can support and
configuration option for build system (menuconfig).

Signed-off-by: Antonio Pastor <antonio.pastor@gmail.com>
net/netatalk/Config.in [new file with mode: 0644]
net/netatalk/Makefile

diff --git a/net/netatalk/Config.in b/net/netatalk/Config.in
new file mode 100644 (file)
index 0000000..c889c4b
--- /dev/null
@@ -0,0 +1,35 @@
+if PACKAGE_netatalk-full
+
+        config PACKAGE_NETATALK_APPLETALK
+                bool "Enable AppleTalk support."
+                default y
+
+        config PACKAGE_NETATALK_ZEROCONF
+                bool "Enable Zeroconf support."
+                default y
+
+        config PACKAGE_NETATALK_ACLS
+                bool "Enable ACL support."
+                default y
+
+        config PACKAGE_NETATALK_PAM
+                bool "Enable PAM support."
+                default y
+
+        config PACKAGE_NETATALK_LDAP
+                bool "Enable LDAP support."
+                default y
+
+        config PACKAGE_NETATALK_ICONV
+                bool "Use libiconv features."
+                default y
+
+        config PACKAGE_NETATALK_KERBEROS
+                bool "Enable kerberos support."
+                default y
+
+        config PACKAGE_NETATALK_LIBWRAP
+                bool "Enable TCP wrappers."
+                default y
+
+endif
index f557470ca3221b851e2b7b9ca7bb8a4d3e6bce17..8d54a25f108fa7fd53fa64d1326404d2c6192b7d 100644 (file)
@@ -24,63 +24,146 @@ include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/nls.mk
 include $(INCLUDE_DIR)/meson.mk
 
-define Package/netatalk
+define Package/netatalk/Default
   SECTION:=net
   CATEGORY:=Network
   SUBMENU:=Filesystem
-  TITLE:=Netatalk - Apple Filing Protocol (AFP) file server.
+  TITLE:=Apple Filing Protocol
+  PROVIDES:=netatalk
   URL:=http://netatalk.sourceforge.net
   DEPENDS:=+libevent2 +libdb47 +libgcrypt
 endef
 
-define Package/netatalk/description
+define Package/netatalk-small
+  $(call Package/netatalk/Default)
+  TITLE+= (afpd only)
+  VARIANT:=small
+endef
+
+define Package/netatalk
+  $(call Package/netatalk/Default)
+  TITLE+= with AppleTalk support
+  VARIANT:=appletalk
+  DEPENDS+=+kmod-appletalk
+endef
+
+define Package/netatalk-full
+  $(call Package/netatalk/Default)
+  TITLE+= (configurable)
+  VARIANT:=full
+  DEPENDS+= \
+    +PACKAGE_NETATALK_APPLETALK:kmod-appletalk \
+    +PACKAGE_NETATALK_ZEROCONF:libavahi-client \
+    +PACKAGE_NETATALK_ACLS:libacl \
+    +PACKAGE_NETATALK_PAM:libpam \
+    +PACKAGE_NETATALK_LDAP:libopenldap \
+    +PACKAGE_NETATALK_ICONV:libiconv-full \
+    +PACKAGE_NETATALK_KERBEROS:krb5-libs \
+    +PACKAGE_NETATALK_LIBWRAP:libwrap
+  MENU:=1
+endef
+
+define Package/netatalk/description/default
   Netatalk is an Open Source Apple Filing Protocol (AFP) fileserver.
   Implements a service that allows Macintosh file sharing
   and Time Machine backups. Modern MacOS prefers Samba network shares
   but AFP has shown superior throughput. High Sierra and older MacOS
   only support AFP for Time Machine backups.
-  Includes support of AppleTalk protocols to network with pre-OSX Macs.
+endef
+
+define Package/netatalk-small/description
+  $(call Package/netatalk/description/default)
+  This package includes only the AFPD service.
+endef
+
+define Package/netatalk/description
+  $(call Package/netatalk/description/default)
+  This package includes the AFPD service and AppleTalk binaries.
+endef
+
+define Package/netatalk-full/description
+  $(call Package/netatalk/description/default)
+  This package includes all OpenWrt supported features (customizable).
+endef
+
+define Package/netatalk-full/config
+        source "$(SOURCE)/Config.in"
 endef
 
 MESON_ARGS += \
-       -Dwith-appletalk=true \
-       -Dwith-zeroconf=false \
-       -Dwith-cups=false \
-       -Dwith-quota=false \
-       -Dwith-afpstats=false \
-       -Dwith-acls=false \
-       -Dwith-ldap=false \
        -Dwith-cnid-default-backend=dbd \
        -Dwith-cnid-dbd-backend=true \
        -Dwith-cnid-mysql-backend=false \
-       -Dwith-pam=false \
-       -Dwith-tests=false \
-       -Dwith-testsuite=false \
        -Dwith-bdb-path="$(STAGING_DIR)/usr/" \
        -Dwith-unicode-data-path="$(STAGING_DIR_HOST)/share/gnulib/tests/uniname/" \
        -Dwith-libgcrypt-path="$(STAGING_DIR)/usr/" \
-       -Dwith-kerberos=false \
-       -Dwith-krbV-uam=false \
-       -Dwith-libiconv=false \
-       -Dwith-spotlight=false \
        $(if $(CONFIG_SHADOW_PASSWORDS),-Dwith-shadow=true,-Dwith-shadow=false) \
+       -Dwith-afpstats=false \
+       -Dwith-cups=false \
+       -Dwith-quota=false \
+       -Dwith-spotlight=false \
+       -Dwith-cracklib=false \
+       -Dwith-tests=false \
+       -Dwith-testsuite=false \
        -Dwith-dtrace=false \
-       -Dwith-tcp-wrappers=false \
        -Dwith-debug=false \
        -Dwith-shell-check=false \
        -Dwith-readmes=false \
        -Dwith-manual=none \
        -Dwith-init-style=none \
 
+ifeq ($(BUILD_VARIANT),small)
+MESON_ARGS += \
+       -Dwith-appletalk=false \
+       -Dwith-zeroconf=false \
+       -Dwith-acls=false \
+       -Dwith-ldap=false \
+       -Dwith-pam=false \
+       -Dwith-libiconv=false \
+       -Dwith-kerberos=false \
+       -Dwith-krbV-uam=false \
+       -Dwith-tcp-wrappers=false \
+
+endif
+
+ifeq ($(BUILD_VARIANT),appletalk)
+MESON_ARGS += \
+       -Dwith-appletalk=true \
+       -Dwith-zeroconf=false \
+       -Dwith-acls=false \
+       -Dwith-ldap=false \
+       -Dwith-pam=false \
+       -Dwith-libiconv=false \
+       -Dwith-kerberos=false \
+       -Dwith-krbV-uam=false \
+       -Dwith-tcp-wrappers=false \
+
+endif
+
+ifeq ($(BUILD_VARIANT),full)
+MESON_ARGS += \
+       -Dwith-appletalk=$(if $(CONFIG_PACKAGE_NETATALK_APPLETALK),true,false) \
+       -Dwith-zeroconf=$(if $(CONFIG_PACKAGE_NETATALK_ZEROCONF),true,false) \
+       -Dwith-acls=$(if $(CONFIG_PACKAGE_NETATALK_ACLS),true,false) \
+       -Dwith-ldap=$(if $(CONFIG_PACKAGE_NETATALK_LDAP),true,false) \
+       -Dwith-pam=$(if $(CONFIG_PACKAGE_NETATALK_PAM),true,false) \
+       -Dwith-libiconv=$(if $(CONFIG_PACKAGE_NETATALK_ICONV),true,false) \
+       $(if $(CONFIG_PACKAGE_NETATALK_ICONV),-Dwith-libiconv-path=$(STAGING_DIR)/usr/lib/libiconv-full,) \
+       -Dwith-kerberos=$(if $(CONFIG_PACKAGE_NETATALK_KERBEROS),true,false) \
+       -Dwith-krbV-uam=$(if $(CONFIG_PACKAGE_NETATALK_KERBEROS),true,false) \
+       -Dwith-tcp-wrappers=$(if $(CONFIG_PACKAGE_NETATALK_LIBWRAP),true,false) \
+
+endif
+
 define Package/netatalk/conffiles
 /etc/afp.conf
 /etc/extmap.conf
 /etc/netatalk/
 /etc/atalkd.conf
-/etc/papd.conf
+/etc/macipgw.conf
 endef
 
-define Package/netatalk/install
+define Package/netatalk-small/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_DIR) $(1)/usr/lib
        $(INSTALL_DIR) $(1)/usr/lib/netatalk
@@ -92,9 +175,23 @@ define Package/netatalk/install
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/afp.conf $(1)/etc/
        $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/extmap.conf $(1)/etc/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/papd.conf $(1)/etc/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/atalkd.conf $(1)/etc/
        $(INSTALL_BIN) ./files/afpd.init $(1)/etc/init.d/afpd
 endef
 
+define Package/netatalk/install
+        $(call Package/netatalk-small/install,$(1))
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/atalkd.conf $(1)/etc/
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/macipgw.conf $(1)/etc/
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/papd.conf $(1)/etc/
+endef
+
+define Package/netatalk-full/install
+        $(call Package/netatalk-small/install,$(1))
+       $(if $(PACKAGE_NETATALK_APPLETALK),$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/atalkd.conf $(1)/etc/,)
+       $(if $(PACKAGE_NETATALK_APPLETALK),$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/macipgw.conf $(1)/etc/,)
+       $(if $(PACKAGE_NETATALK_APPLETALK),$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/papd.conf $(1)/etc/,)
+endef
+
+$(eval $(call BuildPackage,netatalk-small))
 $(eval $(call BuildPackage,netatalk))
+$(eval $(call BuildPackage,netatalk-full))