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.

178 lines
6.0 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.1
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
  12. http://www.cpan.org/src/5.0/perl-5.20.0.tar.gz \
  13. ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
  14. http://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
  15. ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \
  16. http://ftp5.gwdg.de/pub/languages/perl/CPAN/src/ \
  17. ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 \
  18. http://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0
  19. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  20. PKG_MD5SUM:=7a195abb7d6769f751e90c7d30dcf2e0
  21. PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
  22. PKG_LICENSE_FILES:=Copying Artistic README
  23. PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
  24. # Build settings
  25. PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
  26. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/$(PKG_NAME)-$(PKG_VERSION)
  27. PKG_INSTALL:=1
  28. PKG_BUILD_DEPENDS:=perl/host
  29. PKG_BUILD_PARALLEL:=1
  30. HOST_BUILD_PARALLEL:=1
  31. # Variables used during configuration/build
  32. HOST_PERL_PREFIX:=$(STAGING_DIR_HOST)/usr
  33. ifneq ($(CONFIG_USE_EGLIBC),)
  34. EXTRA_LIBS:=bsd
  35. EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
  36. endif
  37. # Filter -g3, it will break Compress-Raw-Zlib
  38. TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))
  39. TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS))
  40. # A list of disabled testss
  41. # ExtUtils tests are disabled for now as we don't support building
  42. # native extensions on the target machine at the moment
  43. PERL_DISABLEDTESTS:=cpan/ExtUtils-Constant cpan/ExtUtils-MakeMaker
  44. # We're on Linux, so don't even package those
  45. PERL_DISABLEDTESTS+=cpan/Win32API-File cpan/Win32 ext/VMS-DCLsym ext/VMS-Filespec ext/VMS-Stdio ext/Win32CORE
  46. # NDBM and ODBM not supported
  47. PERL_DISABLEDTESTS+=ext/NDBM_File ext/ODBM_File
  48. include $(INCLUDE_DIR)/package.mk
  49. include $(INCLUDE_DIR)/host-build.mk
  50. include perlmod.mk
  51. define Package/perl
  52. SUBMENU:=Perl
  53. SECTION:=lang
  54. CATEGORY:=Languages
  55. TITLE:=The Perl intepreter
  56. URL:=http://www.perl.com/
  57. DEPENDS:=+USE_EGLIBC:libbsd
  58. endef
  59. define Package/perl/description
  60. Perl is a stable, cross platform programming language.
  61. It is used for mission critical projects in the public and private sectors
  62. and is widely used to program web applications of all needs.
  63. endef
  64. define Package/perl/config
  65. source "$(SOURCE)/Config.in"
  66. endef
  67. # Static host perl
  68. define Host/Configure
  69. ( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) )
  70. endef
  71. define Host/Install
  72. ( cd $(HOST_BUILD_DIR); ./miniperl installperl )
  73. $(INSTALL_DIR) $(HOST_PERL_PREFIX)/bin/
  74. $(CP) $(HOST_BUILD_DIR)/generate_uudmap $(HOST_PERL_PREFIX)/bin/
  75. # Link any possibly installed static extension in
  76. $(MAKE) -C $(HOST_BUILD_DIR)/relink clean || true
  77. ( cd $(HOST_BUILD_DIR)/relink && $(HOST_PERL_PREFIX)/bin/perl Makefile.PL )
  78. $(call perlmod/host/relink,$(HOST_BUILD_DIR)/relink)
  79. endef
  80. # Target perl
  81. define Build/Configure
  82. sed \
  83. -e 's!%%CC%%!$(TARGET_CC)!g' \
  84. -e 's!%%CFLAGS%%!$(TARGET_CFLAGS_PERL) $(TARGET_CPPFLAGS_PERL)!g' \
  85. -e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
  86. -e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
  87. -e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
  88. -e 's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
  89. -e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
  90. -e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
  91. -e 's!%%EXTRA_PERLLIBS%%!$(EXTRA_LIBS:%=-l%)!g' \
  92. -e 's!%%EXTRA_PERLLIBDIRS%%!$(EXTRA_LIBDIRS:%=-L%)!g' \
  93. -e 's!%%IPV6%%!$(if $($(CONFIG_IPV6)),define,undef)!g' \
  94. -e 's!%%HOSTMINIPERL%%!$(HOST_PERL_PREFIX)/bin/perl!g' \
  95. -e 's!%%HOSTGENERATE%%!$(HOST_PERL_PREFIX)/bin/generate_uudmap!g' \
  96. files/config.sh-$(patsubst i386,i486,$(ARCH)).in \
  97. > $(PKG_BUILD_DIR)/config.sh
  98. (cd $(PKG_BUILD_DIR) && ./Configure -S)
  99. install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
  100. endef
  101. define Build/Compile
  102. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
  103. endef
  104. define Build/InstallDev
  105. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20
  106. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/5.20 $(1)/usr/lib/perl5/
  107. endef
  108. define Package/perl/install
  109. $(INSTALL_DIR) $(1)/usr/bin
  110. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
  111. ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
  112. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/CORE
  113. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/5.20/CORE/libperl.so $(1)/usr/lib/perl5/5.20/CORE/
  114. endef
  115. $(eval $(call RequireCommand,rsync, \
  116. $(PKG_NAME) requires rsync installed on the host-system. \
  117. ))
  118. $(eval $(call BuildPackage,perl))
  119. $(eval $(call HostBuild))
  120. -include perlbase.mk
  121. # A helper package that includes all sort of supplementary files for tests
  122. define Package/perl-tests-common
  123. $(call Package/perlbase-template)
  124. TITLE:=Common test support files
  125. DEPENDS:=@PERL_TESTS
  126. endef
  127. define Package/perl-tests-common/install
  128. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)
  129. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting
  130. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen
  131. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/XS
  132. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/auto/XS
  133. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/unicore
  134. $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR)
  135. $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR)
  136. $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR)
  137. $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR)
  138. $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR)
  139. $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR)
  140. $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR)
  141. $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/5.20/
  142. $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/5.20/auto
  143. $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/5.20/
  144. $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/5.20/unicore
  145. $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh
  146. sed -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' -i $(1)/$(PERL_TESTSDIR)/run_tests.sh
  147. $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR)
  148. $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR)
  149. endef
  150. $(eval $(call BuildPackage,perl-tests-common))