You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
5.1 KiB

  1. #
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=perl
  9. PKG_VERSION:=5.20.0
  10. PKG_RELEASE:=1
  11. PKG_MD5SUM:=406ec049ebe3afcc80d9c76ec78ca4f8
  12. PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
  13. http://www.cpan.org/src/5.0/perl-5.20.0.tar.gz \
  14. ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
  15. http://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
  16. ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \
  17. http://ftp5.gwdg.de/pub/languages/perl/CPAN/src/ \
  18. ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 \
  19. http://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0
  20. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  21. PKG_LICENSE:=GPLv1 ARTISTIC
  22. PKG_LICENSE_FILES:=Copying Artistic README
  23. PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
  24. PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
  25. include $(INCLUDE_DIR)/package.mk
  26. ifneq ($(CONFIG_USE_EGLIBC),)
  27. EXTRA_LIBS:=bsd
  28. EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
  29. endif
  30. define Package/perl/Default
  31. SUBMENU:=Perl
  32. SECTION:=lang
  33. CATEGORY:=Languages
  34. TITLE:=The Perl intepreter
  35. URL:=http://www.perl.com/
  36. DEPENDS:=+USE_EGLIBC:libbsd
  37. endef
  38. define Package/microperl
  39. $(call Package/perl/Default)
  40. TITLE+=(minimal version)
  41. endef
  42. define Package/microperl/description
  43. A perl package without operating-specific functions such as readdir.
  44. endef
  45. define Build/Template
  46. $(STAMP_CONFIGURED)-$(1): $(STAMP_PREPARED)
  47. -$(MAKE) -C $(PKG_BUILD_DIR) clean
  48. $(call Build/$(1)/Configure)
  49. touch $$@
  50. $(STAMP_BUILT)-$(1): $(STAMP_CONFIGURED)-$(1)
  51. $(call Build/$(1)/Compile)
  52. touch $$@
  53. $(STAMP_BUILT): $(STAMP_BUILT)-$(1)
  54. endef
  55. define Build/microperl/Configure
  56. endef
  57. define Build/microperl/Compile
  58. +$(MAKE) $(MAKE_J) -C $(PKG_BUILD_DIR) -f Makefile.micro \
  59. CC="gcc" ugenerate_uudmap
  60. +$(MAKE) $(MAKE_J) -C $(PKG_BUILD_DIR) -f Makefile.micro \
  61. CC="$(TARGET_CC)" OPTIMIZE="$(TARGET_CFLAGS)"
  62. $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/bin/
  63. $(CP) $(PKG_BUILD_DIR)/microperl $(PKG_INSTALL_DIR)/usr/bin/
  64. endef
  65. define Package/microperl/install
  66. $(INSTALL_DIR) $(1)/usr/bin
  67. $(INSTALL_BIN) $(PKG_BUILD_DIR)/microperl $(1)/usr/bin/
  68. endef
  69. include perlmod.mk
  70. define Package/perl
  71. $(call Package/perl/Default)
  72. endef
  73. define Package/perl/description
  74. Perl is a stable, cross platform programming language.
  75. It is used for mission critical projects in the public and private sectors
  76. and is widely used to program web applications of all needs.
  77. endef
  78. define Build/perl/Configure
  79. @echo
  80. @echo "===> Stage 1: Configure host perl"
  81. @echo
  82. mkdir -p $(PKG_BUILD_DIR)/host-perl
  83. (cd $(PKG_BUILD_DIR)/host-perl && sh ../Configure -der -Dmksymlinks -Uusedl -Dotherlibdirs=$(PERL_LIB))
  84. @echo
  85. @echo "===> Stage 2: Build host perl binary with static extensions"
  86. @echo
  87. +$(MAKE) $(MAKE_J) -C $(PKG_BUILD_DIR)/host-perl miniperl
  88. @echo
  89. @echo "===> Stage 3: Configure target perl"
  90. @echo
  91. -$(MAKE) -C $(PKG_BUILD_DIR) clean
  92. sed \
  93. -e 's!%%CC%%!$(TARGET_CC)!g' \
  94. -e 's!%%CFLAGS%%!$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)!g' \
  95. -e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
  96. -e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
  97. -e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
  98. -e 's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
  99. -e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
  100. -e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
  101. -e 's!%%EXTRA_PERLLIBS%%!$(EXTRA_LIBS:%=-l%)!g' \
  102. -e 's!%%EXTRA_PERLLIBDIRS%%!$(EXTRA_LIBDIRS:%=-L%)!g' \
  103. -e 's!%%IPV6%%!$(if $($(CONFIG_IPV6)),define,undef)!g' \
  104. -e 's!%%HOSTMINIPERL%%!$(PKG_BUILD_DIR)/host-perl/miniperl!g' \
  105. -e 's!%%HOSTGENERATE%%!$(PKG_BUILD_DIR)/host-perl/generate_uudmap!g' \
  106. files/config.sh-$(patsubst i386,i486,$(ARCH)).in \
  107. > $(PKG_BUILD_DIR)/config.sh
  108. (cd $(PKG_BUILD_DIR) && ./Configure -S)
  109. endef
  110. define Build/perl/Compile
  111. @echo
  112. @echo "===> Stage 4: Build target perl binary"
  113. @echo
  114. install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
  115. +$(MAKE) $(MAKE_J) -C $(PKG_BUILD_DIR) perl
  116. mkdir -p $(PKG_BUILD_DIR)/target-bin
  117. install -m 0755 $(PKG_BUILD_DIR)/perl $(PKG_BUILD_DIR)/target-bin/
  118. @echo
  119. @echo "===> Stage 5: Build target extensions and utils"
  120. @echo
  121. +$(MAKE) $(MAKE_J) -C $(PKG_BUILD_DIR)
  122. @echo
  123. @echo "===> Stage 6: Install Perl into staging dir"
  124. @echo
  125. (cd $(PKG_BUILD_DIR) && ./miniperl installperl --destdir=$(STAGING_DIR))
  126. @echo
  127. @echo "===> Stage 7: Install Perl into a temporary root"
  128. @echo
  129. mkdir -p $(PKG_INSTALL_DIR)
  130. (cd $(PKG_BUILD_DIR) && ./miniperl installperl --destdir=$(PKG_INSTALL_DIR))
  131. endef
  132. define Package/perl/install
  133. $(INSTALL_DIR) $(1)/usr/bin
  134. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
  135. ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
  136. endef
  137. ifneq ($(CONFIG_PACKAGE_microperl),)
  138. define Build/microperl
  139. $(call Build/Template,microperl)
  140. endef
  141. endif
  142. $(eval $(Build/microperl))
  143. ifneq ($(CONFIG_PACKAGE_perl),)
  144. define Build/perl
  145. $(call Build/Template,perl)
  146. endef
  147. endif
  148. $(eval $(Build/perl))
  149. define Build/Configure
  150. endef
  151. define Build/Compile
  152. endef
  153. $(eval $(call RequireCommand,rsync, \
  154. $(PKG_NAME) requires rsync installed on the host-system. \
  155. ))
  156. $(eval $(call BuildPackage,microperl))
  157. $(eval $(call BuildPackage,perl))
  158. -include perlbase.mk