No Description

Makefile 5.6KB

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