xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("python2")
  2. set_kind("binary")
  3. set_homepage("https://www.python.org/")
  4. set_description("The python programming language.")
  5. if is_host("windows") then
  6. if os.arch() == "x64" then
  7. set_urls("https://www.python.org/ftp/python/$(version)/python-$(version).amd64.msi")
  8. add_versions("2.7.15", "5e85f3c4c209de98480acbf2ba2e71a907fd5567a838ad4b6748c76deb286ad7")
  9. else
  10. set_urls("https://www.python.org/ftp/python/$(version)/python-$(version).msi")
  11. add_versions("2.7.15", "1afa1b10cf491c788baa340066a813d5ec6232561472cfc3af1664dbc6f29f77")
  12. end
  13. else
  14. set_urls("https://www.python.org/ftp/python/$(version)/Python-$(version).tgz")
  15. add_versions("2.7.15", "18617d1f15a380a919d517630a9cd85ce17ea602f9bbdc58ddc672df4b0239db")
  16. end
  17. on_build(function (package)
  18. end)
  19. on_install("windows", function (package)
  20. local installdir = package:installdir("share", package:name(), package:version_str())
  21. os.mkdir("targetdir")
  22. os.vrun("msiexec /a \"%s\" /quiet /qn TARGETDIR=\"%s\"", package:originfile(), path.absolute("targetdir"))
  23. os.cp("targetdir/*", installdir)
  24. os.cp("targetdir/python.exe", path.join(installdir, "python2.exe"))
  25. package:addenv("PATH", path.join("share", package:name(), package:version_str()))
  26. end)
  27. on_build("macosx", "linux", function (package)
  28. import("package.builder.autoconf").build(package, {prefix = package:installdir("share", package:name(), package:version_str())})
  29. end)
  30. on_install("macosx", "linux", function (package)
  31. import("package.builder.autoconf").install(package)
  32. package:addenv("PATH", path.join("share", package:name(), package:version_str(), "bin"))
  33. end)