perl.mk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. ################################################################################
  2. #
  3. # perl
  4. #
  5. ################################################################################
  6. PERL_VERSION_MAJOR = 18
  7. PERL_VERSION = 5.$(PERL_VERSION_MAJOR).2
  8. PERL_SITE = http://www.cpan.org/src/5.0
  9. PERL_SOURCE = perl-$(PERL_VERSION).tar.bz2
  10. PERL_LICENSE = Artistic or GPLv1+
  11. PERL_LICENSE_FILES = Artistic Copying README
  12. PERL_INSTALL_STAGING = YES
  13. PERL_CROSS_VERSION = 0.8.3
  14. PERL_CROSS_BASE_VERSION = 5.$(PERL_VERSION_MAJOR).1
  15. PERL_CROSS_SITE = http://download.berlios.de/perlcross
  16. PERL_CROSS_SOURCE = perl-$(PERL_CROSS_BASE_VERSION)-cross-$(PERL_CROSS_VERSION).tar.gz
  17. PERL_CROSS_OLD_POD = perl$(subst .,,$(PERL_CROSS_BASE_VERSION))delta.pod
  18. PERL_CROSS_NEW_POD = perl$(subst .,,$(PERL_VERSION))delta.pod
  19. # We use the perlcross hack to cross-compile perl. It should
  20. # be extracted over the perl sources, so we don't define that
  21. # as a separate package. Instead, it is downloaded and extracted
  22. # together with perl
  23. define PERL_CROSS_DOWNLOAD
  24. $(call DOWNLOAD,$(PERL_CROSS_SITE:/=)/$(PERL_CROSS_SOURCE))
  25. endef
  26. PERL_POST_DOWNLOAD_HOOKS += PERL_CROSS_DOWNLOAD
  27. define PERL_CROSS_EXTRACT
  28. $(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
  29. $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
  30. endef
  31. PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
  32. define PERL_CROSS_SET_POD
  33. $(SED) s/$(PERL_CROSS_OLD_POD)/$(PERL_CROSS_NEW_POD)/g $(@D)/Makefile
  34. endef
  35. PERL_POST_PATCH_HOOKS += PERL_CROSS_SET_POD
  36. ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
  37. PERL_DEPENDENCIES += berkeleydb
  38. endif
  39. ifeq ($(BR2_PACKAGE_GDBM),y)
  40. PERL_DEPENDENCIES += gdbm
  41. endif
  42. # We have to override LD, because an external multilib toolchain ld is not
  43. # wrapped to provide the required sysroot options. We also can't use ccache
  44. # because the configure script doesn't support it.
  45. PERL_CONF_OPT = \
  46. --target=$(GNU_TARGET_NAME) \
  47. --target-tools-prefix=$(TARGET_CROSS) \
  48. --prefix=/usr \
  49. -Dld="$(TARGET_CC_NOCCACHE)" \
  50. -Dccflags="$(TARGET_CFLAGS)" \
  51. -Dldflags="$(TARGET_LDFLAGS) -lm" \
  52. -Dmydomain="" \
  53. -Dmyhostname="$(BR2_TARGET_GENERIC_HOSTNAME)" \
  54. -Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
  55. -Dosname=linux \
  56. -Dosvers=$(LINUX_VERSION) \
  57. -Dperladmin=root
  58. ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
  59. PERL_CONF_OPT += -Dusedevel
  60. endif
  61. ifneq ($(BR2_LARGEFILE),y)
  62. PERL_CONF_OPT += -Uuselargefiles
  63. endif
  64. PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
  65. ifneq ($(PERL_MODULES),)
  66. PERL_CONF_OPT += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
  67. endif
  68. define PERL_CONFIGURE_CMDS
  69. (cd $(@D); HOSTCC='$(HOSTCC_NOCACHE)' ./configure $(PERL_CONF_OPT))
  70. $(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
  71. endef
  72. define PERL_BUILD_CMDS
  73. $(MAKE1) -C $(@D) all
  74. endef
  75. define PERL_INSTALL_STAGING_CMDS
  76. $(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl
  77. endef
  78. PERL_INSTALL_TARGET_GOALS = install.perl
  79. define PERL_INSTALL_TARGET_CMDS
  80. $(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" $(PERL_INSTALL_TARGET_GOALS)
  81. endef
  82. $(eval $(generic-package))