actions.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. def setup():
  11. shelltools.system("sed -i 's/Linux..345/&6/' makedefs")
  12. shelltools.system("sed -i 's/LINUX2/LINUX6/' src/util/sys_defs.h")
  13. pisitools.dosed("src/util/sys_defs.h", "hash:\/etc\/aliases", "hash:/etc/mail/aliases")
  14. def build():
  15. cc_args = "-DHAS_PCRE -DHAS_MYSQL -I/usr/include/mysql -DHAS_PGSQL -I/usr/include/postgresql \
  16. -DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DHAS_LDAP -fPIC"
  17. cc_libs = "-pie -Wl,-z,relro -Wl,-z,now -L/usr/lib -lpcre -lcrypt -lpthread -lpam -lssl -lcrypto -lsasl2 -lmysqlclient -lpq -lm -lz -lldap -llber"
  18. # Default paths
  19. pisitools.dosed("src/global/mail_params.h", \
  20. "#define DEF_README_DIR\s+\"no\"", \
  21. "#define DEF_README_DIR \"/usr/share/doc/%s/readme\"" % get.srcNAME())
  22. pisitools.dosed("src/global/mail_params.h", \
  23. "#define DEF_HTML_DIR\s+\"no\"", \
  24. "#define DEF_HTML_DIR \"/usr/share/doc/%s/html\"" % get.srcNAME())
  25. pisitools.dosed("src/global/mail_params.h", \
  26. "#define DEF_MANPAGE_DIR\s+\"/usr/local/man\"", \
  27. "#define DEF_MANPAGE_DIR \"/usr/share/man\"")
  28. pisitools.dosed("src/util/sys_defs.h", \
  29. "#define NATIVE_DAEMON_DIR \"/usr/libexec/postfix\"", \
  30. "#define NATIVE_DAEMON_DIR \"/usr/lib/postfix\"")
  31. autotools.make('CC=%s \
  32. OPT="%s" \
  33. CCARGS="%s" \
  34. AUXLIBS="%s" makefiles' % (get.CC(), get.CFLAGS(), cc_args, cc_libs))
  35. autotools.make()
  36. def install():
  37. shelltools.system('/bin/sh postfix-install \
  38. -non-interactive \
  39. install_root="%(installDIR)s" \
  40. config_directory="/usr/share/doc/%(srcNAME)s/defaults" \
  41. readme_directory="/usr/share/doc/%(srcNAME)s/readme" \
  42. ' % {'installDIR': get.installDIR(), 'srcNAME': get.srcNAME()})
  43. pisitools.removeDir("/var/")
  44. # lets make dirs
  45. pisitools.dodir("/var/spool/postfix/")
  46. pisitools.dodir("/etc/mail/")
  47. pisitools.dodir("/etc/postfix/")
  48. pisitools.dodir("/var/spool/mail/")
  49. pisitools.dodir("/var/lib/postfix")
  50. pisitools.dosym("/var/spool/mail", "/var/mail")
  51. # qshape comes
  52. pisitools.dosbin("auxiliary/qshape/qshape.pl")
  53. pisitools.rename("/usr/sbin/qshape.pl", "qshape")
  54. # legacy FSH
  55. pisitools.dosym("/usr/sbin/sendmail", "/usr/lib/sendmail")
  56. # performance tuning tools.
  57. pisitools.dosbin("bin/smtp-source")
  58. pisitools.dosbin("bin/smtp-sink")
  59. pisitools.dosbin("bin/qmqp-source")
  60. pisitools.dosbin("bin/qmqp-sink")
  61. pisitools.doman("man/man1/smtp-source.1")
  62. pisitools.doman("man/man1/smtp-sink.1")
  63. pisitools.doman("man/man1/qmqp-source.1")
  64. pisitools.doman("man/man1/qmqp-sink.1")
  65. # Move some files
  66. pisitools.domove("/usr/share/doc/%s/defaults/master.cf" % get.srcNAME(), "/etc/postfix/")
  67. # Docs
  68. pisitools.insinto("/usr/share/doc/%s/" % get.srcNAME(), "html/")
  69. pisitools.insinto("/usr/share/doc/%s/" % get.srcNAME(), "examples/")
  70. for s in ["*README", "COMPATIBILITY", "HISTORY", "LICENSE", "RELEASE_NOTES"]:
  71. pisitools.insinto("/usr/share/doc/%s/" % get.srcNAME(), s)