guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/07: gnu: Add postfix.


From: guix-commits
Subject: 01/07: gnu: Add postfix.
Date: Fri, 30 Jul 2021 10:15:21 -0400 (EDT)

cwebber pushed a commit to branch wip-postfix
in repository guix.

commit 7e8c1167411d4060b09515c8fbf03cf3bea46ba8
Author: Gábor Boskovits <boskovits@gmail.com>
AuthorDate: Mon Feb 3 13:31:34 2020 +0100

    gnu: Add postfix.
    
    * gnu/packages/mail.scm (postfix-minimal): New variable.
    
    Co-authored-by: Brant Gardner <brantcgardner@brantware.com>
---
 gnu/packages/mail.scm | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index c207d36..2c70f6a 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2020 divoplade <d@divoplade.fr>
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;; Copyright © 2021 Benoit Joly <benoit@benoitj.ca>
+;;; Copyright © 2020 Brant Gardner <brantcgardner@brantware.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -87,6 +88,7 @@
   #:use-module (gnu packages file)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages gdb)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
@@ -4484,3 +4486,116 @@ regexes, approximate regexes, a Hidden Markov Model, 
Orthogonal Sparse
 Bigrams, WINNOW, Correllation, KNN/Hyperspace, or Bit Entropy (or by other
 means--it's all programmable).")
     (license license:gpl3)))
+
+(define-public postfix-minimal
+  (package
+    (name "postfix-minimal")
+    (version "3.4.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://cdn.postfix.johnriley.me/";
+                                  "mirrors/postfix-release/official/"
+                                  "postfix-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0hw9kbr05qdzvfqhxi4dp4n3s9xvdh0gr0la08a4bip06ybl4pcd"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-/bin/sh
+           (lambda _
+             (substitute* (find-files "." "^Makefile.in")
+               (("/bin/sh") (which "sh")))
+             #t))
+         ;; allow us to find the bdb headers
+         (add-before 'build 'patch-/usr/include
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* '("makedefs")
+               (("/usr/include") (string-append (assoc-ref inputs "bdb")
+                                                "/include")))
+             #t))
+         (add-before 'build 'set-up-environment
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; os detection on Guix System does not provide this
+             (setenv "AUXLIBS" "-lnsl")
+             ;; have to set this here, so that we get the correct
+             ;; location in the compiled binaries
+             (setenv "shlib_directory" (assoc-ref outputs "out"))
+             #t))
+         ;; do not allow writes to the configuration directory,
+         ;; so that we can keep that in the store
+         (add-before 'build 'disable-postconf-edit
+           (lambda _
+             (substitute* "src/postconf/postconf_edit.c"
+               (("pcf_set_config_dir\\(\\);") "return 0;"))))
+         (add-before 'build 'configure-compile
+           (lambda _
+             (invoke "make" "makefiles" "pie=yes" "dynamicmaps=yes")))
+         (add-before 'install 'fix-postfix-scripts-path
+           (lambda _
+             (for-each
+              (lambda (command)
+                (substitute* '("postfix-install" "conf/post-install" 
"conf/postfix-script")
+                  (((string-append command " ")) (string-append (which 
command) " "))))
+              '("awk" "chmod" "chown" "chgrp" "cp" "find" "ln" "mkdir" "mv" 
"rm" "sed"
+                "sleep" "sort" "touch" "uname"))
+             #t))
+         (add-before 'install 'configure-install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "sendmail_path" (string-append out "/sendmail"))
+               (setenv "newaliases_path" (string-append out "/newaliases"))
+               (setenv "mailq_path" (string-append out "/mailq"))
+               (setenv "command_directory" out)
+               (setenv "config_directory" out)
+               (setenv "daemon_directory" out)
+               (setenv "data_directory" out)
+               (setenv "html_directory" out)
+               (setenv "queue_directory" out)
+               (setenv "manpage_directory" out)
+               (setenv "sample_directory" out)
+               (setenv "meta_directory" out)
+               (setenv "readme_directory" out))
+             (setenv "tempdir" "/tmp")
+             #t))
+         ;; done in the service activation snippet
+         ;; we don't have the account here
+         (add-before 'fix-postfix-scripts-path 'disable-chown
+           (lambda _
+             (substitute* "postfix-install"
+               (("chown") (which "true")))
+             (substitute* "postfix-install"
+               (("chgrp") (which "true")))
+             #t))
+         ;; disable writing the configuration files (service provides these)
+         ;; disable chowning (does not matter, stuff ends up in the store)
+         ;; and disable live update code (we always install to a clean 
directory)
+         (add-after 'configure-install 'disable-postinstall
+           (lambda _
+             (substitute* "postfix-install"
+               (("# we're sorry.") "exit 0"))
+             #t))
+         ;; postfix by default uses an interactive installer
+         ;; replacing it with the upgrade target allows for
+         ;; a non-interactive install.
+         (replace 'install
+           (lambda _
+             (invoke "make" "upgrade")))
+         (delete 'configure)
+         (delete 'check))))
+    (inputs `(("bdb" ,bdb)
+              ("libnsl" ,libnsl)))
+    (native-inputs `(("coreutils" ,coreutils)
+                     ("findutils" ,findutils)
+                     ("gawk" ,gawk)
+                     ("m4" ,m4)
+                     ("sed" ,sed)))
+    (home-page "http://www.postfix.org";) ; https disabled on server
+    (synopsis "Wietse Venema's mail server")
+    (description "Postfix is Wietse Venema's mail server that started life at
+IBM research as an alternative to the widely-used Sendmail program. Now at
+Google, Wietse continues to support Postfix. Postfix attempts to be fast, easy
+to administer, and secure. The outside has a definite Sendmail-ish flavor, but
+the inside is completely different.")
+    (license license:ibmpl1.0)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]