Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include ${TOPDIR}/rules.mk
  4. PKG_NAME:= python2
  5. PKG_VERSION:= 2.7.1
  6. PKG_RELEASE:= 3
  7. PKG_MD5SUM:= 15ed56733655e3fab785e49a7278d2fb
  8. PKG_DESCR:= Python scripting language (Version 2)
  9. PKG_SECTION:= lang
  10. PKG_BUILDDEP:= zlib libffi openssl readline bzip2
  11. PKG_DEPENDS:= libpthread zlib libffi libopenssl
  12. PKG_URL:= http://www.python.org/
  13. PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/
  14. PKG_OPTS:= noscripts
  15. PKG_HOST_DEPENDS:= !netbsd !openbsd !cygwin
  16. DISTFILES= Python-${PKG_VERSION}.tgz
  17. WRKDIST= ${WRKDIR}/Python-${PKG_VERSION}
  18. PKG_SUBPKGS:= PYTHON2 PYTHON2_READLINE PYTHON2_BZIP2
  19. PKGSS_PYTHON2_READLINE:=libreadline
  20. PKGSS_PYTHON2_BZIP2:= bzip2
  21. include ${TOPDIR}/mk/package.mk
  22. $(eval $(call PKG_template,PYTHON2,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  23. $(eval $(call PKG_template,PYTHON2_BZIP2,${PKG_NAME}-bzip2,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_PYTHON2_BZIP2},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  24. $(eval $(call PKG_template,PYTHON2_READLINE,${PKG_NAME}-readline,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_PYTHON2_READLINE},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS}))
  25. TARGET_CFLAGS+= -fPIC
  26. TARGET_LDFLAGS+= -L.
  27. MAKE_ENV+= OPT="$(TARGET_CFLAGS)" \
  28. RANLIB="${TARGET_CROSS}ranlib" \
  29. HOSTPYTHON=./hostpython \
  30. HOSTPGEN=./Parser/hostpgen
  31. CONFIGURE_ENV+= OPT="$(TARGET_CFLAGS)" \
  32. ac_cv_have_long_long_format=yes
  33. CONFIGURE_ARGS:= --with-threads \
  34. --disable-toolbox-glue \
  35. --with-system-ffi \
  36. --without-cxx-main
  37. post-extract:
  38. $(CP) ${WRKBUILD}/setup.py ${WRKBUILD}/setup.py.sav
  39. $(CP) ./files/setup.py ${WRKBUILD}/setup.py
  40. $(CP) ./files/posixmodule.c ${WRKBUILD}/Modules/posixmodule.c
  41. $(CP) ./files/python-config.in ${WRKBUILD}/Misc/python-config.in
  42. $(CP) ./files/build_scripts.py ${WRKBUILD}/Lib/distutils/command/build_scripts.py
  43. $(CP) ./files/sysconfig.py ${WRKBUILD}/Lib/distutils/sysconfig.py
  44. (cd ${WRKBUILD}; rm -rf config.{cache,status} ; \
  45. OPT="$(CFLAGS_FOR_BUILD)" \
  46. ./configure --without-cxx-main --with-threads \
  47. --prefix=$(STAGING_HOST_DIR)/usr \
  48. );
  49. $(MAKE) -C ${WRKBUILD} python Parser/pgen
  50. $(MAKE) -C ${WRKBUILD} install
  51. ${CP} ${WRKBUILD}/Parser/pgen ${STAGING_HOST_DIR}/usr/bin/pgen
  52. ${CP} ${WRKBUILD}/python ${STAGING_HOST_DIR}/usr/bin/hostpython
  53. ${CP} ${WRKBUILD}/Parser/pgen ${WRKBUILD}/Parser/hostpgen
  54. ${CP} ${WRKBUILD}/python ${WRKBUILD}/hostpython
  55. $(MAKE) -C ${WRKBUILD} distclean
  56. $(CP) ${WRKBUILD}/setup.py.sav ${WRKBUILD}/setup.py
  57. pre-configure:
  58. $(SED) "s#@@CPU_ARCH@@#$(CPU_ARCH)#" ${WRKBUILD}/configure
  59. $(SED) "s#@@STAGING_DIR@@#$(STAGING_DIR)#" ${WRKBUILD}/setup.py
  60. post-install:
  61. ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/bin ${IDIR_PYTHON2}/usr/lib
  62. ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/lib/python2.7
  63. ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/include/python2.7
  64. ${INSTALL_BIN} ${WRKINST}/usr/bin/python ${IDIR_PYTHON2}/usr/bin
  65. ${CP} ${WRKINST}/usr/lib/libpython*.so* ${IDIR_PYTHON2}/usr/lib
  66. ${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7
  67. ${CP} ${WRKINST}/usr/include/python2.7/* ${IDIR_PYTHON2}/usr/include/python2.7
  68. -find ${IDIR_PYTHON2} -name "\*.pyc" -o -name "*\.pyo" -exec rm {} \;
  69. -rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/readline.so
  70. -rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/bz2.so
  71. # workaround, copy host python-config to target scripts directory
  72. ${CP} ${STAGING_HOST_DIR}/usr/bin/python*-config ${STAGING_DIR}/scripts
  73. (cd ${STAGING_DIR}/usr/bin/ && ln -sf $(STAGING_HOST_DIR)/usr/bin/hostpython hostpython)
  74. python2-readline-install:
  75. ${INSTALL_DIR} ${IDIR_PYTHON2_READLINE}/usr/lib/python2.7/lib-dynload
  76. ${CP} ${WRKINST}/usr/lib/python2.7/lib-dynload/readline.so \
  77. ${IDIR_PYTHON2_READLINE}/usr/lib/python2.7/lib-dynload
  78. python2-bzip2-install:
  79. ${INSTALL_DIR} ${IDIR_PYTHON2_BZIP2}/usr/lib/python2.7/lib-dynload
  80. ${CP} ${WRKINST}/usr/lib/python2.7/lib-dynload/bz2.so \
  81. ${IDIR_PYTHON2_BZIP2}/usr/lib/python2.7/lib-dynload
  82. include ${TOPDIR}/mk/pkg-bottom.mk