actions.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 shelltools
  7. from pisi.actionsapi import autotools
  8. from pisi.actionsapi import pisitools
  9. from pisi.actionsapi import get
  10. import os
  11. WorkDir = "Python-%s" % get.srcVERSION()
  12. PythonVersion = "2.7"
  13. def setup():
  14. # shelltools.system("export PYTHON_DISABLE_SSL='1'")
  15. #shelltools.system("echo -e '\033[0;36mBuilding Bzip2\033[0m' ")
  16. #shelltools.makedirs("%s/temp/lib" %get.workDIR())
  17. #shelltools.cd("bzip2-1.0.8")
  18. #autotools.make('CC=%s AR=%s RANLIB=%s CFLAGS="%s -D_FILE_OFFSET_BITS=64 -fPIC" libbz2.a' % (get.CC(), get.AR(), get.RANLIB(), get.CFLAGS()))
  19. #shelltools.system("cp libbz2.a %s/temp/lib/libbz2.a" % get.workDIR())
  20. #shelltools.cd("..")
  21. #os.system("echo -e '\033[0;36mBuilding OpenSSL\033[0m' ")
  22. #shelltools.cd("openssl-1.1.1n")
  23. #shelltools.system("./Configure --prefix=%s/temp --openssldir=%s/openssl/etc/ssl --libdir=lib no-shared enable-ec_nistp_64_gcc_128 linux-x86_64 -Wa,--noexecstack" %(get.workDIR(), get.workDIR()))
  24. #autotools.make()
  25. #autotools.make("install")
  26. #shelltools.cd("..")
  27. #os.system("echo -e '\033[0;36mBuilding Python\033[0m' ")
  28. pisitools.cflags.add("-fwrapv")
  29. # no rpath
  30. pisitools.dosed("configure.ac", "-rpath \$\(LIBDIR\) ")
  31. pisitools.dosed("Lib/cgi.py", r"/usr/local/bin/", r"/usr/bin/")
  32. pisitools.dosed("setup.py", "SQLITE_OMIT_LOAD_EXTENSION", deleteLine=True)
  33. pisitools.dosed("setup.py","ndbm_libs =.*","ndbm_libs = ['gdbm', 'gdbm_compat']")
  34. for dir in ["expat","zlib","_ctypes/libffi_arm_wince","_ctypes/libffi_msvc",
  35. "_ctypes/libffi_osx","_ctypes/libffi","_ctypes/darwin"]:
  36. shelltools.unlinkDir("Modules/%s" % dir)
  37. #shelltools.export("CFLAGS", "-I%s/temp/include -O3" %get.workDIR())
  38. #shelltools.export("LDFLAGS", "-L%s/temp/lib -lssl -lcrypto -lpthread -ldl" %get.workDIR())
  39. #shelltools.export("PKG_CONFIG_PATH", "$PKG_CONFIG_PATH:%s/temp/lib/pkgconfig" %get.workDIR())
  40. #pisitools.cflags.add("-I%s/temp/include -O3" %get.workDIR())
  41. #pisitools.ldflags.add("-L%s/temp/lib -lssl -lcrypto -lpthread -ldl" %get.workDIR())
  42. # shelltools.export("CFLAGS", "-I/usr/include/openssl-1.1 -O3")
  43. # shelltools.export("LDFLAGS", "-L/usr/lib/openssl-1.1")
  44. # shelltools.system('export OPT="${CFLAGS}"')
  45. # shelltools.export("CFLAGS", "-I/usr/include/openssl-1.1 -O3")
  46. # shelltools.export("LDFLAGS", "-L/usr/lib/openssl-1.1 -lssl -lcrypto -lpthread -ldl")
  47. # shelltools.export("PKG_CONFIG_PATH", "$PKG_CONFIG_PATH:/usr/lib/openssl-1.1/pkgconfig")
  48. # pisitools.cflags.add("-I/usr/include/openssl-1.1 -O3")
  49. # pisitools.ldflags.add("-L/usr/lib/openssl-1.1 -lssl -lcrypto -lpthread -ldl")
  50. autotools.autoreconf("-vif")
  51. # disable bsddb
  52. pisitools.dosed("setup.py", "^(disabled_module_list = \[)\]", r"\1'_bsddb', 'dbm']")
  53. # no rpath
  54. pisitools.dosed("Lib/distutils/command/build_ext.py", "self.rpath.append\(user_lib\)", "pass")
  55. autotools.configure("--with-fpectl \
  56. --enable-shared \
  57. --enable-ipv6 \
  58. --with-threads \
  59. --with-libc='' \
  60. --enable-unicode=ucs4 \
  61. --with-wctype-functions \
  62. --with-system-expat \
  63. --with-system-ffi \
  64. --with-dbmliborder=gdbm")
  65. def build():
  66. autotools.make()
  67. # some tests fail. let's disable testing temporarily
  68. # def check():
  69. #autotools.make("test")
  70. def install():
  71. autotools.rawInstall("DESTDIR=%s" % get.installDIR(), "altinstall")
  72. pisitools.dosym("/usr/bin/python%s" % PythonVersion, "/usr/bin/python")
  73. pisitools.dosym("/usr/bin/python%s" % PythonVersion, "/usr/bin/python2")
  74. pisitools.dosym("/usr/bin/python%s-config" % PythonVersion, "/usr/bin/python-config")
  75. pisitools.dosym("/usr/lib/python%s/pdb.py" % PythonVersion, "/usr/bin/pdb")
  76. #pisitools.domove("/usr/lib/python2.7/lib-dynload/bz2_failed.so", "/usr/lib/python2.7/lib-dynload", "bz2.so")
  77. pisitools.dodoc("LICENSE", "README")