actions.py 4.4 KB

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