actions.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 inary.actionsapi import autotools
  7. from inary.actionsapi import inarytools
  8. from inary.actionsapi import shelltools
  9. from inary.actionsapi import get
  10. def setup():
  11. inarytools.dosed("Configure", " $prefix/$libdir/engines ", " /%{_lib}/engines ")
  12. options = " --prefix=/usr \
  13. --libdir=lib \
  14. --openssldir=/etc/ssl \
  15. shared -Wa,--noexecstack \
  16. zlib enable-camellia enable-idea \
  17. enable-seed enable-rfc3779 enable-rc5 \
  18. enable-cms enable-md2 enable-mdc2 threads"
  19. if get.buildTYPE() == "_emul32":
  20. options += " --prefix=/_emul32 --libdir=lib32".format(get.installDIR())
  21. shelltools.export("CC", "%s -m32" % get.CC())
  22. shelltools.export("CXX", "%s -m32" % get.CXX())
  23. shelltools.system("./Configure linux-elf %s" % options)
  24. shelltools.export("PKG_CONFIG_PATH","/usr/lib32/pkgconfig")
  25. elif get.ARCH() == "i686":
  26. shelltools.system("./Configure linux-elf %s" % options)
  27. inarytools.dosed("Makefile", "^(SHARED_LDFLAGS=).*", "\\1 ${LDFLAGS}")
  28. inarytools.dosed("Makefile", "^(CFLAG=.*)", "\\1 ${CFLAGS}")
  29. else:
  30. options += " enable-ec_nistp_64_gcc_128"
  31. shelltools.system("./Configure linux-x86_64 %s" % options)
  32. inarytools.dosed("Makefile", "^(SHARED_LDFLAGS=).*", "\\1 ${LDFLAGS}")
  33. inarytools.dosed("Makefile", "^(CFLAG=.*)", "\\1 ${CFLAGS}")
  34. def build():
  35. autotools.make("depend")
  36. autotools.make("-j1")
  37. #autotools.make("rehash")
  38. #def check():
  39. #Revert ca-dir patch not to fail test
  40. #shelltools.system("patch -p1 -R < openssl-1.0.0-beta4-ca-dir.patch")
  41. # homeDir = "%s/test-home" % get.workDIR()
  42. # shelltools.export("HOME", homeDir)
  43. # shelltools.makedirs(homeDir)
  44. # autotools.make("-j1 test")
  45. #Passed. So, re-patch
  46. #shelltools.system("patch -p1 < openssl-1.0.0-beta4-ca-dir.patch")
  47. def install():
  48. shelltools.system("sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile")
  49. autotools.rawInstall("DESTDIR=%s MANDIR=/usr/share/man" % get.installDIR())
  50. # Rename conflicting manpages
  51. inarytools.rename("/usr/share/man/man1/passwd.1", "ssl-passwd.1")
  52. inarytools.remove("/usr/share/man/man1/openssl-passwd.1")
  53. inarytools.dosym("ssl-passwd.1", "/usr/share/man/man1/openssl-passwd.1")
  54. inarytools.rename("/usr/share/man/man1/rand.1", "ssl-rand.1")
  55. inarytools.remove("/usr/share/man/man1/openssl-rand.1")
  56. inarytools.dosym("ssl-passwd.1", "/usr/share/man/man1/openssl-rand.1")
  57. #inarytools.rename("/usr/share/man/man3/err.3", "ssl-err.3")
  58. if get.buildTYPE() == "_emul32":
  59. #from distutils.dir_util import copy_tree
  60. shelltools.copytree("%s/_emul32/lib32/" % get.installDIR(), "%s/usr/lib32" % get.installDIR())
  61. inarytools.removeDir("/_emul32")
  62. path = "%s/usr/lib32/pkgconfig" % get.installDIR()
  63. inarytools.domove("/usr/lib32/engines-1.1", "/usr/lib32/openssl")
  64. for f in shelltools.ls(path): inarytools.dosed("%s/%s" % (path, f), "^(prefix=\/)_emul32", r"\1usr")
  65. return
  66. # Move engines to /usr/lib/openssl/engines
  67. inarytools.dodir("/usr/lib/openssl")
  68. inarytools.domove("/usr/lib/engines-1.1", "/usr/lib/openssl")
  69. # Certificate stuff
  70. inarytools.dobin("tools/c_rehash")
  71. # Create needed dirs
  72. for cadir in ["misc", "private"]:
  73. inarytools.dodir("/etc/ssl/%s" % cadir)
  74. inarytools.dohtml("doc/*")
  75. inarytools.dodoc("CHANGES*", "FAQ", "LICENSE", "NEWS", "README", "doc/*.txt")