actions.py 3.6 KB

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