|
| 1 | +class Netatalk < Formula |
| 2 | + desc "File server for Macs, compliant with Apple Filing Protocol (AFP)" |
| 3 | + homepage "https://netatalk.io" |
| 4 | + url "https://github.com/Netatalk/netatalk/releases/download/netatalk-4-0-8/netatalk-4.0.8.tar.xz" |
| 5 | + sha256 "d09d591521b27b91b1c2a6255a2e059af8c9fda43570f983f0a145706e5f7628" |
| 6 | + license all_of: [ |
| 7 | + "GPL-2.0-only", |
| 8 | + "GPL-2.0-or-later", |
| 9 | + "LGPL-2.0-only", |
| 10 | + "LGPL-2.1-or-later", |
| 11 | + "BSD-2-Clause", |
| 12 | + "BSD-3-Clause", |
| 13 | + "MIT", |
| 14 | + ] |
| 15 | + head "https://github.com/Netatalk/netatalk.git", branch: "main" |
| 16 | + |
| 17 | + bottle do |
| 18 | + sha256 arm64_sequoia: "5aff5ad6a6dccba9fab03fd27a12cd517ab04f73c535b7b45535cf13d8957175" |
| 19 | + sha256 arm64_sonoma: "d9146fce6e190d8f5558389f6ee795331dd801f6af42cb7a57a2b246b8e9277f" |
| 20 | + sha256 arm64_ventura: "ea9c8c297943ae06289cecaecc46873808e4c025dcd26efb2cd14c960c4613a9" |
| 21 | + sha256 sonoma: "22af562496f53cffb3aa4ed4d5f6be7dbbe29e35fe9720c5942d1e4c180e1d38" |
| 22 | + sha256 ventura: "f54bb34fae8700afc7eebfe3946fcb9442d2eaabc5f55391803e2fc50605e074" |
| 23 | + sha256 x86_64_linux: "eeaf7470fce660f94284f477223bf45fb9ccafa4c4f06217e317e6d24a53f018" |
| 24 | + end |
| 25 | + |
| 26 | + depends_on "docbook-xsl" => :build |
| 27 | + depends_on "meson" => :build |
| 28 | + depends_on "ninja" => :build |
| 29 | + depends_on "pkgconf" => :build |
| 30 | + |
| 31 | + depends_on "berkeley-db@5" # macOS bdb library lacks DBC type etc. |
| 32 | + depends_on "cracklib" |
| 33 | + depends_on "libevent" |
| 34 | + depends_on "libgcrypt" |
| 35 | + depends_on "mysql" |
| 36 | + depends_on "openldap" # macOS LDAP.Framework is not fork safe |
| 37 | + |
| 38 | + uses_from_macos "libxslt" => :build |
| 39 | + |
| 40 | + uses_from_macos "krb5" |
| 41 | + uses_from_macos "libxcrypt" |
| 42 | + uses_from_macos "perl" |
| 43 | + |
| 44 | + on_linux do |
| 45 | + depends_on "avahi" # on macOS we use native mDNS instead |
| 46 | + depends_on "cups" # used by the AppleTalk print server |
| 47 | + depends_on "libtirpc" # on macOS we use native RPC instead |
| 48 | + end |
| 49 | + |
| 50 | + patch do |
| 51 | + url "https://github.com/Netatalk/netatalk/commit/206fb7771862b9b98452c934dac884aaa397c8ca.patch?full_index=1" |
| 52 | + sha256 "fd448734556daf0344be4fa0bb09e4704c4123078ad804069d288aa0e3e104d6" |
| 53 | + end |
| 54 | + |
| 55 | + def install |
| 56 | + inreplace "distrib/initscripts/macos.netatalk.in", "@sbindir@", opt_sbin |
| 57 | + inreplace "distrib/initscripts/macos.netatalk.plist.in", "@bindir@", opt_bin |
| 58 | + inreplace "distrib/initscripts/macos.netatalk.plist.in", "@sbindir@", opt_sbin |
| 59 | + inreplace "distrib/initscripts/systemd.netatalk.service.in", "@sbindir@", opt_sbin |
| 60 | + bdb5_rpath = rpath(target: Formula["berkeley-db@5"].opt_lib) |
| 61 | + ENV.append "LDFLAGS", "-Wl,-rpath,#{bdb5_rpath}" if OS.linux? |
| 62 | + args = [ |
| 63 | + "-Dwith-afpstats=false", |
| 64 | + "-Dwith-appletalk=#{OS.linux?}", # macOS doesn't have an AppleTalk stack |
| 65 | + "-Dwith-bdb-path=#{Formula["berkeley-db@5"].opt_prefix}", |
| 66 | + "-Dwith-docbook-path=#{Formula["docbook-xsl"].opt_prefix}/docbook-xsl", |
| 67 | + "-Dwith-init-dir=#{prefix}", |
| 68 | + "-Dwith-init-hooks=false", |
| 69 | + "-Dwith-install-hooks=false", |
| 70 | + "-Dwith-statedir-path=#{var}", |
| 71 | + "-Dwith-pam-config-path=#{etc}/pam.d", |
| 72 | + "-Dwith-rpath=false", |
| 73 | + "-Dwith-spotlight=false", |
| 74 | + ] |
| 75 | + |
| 76 | + system "meson", "setup", "build", *args, *std_meson_args |
| 77 | + system "meson", "compile", "-C", "build", "--verbose" |
| 78 | + system "meson", "install", "-C", "build" |
| 79 | + end |
| 80 | + |
| 81 | + service do |
| 82 | + name macos: "io.netatalk.daemon", linux: "netatalk" |
| 83 | + require_root true |
| 84 | + end |
| 85 | + |
| 86 | + test do |
| 87 | + system sbin/"netatalk", "-V" |
| 88 | + system sbin/"afpd", "-V" |
| 89 | + assert_empty shell_output(sbin/"netatalk") |
| 90 | + end |
| 91 | +end |
0 commit comments