Makefile 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. (cd ${WRKBUILD}; rm -rf config.{cache,status} ; \
  44. OPT="$(CFLAGS_FOR_BUILD)" \
  45. ./configure --without-cxx-main --with-threads \
  46. --prefix=$(STAGING_HOST_DIR)/usr \
  47. );
  48. $(MAKE) -C ${WRKBUILD} python Parser/pgen
  49. $(MAKE) -C ${WRKBUILD} install
  50. ${CP} ${WRKBUILD}/Parser/pgen ${STAGING_HOST_DIR}/usr/bin/pgen
  51. ${CP} ${WRKBUILD}/python ${STAGING_HOST_DIR}/usr/bin/hostpython
  52. ${CP} ${WRKBUILD}/Parser/pgen ${WRKBUILD}/Parser/hostpgen
  53. ${CP} ${WRKBUILD}/python ${WRKBUILD}/hostpython
  54. $(MAKE) -C ${WRKBUILD} distclean
  55. $(CP) ${WRKBUILD}/setup.py.sav ${WRKBUILD}/setup.py
  56. pre-configure:
  57. $(SED) "s#@@CPU_ARCH@@#$(CPU_ARCH)#" ${WRKBUILD}/configure
  58. $(SED) "s#@@STAGING_DIR@@#$(STAGING_DIR)#" ${WRKBUILD}/setup.py
  59. post-install:
  60. ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/bin ${IDIR_PYTHON2}/usr/lib
  61. ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/lib/python2.7
  62. ${INSTALL_DIR} ${IDIR_PYTHON2}/usr/include/python2.7
  63. ${INSTALL_BIN} ${WRKINST}/usr/bin/python ${IDIR_PYTHON2}/usr/bin
  64. ${CP} ${WRKINST}/usr/lib/libpython*.so* ${IDIR_PYTHON2}/usr/lib
  65. ${CP} ${WRKINST}/usr/lib/python2.7/* ${IDIR_PYTHON2}/usr/lib/python2.7
  66. ${CP} ${WRKINST}/usr/include/python2.7/* ${IDIR_PYTHON2}/usr/include/python2.7
  67. -find ${IDIR_PYTHON2} -name "\*.pyc" -o -name "*\.pyo" -exec rm {} \;
  68. -rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/readline.so
  69. -rm ${IDIR_PYTHON2}/usr/lib/python2.7/lib-dynload/bz2.so
  70. # workaround, copy host python-config to target scripts directory
  71. ${CP} ${STAGING_HOST_DIR}/usr/bin/python*-config ${STAGING_DIR}/scripts
  72. (cd ${STAGING_DIR}/usr/bin/ && ln -sf $(STAGING_HOST_DIR)/usr/bin/hostpython hostpython)
  73. python2-readline-install:
  74. ${INSTALL_DIR} ${IDIR_PYTHON2_READLINE}/usr/lib/python2.7/lib-dynload
  75. ${CP} ${WRKINST}/usr/lib/python2.7/lib-dynload/readline.so \
  76. ${IDIR_PYTHON2_READLINE}/usr/lib/python2.7/lib-dynload
  77. python2-bzip2-install:
  78. ${INSTALL_DIR} ${IDIR_PYTHON2_BZIP2}/usr/lib/python2.7/lib-dynload
  79. ${CP} ${WRKINST}/usr/lib/python2.7/lib-dynload/bz2.so \
  80. ${IDIR_PYTHON2_BZIP2}/usr/lib/python2.7/lib-dynload
  81. include ${TOPDIR}/mk/pkg-bottom.mk