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.

195 lines
6.4 KiB

  1. #
  2. # Copyright (C) 2006-2015 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.2
  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:=81b17b9a4e5ee18e54efe906c9bf544d
  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_GLIBC),)
  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. # Handle threading
  41. ifdef CONFIG_PERL_THREADS
  42. PERL_CONFIG_SUFFIX:=-mt
  43. # uclibc doesn't provide crypt_r(). Enable crypt() usage for glibc builds only
  44. ifdef CONFIG_USE_GLIBC
  45. CRYPT_R_PROTO:=REENTRANT_PROTO_B_CCS
  46. CRYPT:=define
  47. else
  48. CRYPT_R_PROTO:=0
  49. CRYPT:=undef
  50. endif
  51. endif
  52. # A list of disabled tests
  53. # ExtUtils tests are disabled for now as we don't support building
  54. # native extensions on the target machine at the moment
  55. PERL_DISABLEDTESTS:=cpan/ExtUtils-Constant cpan/ExtUtils-MakeMaker
  56. # We're on Linux, so don't even package them
  57. PERL_DISABLEDTESTS+=cpan/Win32API-File cpan/Win32 ext/VMS-DCLsym ext/VMS-Filespec ext/VMS-Stdio ext/Win32CORE
  58. # NDBM and ODBM not supported
  59. PERL_DISABLEDTESTS+=ext/NDBM_File ext/ODBM_File
  60. include $(INCLUDE_DIR)/package.mk
  61. include $(INCLUDE_DIR)/host-build.mk
  62. include perlmod.mk
  63. define Package/perl
  64. SUBMENU:=Perl
  65. SECTION:=lang
  66. CATEGORY:=Languages
  67. TITLE:=The Perl intepreter
  68. URL:=http://www.perl.com/
  69. DEPENDS:=+USE_GLIBC:libbsd +PERL_THREADS:libpthread
  70. endef
  71. define Package/perl/description
  72. Perl is a stable, cross platform programming language.
  73. It is used for mission critical projects in the public and private sectors
  74. and is widely used to program web applications of all needs.
  75. endef
  76. define Package/perl/config
  77. source "$(SOURCE)/Config.in"
  78. endef
  79. # Static host perl
  80. define Host/Configure
  81. ( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) )
  82. endef
  83. define Host/Install
  84. ( cd $(HOST_BUILD_DIR); ./miniperl installperl )
  85. $(INSTALL_DIR) $(HOST_PERL_PREFIX)/bin/
  86. $(CP) $(HOST_BUILD_DIR)/generate_uudmap $(HOST_PERL_PREFIX)/bin/
  87. # Link any possibly installed static extension in
  88. $(MAKE) -C $(HOST_BUILD_DIR)/relink clean || true
  89. ( cd $(HOST_BUILD_DIR)/relink && $(HOST_PERL_PREFIX)/bin/perl Makefile.PL )
  90. $(call perlmod/host/relink,$(HOST_BUILD_DIR)/relink)
  91. endef
  92. # Target perl
  93. define Build/Configure
  94. sed \
  95. -e 's!%%CC%%!$(TARGET_CC)!g' \
  96. -e 's!%%CFLAGS%%!$(TARGET_CFLAGS_PERL) $(TARGET_CPPFLAGS_PERL)!g' \
  97. -e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
  98. -e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
  99. -e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
  100. -e 's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
  101. -e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
  102. -e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
  103. -e 's!%%EXTRA_PERLLIBS%%!$(EXTRA_LIBS:%=-l%)!g' \
  104. -e 's!%%EXTRA_PERLLIBDIRS%%!$(EXTRA_LIBDIRS:%=-L%)!g' \
  105. -e 's!%%IPV6%%!$(if $($(CONFIG_IPV6)),define,undef)!g' \
  106. -e 's!%%HOSTMINIPERL%%!$(HOST_PERL_PREFIX)/bin/perl!g' \
  107. -e 's!%%CRYPT_R_PROTO%%!$(CRYPT_R_PROTO)!g' \
  108. -e 's!%%CRYPT%%!$(CRYPT)!g' \
  109. -e 's!%%HOSTGENERATE%%!$(HOST_PERL_PREFIX)/bin/generate_uudmap!g' \
  110. files/config.sh-$(patsubst i386,i486,$(ARCH))$(PERL_CONFIG_SUFFIX).in \
  111. > $(PKG_BUILD_DIR)/config.sh
  112. (cd $(PKG_BUILD_DIR) && ./Configure -S)
  113. install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
  114. endef
  115. define Build/Compile
  116. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
  117. endef
  118. define Build/InstallDev
  119. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20
  120. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/5.20 $(1)/usr/lib/perl5/
  121. endef
  122. define Package/perl/install
  123. $(INSTALL_DIR) $(1)/usr/bin
  124. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
  125. ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
  126. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/CORE
  127. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/5.20/CORE/libperl.so $(1)/usr/lib/perl5/5.20/CORE/
  128. endef
  129. $(eval $(call RequireCommand,rsync, \
  130. $(PKG_NAME) requires rsync installed on the host-system. \
  131. ))
  132. $(eval $(call BuildPackage,perl))
  133. $(eval $(call HostBuild))
  134. -include perlbase.mk
  135. # A helper package that includes all sort of supplementary files for tests
  136. define Package/perl-tests-common
  137. $(call Package/perlbase-template)
  138. TITLE:=Common test support files
  139. DEPENDS:=@PERL_TESTS
  140. endef
  141. define Package/perl-tests-common/install
  142. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)
  143. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting
  144. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen
  145. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/XS
  146. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/auto/XS
  147. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/unicore
  148. $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR)
  149. $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR)
  150. $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR)
  151. $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR)
  152. $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR)
  153. $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR)
  154. $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR)
  155. $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/5.20/
  156. $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/5.20/auto
  157. $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/5.20/
  158. $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/5.20/unicore
  159. $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh
  160. sed -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' -i $(1)/$(PERL_TESTSDIR)/run_tests.sh
  161. $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR)
  162. $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR)
  163. endef
  164. $(eval $(call BuildPackage,perl-tests-common))