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.

215 lines
7.3 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:=3
  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) $(if $(CONFIG_PERL_THREADS),-Dusethreads,))
  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. ifeq ($(CONFIG_USE_MUSL),y)
  113. sed -i \
  114. -e "s,\(d_stdio_ptr_lval=\)'define',\1'undef',g" \
  115. -e "s,\(d_stdio_ptr_lval_sets_cnt=\)'define',\1'undef',g" \
  116. -e "s,\(d_stdiobase=\)'define',\1'undef',g" \
  117. -e "s,\(d_stdstdio=\)'define',\1'undef',g" \
  118. -e "s,\(d_getnetbyname_r=\)'define',\1'undef',g" \
  119. -e "s,\(getprotobyname_r=\)'define',\1'undef',g" \
  120. -e "s,\(getpwent_r=\)'define',\1'undef',g" \
  121. -e "s,\(getservent_r=\)'define',\1'undef',g" \
  122. -e "s,\(gethostent_r=\)'define',\1'undef',g" \
  123. -e "s,\(getnetent_r=\)'define',\1'undef',g" \
  124. -e "s,\(getnetbyaddr_r=\)'define',\1'undef',g" \
  125. -e "s,\(getprotoent_r=\)'define',\1'undef',g" \
  126. -e "s,\(getprotobynumber_r=\)'define',\1'undef',g" \
  127. -e "s,\(getgrent_r=\)'define',\1'undef',g" \
  128. -e "s,\(i_fcntl=\)'undef',\1'define',g" \
  129. -e "s,\(h_fcntl=\)'false',\1'true',g" \
  130. $(PKG_BUILD_DIR)/config.sh
  131. endif
  132. (cd $(PKG_BUILD_DIR) && ./Configure -S)
  133. install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
  134. endef
  135. define Build/Compile
  136. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
  137. endef
  138. define Build/InstallDev
  139. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20
  140. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/5.20 $(1)/usr/lib/perl5/
  141. endef
  142. define Package/perl/install
  143. $(INSTALL_DIR) $(1)/usr/bin
  144. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
  145. ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
  146. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/CORE
  147. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/5.20/CORE/libperl.so $(1)/usr/lib/perl5/5.20/CORE/
  148. endef
  149. $(eval $(call RequireCommand,rsync, \
  150. $(PKG_NAME) requires rsync installed on the host-system. \
  151. ))
  152. $(eval $(call BuildPackage,perl))
  153. $(eval $(call HostBuild))
  154. -include perlbase.mk
  155. # A helper package that includes all sort of supplementary files for tests
  156. define Package/perl-tests-common
  157. $(call Package/perlbase-template)
  158. TITLE:=Common test support files
  159. DEPENDS:=@PERL_TESTS
  160. endef
  161. define Package/perl-tests-common/install
  162. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)
  163. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting
  164. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen
  165. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/XS
  166. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/auto/XS
  167. $(INSTALL_DIR) $(1)/usr/lib/perl5/5.20/unicore
  168. $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR)
  169. $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR)
  170. $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR)
  171. $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR)
  172. $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR)
  173. $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR)
  174. $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR)
  175. $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/5.20/
  176. $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/5.20/auto
  177. $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/5.20/
  178. $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/5.20/unicore
  179. $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh
  180. sed -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' -i $(1)/$(PERL_TESTSDIR)/run_tests.sh
  181. $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR)
  182. $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR)
  183. endef
  184. $(eval $(call BuildPackage,perl-tests-common))